diff --git a/src/webui/__init__.py b/src/webui/__init__.py deleted file mode 100644 index 713145a3..00000000 --- a/src/webui/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""WebUI 模块""" diff --git a/src/webui/annual_report_routes.py b/src/webui/annual_report_routes.py deleted file mode 100644 index ff3ec00f..00000000 --- a/src/webui/annual_report_routes.py +++ /dev/null @@ -1,938 +0,0 @@ -"""麦麦 2025 年度总结 API 路由""" - -from fastapi import APIRouter, HTTPException, Depends, Cookie, Header -from pydantic import BaseModel, Field -from typing import Dict, Any, List, Optional -from datetime import datetime -from peewee import fn - -from src.common.logger import get_logger -from src.common.database.database_model import ( - LLMUsage, - OnlineTime, - Messages, - ChatStreams, - PersonInfo, - Emoji, - Expression, - ActionRecords, - Jargon, -) -from src.webui.auth import verify_auth_token_from_cookie_or_header - -logger = get_logger("webui.annual_report") - -router = APIRouter(prefix="/annual-report", tags=["annual-report"]) - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -# ==================== Pydantic 模型定义 ==================== - - -class TimeFootprintData(BaseModel): - """时光足迹数据""" - - total_online_hours: float = Field(0.0, description="年度在线总时长(小时)") - first_message_time: Optional[str] = Field(None, description="初次消息时间") - first_message_user: Optional[str] = Field(None, description="初次消息用户昵称") - first_message_content: Optional[str] = Field(None, description="初次消息内容(截断)") - busiest_day: Optional[str] = Field(None, description="最忙碌的一天") - busiest_day_count: int = Field(0, description="最忙碌那天的消息数") - hourly_distribution: List[int] = Field(default_factory=lambda: [0] * 24, description="24小时活跃分布") - midnight_chat_count: int = Field(0, description="深夜(0-4点)互动次数") - is_night_owl: bool = Field(False, description="是否是夜猫子") - - -class SocialNetworkData(BaseModel): - """社交网络数据""" - - total_groups: int = Field(0, description="加入的群组总数") - top_groups: List[Dict[str, Any]] = Field(default_factory=list, description="话痨群组TOP5") - top_users: List[Dict[str, Any]] = Field(default_factory=list, description="互动最多的用户TOP5") - at_count: int = Field(0, description="被@次数") - mentioned_count: int = Field(0, description="被提及次数") - longest_companion_user: Optional[str] = Field(None, description="最长情陪伴的用户") - longest_companion_days: int = Field(0, description="陪伴天数") - - -class BrainPowerData(BaseModel): - """最强大脑数据""" - - total_tokens: int = Field(0, description="年度消耗Token总量") - total_cost: float = Field(0.0, description="年度总花费") - favorite_model: Optional[str] = Field(None, description="最爱用的模型") - favorite_model_count: int = Field(0, description="最爱模型的调用次数") - model_distribution: List[Dict[str, Any]] = Field(default_factory=list, description="模型使用分布") - top_reply_models: List[Dict[str, Any]] = Field(default_factory=list, description="最喜欢的回复模型TOP5") - most_expensive_cost: float = Field(0.0, description="最昂贵的一次思考花费") - most_expensive_time: Optional[str] = Field(None, description="最昂贵思考的时间") - top_token_consumers: List[Dict[str, Any]] = Field(default_factory=list, description="烧钱大户TOP3") - silence_rate: float = Field(0.0, description="高冷指数(沉默率)") - total_actions: int = Field(0, description="总动作数") - no_reply_count: int = Field(0, description="选择沉默的次数") - avg_interest_value: float = Field(0.0, description="平均兴趣值") - max_interest_value: float = Field(0.0, description="最高兴趣值") - max_interest_time: Optional[str] = Field(None, description="最高兴趣值时间") - avg_reasoning_length: float = Field(0.0, description="平均思考长度") - max_reasoning_length: int = Field(0, description="最长思考长度") - max_reasoning_time: Optional[str] = Field(None, description="最长思考的时间") - - -class ExpressionVibeData(BaseModel): - """个性与表达数据""" - - top_emoji: Optional[Dict[str, Any]] = Field(None, description="表情包之王") - top_emojis: List[Dict[str, Any]] = Field(default_factory=list, description="TOP3表情包") - top_expressions: List[Dict[str, Any]] = Field(default_factory=list, description="印象最深刻的表达风格") - rejected_expression_count: int = Field(0, description="被拒绝的表达次数") - checked_expression_count: int = Field(0, description="已检查的表达次数") - total_expressions: int = Field(0, description="表达总数") - action_types: List[Dict[str, Any]] = Field(default_factory=list, description="动作类型分布") - image_processed_count: int = Field(0, description="处理的图片数量") - late_night_reply: Optional[Dict[str, Any]] = Field(None, description="深夜还在回复") - favorite_reply: Optional[Dict[str, Any]] = Field(None, description="最喜欢的回复") - - -class AchievementData(BaseModel): - """趣味成就数据""" - - new_jargon_count: int = Field(0, description="新学到的黑话数量") - sample_jargons: List[Dict[str, Any]] = Field(default_factory=list, description="代表性黑话示例") - total_messages: int = Field(0, description="总消息数") - total_replies: int = Field(0, description="总回复数") - - -class AnnualReportData(BaseModel): - """年度报告完整数据""" - - year: int = Field(2025, description="报告年份") - bot_name: str = Field("麦麦", description="Bot名称") - generated_at: str = Field(..., description="报告生成时间") - time_footprint: TimeFootprintData = Field(default_factory=TimeFootprintData) - social_network: SocialNetworkData = Field(default_factory=SocialNetworkData) - brain_power: BrainPowerData = Field(default_factory=BrainPowerData) - expression_vibe: ExpressionVibeData = Field(default_factory=ExpressionVibeData) - achievements: AchievementData = Field(default_factory=AchievementData) - - -# ==================== 辅助函数 ==================== - - -def get_year_time_range(year: int = 2025) -> tuple[float, float]: - """获取指定年份的时间戳范围""" - start = datetime(year, 1, 1, 0, 0, 0).timestamp() - end = datetime(year, 12, 31, 23, 59, 59).timestamp() - return start, end - - -def get_year_datetime_range(year: int = 2025) -> tuple[datetime, datetime]: - """获取指定年份的 datetime 范围""" - start = datetime(year, 1, 1, 0, 0, 0) - end = datetime(year, 12, 31, 23, 59, 59) - return start, end - - -# ==================== 维度一:时光足迹 ==================== - - -async def get_time_footprint(year: int = 2025) -> TimeFootprintData: - """获取时光足迹数据""" - data = TimeFootprintData() - start_ts, end_ts = get_year_time_range(year) - start_dt, end_dt = get_year_datetime_range(year) - - try: - # 1. 年度在线时长 - online_records = list( - OnlineTime.select().where( - (OnlineTime.start_timestamp >= start_dt) | (OnlineTime.end_timestamp <= end_dt) - ) - ) - total_seconds = 0 - for record in online_records: - try: - start = max(record.start_timestamp, start_dt) - end = min(record.end_timestamp, end_dt) - if end > start: - total_seconds += (end - start).total_seconds() - except Exception: - continue - data.total_online_hours = round(total_seconds / 3600, 2) - - # 2. 初次相遇 - 年度第一条消息 - first_msg = ( - Messages.select() - .where((Messages.time >= start_ts) & (Messages.time <= end_ts)) - .order_by(Messages.time.asc()) - .first() - ) - if first_msg: - data.first_message_time = datetime.fromtimestamp(first_msg.time).strftime("%Y-%m-%d %H:%M:%S") - data.first_message_user = first_msg.user_nickname or first_msg.user_id or "未知用户" - content = first_msg.processed_plain_text or first_msg.display_message or "" - data.first_message_content = content[:50] + "..." if len(content) > 50 else content - - # 3. 最忙碌的一天 - # 使用 SQLite 的 date 函数按日期分组 - busiest_query = ( - Messages.select( - fn.date(Messages.time, "unixepoch").alias("day"), - fn.COUNT(Messages.id).alias("count"), - ) - .where((Messages.time >= start_ts) & (Messages.time <= end_ts)) - .group_by(fn.date(Messages.time, "unixepoch")) - .order_by(fn.COUNT(Messages.id).desc()) - .limit(1) - ) - busiest_result = list(busiest_query.dicts()) - if busiest_result: - data.busiest_day = busiest_result[0].get("day") - data.busiest_day_count = busiest_result[0].get("count", 0) - - # 4. 昼夜节律 - 24小时活跃分布 - hourly_query = ( - Messages.select( - fn.strftime("%H", Messages.time, "unixepoch").alias("hour"), - fn.COUNT(Messages.id).alias("count"), - ) - .where((Messages.time >= start_ts) & (Messages.time <= end_ts)) - .group_by(fn.strftime("%H", Messages.time, "unixepoch")) - ) - hourly_distribution = [0] * 24 - for row in hourly_query.dicts(): - try: - hour = int(row.get("hour", 0)) - if 0 <= hour < 24: - hourly_distribution[hour] = row.get("count", 0) - except (ValueError, TypeError): - continue - data.hourly_distribution = hourly_distribution - - # 5. 深夜食堂 (0-4点) - data.midnight_chat_count = sum(hourly_distribution[0:5]) - - # 6. 判断是否夜猫子 (22点-4点活跃度 vs 6点-12点) - night_activity = sum(hourly_distribution[22:24]) + sum(hourly_distribution[0:5]) - morning_activity = sum(hourly_distribution[6:13]) - data.is_night_owl = night_activity > morning_activity - - except Exception as e: - logger.error(f"获取时光足迹数据失败: {e}") - - return data - - -# ==================== 维度二:社交网络 ==================== - - -async def get_social_network(year: int = 2025) -> SocialNetworkData: - """获取社交网络数据""" - from src.config.config import global_config - - data = SocialNetworkData() - start_ts, end_ts = get_year_time_range(year) - - # 获取 bot 自身的 QQ 账号,用于过滤 - bot_qq = str(global_config.bot.qq_account or "") - - try: - # 1. 加入的群组总数 - data.total_groups = ChatStreams.select().where(ChatStreams.group_id.is_null(False)).count() - - # 2. 话痨群组 TOP3 - top_groups_query = ( - Messages.select( - Messages.chat_info_group_id, - Messages.chat_info_group_name, - fn.COUNT(Messages.id).alias("count"), - ) - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.chat_info_group_id.is_null(False)) - ) - .group_by(Messages.chat_info_group_id) - .order_by(fn.COUNT(Messages.id).desc()) - .limit(5) - ) - data.top_groups = [ - { - "group_id": row["chat_info_group_id"], - "group_name": row["chat_info_group_name"] or "未知群组", - "message_count": row["count"], - "is_webui": str(row["chat_info_group_id"]).startswith("webui_"), - } - for row in top_groups_query.dicts() - ] - - # 3. 互动最多的用户 TOP5(过滤 bot 自身) - top_users_query = ( - Messages.select( - Messages.user_id, - Messages.user_nickname, - fn.COUNT(Messages.id).alias("count"), - ) - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.user_id.is_null(False)) - & (Messages.user_id != bot_qq) # 过滤 bot 自身 - ) - .group_by(Messages.user_id) - .order_by(fn.COUNT(Messages.id).desc()) - .limit(5) - ) - data.top_users = [ - { - "user_id": row["user_id"], - "user_nickname": row["user_nickname"] or "未知用户", - "message_count": row["count"], - "is_webui": str(row["user_id"]).startswith("webui_"), - } - for row in top_users_query.dicts() - ] - - # 4. 被@次数 - data.at_count = ( - Messages.select() - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.is_at == True) - ) - .count() - ) - - # 5. 被提及次数 - data.mentioned_count = ( - Messages.select() - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.is_mentioned == True) - ) - .count() - ) - - # 6. 最长情陪伴的用户(过滤 bot 自身) - companion_query = ( - ChatStreams.select( - ChatStreams.user_id, - ChatStreams.user_nickname, - (ChatStreams.last_active_time - ChatStreams.create_time).alias("duration"), - ) - .where( - (ChatStreams.user_id.is_null(False)) - & (ChatStreams.user_id != bot_qq) # 过滤 bot 自身 - ) - .order_by((ChatStreams.last_active_time - ChatStreams.create_time).desc()) - .limit(1) - ) - companion_result = list(companion_query.dicts()) - if companion_result: - data.longest_companion_user = companion_result[0].get("user_nickname") or "未知用户" - duration = companion_result[0].get("duration", 0) or 0 - data.longest_companion_days = int(duration / 86400) # 转换为天 - - except Exception as e: - logger.error(f"获取社交网络数据失败: {e}") - - return data - - -# ==================== 维度三:最强大脑 ==================== - - -async def get_brain_power(year: int = 2025) -> BrainPowerData: - """获取最强大脑数据""" - data = BrainPowerData() - start_dt, end_dt = get_year_datetime_range(year) - start_ts, end_ts = get_year_time_range(year) - - try: - # 1. 年度消耗 Token 总量和总花费 - token_query = LLMUsage.select( - fn.COALESCE(fn.SUM(LLMUsage.total_tokens), 0).alias("total_tokens"), - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("total_cost"), - ).where((LLMUsage.timestamp >= start_dt) & (LLMUsage.timestamp <= end_dt)) - result = token_query.dicts().get() - data.total_tokens = int(result.get("total_tokens", 0) or 0) - data.total_cost = round(float(result.get("total_cost", 0) or 0), 4) - - # 2. 最爱用的模型 - model_query = ( - LLMUsage.select( - fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name).alias("model"), - fn.COUNT(LLMUsage.id).alias("count"), - fn.COALESCE(fn.SUM(LLMUsage.total_tokens), 0).alias("tokens"), - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("cost"), - ) - .where((LLMUsage.timestamp >= start_dt) & (LLMUsage.timestamp <= end_dt)) - .group_by(fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name)) - .order_by(fn.COUNT(LLMUsage.id).desc()) - .limit(10) - ) - model_results = list(model_query.dicts()) - if model_results: - data.favorite_model = model_results[0].get("model") - data.favorite_model_count = model_results[0].get("count", 0) - data.model_distribution = [ - { - "model": row["model"], - "count": row["count"], - "tokens": row["tokens"], - "cost": round(row["cost"], 4), - } - for row in model_results - ] - - # 3. 最昂贵的一次思考 - expensive_query = ( - LLMUsage.select(LLMUsage.cost, LLMUsage.timestamp) - .where((LLMUsage.timestamp >= start_dt) & (LLMUsage.timestamp <= end_dt)) - .order_by(LLMUsage.cost.desc()) - .limit(1) - ) - expensive_result = expensive_query.first() - if expensive_result: - data.most_expensive_cost = round(expensive_result.cost or 0, 4) - data.most_expensive_time = expensive_result.timestamp.strftime("%Y-%m-%d %H:%M:%S") - - # 4. 烧钱大户 TOP3 (按用户,过滤 system) - consumer_query = ( - LLMUsage.select( - LLMUsage.user_id, - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("cost"), - fn.COALESCE(fn.SUM(LLMUsage.total_tokens), 0).alias("tokens"), - ) - .where( - (LLMUsage.timestamp >= start_dt) - & (LLMUsage.timestamp <= end_dt) - & (LLMUsage.user_id != "system") # 过滤 system 用户 - & (LLMUsage.user_id.is_null(False)) - ) - .group_by(LLMUsage.user_id) - .order_by(fn.SUM(LLMUsage.cost).desc()) - .limit(3) - ) - data.top_token_consumers = [ - { - "user_id": row["user_id"], - "cost": round(row["cost"], 4), - "tokens": row["tokens"], - } - for row in consumer_query.dicts() - ] - - # 5. 最喜欢的回复模型 TOP5(按模型的回复次数统计,只统计 replyer 调用) - # 假设 replyer 调用有特定的 model_assign_name 格式或可以通过某种方式识别 - reply_model_query = ( - LLMUsage.select( - fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name).alias("model"), - fn.COUNT(LLMUsage.id).alias("count"), - ) - .where( - (LLMUsage.timestamp >= start_dt) - & (LLMUsage.timestamp <= end_dt) - & ( - LLMUsage.model_assign_name.contains("replyer") - | LLMUsage.model_assign_name.contains("回复") - | LLMUsage.model_assign_name.is_null(True) # 包含没有 assign_name 的情况 - ) - ) - .group_by(fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name)) - .order_by(fn.COUNT(LLMUsage.id).desc()) - .limit(5) - ) - data.top_reply_models = [ - {"model": row["model"], "count": row["count"]} - for row in reply_model_query.dicts() - ] - - # 6. 高冷指数 (沉默率) - 基于 ActionRecords - total_actions = ActionRecords.select().where( - (ActionRecords.time >= start_ts) & (ActionRecords.time <= end_ts) - ).count() - no_reply_count = ActionRecords.select().where( - (ActionRecords.time >= start_ts) - & (ActionRecords.time <= end_ts) - & (ActionRecords.action_name == "no_reply") - ).count() - data.total_actions = total_actions - data.no_reply_count = no_reply_count - data.silence_rate = round(no_reply_count / total_actions * 100, 2) if total_actions > 0 else 0 - - # 6. 情绪波动 (兴趣值) - interest_query = Messages.select( - fn.AVG(Messages.interest_value).alias("avg_interest"), - fn.MAX(Messages.interest_value).alias("max_interest"), - ).where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.interest_value.is_null(False)) - ) - interest_result = interest_query.dicts().get() - data.avg_interest_value = round(float(interest_result.get("avg_interest") or 0), 2) - data.max_interest_value = round(float(interest_result.get("max_interest") or 0), 2) - - # 找到最高兴趣值的时间 - if data.max_interest_value > 0: - max_interest_msg = ( - Messages.select(Messages.time) - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.interest_value == data.max_interest_value) - ) - .first() - ) - if max_interest_msg: - data.max_interest_time = datetime.fromtimestamp(max_interest_msg.time).strftime( - "%Y-%m-%d %H:%M:%S" - ) - - # 7. 思考深度 (基于 action_reasoning 长度) - reasoning_records = ( - ActionRecords.select(ActionRecords.action_reasoning, ActionRecords.time) - .where( - (ActionRecords.time >= start_ts) - & (ActionRecords.time <= end_ts) - & (ActionRecords.action_reasoning.is_null(False)) - & (ActionRecords.action_reasoning != "") - ) - ) - reasoning_lengths = [] - max_len = 0 - max_len_time = None - for record in reasoning_records: - if record.action_reasoning: - length = len(record.action_reasoning) - reasoning_lengths.append(length) - if length > max_len: - max_len = length - max_len_time = record.time - - if reasoning_lengths: - data.avg_reasoning_length = round(sum(reasoning_lengths) / len(reasoning_lengths), 1) - data.max_reasoning_length = max_len - if max_len_time: - data.max_reasoning_time = datetime.fromtimestamp(max_len_time).strftime("%Y-%m-%d %H:%M:%S") - - except Exception as e: - logger.error(f"获取最强大脑数据失败: {e}") - - return data - - -# ==================== 维度四:个性与表达 ==================== - - -async def get_expression_vibe(year: int = 2025) -> ExpressionVibeData: - """获取个性与表达数据""" - from src.config.config import global_config - - data = ExpressionVibeData() - start_ts, end_ts = get_year_time_range(year) - - # 获取 bot 自身的 QQ 账号,用于筛选 bot 发送的消息 - bot_qq = str(global_config.bot.qq_account or "") - - try: - # 1. 表情包之王 - 使用次数最多的表情包 - top_emoji_query = ( - Emoji.select(Emoji.id, Emoji.full_path, Emoji.description, Emoji.usage_count, Emoji.emoji_hash) - .where(Emoji.is_registered == True) - .order_by(Emoji.usage_count.desc()) - .limit(5) - ) - top_emojis = list(top_emoji_query.dicts()) - if top_emojis: - data.top_emoji = { - "id": top_emojis[0].get("id"), - "path": top_emojis[0].get("full_path"), - "description": top_emojis[0].get("description"), - "usage_count": top_emojis[0].get("usage_count", 0), - "hash": top_emojis[0].get("emoji_hash"), - } - data.top_emojis = [ - { - "id": e.get("id"), - "path": e.get("full_path"), - "description": e.get("description"), - "usage_count": e.get("usage_count", 0), - "hash": e.get("emoji_hash"), - } - for e in top_emojis - ] - - # 2. 百变麦麦 - 最常用的表达风格 - expression_query = ( - Expression.select( - Expression.style, - fn.SUM(Expression.count).alias("total_count"), - ) - .where( - (Expression.last_active_time >= start_ts) - & (Expression.last_active_time <= end_ts) - ) - .group_by(Expression.style) - .order_by(fn.SUM(Expression.count).desc()) - .limit(5) - ) - data.top_expressions = [ - {"style": row["style"], "count": row["total_count"]} - for row in expression_query.dicts() - ] - - # 3. 被拒绝的表达 - data.rejected_expression_count = ( - Expression.select() - .where( - (Expression.last_active_time >= start_ts) - & (Expression.last_active_time <= end_ts) - & (Expression.rejected == True) - ) - .count() - ) - - # 4. 已检查的表达 - data.checked_expression_count = ( - Expression.select() - .where( - (Expression.last_active_time >= start_ts) - & (Expression.last_active_time <= end_ts) - & (Expression.checked == True) - ) - .count() - ) - - # 5. 表达总数 - data.total_expressions = ( - Expression.select() - .where( - (Expression.last_active_time >= start_ts) - & (Expression.last_active_time <= end_ts) - ) - .count() - ) - - # 6. 动作类型分布 (过滤无意义的动作) - # 过滤掉: no_reply_until_call, make_question, no_action, wait, complete_talk, listening, block_and_ignore - excluded_actions = [ - "reply", "no_reply", "no_reply_until_call", "make_question", - "no_action", "wait", "complete_talk", "listening", "block_and_ignore" - ] - action_query = ( - ActionRecords.select( - ActionRecords.action_name, - fn.COUNT(ActionRecords.id).alias("count"), - ) - .where( - (ActionRecords.time >= start_ts) - & (ActionRecords.time <= end_ts) - & (ActionRecords.action_name.not_in(excluded_actions)) - ) - .group_by(ActionRecords.action_name) - .order_by(fn.COUNT(ActionRecords.id).desc()) - .limit(10) - ) - data.action_types = [ - {"action": row["action_name"], "count": row["count"]} - for row in action_query.dicts() - ] - - # 7. 处理的图片数量 - data.image_processed_count = ( - Messages.select() - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.is_picid == True) - ) - .count() - ) - - # 8. 深夜还在回复 (0-6点最晚的10条消息中随机抽取一条) - import random - import re - - def clean_message_content(content: str) -> str: - """清理消息内容,移除回复引用等标记""" - if not content: - return "" - # 移除 [回复 的消息:...] 格式的引用 - content = re.sub(r'\[回复<[^>]+>\s*的消息[::][^\]]*\]', '', content) - # 移除 [图片] [表情] 等标记 - content = re.sub(r'\[(图片|表情|语音|视频|文件)\]', '', content) - # 移除多余的空白 - content = re.sub(r'\s+', ' ', content).strip() - return content - - # 使用 user_id 判断是否是 bot 发送的消息 - late_night_messages = list( - Messages.select( - Messages.time, - Messages.processed_plain_text, - Messages.display_message, - ) - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.user_id == bot_qq) # bot 发送的消息 - ) - .order_by(Messages.time.desc()) - ) - # 筛选出0-6点的消息 - late_night_filtered = [] - for msg in late_night_messages: - msg_dt = datetime.fromtimestamp(msg.time) - hour = msg_dt.hour - if 0 <= hour < 6: # 0点到6点 - raw_content = msg.processed_plain_text or msg.display_message or "" - cleaned_content = clean_message_content(raw_content) - # 只保留有意义的内容 - if cleaned_content and len(cleaned_content) > 2: - late_night_filtered.append({ - "time": msg.time, - "hour": hour, - "minute": msg_dt.minute, - "content": cleaned_content, - "datetime_str": msg_dt.strftime("%H:%M"), - }) - if len(late_night_filtered) >= 10: - break - - if late_night_filtered: - selected = random.choice(late_night_filtered) - content = selected["content"][:50] + "..." if len(selected["content"]) > 50 else selected["content"] - data.late_night_reply = { - "time": selected["datetime_str"], - "content": content, - } - - # 9. 最喜欢的回复(按 action_data 统计回复内容出现次数) - from collections import Counter - import json as json_lib - - reply_records = ( - ActionRecords.select(ActionRecords.action_data) - .where( - (ActionRecords.time >= start_ts) - & (ActionRecords.time <= end_ts) - & (ActionRecords.action_name == "reply") - & (ActionRecords.action_data.is_null(False)) - & (ActionRecords.action_data != "") - ) - ) - - reply_contents = [] - for record in reply_records: - try: - action_data = record.action_data - if action_data: - content = None - # 尝试解析 JSON 格式 - try: - parsed = json_lib.loads(action_data) - if isinstance(parsed, dict): - # 优先使用 reply_text,其次使用 content - content = parsed.get("reply_text") or parsed.get("content") - elif isinstance(parsed, str): - content = parsed - except (json_lib.JSONDecodeError, TypeError): - pass - - # 如果 JSON 解析失败,尝试解析 Python 字典字符串格式 - # 例如: "{'reply_text': '墨白灵不知道哦'}" - if content is None: - import ast - try: - parsed = ast.literal_eval(action_data) - if isinstance(parsed, dict): - content = parsed.get("reply_text") or parsed.get("content") - elif isinstance(parsed, str): - content = parsed - except (ValueError, SyntaxError): - # 无法解析,使用原始字符串 - content = action_data - - # 只统计有意义的回复(长度大于2) - if content and len(content) > 2: - reply_contents.append(content) - except Exception: - continue - - if reply_contents: - content_counter = Counter(reply_contents) - most_common = content_counter.most_common(1) - if most_common: - fav_content, fav_count = most_common[0] - # 截断过长的内容 - display_content = fav_content[:50] + "..." if len(fav_content) > 50 else fav_content - data.favorite_reply = { - "content": display_content, - "count": fav_count, - } - - except Exception as e: - logger.error(f"获取个性与表达数据失败: {e}") - - return data - - -# ==================== 维度五:趣味成就 ==================== - - -async def get_achievements(year: int = 2025) -> AchievementData: - """获取趣味成就数据""" - data = AchievementData() - start_ts, end_ts = get_year_time_range(year) - - try: - # 1. 新学到的黑话数量 - # Jargon 表没有时间字段,统计全部已确认的黑话 - data.new_jargon_count = Jargon.select().where(Jargon.is_jargon == True).count() - - # 2. 代表性黑话示例 - jargon_samples = ( - Jargon.select(Jargon.content, Jargon.meaning, Jargon.count) - .where(Jargon.is_jargon == True) - .order_by(Jargon.count.desc()) - .limit(5) - ) - data.sample_jargons = [ - { - "content": j.content, - "meaning": j.meaning, - "count": j.count, - } - for j in jargon_samples - ] - - # 3. 总消息数 - data.total_messages = ( - Messages.select() - .where((Messages.time >= start_ts) & (Messages.time <= end_ts)) - .count() - ) - - # 4. 总回复数 (有 reply_to 的消息) - data.total_replies = ( - Messages.select() - .where( - (Messages.time >= start_ts) - & (Messages.time <= end_ts) - & (Messages.reply_to.is_null(False)) - ) - .count() - ) - - except Exception as e: - logger.error(f"获取趣味成就数据失败: {e}") - - return data - - -# ==================== API 路由 ==================== - - -@router.get("/full", response_model=AnnualReportData) -async def get_full_annual_report(year: int = 2025, _auth: bool = Depends(require_auth)): - """ - 获取完整年度报告数据 - - Args: - year: 报告年份,默认2025 - - Returns: - 完整的年度报告数据 - """ - try: - from src.config.config import global_config - - logger.info(f"开始生成 {year} 年度报告...") - - # 获取 bot 名称 - bot_name = global_config.bot.nickname or "麦麦" - - # 并行获取各维度数据 - time_footprint = await get_time_footprint(year) - social_network = await get_social_network(year) - brain_power = await get_brain_power(year) - expression_vibe = await get_expression_vibe(year) - achievements = await get_achievements(year) - - report = AnnualReportData( - year=year, - bot_name=bot_name, - generated_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), - time_footprint=time_footprint, - social_network=social_network, - brain_power=brain_power, - expression_vibe=expression_vibe, - achievements=achievements, - ) - - logger.info(f"{year} 年度报告生成完成") - return report - - except Exception as e: - logger.error(f"生成年度报告失败: {e}") - raise HTTPException(status_code=500, detail=f"生成年度报告失败: {str(e)}") from e - - -@router.get("/time-footprint", response_model=TimeFootprintData) -async def get_time_footprint_api(year: int = 2025, _auth: bool = Depends(require_auth)): - """获取时光足迹数据""" - try: - return await get_time_footprint(year) - except Exception as e: - logger.error(f"获取时光足迹数据失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e - - -@router.get("/social-network", response_model=SocialNetworkData) -async def get_social_network_api(year: int = 2025, _auth: bool = Depends(require_auth)): - """获取社交网络数据""" - try: - return await get_social_network(year) - except Exception as e: - logger.error(f"获取社交网络数据失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e - - -@router.get("/brain-power", response_model=BrainPowerData) -async def get_brain_power_api(year: int = 2025, _auth: bool = Depends(require_auth)): - """获取最强大脑数据""" - try: - return await get_brain_power(year) - except Exception as e: - logger.error(f"获取最强大脑数据失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e - - -@router.get("/expression-vibe", response_model=ExpressionVibeData) -async def get_expression_vibe_api(year: int = 2025, _auth: bool = Depends(require_auth)): - """获取个性与表达数据""" - try: - return await get_expression_vibe(year) - except Exception as e: - logger.error(f"获取个性与表达数据失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e - - -@router.get("/achievements", response_model=AchievementData) -async def get_achievements_api(year: int = 2025, _auth: bool = Depends(require_auth)): - """获取趣味成就数据""" - try: - return await get_achievements(year) - except Exception as e: - logger.error(f"获取趣味成就数据失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e diff --git a/src/webui/anti_crawler.py b/src/webui/anti_crawler.py deleted file mode 100644 index b489179b..00000000 --- a/src/webui/anti_crawler.py +++ /dev/null @@ -1,795 +0,0 @@ -""" -WebUI 防爬虫模块 -提供爬虫检测和阻止功能,保护 WebUI 不被搜索引擎和恶意爬虫访问 -""" - -import time -import ipaddress -import re -from collections import deque -from typing import Optional -from starlette.middleware.base import BaseHTTPMiddleware -from starlette.requests import Request -from starlette.responses import PlainTextResponse - -from src.common.logger import get_logger - -logger = get_logger("webui.anti_crawler") - -# 常见爬虫 User-Agent 列表(使用更精确的关键词,避免误报) -CRAWLER_USER_AGENTS = { - # 搜索引擎爬虫(精确匹配) - "googlebot", - "bingbot", - "baiduspider", - "yandexbot", - "slurp", # Yahoo - "duckduckbot", - "sogou", - "exabot", - "facebot", - "ia_archiver", # Internet Archive - # 通用爬虫(移除过于宽泛的关键词) - "crawler", - "spider", - "scraper", - "wget", # 保留wget,因为通常用于自动化脚本 - "scrapy", # 保留scrapy,因为这是爬虫框架 - # 安全扫描工具(这些是明确的扫描工具) - "masscan", - "nmap", - "nikto", - "sqlmap", - # 注意:移除了以下过于宽泛的关键词以避免误报: - # - "bot" (会误匹配GitHub-Robot等) - # - "curl" (正常工具) - # - "python-requests" (正常库) - # - "httpx" (正常库) - # - "aiohttp" (正常库) -} - -# 资产测绘工具 User-Agent 标识 -ASSET_SCANNER_USER_AGENTS = { - # 知名资产测绘平台 - "shodan", - "censys", - "zoomeye", - "fofa", - "quake", - "hunter", - "binaryedge", - "onyphe", - "securitytrails", - "virustotal", - "passivetotal", - # 安全扫描工具 - "acunetix", - "appscan", - "burpsuite", - "nessus", - "openvas", - "qualys", - "rapid7", - "tenable", - "veracode", - "zap", - "awvs", # Acunetix Web Vulnerability Scanner - "netsparker", - "skipfish", - "w3af", - "arachni", - # 其他扫描工具 - "masscan", - "zmap", - "nmap", - "whatweb", - "wpscan", - "joomscan", - "dnsenum", - "subfinder", - "amass", - "sublist3r", - "theharvester", -} - -# 资产测绘工具常用的HTTP头标识 -ASSET_SCANNER_HEADERS = { - # 常见的扫描工具自定义头 - "x-scan": {"shodan", "censys", "zoomeye", "fofa"}, - "x-scanner": {"nmap", "masscan", "zmap"}, - "x-probe": {"masscan", "zmap"}, - # 其他可疑头(移除反向代理标准头) - "x-originating-ip": set(), - "x-remote-ip": set(), - "x-remote-addr": set(), - # 注意:移除了以下反向代理标准头以避免误报: - # - "x-forwarded-proto" (反向代理标准头) - # - "x-real-ip" (反向代理标准头,已在_get_client_ip中使用) -} - -# 仅检查特定HTTP头中的可疑模式(收紧匹配范围) -# 只检查这些特定头,不检查所有头 -SCANNER_SPECIFIC_HEADERS = { - "x-scan", - "x-scanner", - "x-probe", - "x-originating-ip", - "x-remote-ip", - "x-remote-addr", -} - -# 防爬虫模式配置 -# false: 禁用 -# strict: 严格模式(更严格的检测,更低的频率限制) -# loose: 宽松模式(较宽松的检测,较高的频率限制) -# basic: 基础模式(只记录恶意访问,不阻止,不限制请求数,不跟踪IP) - -# IP白名单配置(从配置文件读取,逗号分隔) -# 支持格式: -# - 精确IP:127.0.0.1, 192.168.1.100 -# - CIDR格式:192.168.1.0/24, 172.17.0.0/16 (适用于Docker网络) -# - 通配符:192.168.*.*, 10.*.*.*, *.*.*.* (匹配所有) -# - IPv6:::1, 2001:db8::/32 -def _parse_allowed_ips(ip_string: str) -> list: - """ - 解析IP白名单字符串,支持精确IP、CIDR格式和通配符 - - Args: - ip_string: 逗号分隔的IP字符串 - - Returns: - IP白名单列表,每个元素可能是: - - ipaddress.IPv4Network/IPv6Network对象(CIDR格式) - - ipaddress.IPv4Address/IPv6Address对象(精确IP) - - str(通配符模式,已转换为正则表达式) - """ - allowed = [] - if not ip_string: - return allowed - - for ip_entry in ip_string.split(","): - ip_entry = ip_entry.strip() # 去除空格 - if not ip_entry: - continue - - # 跳过注释行(以#开头) - if ip_entry.startswith("#"): - continue - - # 检查通配符格式(包含*) - if "*" in ip_entry: - # 处理通配符 - pattern = _convert_wildcard_to_regex(ip_entry) - if pattern: - allowed.append(pattern) - else: - logger.warning(f"无效的通配符IP格式,已忽略: {ip_entry}") - continue - - try: - # 尝试解析为CIDR格式(包含/) - if "/" in ip_entry: - allowed.append(ipaddress.ip_network(ip_entry, strict=False)) - else: - # 精确IP地址 - allowed.append(ipaddress.ip_address(ip_entry)) - except (ValueError, AttributeError) as e: - logger.warning(f"无效的IP白名单条目,已忽略: {ip_entry} ({e})") - - return allowed - - -def _convert_wildcard_to_regex(wildcard_pattern: str) -> Optional[str]: - """ - 将通配符IP模式转换为正则表达式 - - 支持的格式: - - 192.168.*.* 或 192.168.* - - 10.*.*.* 或 10.* - - *.*.*.* 或 * - - Args: - wildcard_pattern: 通配符模式字符串 - - Returns: - 正则表达式字符串,如果格式无效则返回None - """ - # 去除空格 - pattern = wildcard_pattern.strip() - - # 处理单个*(匹配所有) - if pattern == "*": - return r".*" - - # 处理IPv4通配符格式 - # 支持:192.168.*.*, 192.168.*, 10.*.*.*, 10.* 等 - parts = pattern.split(".") - - if len(parts) > 4: - return None # IPv4最多4段 - - # 构建正则表达式 - regex_parts = [] - for part in parts: - part = part.strip() - if part == "*": - regex_parts.append(r"\d+") # 匹配任意数字 - elif part.isdigit(): - # 验证数字范围(0-255) - num = int(part) - if 0 <= num <= 255: - regex_parts.append(re.escape(part)) - else: - return None # 无效的数字 - else: - return None # 无效的格式 - - # 如果部分少于4段,补充.* - while len(regex_parts) < 4: - regex_parts.append(r"\d+") - - # 组合成正则表达式 - regex = r"^" + r"\.".join(regex_parts) + r"$" - return regex - - -# 从配置读取防爬虫设置(延迟导入避免循环依赖) -def _get_anti_crawler_config(): - """获取防爬虫配置""" - from src.config.config import global_config - return { - 'mode': global_config.webui.anti_crawler_mode, - 'allowed_ips': _parse_allowed_ips(global_config.webui.allowed_ips), - 'trusted_proxies': _parse_allowed_ips(global_config.webui.trusted_proxies), - 'trust_xff': global_config.webui.trust_xff - } - -# 初始化配置(将在模块加载时执行) -_config = _get_anti_crawler_config() -ANTI_CRAWLER_MODE = _config['mode'] -ALLOWED_IPS = _config['allowed_ips'] -TRUSTED_PROXIES = _config['trusted_proxies'] -TRUST_XFF = _config['trust_xff'] - - -def _get_mode_config(mode: str) -> dict: - """ - 根据模式获取配置参数 - - Args: - mode: 防爬虫模式 (false/strict/loose/basic) - - Returns: - 配置字典,包含所有相关参数 - """ - mode = mode.lower() - - if mode == "false": - return { - "enabled": False, - "rate_limit_window": 60, - "rate_limit_max_requests": 1000, # 禁用时设置很高的值 - "max_tracked_ips": 0, - "check_user_agent": False, - "check_asset_scanner": False, - "check_rate_limit": False, - "block_on_detect": False, # 不阻止 - } - elif mode == "strict": - return { - "enabled": True, - "rate_limit_window": 60, - "rate_limit_max_requests": 15, # 严格模式:更低的请求数 - "max_tracked_ips": 20000, - "check_user_agent": True, - "check_asset_scanner": True, - "check_rate_limit": True, - "block_on_detect": True, # 阻止恶意访问 - } - elif mode == "loose": - return { - "enabled": True, - "rate_limit_window": 60, - "rate_limit_max_requests": 60, # 宽松模式:更高的请求数 - "max_tracked_ips": 5000, - "check_user_agent": True, - "check_asset_scanner": True, - "check_rate_limit": True, - "block_on_detect": True, # 阻止恶意访问 - } - else: # basic (默认模式) - return { - "enabled": True, - "rate_limit_window": 60, - "rate_limit_max_requests": 1000, # 不限制请求数 - "max_tracked_ips": 0, # 不跟踪IP - "check_user_agent": True, # 检测但不阻止 - "check_asset_scanner": True, # 检测但不阻止 - "check_rate_limit": False, # 不限制请求频率 - "block_on_detect": False, # 只记录,不阻止 - } - - -class AntiCrawlerMiddleware(BaseHTTPMiddleware): - """防爬虫中间件""" - - def __init__(self, app, mode: str = "standard"): - """ - 初始化防爬虫中间件 - - Args: - app: FastAPI 应用实例 - mode: 防爬虫模式 (false/strict/loose/standard) - """ - super().__init__(app) - self.mode = mode.lower() - # 根据模式获取配置 - config = _get_mode_config(self.mode) - self.enabled = config["enabled"] - self.rate_limit_window = config["rate_limit_window"] - self.rate_limit_max_requests = config["rate_limit_max_requests"] - self.max_tracked_ips = config["max_tracked_ips"] - self.check_user_agent = config["check_user_agent"] - self.check_asset_scanner = config["check_asset_scanner"] - self.check_rate_limit = config["check_rate_limit"] - self.block_on_detect = config["block_on_detect"] # 是否阻止检测到的恶意访问 - - # 用于存储每个IP的请求时间戳(使用deque提高性能) - self.request_times: dict[str, deque] = {} - # 上次清理时间 - self.last_cleanup = time.time() - # 将关键词列表转换为集合以提高查找性能 - self.crawler_keywords_set = set(CRAWLER_USER_AGENTS) - self.scanner_keywords_set = set(ASSET_SCANNER_USER_AGENTS) - - def _is_crawler_user_agent(self, user_agent: Optional[str]) -> bool: - """ - 检测是否为爬虫 User-Agent - - Args: - user_agent: User-Agent 字符串 - - Returns: - 如果是爬虫则返回 True - """ - if not user_agent: - # 没有 User-Agent 的请求记录日志但不直接阻止 - # 改为只记录,让频率限制来处理 - logger.debug("请求缺少User-Agent") - return False # 不再直接阻止无User-Agent的请求 - - user_agent_lower = user_agent.lower() - - # 使用集合查找提高性能(检查是否包含爬虫关键词) - for crawler_keyword in self.crawler_keywords_set: - if crawler_keyword in user_agent_lower: - return True - - return False - - def _is_asset_scanner_header(self, request: Request) -> bool: - """ - 检测是否为资产测绘工具的HTTP头(只检查特定头,收紧匹配) - - Args: - request: 请求对象 - - Returns: - 如果检测到资产测绘工具头则返回 True - """ - # 只检查特定的扫描工具头,不检查所有头 - for header_name, header_value in request.headers.items(): - header_name_lower = header_name.lower() - header_value_lower = header_value.lower() if header_value else "" - - # 检查已知的扫描工具头 - if header_name_lower in ASSET_SCANNER_HEADERS: - # 如果该头有特定的工具集合,检查值是否匹配 - expected_tools = ASSET_SCANNER_HEADERS[header_name_lower] - if expected_tools: - for tool in expected_tools: - if tool in header_value_lower: - return True - else: - # 如果没有特定工具集合,只要存在该头就视为可疑 - if header_value_lower: - return True - - # 只检查特定头中的可疑模式(收紧匹配) - if header_name_lower in SCANNER_SPECIFIC_HEADERS: - # 检查头值中是否包含已知扫描工具名称 - for tool in self.scanner_keywords_set: - if tool in header_value_lower: - return True - - return False - - def _detect_asset_scanner(self, request: Request) -> tuple[bool, Optional[str]]: - """ - 检测资产测绘工具 - - Args: - request: 请求对象 - - Returns: - (是否检测到, 检测到的工具名称) - """ - user_agent = request.headers.get("User-Agent") - - # 检查 User-Agent(使用集合查找提高性能) - if user_agent: - user_agent_lower = user_agent.lower() - for scanner_keyword in self.scanner_keywords_set: - if scanner_keyword in user_agent_lower: - return True, scanner_keyword - - # 检查HTTP头 - if self._is_asset_scanner_header(request): - # 尝试从User-Agent或头中提取工具名称 - detected_tool = None - if user_agent: - user_agent_lower = user_agent.lower() - for tool in self.scanner_keywords_set: - if tool in user_agent_lower: - detected_tool = tool - break - - # 检查HTTP头中的工具标识(只检查特定头) - if not detected_tool: - for header_name, header_value in request.headers.items(): - header_name_lower = header_name.lower() - if header_name_lower in SCANNER_SPECIFIC_HEADERS: - header_value_lower = (header_value or "").lower() - for tool in self.scanner_keywords_set: - if tool in header_value_lower: - detected_tool = tool - break - if detected_tool: - break - - return True, detected_tool or "unknown_scanner" - - return False, None - - def _check_rate_limit(self, client_ip: str) -> bool: - """ - 检查请求频率限制 - - Args: - client_ip: 客户端IP地址 - - Returns: - 如果超过限制则返回 True(需要阻止) - """ - # 检查IP白名单 - if self._is_ip_allowed(client_ip): - return False - - current_time = time.time() - - # 定期清理过期的请求记录(每5分钟清理一次) - if current_time - self.last_cleanup > 300: - self._cleanup_old_requests(current_time) - self.last_cleanup = current_time - - # 限制跟踪的IP数量,防止内存泄漏 - if self.max_tracked_ips > 0 and len(self.request_times) > self.max_tracked_ips: - # 清理最旧的记录(删除最久未访问的IP) - self._cleanup_oldest_ips() - - # 获取或创建该IP的请求时间deque(不使用maxlen,避免限流变松) - if client_ip not in self.request_times: - self.request_times[client_ip] = deque() - - request_times = self.request_times[client_ip] - - # 移除时间窗口外的请求记录(从左侧弹出过期记录) - while request_times and current_time - request_times[0] >= self.rate_limit_window: - request_times.popleft() - - # 检查是否超过限制 - if len(request_times) >= self.rate_limit_max_requests: - return True - - # 记录当前请求时间 - request_times.append(current_time) - return False - - def _cleanup_old_requests(self, current_time: float): - """清理过期的请求记录(只清理当前需要检查的IP,不全量遍历)""" - # 这个方法现在主要用于定期清理,实际清理在_check_rate_limit中按需进行 - # 清理最久未访问的IP记录 - if len(self.request_times) > self.max_tracked_ips * 0.8: - self._cleanup_oldest_ips() - - def _cleanup_oldest_ips(self): - """清理最久未访问的IP记录(全量遍历找真正的oldest)""" - if not self.request_times: - return - - # 先收集空deque的IP(优先删除) - empty_ips = [] - # 找到最久未访问的IP(最旧时间戳) - oldest_ip = None - oldest_time = float("inf") - - # 全量遍历找真正的oldest(超限时性能可接受) - for ip, times in self.request_times.items(): - if not times: - # 空deque,记录待删除 - empty_ips.append(ip) - else: - # 找到最旧的时间戳 - if times[0] < oldest_time: - oldest_time = times[0] - oldest_ip = ip - - # 先删除空deque的IP - for ip in empty_ips: - del self.request_times[ip] - - # 如果没有空deque可删除,且仍需要清理,删除最旧的一个IP - if not empty_ips and oldest_ip: - del self.request_times[oldest_ip] - - def _is_trusted_proxy(self, ip: str) -> bool: - """ - 检查IP是否在信任的代理列表中 - - Args: - ip: IP地址字符串 - - Returns: - 如果是信任的代理则返回 True - """ - if not TRUSTED_PROXIES or ip == "unknown": - return False - - # 检查代理列表中的每个条目 - for trusted_entry in TRUSTED_PROXIES: - # 通配符模式(字符串,正则表达式) - if isinstance(trusted_entry, str): - try: - if re.match(trusted_entry, ip): - return True - except re.error: - continue - # CIDR格式(网络对象) - elif isinstance(trusted_entry, (ipaddress.IPv4Network, ipaddress.IPv6Network)): - try: - client_ip_obj = ipaddress.ip_address(ip) - if client_ip_obj in trusted_entry: - return True - except (ValueError, AttributeError): - continue - # 精确IP(地址对象) - elif isinstance(trusted_entry, (ipaddress.IPv4Address, ipaddress.IPv6Address)): - try: - client_ip_obj = ipaddress.ip_address(ip) - if client_ip_obj == trusted_entry: - return True - except (ValueError, AttributeError): - continue - - return False - - def _get_client_ip(self, request: Request) -> str: - """ - 获取客户端真实IP地址(带基本验证和代理信任检查) - - Args: - request: 请求对象 - - Returns: - 客户端IP地址 - """ - # 获取直接连接的客户端IP(用于验证代理) - direct_client_ip = None - if request.client: - direct_client_ip = request.client.host - - # 检查是否信任X-Forwarded-For头 - # TRUST_XFF 只表示"启用代理解析能力",但仍要求直连 IP 在 TRUSTED_PROXIES 中 - use_xff = False - if TRUST_XFF and TRUSTED_PROXIES and direct_client_ip: - # 只有在启用 TRUST_XFF 且直连 IP 在信任列表中时,才信任 XFF - use_xff = self._is_trusted_proxy(direct_client_ip) - - # 如果信任代理,优先从 X-Forwarded-For 获取 - if use_xff: - forwarded_for = request.headers.get("X-Forwarded-For") - if forwarded_for: - # X-Forwarded-For 可能包含多个IP,取第一个 - ip = forwarded_for.split(",")[0].strip() - # 基本验证IP格式 - if self._validate_ip(ip): - return ip - - # 从 X-Real-IP 获取(如果信任代理) - if use_xff: - real_ip = request.headers.get("X-Real-IP") - if real_ip: - ip = real_ip.strip() - if self._validate_ip(ip): - return ip - - # 使用直接连接的客户端IP - if direct_client_ip and self._validate_ip(direct_client_ip): - return direct_client_ip - - return "unknown" - - def _validate_ip(self, ip: str) -> bool: - """ - 验证IP地址格式 - - Args: - ip: IP地址字符串 - - Returns: - 如果格式有效则返回 True - """ - try: - ipaddress.ip_address(ip) - return True - except (ValueError, AttributeError): - return False - - def _is_ip_allowed(self, ip: str) -> bool: - """ - 检查IP是否在白名单中(支持精确IP、CIDR格式和通配符) - - Args: - ip: 客户端IP地址 - - Returns: - 如果IP在白名单中则返回 True - """ - if not ALLOWED_IPS or ip == "unknown": - return False - - # 检查白名单中的每个条目 - for allowed_entry in ALLOWED_IPS: - # 通配符模式(字符串,正则表达式) - if isinstance(allowed_entry, str): - try: - if re.match(allowed_entry, ip): - return True - except re.error: - # 正则表达式错误,跳过 - continue - # CIDR格式(网络对象) - elif isinstance(allowed_entry, (ipaddress.IPv4Network, ipaddress.IPv6Network)): - try: - client_ip_obj = ipaddress.ip_address(ip) - if client_ip_obj in allowed_entry: - return True - except (ValueError, AttributeError): - # IP格式无效,跳过 - continue - # 精确IP(地址对象) - elif isinstance(allowed_entry, (ipaddress.IPv4Address, ipaddress.IPv6Address)): - try: - client_ip_obj = ipaddress.ip_address(ip) - if client_ip_obj == allowed_entry: - return True - except (ValueError, AttributeError): - # IP格式无效,跳过 - continue - - return False - - async def dispatch(self, request: Request, call_next): - """ - 处理请求 - - Args: - request: 请求对象 - call_next: 下一个中间件或路由处理函数 - - Returns: - 响应对象 - """ - # 如果未启用,直接通过 - if not self.enabled: - return await call_next(request) - - # 允许访问 robots.txt(由专门的路由处理) - if request.url.path == "/robots.txt": - return await call_next(request) - - # 允许访问静态资源(CSS、JS、图片等) - # 注意:.json 已移除,避免 API 路径绕过防护 - # 静态资源只在特定前缀下放行(/static/、/assets/、/dist/) - static_extensions = { - ".css", - ".js", - ".png", - ".jpg", - ".jpeg", - ".gif", - ".svg", - ".ico", - ".woff", - ".woff2", - ".ttf", - ".eot", - } - static_prefixes = {"/static/", "/assets/", "/dist/"} - - # 检查是否是静态资源路径(特定前缀下的静态文件) - path = request.url.path - is_static_path = any(path.startswith(prefix) for prefix in static_prefixes) and any( - path.endswith(ext) for ext in static_extensions - ) - - # 也允许根路径下的静态文件(如 /favicon.ico) - is_root_static = path.count("/") == 1 and any(path.endswith(ext) for ext in static_extensions) - - if is_static_path or is_root_static: - return await call_next(request) - - # 获取客户端IP(只获取一次,避免重复调用) - client_ip = self._get_client_ip(request) - - # 检查IP白名单(优先检查,白名单IP直接通过) - if self._is_ip_allowed(client_ip): - return await call_next(request) - - # 获取 User-Agent - user_agent = request.headers.get("User-Agent") - - # 检测资产测绘工具(优先检测,因为更危险) - if self.check_asset_scanner: - is_scanner, scanner_name = self._detect_asset_scanner(request) - if is_scanner: - logger.warning( - f"🚫 检测到资产测绘工具请求 - IP: {client_ip}, 工具: {scanner_name}, " - f"User-Agent: {user_agent}, Path: {request.url.path}" - ) - # 根据配置决定是否阻止 - if self.block_on_detect: - return PlainTextResponse( - "Access Denied: Asset scanning tools are not allowed", - status_code=403, - ) - - # 检测爬虫 User-Agent - if self.check_user_agent and self._is_crawler_user_agent(user_agent): - logger.warning(f"🚫 检测到爬虫请求 - IP: {client_ip}, User-Agent: {user_agent}, Path: {request.url.path}") - # 根据配置决定是否阻止 - if self.block_on_detect: - return PlainTextResponse( - "Access Denied: Crawlers are not allowed", - status_code=403, - ) - - # 检查请求频率限制 - if self.check_rate_limit and self._check_rate_limit(client_ip): - logger.warning(f"🚫 请求频率过高 - IP: {client_ip}, User-Agent: {user_agent}, Path: {request.url.path}") - return PlainTextResponse( - "Too Many Requests: Rate limit exceeded", - status_code=429, - ) - - # 正常请求,继续处理 - return await call_next(request) - - -def create_robots_txt_response() -> PlainTextResponse: - """ - 创建 robots.txt 响应 - - Returns: - robots.txt 响应对象 - """ - robots_content = """User-agent: * -Disallow: / - -# 禁止所有爬虫访问 -""" - return PlainTextResponse( - content=robots_content, - media_type="text/plain", - headers={"Cache-Control": "public, max-age=86400"}, # 缓存24小时 - ) diff --git a/src/webui/api/planner.py b/src/webui/api/planner.py deleted file mode 100644 index e202df2d..00000000 --- a/src/webui/api/planner.py +++ /dev/null @@ -1,301 +0,0 @@ -""" -规划器监控API -提供规划器日志数据的查询接口 - -性能优化: -1. 聊天摘要只统计文件数量和最新时间戳,不读取文件内容 -2. 日志列表使用文件名解析时间戳,只在需要时读取完整内容 -3. 详情按需加载 -""" -import json -from pathlib import Path -from typing import List, Dict, Optional -from fastapi import APIRouter, HTTPException, Query -from pydantic import BaseModel - -router = APIRouter(prefix="/api/planner", tags=["planner"]) - -# 规划器日志目录 -PLAN_LOG_DIR = Path("logs/plan") - - -class ChatSummary(BaseModel): - """聊天摘要 - 轻量级,不读取文件内容""" - chat_id: str - plan_count: int - latest_timestamp: float - latest_filename: str - - -class PlanLogSummary(BaseModel): - """规划日志摘要""" - chat_id: str - timestamp: float - filename: str - action_count: int - action_types: List[str] # 动作类型列表 - total_plan_ms: float - llm_duration_ms: float - reasoning_preview: str - - -class PlanLogDetail(BaseModel): - """规划日志详情""" - type: str - chat_id: str - timestamp: float - prompt: str - reasoning: str - raw_output: str - actions: List[Dict] - timing: Dict - extra: Optional[Dict] = None - - -class PlannerOverview(BaseModel): - """规划器总览 - 轻量级统计""" - total_chats: int - total_plans: int - chats: List[ChatSummary] - - -class PaginatedChatLogs(BaseModel): - """分页的聊天日志列表""" - data: List[PlanLogSummary] - total: int - page: int - page_size: int - chat_id: str - - -def parse_timestamp_from_filename(filename: str) -> float: - """从文件名解析时间戳: 1766497488220_af92bdb1.json -> 1766497488.220""" - try: - timestamp_str = filename.split('_')[0] - # 时间戳是毫秒级,需要转换为秒 - return float(timestamp_str) / 1000 - except (ValueError, IndexError): - return 0 - - -@router.get("/overview", response_model=PlannerOverview) -async def get_planner_overview(): - """ - 获取规划器总览 - 轻量级接口 - 只统计文件数量,不读取文件内容 - """ - if not PLAN_LOG_DIR.exists(): - return PlannerOverview(total_chats=0, total_plans=0, chats=[]) - - chats = [] - total_plans = 0 - - for chat_dir in PLAN_LOG_DIR.iterdir(): - if not chat_dir.is_dir(): - continue - - # 只统计json文件数量 - json_files = list(chat_dir.glob("*.json")) - plan_count = len(json_files) - total_plans += plan_count - - if plan_count == 0: - continue - - # 从文件名获取最新时间戳 - latest_file = max(json_files, key=lambda f: parse_timestamp_from_filename(f.name)) - latest_timestamp = parse_timestamp_from_filename(latest_file.name) - - chats.append(ChatSummary( - chat_id=chat_dir.name, - plan_count=plan_count, - latest_timestamp=latest_timestamp, - latest_filename=latest_file.name - )) - - # 按最新时间戳排序 - chats.sort(key=lambda x: x.latest_timestamp, reverse=True) - - return PlannerOverview( - total_chats=len(chats), - total_plans=total_plans, - chats=chats - ) - - -@router.get("/chat/{chat_id}/logs", response_model=PaginatedChatLogs) -async def get_chat_plan_logs( - chat_id: str, - page: int = Query(1, ge=1), - page_size: int = Query(20, ge=1, le=100), - search: Optional[str] = Query(None, description="搜索关键词,匹配提示词内容") -): - """ - 获取指定聊天的规划日志列表(分页) - 需要读取文件内容获取摘要信息 - 支持搜索提示词内容 - """ - chat_dir = PLAN_LOG_DIR / chat_id - if not chat_dir.exists(): - return PaginatedChatLogs( - data=[], total=0, page=page, page_size=page_size, chat_id=chat_id - ) - - # 先获取所有文件并按时间戳排序 - json_files = list(chat_dir.glob("*.json")) - json_files.sort(key=lambda f: parse_timestamp_from_filename(f.name), reverse=True) - - # 如果有搜索关键词,需要过滤文件 - if search: - search_lower = search.lower() - filtered_files = [] - for log_file in json_files: - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - prompt = data.get('prompt', '') - if search_lower in prompt.lower(): - filtered_files.append(log_file) - except Exception: - continue - json_files = filtered_files - - total = len(json_files) - - # 分页 - 只读取当前页的文件 - offset = (page - 1) * page_size - page_files = json_files[offset:offset + page_size] - - logs = [] - for log_file in page_files: - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - reasoning = data.get('reasoning', '') - actions = data.get('actions', []) - action_types = [a.get('action_type', '') for a in actions if a.get('action_type')] - logs.append(PlanLogSummary( - chat_id=data.get('chat_id', chat_id), - timestamp=data.get('timestamp', parse_timestamp_from_filename(log_file.name)), - filename=log_file.name, - action_count=len(actions), - action_types=action_types, - total_plan_ms=data.get('timing', {}).get('total_plan_ms', 0), - llm_duration_ms=data.get('timing', {}).get('llm_duration_ms', 0), - reasoning_preview=reasoning[:100] if reasoning else '' - )) - except Exception: - # 文件读取失败时使用文件名信息 - logs.append(PlanLogSummary( - chat_id=chat_id, - timestamp=parse_timestamp_from_filename(log_file.name), - filename=log_file.name, - action_count=0, - action_types=[], - total_plan_ms=0, - llm_duration_ms=0, - reasoning_preview='[读取失败]' - )) - - return PaginatedChatLogs( - data=logs, - total=total, - page=page, - page_size=page_size, - chat_id=chat_id - ) - - -@router.get("/log/{chat_id}/{filename}", response_model=PlanLogDetail) -async def get_log_detail(chat_id: str, filename: str): - """获取规划日志详情 - 按需加载完整内容""" - log_file = PLAN_LOG_DIR / chat_id / filename - if not log_file.exists(): - raise HTTPException(status_code=404, detail="日志文件不存在") - - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - return PlanLogDetail(**data) - except Exception as e: - raise HTTPException(status_code=500, detail=f"读取日志失败: {str(e)}") - - -# ========== 兼容旧接口 ========== - -@router.get("/stats") -async def get_planner_stats(): - """获取规划器统计信息 - 兼容旧接口""" - overview = await get_planner_overview() - - # 获取最近10条计划的摘要 - recent_plans = [] - for chat in overview.chats[:5]: # 从最近5个聊天中获取 - try: - chat_logs = await get_chat_plan_logs(chat.chat_id, page=1, page_size=2) - recent_plans.extend(chat_logs.data) - except Exception: - continue - - # 按时间排序取前10 - recent_plans.sort(key=lambda x: x.timestamp, reverse=True) - recent_plans = recent_plans[:10] - - return { - "total_chats": overview.total_chats, - "total_plans": overview.total_plans, - "avg_plan_time_ms": 0, - "avg_llm_time_ms": 0, - "recent_plans": recent_plans - } - - -@router.get("/chats") -async def get_chat_list(): - """获取所有聊天ID列表 - 兼容旧接口""" - overview = await get_planner_overview() - return [chat.chat_id for chat in overview.chats] - - -@router.get("/all-logs") -async def get_all_logs( - page: int = Query(1, ge=1), - page_size: int = Query(20, ge=1, le=100) -): - """获取所有规划日志 - 兼容旧接口""" - if not PLAN_LOG_DIR.exists(): - return {"data": [], "total": 0, "page": page, "page_size": page_size} - - # 收集所有文件 - all_files = [] - for chat_dir in PLAN_LOG_DIR.iterdir(): - if chat_dir.is_dir(): - for log_file in chat_dir.glob("*.json"): - all_files.append((chat_dir.name, log_file)) - - # 按时间戳排序 - all_files.sort(key=lambda x: parse_timestamp_from_filename(x[1].name), reverse=True) - - total = len(all_files) - offset = (page - 1) * page_size - page_files = all_files[offset:offset + page_size] - - logs = [] - for chat_id, log_file in page_files: - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - reasoning = data.get('reasoning', '') - logs.append({ - "chat_id": data.get('chat_id', chat_id), - "timestamp": data.get('timestamp', parse_timestamp_from_filename(log_file.name)), - "filename": log_file.name, - "action_count": len(data.get('actions', [])), - "total_plan_ms": data.get('timing', {}).get('total_plan_ms', 0), - "llm_duration_ms": data.get('timing', {}).get('llm_duration_ms', 0), - "reasoning_preview": reasoning[:100] if reasoning else '' - }) - except Exception: - continue - - return {"data": logs, "total": total, "page": page, "page_size": page_size} diff --git a/src/webui/api/replier.py b/src/webui/api/replier.py deleted file mode 100644 index 085a46cb..00000000 --- a/src/webui/api/replier.py +++ /dev/null @@ -1,269 +0,0 @@ -""" -回复器监控API -提供回复器日志数据的查询接口 - -性能优化: -1. 聊天摘要只统计文件数量和最新时间戳,不读取文件内容 -2. 日志列表使用文件名解析时间戳,只在需要时读取完整内容 -3. 详情按需加载 -""" -import json -from pathlib import Path -from typing import List, Dict, Optional -from fastapi import APIRouter, HTTPException, Query -from pydantic import BaseModel - -router = APIRouter(prefix="/api/replier", tags=["replier"]) - -# 回复器日志目录 -REPLY_LOG_DIR = Path("logs/reply") - - -class ReplierChatSummary(BaseModel): - """聊天摘要 - 轻量级,不读取文件内容""" - chat_id: str - reply_count: int - latest_timestamp: float - latest_filename: str - - -class ReplyLogSummary(BaseModel): - """回复日志摘要""" - chat_id: str - timestamp: float - filename: str - model: str - success: bool - llm_ms: float - overall_ms: float - output_preview: str - - -class ReplyLogDetail(BaseModel): - """回复日志详情""" - type: str - chat_id: str - timestamp: float - prompt: str - output: str - processed_output: List[str] - model: str - reasoning: str - think_level: int - timing: Dict - error: Optional[str] = None - success: bool - - -class ReplierOverview(BaseModel): - """回复器总览 - 轻量级统计""" - total_chats: int - total_replies: int - chats: List[ReplierChatSummary] - - -class PaginatedReplyLogs(BaseModel): - """分页的回复日志列表""" - data: List[ReplyLogSummary] - total: int - page: int - page_size: int - chat_id: str - - -def parse_timestamp_from_filename(filename: str) -> float: - """从文件名解析时间戳: 1766497488220_af92bdb1.json -> 1766497488.220""" - try: - timestamp_str = filename.split('_')[0] - # 时间戳是毫秒级,需要转换为秒 - return float(timestamp_str) / 1000 - except (ValueError, IndexError): - return 0 - - -@router.get("/overview", response_model=ReplierOverview) -async def get_replier_overview(): - """ - 获取回复器总览 - 轻量级接口 - 只统计文件数量,不读取文件内容 - """ - if not REPLY_LOG_DIR.exists(): - return ReplierOverview(total_chats=0, total_replies=0, chats=[]) - - chats = [] - total_replies = 0 - - for chat_dir in REPLY_LOG_DIR.iterdir(): - if not chat_dir.is_dir(): - continue - - # 只统计json文件数量 - json_files = list(chat_dir.glob("*.json")) - reply_count = len(json_files) - total_replies += reply_count - - if reply_count == 0: - continue - - # 从文件名获取最新时间戳 - latest_file = max(json_files, key=lambda f: parse_timestamp_from_filename(f.name)) - latest_timestamp = parse_timestamp_from_filename(latest_file.name) - - chats.append(ReplierChatSummary( - chat_id=chat_dir.name, - reply_count=reply_count, - latest_timestamp=latest_timestamp, - latest_filename=latest_file.name - )) - - # 按最新时间戳排序 - chats.sort(key=lambda x: x.latest_timestamp, reverse=True) - - return ReplierOverview( - total_chats=len(chats), - total_replies=total_replies, - chats=chats - ) - - -@router.get("/chat/{chat_id}/logs", response_model=PaginatedReplyLogs) -async def get_chat_reply_logs( - chat_id: str, - page: int = Query(1, ge=1), - page_size: int = Query(20, ge=1, le=100), - search: Optional[str] = Query(None, description="搜索关键词,匹配提示词内容") -): - """ - 获取指定聊天的回复日志列表(分页) - 需要读取文件内容获取摘要信息 - 支持搜索提示词内容 - """ - chat_dir = REPLY_LOG_DIR / chat_id - if not chat_dir.exists(): - return PaginatedReplyLogs( - data=[], total=0, page=page, page_size=page_size, chat_id=chat_id - ) - - # 先获取所有文件并按时间戳排序 - json_files = list(chat_dir.glob("*.json")) - json_files.sort(key=lambda f: parse_timestamp_from_filename(f.name), reverse=True) - - # 如果有搜索关键词,需要过滤文件 - if search: - search_lower = search.lower() - filtered_files = [] - for log_file in json_files: - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - prompt = data.get('prompt', '') - if search_lower in prompt.lower(): - filtered_files.append(log_file) - except Exception: - continue - json_files = filtered_files - - total = len(json_files) - - # 分页 - 只读取当前页的文件 - offset = (page - 1) * page_size - page_files = json_files[offset:offset + page_size] - - logs = [] - for log_file in page_files: - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - output = data.get('output', '') - logs.append(ReplyLogSummary( - chat_id=data.get('chat_id', chat_id), - timestamp=data.get('timestamp', parse_timestamp_from_filename(log_file.name)), - filename=log_file.name, - model=data.get('model', ''), - success=data.get('success', True), - llm_ms=data.get('timing', {}).get('llm_ms', 0), - overall_ms=data.get('timing', {}).get('overall_ms', 0), - output_preview=output[:100] if output else '' - )) - except Exception: - # 文件读取失败时使用文件名信息 - logs.append(ReplyLogSummary( - chat_id=chat_id, - timestamp=parse_timestamp_from_filename(log_file.name), - filename=log_file.name, - model='', - success=False, - llm_ms=0, - overall_ms=0, - output_preview='[读取失败]' - )) - - return PaginatedReplyLogs( - data=logs, - total=total, - page=page, - page_size=page_size, - chat_id=chat_id - ) - - -@router.get("/log/{chat_id}/{filename}", response_model=ReplyLogDetail) -async def get_reply_log_detail(chat_id: str, filename: str): - """获取回复日志详情 - 按需加载完整内容""" - log_file = REPLY_LOG_DIR / chat_id / filename - if not log_file.exists(): - raise HTTPException(status_code=404, detail="日志文件不存在") - - try: - with open(log_file, 'r', encoding='utf-8') as f: - data = json.load(f) - return ReplyLogDetail( - type=data.get('type', 'reply'), - chat_id=data.get('chat_id', chat_id), - timestamp=data.get('timestamp', 0), - prompt=data.get('prompt', ''), - output=data.get('output', ''), - processed_output=data.get('processed_output', []), - model=data.get('model', ''), - reasoning=data.get('reasoning', ''), - think_level=data.get('think_level', 0), - timing=data.get('timing', {}), - error=data.get('error'), - success=data.get('success', True) - ) - except Exception as e: - raise HTTPException(status_code=500, detail=f"读取日志失败: {str(e)}") - - -# ========== 兼容接口 ========== - -@router.get("/stats") -async def get_replier_stats(): - """获取回复器统计信息""" - overview = await get_replier_overview() - - # 获取最近10条回复的摘要 - recent_replies = [] - for chat in overview.chats[:5]: # 从最近5个聊天中获取 - try: - chat_logs = await get_chat_reply_logs(chat.chat_id, page=1, page_size=2) - recent_replies.extend(chat_logs.data) - except Exception: - continue - - # 按时间排序取前10 - recent_replies.sort(key=lambda x: x.timestamp, reverse=True) - recent_replies = recent_replies[:10] - - return { - "total_chats": overview.total_chats, - "total_replies": overview.total_replies, - "recent_replies": recent_replies - } - - -@router.get("/chats") -async def get_replier_chat_list(): - """获取所有聊天ID列表""" - overview = await get_replier_overview() - return [chat.chat_id for chat in overview.chats] diff --git a/src/webui/auth.py b/src/webui/auth.py deleted file mode 100644 index db0fc675..00000000 --- a/src/webui/auth.py +++ /dev/null @@ -1,183 +0,0 @@ -""" -WebUI 认证模块 -提供统一的认证依赖,支持 Cookie 和 Header 两种方式 -""" - -from typing import Optional -from fastapi import HTTPException, Cookie, Header, Response, Request -from src.common.logger import get_logger -from src.config.config import global_config -from .token_manager import get_token_manager - -logger = get_logger("webui.auth") - -# Cookie 配置 -COOKIE_NAME = "maibot_session" -COOKIE_MAX_AGE = 7 * 24 * 60 * 60 # 7天 - - -def _is_secure_environment() -> bool: - """ - 检测是否应该启用安全 Cookie(HTTPS) - - Returns: - bool: 如果应该使用 secure cookie 则返回 True - """ - # 从配置读取 - if global_config.webui.secure_cookie: - logger.info("配置中启用了 secure_cookie") - return True - - # 检查是否是生产环境 - if global_config.webui.mode == "production": - logger.info("WebUI运行在生产模式,启用 secure cookie") - return True - - # 默认:开发环境不启用(因为通常是 HTTP) - logger.debug("WebUI运行在开发模式,禁用 secure cookie") - return False - - -def get_current_token( - request: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> str: - """ - 获取当前请求的 token,优先从 Cookie 获取,其次从 Header 获取 - - Args: - request: FastAPI Request 对象 - maibot_session: Cookie 中的 token - authorization: Authorization Header (Bearer token) - - Returns: - 验证通过的 token - - Raises: - HTTPException: 认证失败时抛出 401 错误 - """ - token = None - - # 优先从 Cookie 获取 - if maibot_session: - token = maibot_session - # 其次从 Header 获取(兼容旧版本) - elif authorization and authorization.startswith("Bearer "): - token = authorization.replace("Bearer ", "") - - if not token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - # 验证 token - token_manager = get_token_manager() - if not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="Token 无效或已过期") - - return token - - -def set_auth_cookie(response: Response, token: str, request: Optional[Request] = None) -> None: - """ - 设置认证 Cookie - - Args: - response: FastAPI Response 对象 - token: 要设置的 token - request: FastAPI Request 对象(可选,用于检测协议) - """ - # 根据环境和实际请求协议决定安全设置 - is_secure = _is_secure_environment() - - # 如果提供了 request,检测实际使用的协议 - if request: - # 检查 X-Forwarded-Proto header(代理/负载均衡器) - forwarded_proto = request.headers.get("x-forwarded-proto", "").lower() - if forwarded_proto: - is_https = forwarded_proto == "https" - logger.debug(f"检测到 X-Forwarded-Proto: {forwarded_proto}, is_https={is_https}") - else: - # 检查 request.url.scheme - is_https = request.url.scheme == "https" - logger.debug(f"检测到 scheme: {request.url.scheme}, is_https={is_https}") - - # 如果是 HTTP 连接,强制禁用 secure 标志 - if not is_https and is_secure: - logger.warning("=" * 80) - logger.warning("检测到 HTTP 连接但环境配置要求 HTTPS (secure cookie)") - logger.warning("已自动禁用 secure 标志以允许登录,但建议修改配置:") - logger.warning("1. 在配置文件中设置: webui.secure_cookie = false") - logger.warning("2. 如果使用反向代理,请确保正确配置 X-Forwarded-Proto 头") - logger.warning("=" * 80) - is_secure = False - - # 设置 Cookie - response.set_cookie( - key=COOKIE_NAME, - value=token, - max_age=COOKIE_MAX_AGE, - httponly=True, # 防止 JS 读取,阻止 XSS 窃取 - samesite="lax", # 使用 lax 以兼容更多场景(开发和生产) - secure=is_secure, # 根据实际协议决定 - path="/", # 确保 Cookie 在所有路径下可用 - ) - - logger.info(f"已设置认证 Cookie: {token[:8]}... (secure={is_secure}, samesite=lax, httponly=True, path=/, max_age={COOKIE_MAX_AGE})") - logger.debug(f"完整 token 前缀: {token[:20]}...") - - -def clear_auth_cookie(response: Response) -> None: - """ - 清除认证 Cookie - - Args: - response: FastAPI Response 对象 - """ - # 保持与 set_auth_cookie 相同的安全设置 - is_secure = _is_secure_environment() - - response.delete_cookie( - key=COOKIE_NAME, - httponly=True, - samesite="strict" if is_secure else "lax", - secure=is_secure, - path="/", - ) - logger.debug("已清除认证 Cookie") - - -def verify_auth_token_from_cookie_or_header( - maibot_session: Optional[str] = None, - authorization: Optional[str] = None, -) -> bool: - """ - 验证认证 Token,支持从 Cookie 或 Header 获取 - - Args: - maibot_session: Cookie 中的 token - authorization: Authorization header (Bearer token) - - Returns: - 验证成功返回 True - - Raises: - HTTPException: 认证失败时抛出 401 错误 - """ - token = None - - # 优先从 Cookie 获取 - if maibot_session: - token = maibot_session - # 其次从 Header 获取(兼容旧版本) - elif authorization and authorization.startswith("Bearer "): - token = authorization.replace("Bearer ", "") - - if not token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - # 验证 token - token_manager = get_token_manager() - if not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="Token 无效或已过期") - - return True diff --git a/src/webui/chat_routes.py b/src/webui/chat_routes.py deleted file mode 100644 index 6535b9e9..00000000 --- a/src/webui/chat_routes.py +++ /dev/null @@ -1,782 +0,0 @@ -"""本地聊天室路由 - WebUI 与麦麦直接对话 - -支持两种模式: -1. WebUI 模式:使用 WebUI 平台独立身份聊天 -2. 虚拟身份模式:使用真实平台用户的身份,在虚拟群聊中与麦麦对话 -""" - -import time -import uuid -from typing import Dict, Any, Optional, List -from fastapi import APIRouter, WebSocket, WebSocketDisconnect, Query, Depends, Cookie, Header -from pydantic import BaseModel - -from src.common.logger import get_logger -from src.common.database.database_model import Messages, PersonInfo -from src.config.config import global_config -from src.chat.message_receive.bot import chat_bot -from src.webui.auth import verify_auth_token_from_cookie_or_header -from src.webui.token_manager import get_token_manager -from src.webui.ws_auth import verify_ws_token - -logger = get_logger("webui.chat") - -router = APIRouter(prefix="/api/chat", tags=["LocalChat"]) - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -# WebUI 聊天的虚拟群组 ID -WEBUI_CHAT_GROUP_ID = "webui_local_chat" -WEBUI_CHAT_PLATFORM = "webui" - -# 虚拟身份模式的群 ID 前缀 -VIRTUAL_GROUP_ID_PREFIX = "webui_virtual_group_" - -# 固定的 WebUI 用户 ID 前缀 -WEBUI_USER_ID_PREFIX = "webui_user_" - - -class VirtualIdentityConfig(BaseModel): - """虚拟身份配置""" - - enabled: bool = False # 是否启用虚拟身份模式 - platform: Optional[str] = None # 目标平台(如 qq, discord 等) - person_id: Optional[str] = None # PersonInfo 的 person_id - user_id: Optional[str] = None # 原始平台用户 ID - user_nickname: Optional[str] = None # 用户昵称 - group_id: Optional[str] = None # 虚拟群 ID(自动生成或用户指定) - group_name: Optional[str] = None # 虚拟群名(用户自定义) - - -class ChatHistoryMessage(BaseModel): - """聊天历史消息""" - - id: str - type: str # 'user' | 'bot' | 'system' - content: str - timestamp: float - sender_name: str - sender_id: Optional[str] = None - is_bot: bool = False - - -class ChatHistoryManager: - """聊天历史管理器 - 使用 SQLite 数据库存储""" - - def __init__(self, max_messages: int = 200): - self.max_messages = max_messages - - def _message_to_dict(self, msg: Messages, group_id: Optional[str] = None) -> Dict[str, Any]: - """将数据库消息转换为前端格式 - - Args: - msg: 数据库消息对象 - group_id: 群 ID,用于判断是否是虚拟群 - """ - # 判断是否是机器人消息 - user_id = msg.user_id or "" - - # 对于虚拟群,通过比较机器人 QQ 账号来判断 - # 对于普通 WebUI 群,检查 user_id 是否以 webui_ 开头 - if group_id and group_id.startswith(VIRTUAL_GROUP_ID_PREFIX): - # 虚拟群:user_id 等于机器人 QQ 账号的是机器人消息 - bot_qq = str(global_config.bot.qq_account) - is_bot = user_id == bot_qq - else: - # 普通 WebUI 群:不以 webui_ 开头的是机器人消息 - is_bot = not user_id.startswith("webui_") and not user_id.startswith(WEBUI_USER_ID_PREFIX) - - return { - "id": msg.message_id, - "type": "bot" if is_bot else "user", - "content": msg.processed_plain_text or msg.display_message or "", - "timestamp": msg.time, - "sender_name": msg.user_nickname or (global_config.bot.nickname if is_bot else "未知用户"), - "sender_id": "bot" if is_bot else user_id, - "is_bot": is_bot, - } - - def get_history(self, limit: int = 50, group_id: Optional[str] = None) -> List[Dict[str, Any]]: - """从数据库获取最近的历史记录 - - Args: - limit: 获取的消息数量 - group_id: 群 ID,默认为 WEBUI_CHAT_GROUP_ID - """ - target_group_id = group_id if group_id else WEBUI_CHAT_GROUP_ID - try: - # 查询指定群的消息,按时间排序 - messages = ( - Messages.select() - .where(Messages.chat_info_group_id == target_group_id) - .order_by(Messages.time.desc()) - .limit(limit) - ) - - # 转换为列表并反转(使最旧的消息在前) - # 传递 group_id 以便正确判断虚拟群中的机器人消息 - result = [self._message_to_dict(msg, target_group_id) for msg in messages] - result.reverse() - - logger.debug(f"从数据库加载了 {len(result)} 条聊天记录 (group_id={target_group_id})") - return result - except Exception as e: - logger.error(f"从数据库加载聊天记录失败: {e}") - return [] - - def clear_history(self, group_id: Optional[str] = None) -> int: - """清空聊天历史记录 - - Args: - group_id: 群 ID,默认清空 WebUI 默认聊天室 - """ - target_group_id = group_id if group_id else WEBUI_CHAT_GROUP_ID - try: - deleted = Messages.delete().where(Messages.chat_info_group_id == target_group_id).execute() - logger.info(f"已清空 {deleted} 条聊天记录 (group_id={target_group_id})") - return deleted - except Exception as e: - logger.error(f"清空聊天记录失败: {e}") - return 0 - - -# 全局聊天历史管理器 -chat_history = ChatHistoryManager() - - -# 存储 WebSocket 连接 -class ChatConnectionManager: - """聊天连接管理器""" - - def __init__(self): - self.active_connections: Dict[str, WebSocket] = {} - self.user_sessions: Dict[str, str] = {} # user_id -> session_id 映射 - - async def connect(self, websocket: WebSocket, session_id: str, user_id: str): - await websocket.accept() - self.active_connections[session_id] = websocket - self.user_sessions[user_id] = session_id - logger.info(f"WebUI 聊天会话已连接: session={session_id}, user={user_id}") - - def disconnect(self, session_id: str, user_id: str): - if session_id in self.active_connections: - del self.active_connections[session_id] - if user_id in self.user_sessions and self.user_sessions[user_id] == session_id: - del self.user_sessions[user_id] - logger.info(f"WebUI 聊天会话已断开: session={session_id}") - - async def send_message(self, session_id: str, message: dict): - if session_id in self.active_connections: - try: - await self.active_connections[session_id].send_json(message) - except Exception as e: - logger.error(f"发送消息失败: {e}") - - async def broadcast(self, message: dict): - """广播消息给所有连接""" - for session_id in list(self.active_connections.keys()): - await self.send_message(session_id, message) - - -chat_manager = ChatConnectionManager() - - -def create_message_data( - content: str, - user_id: str, - user_name: str, - message_id: Optional[str] = None, - is_at_bot: bool = True, - virtual_config: Optional[VirtualIdentityConfig] = None, -) -> Dict[str, Any]: - """创建符合麦麦消息格式的消息数据 - - Args: - content: 消息内容 - user_id: 用户 ID - user_name: 用户昵称 - message_id: 消息 ID(可选,自动生成) - is_at_bot: 是否 @ 机器人 - virtual_config: 虚拟身份配置(可选,启用后使用真实平台身份) - """ - if message_id is None: - message_id = str(uuid.uuid4()) - - # 确定使用的平台、群信息和用户信息 - if virtual_config and virtual_config.enabled: - # 虚拟身份模式:使用真实平台身份 - platform = virtual_config.platform or WEBUI_CHAT_PLATFORM - group_id = virtual_config.group_id or f"{VIRTUAL_GROUP_ID_PREFIX}{uuid.uuid4().hex[:8]}" - group_name = virtual_config.group_name or "WebUI虚拟群聊" - actual_user_id = virtual_config.user_id or user_id - actual_user_name = virtual_config.user_nickname or user_name - else: - # 标准 WebUI 模式 - platform = WEBUI_CHAT_PLATFORM - group_id = WEBUI_CHAT_GROUP_ID - group_name = "WebUI本地聊天室" - actual_user_id = user_id - actual_user_name = user_name - - return { - "message_info": { - "platform": platform, - "message_id": message_id, - "time": time.time(), - "group_info": { - "group_id": group_id, - "group_name": group_name, - "platform": platform, - }, - "user_info": { - "user_id": actual_user_id, - "user_nickname": actual_user_name, - "user_cardname": actual_user_name, - "platform": platform, - }, - "additional_config": { - "at_bot": is_at_bot, - }, - }, - "message_segment": { - "type": "seglist", - "data": [ - { - "type": "text", - "data": content, - }, - { - "type": "mention_bot", - "data": "1.0", - }, - ], - }, - "raw_message": content, - "processed_plain_text": content, - } - - -@router.get("/history") -async def get_chat_history( - limit: int = Query(default=50, ge=1, le=200), - user_id: Optional[str] = Query(default=None), # 保留参数兼容性,但不用于过滤 - group_id: Optional[str] = Query(default=None), # 可选:指定群 ID 获取历史 - _auth: bool = Depends(require_auth), -): - """获取聊天历史记录 - - 所有 WebUI 用户共享同一个聊天室,因此返回所有历史记录 - 如果指定了 group_id,则获取该虚拟群的历史记录 - """ - target_group_id = group_id if group_id else WEBUI_CHAT_GROUP_ID - history = chat_history.get_history(limit, target_group_id) - return { - "success": True, - "messages": history, - "total": len(history), - } - - -@router.get("/platforms") -async def get_available_platforms(_auth: bool = Depends(require_auth)): - """获取可用平台列表 - - 从 PersonInfo 表中获取所有已知的平台 - """ - try: - from peewee import fn - - # 查询所有不同的平台 - platforms = ( - PersonInfo.select(PersonInfo.platform, fn.COUNT(PersonInfo.id).alias("count")) - .group_by(PersonInfo.platform) - .order_by(fn.COUNT(PersonInfo.id).desc()) - ) - - result = [] - for p in platforms: - if p.platform: # 排除空平台 - result.append({"platform": p.platform, "count": p.count}) - - return {"success": True, "platforms": result} - except Exception as e: - logger.error(f"获取平台列表失败: {e}") - return {"success": False, "error": str(e), "platforms": []} - - -@router.get("/persons") -async def get_persons_by_platform( - platform: str = Query(..., description="平台名称"), - search: Optional[str] = Query(default=None, description="搜索关键词"), - limit: int = Query(default=50, ge=1, le=200), - _auth: bool = Depends(require_auth), -): - """获取指定平台的用户列表 - - Args: - platform: 平台名称(如 qq, discord 等) - search: 搜索关键词(匹配昵称、用户名、user_id) - limit: 返回数量限制 - """ - try: - # 构建查询 - query = PersonInfo.select().where(PersonInfo.platform == platform) - - # 搜索过滤 - if search: - query = query.where( - (PersonInfo.person_name.contains(search)) - | (PersonInfo.nickname.contains(search)) - | (PersonInfo.user_id.contains(search)) - ) - - # 按最后交互时间排序,优先显示活跃用户 - from peewee import Case - - query = query.order_by(Case(None, [(PersonInfo.last_know.is_null(), 1)], 0), PersonInfo.last_know.desc()) - query = query.limit(limit) - - result = [] - for person in query: - result.append( - { - "person_id": person.person_id, - "user_id": person.user_id, - "person_name": person.person_name, - "nickname": person.nickname, - "is_known": person.is_known, - "platform": person.platform, - "display_name": person.person_name or person.nickname or person.user_id, - } - ) - - return {"success": True, "persons": result, "total": len(result)} - except Exception as e: - logger.error(f"获取用户列表失败: {e}") - return {"success": False, "error": str(e), "persons": []} - - -@router.delete("/history") -async def clear_chat_history(group_id: Optional[str] = Query(default=None), _auth: bool = Depends(require_auth)): - """清空聊天历史记录 - - Args: - group_id: 可选,指定要清空的群 ID,默认清空 WebUI 默认聊天室 - """ - deleted = chat_history.clear_history(group_id) - return { - "success": True, - "message": f"已清空 {deleted} 条聊天记录", - } - - -@router.websocket("/ws") -async def websocket_chat( - websocket: WebSocket, - user_id: Optional[str] = Query(default=None), - user_name: Optional[str] = Query(default="WebUI用户"), - platform: Optional[str] = Query(default=None), - person_id: Optional[str] = Query(default=None), - group_name: Optional[str] = Query(default=None), - group_id: Optional[str] = Query(default=None), # 前端传递的稳定 group_id - token: Optional[str] = Query(default=None), # 认证 token -): - """WebSocket 聊天端点 - - Args: - user_id: 用户唯一标识(由前端生成并持久化) - user_name: 用户显示昵称(可修改) - platform: 虚拟身份模式的平台(可选) - person_id: 虚拟身份模式的用户 person_id(可选) - group_name: 虚拟身份模式的群名(可选) - group_id: 虚拟身份模式的群 ID(可选,由前端生成并持久化) - token: 认证 token(可选,也可从 Cookie 获取) - - 虚拟身份模式可通过 URL 参数直接配置,或通过消息中的 set_virtual_identity 配置 - - 支持三种认证方式(按优先级): - 1. query 参数 token(推荐,通过 /api/webui/ws-token 获取临时 token) - 2. Cookie 中的 maibot_session - 3. 直接使用 session token(兼容) - - 示例:ws://host/api/chat/ws?token=xxx - """ - is_authenticated = False - - # 方式 1: 尝试验证临时 WebSocket token(推荐方式) - if token and verify_ws_token(token): - is_authenticated = True - logger.debug("聊天 WebSocket 使用临时 token 认证成功") - - # 方式 2: 尝试从 Cookie 获取 session token - if not is_authenticated: - cookie_token = websocket.cookies.get("maibot_session") - if cookie_token: - token_manager = get_token_manager() - if token_manager.verify_token(cookie_token): - is_authenticated = True - logger.debug("聊天 WebSocket 使用 Cookie 认证成功") - - # 方式 3: 尝试直接验证 query 参数作为 session token(兼容旧方式) - if not is_authenticated and token: - token_manager = get_token_manager() - if token_manager.verify_token(token): - is_authenticated = True - logger.debug("聊天 WebSocket 使用 session token 认证成功") - - if not is_authenticated: - logger.warning("聊天 WebSocket 连接被拒绝:认证失败") - await websocket.close(code=4001, reason="认证失败,请重新登录") - return - - # 生成会话 ID(每次连接都是新的) - session_id = str(uuid.uuid4()) - - # 如果没有提供 user_id,生成一个新的 - if not user_id: - user_id = f"{WEBUI_USER_ID_PREFIX}{uuid.uuid4().hex[:16]}" - elif not user_id.startswith(WEBUI_USER_ID_PREFIX): - # 确保 user_id 有正确的前缀 - user_id = f"{WEBUI_USER_ID_PREFIX}{user_id}" - - # 当前会话的虚拟身份配置(可通过消息动态更新) - current_virtual_config: Optional[VirtualIdentityConfig] = None - - # 如果 URL 参数中提供了虚拟身份信息,自动配置 - if platform and person_id: - try: - person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - if person: - # 使用前端传递的 group_id,如果没有则生成一个稳定的 - virtual_group_id = group_id or f"{VIRTUAL_GROUP_ID_PREFIX}{platform}_{person.user_id}" - current_virtual_config = VirtualIdentityConfig( - enabled=True, - platform=person.platform, - person_id=person.person_id, - user_id=person.user_id, - user_nickname=person.person_name or person.nickname or person.user_id, - group_id=virtual_group_id, - group_name=group_name or "WebUI虚拟群聊", - ) - logger.info( - f"虚拟身份模式已通过 URL 参数激活: {current_virtual_config.user_nickname} @ {current_virtual_config.platform}, group_id={virtual_group_id}" - ) - except Exception as e: - logger.warning(f"通过 URL 参数配置虚拟身份失败: {e}") - - await chat_manager.connect(websocket, session_id, user_id) - - try: - # 构建会话信息 - session_info_data = { - "type": "session_info", - "session_id": session_id, - "user_id": user_id, - "user_name": user_name, - "bot_name": global_config.bot.nickname, - } - - # 如果有虚拟身份配置,添加到会话信息中 - if current_virtual_config and current_virtual_config.enabled: - session_info_data["virtual_mode"] = True - session_info_data["group_id"] = current_virtual_config.group_id - session_info_data["virtual_identity"] = { - "platform": current_virtual_config.platform, - "user_id": current_virtual_config.user_id, - "user_nickname": current_virtual_config.user_nickname, - "group_name": current_virtual_config.group_name, - } - - # 发送会话信息(包含用户 ID,前端需要保存) - await chat_manager.send_message(session_id, session_info_data) - - # 发送历史记录(根据模式选择不同的群) - if current_virtual_config and current_virtual_config.enabled: - history = chat_history.get_history(50, current_virtual_config.group_id) - else: - history = chat_history.get_history(50) - if history: - await chat_manager.send_message( - session_id, - { - "type": "history", - "messages": history, - }, - ) - - # 发送欢迎消息(不保存到历史) - if current_virtual_config and current_virtual_config.enabled: - welcome_msg = f"已以 {current_virtual_config.user_nickname} 的身份连接到「{current_virtual_config.group_name}」,开始与 {global_config.bot.nickname} 对话吧!" - else: - welcome_msg = f"已连接到本地聊天室,可以开始与 {global_config.bot.nickname} 对话了!" - - await chat_manager.send_message( - session_id, - { - "type": "system", - "content": welcome_msg, - "timestamp": time.time(), - }, - ) - - while True: - data = await websocket.receive_json() - - if data.get("type") == "message": - content = data.get("content", "").strip() - if not content: - continue - - # 用户可以更新昵称 - current_user_name = data.get("user_name", user_name) - - message_id = str(uuid.uuid4()) - timestamp = time.time() - - # 确定发送者信息(根据是否使用虚拟身份) - if current_virtual_config and current_virtual_config.enabled: - sender_name = current_virtual_config.user_nickname or current_user_name - sender_user_id = current_virtual_config.user_id or user_id - else: - sender_name = current_user_name - sender_user_id = user_id - - # 广播用户消息给所有连接(包括发送者) - # 注意:用户消息会在 chat_bot.message_process 中自动保存到数据库 - await chat_manager.broadcast( - { - "type": "user_message", - "content": content, - "message_id": message_id, - "timestamp": timestamp, - "sender": { - "name": sender_name, - "user_id": sender_user_id, - "is_bot": False, - }, - "virtual_mode": current_virtual_config.enabled if current_virtual_config else False, - } - ) - - # 创建麦麦消息格式 - message_data = create_message_data( - content=content, - user_id=user_id, - user_name=current_user_name, - message_id=message_id, - is_at_bot=True, - virtual_config=current_virtual_config, - ) - - try: - # 显示正在输入状态 - await chat_manager.broadcast( - { - "type": "typing", - "is_typing": True, - } - ) - - # 调用麦麦的消息处理 - await chat_bot.message_process(message_data) - - except Exception as e: - logger.error(f"处理消息时出错: {e}") - await chat_manager.send_message( - session_id, - { - "type": "error", - "content": f"处理消息时出错: {str(e)}", - "timestamp": time.time(), - }, - ) - finally: - await chat_manager.broadcast( - { - "type": "typing", - "is_typing": False, - } - ) - - elif data.get("type") == "ping": - await chat_manager.send_message( - session_id, - { - "type": "pong", - "timestamp": time.time(), - }, - ) - - elif data.get("type") == "update_nickname": - # 允许用户更新昵称 - if new_name := data.get("user_name", "").strip(): - current_user_name = new_name - await chat_manager.send_message( - session_id, - { - "type": "nickname_updated", - "user_name": current_user_name, - "timestamp": time.time(), - }, - ) - - elif data.get("type") == "set_virtual_identity": - # 设置或更新虚拟身份配置 - virtual_data = data.get("config", {}) - if virtual_data.get("enabled"): - # 验证必要字段 - if not virtual_data.get("platform") or not virtual_data.get("person_id"): - await chat_manager.send_message( - session_id, - { - "type": "error", - "content": "虚拟身份配置缺少必要字段: platform 和 person_id", - "timestamp": time.time(), - }, - ) - continue - - # 获取用户信息 - try: - person = PersonInfo.get_or_none(PersonInfo.person_id == virtual_data.get("person_id")) - if not person: - await chat_manager.send_message( - session_id, - { - "type": "error", - "content": f"找不到用户: {virtual_data.get('person_id')}", - "timestamp": time.time(), - }, - ) - continue - - # 生成虚拟群 ID - custom_group_id = virtual_data.get("group_id") - if custom_group_id: - group_id = f"{VIRTUAL_GROUP_ID_PREFIX}{custom_group_id}" - else: - group_id = f"{VIRTUAL_GROUP_ID_PREFIX}{session_id[:8]}" - - current_virtual_config = VirtualIdentityConfig( - enabled=True, - platform=person.platform, - person_id=person.person_id, - user_id=person.user_id, - user_nickname=person.person_name or person.nickname or person.user_id, - group_id=group_id, - group_name=virtual_data.get("group_name", "WebUI虚拟群聊"), - ) - - # 发送虚拟身份已激活的消息 - await chat_manager.send_message( - session_id, - { - "type": "virtual_identity_set", - "config": { - "enabled": True, - "platform": current_virtual_config.platform, - "user_id": current_virtual_config.user_id, - "user_nickname": current_virtual_config.user_nickname, - "group_id": current_virtual_config.group_id, - "group_name": current_virtual_config.group_name, - }, - "timestamp": time.time(), - }, - ) - - # 加载虚拟群的历史记录 - virtual_history = chat_history.get_history(50, current_virtual_config.group_id) - await chat_manager.send_message( - session_id, - { - "type": "history", - "messages": virtual_history, - "group_id": current_virtual_config.group_id, - }, - ) - - # 发送系统消息 - await chat_manager.send_message( - session_id, - { - "type": "system", - "content": f"已切换到虚拟身份模式:以 {current_virtual_config.user_nickname} 的身份在「{current_virtual_config.group_name}」与 {global_config.bot.nickname} 对话", - "timestamp": time.time(), - }, - ) - - except Exception as e: - logger.error(f"设置虚拟身份失败: {e}") - await chat_manager.send_message( - session_id, - { - "type": "error", - "content": f"设置虚拟身份失败: {str(e)}", - "timestamp": time.time(), - }, - ) - else: - # 禁用虚拟身份模式 - current_virtual_config = None - await chat_manager.send_message( - session_id, - { - "type": "virtual_identity_set", - "config": {"enabled": False}, - "timestamp": time.time(), - }, - ) - - # 重新加载默认聊天室历史 - default_history = chat_history.get_history(50, WEBUI_CHAT_GROUP_ID) - await chat_manager.send_message( - session_id, - { - "type": "history", - "messages": default_history, - "group_id": WEBUI_CHAT_GROUP_ID, - }, - ) - - await chat_manager.send_message( - session_id, - { - "type": "system", - "content": "已切换回 WebUI 独立用户模式", - "timestamp": time.time(), - }, - ) - - except WebSocketDisconnect: - logger.info(f"WebSocket 断开: session={session_id}, user={user_id}") - except Exception as e: - logger.error(f"WebSocket 错误: {e}") - finally: - chat_manager.disconnect(session_id, user_id) - - -@router.get("/info") -async def get_chat_info(_auth: bool = Depends(require_auth)): - """获取聊天室信息""" - return { - "bot_name": global_config.bot.nickname, - "platform": WEBUI_CHAT_PLATFORM, - "group_id": WEBUI_CHAT_GROUP_ID, - "active_sessions": len(chat_manager.active_connections), - } - - -def get_webui_chat_broadcaster() -> tuple: - """获取 WebUI 聊天广播器,供外部模块使用 - - Returns: - (chat_manager, WEBUI_CHAT_PLATFORM) 元组 - """ - return (chat_manager, WEBUI_CHAT_PLATFORM) diff --git a/src/webui/config_routes.py b/src/webui/config_routes.py deleted file mode 100644 index 6a028927..00000000 --- a/src/webui/config_routes.py +++ /dev/null @@ -1,597 +0,0 @@ -""" -配置管理API路由 -""" - -import os -import tomlkit -from fastapi import APIRouter, HTTPException, Body, Depends, Cookie, Header -from typing import Any, Annotated, Optional - -from src.common.logger import get_logger -from src.webui.auth import verify_auth_token_from_cookie_or_header -from src.common.toml_utils import save_toml_with_format, _update_toml_doc -from src.config.config import Config, APIAdapterConfig, CONFIG_DIR, PROJECT_ROOT -from src.config.official_configs import ( - BotConfig, - PersonalityConfig, - RelationshipConfig, - ChatConfig, - MessageReceiveConfig, - EmojiConfig, - ExpressionConfig, - KeywordReactionConfig, - ChineseTypoConfig, - ResponsePostProcessConfig, - ResponseSplitterConfig, - TelemetryConfig, - ExperimentalConfig, - MaimMessageConfig, - LPMMKnowledgeConfig, - ToolConfig, - MemoryConfig, - DebugConfig, - VoiceConfig, -) -from src.config.api_ada_configs import ( - ModelTaskConfig, - ModelInfo, - APIProvider, -) -from src.webui.config_schema import ConfigSchemaGenerator - -logger = get_logger("webui") - -# 模块级别的类型别名(解决 B008 ruff 错误) -ConfigBody = Annotated[dict[str, Any], Body()] -SectionBody = Annotated[Any, Body()] -RawContentBody = Annotated[str, Body(embed=True)] -PathBody = Annotated[dict[str, str], Body()] - -router = APIRouter(prefix="/config", tags=["config"]) - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -# ===== 架构获取接口 ===== - - -@router.get("/schema/bot") -async def get_bot_config_schema(_auth: bool = Depends(require_auth)): - """获取麦麦主程序配置架构""" - try: - # Config 类包含所有子配置 - schema = ConfigSchemaGenerator.generate_config_schema(Config) - return {"success": True, "schema": schema} - except Exception as e: - logger.error(f"获取配置架构失败: {e}") - raise HTTPException(status_code=500, detail=f"获取配置架构失败: {str(e)}") from e - - -@router.get("/schema/model") -async def get_model_config_schema(_auth: bool = Depends(require_auth)): - """获取模型配置架构(包含提供商和模型任务配置)""" - try: - schema = ConfigSchemaGenerator.generate_config_schema(APIAdapterConfig) - return {"success": True, "schema": schema} - except Exception as e: - logger.error(f"获取模型配置架构失败: {e}") - raise HTTPException(status_code=500, detail=f"获取模型配置架构失败: {str(e)}") from e - - -# ===== 子配置架构获取接口 ===== - - -@router.get("/schema/section/{section_name}") -async def get_config_section_schema(section_name: str, _auth: bool = Depends(require_auth)): - """ - 获取指定配置节的架构 - - 支持的section_name: - - bot: BotConfig - - personality: PersonalityConfig - - relationship: RelationshipConfig - - chat: ChatConfig - - message_receive: MessageReceiveConfig - - emoji: EmojiConfig - - expression: ExpressionConfig - - keyword_reaction: KeywordReactionConfig - - chinese_typo: ChineseTypoConfig - - response_post_process: ResponsePostProcessConfig - - response_splitter: ResponseSplitterConfig - - telemetry: TelemetryConfig - - experimental: ExperimentalConfig - - maim_message: MaimMessageConfig - - lpmm_knowledge: LPMMKnowledgeConfig - - tool: ToolConfig - - memory: MemoryConfig - - debug: DebugConfig - - voice: VoiceConfig - - jargon: JargonConfig - - model_task_config: ModelTaskConfig - - api_provider: APIProvider - - model_info: ModelInfo - """ - section_map = { - "bot": BotConfig, - "personality": PersonalityConfig, - "relationship": RelationshipConfig, - "chat": ChatConfig, - "message_receive": MessageReceiveConfig, - "emoji": EmojiConfig, - "expression": ExpressionConfig, - "keyword_reaction": KeywordReactionConfig, - "chinese_typo": ChineseTypoConfig, - "response_post_process": ResponsePostProcessConfig, - "response_splitter": ResponseSplitterConfig, - "telemetry": TelemetryConfig, - "experimental": ExperimentalConfig, - "maim_message": MaimMessageConfig, - "lpmm_knowledge": LPMMKnowledgeConfig, - "tool": ToolConfig, - "memory": MemoryConfig, - "debug": DebugConfig, - "voice": VoiceConfig, - "model_task_config": ModelTaskConfig, - "api_provider": APIProvider, - "model_info": ModelInfo, - } - - if section_name not in section_map: - raise HTTPException(status_code=404, detail=f"配置节 '{section_name}' 不存在") - - try: - config_class = section_map[section_name] - schema = ConfigSchemaGenerator.generate_schema(config_class, include_nested=False) - return {"success": True, "schema": schema} - except Exception as e: - logger.error(f"获取配置节架构失败: {e}") - raise HTTPException(status_code=500, detail=f"获取配置节架构失败: {str(e)}") from e - - -# ===== 配置读取接口 ===== - - -@router.get("/bot") -async def get_bot_config(_auth: bool = Depends(require_auth)): - """获取麦麦主程序配置""" - try: - config_path = os.path.join(CONFIG_DIR, "bot_config.toml") - if not os.path.exists(config_path): - raise HTTPException(status_code=404, detail="配置文件不存在") - - with open(config_path, "r", encoding="utf-8") as f: - config_data = tomlkit.load(f) - - return {"success": True, "config": config_data} - except HTTPException: - raise - except Exception as e: - logger.error(f"读取配置文件失败: {e}") - raise HTTPException(status_code=500, detail=f"读取配置文件失败: {str(e)}") from e - - -@router.get("/model") -async def get_model_config(_auth: bool = Depends(require_auth)): - """获取模型配置(包含提供商和模型任务配置)""" - try: - config_path = os.path.join(CONFIG_DIR, "model_config.toml") - if not os.path.exists(config_path): - raise HTTPException(status_code=404, detail="配置文件不存在") - - with open(config_path, "r", encoding="utf-8") as f: - config_data = tomlkit.load(f) - - return {"success": True, "config": config_data} - except HTTPException: - raise - except Exception as e: - logger.error(f"读取配置文件失败: {e}") - raise HTTPException(status_code=500, detail=f"读取配置文件失败: {str(e)}") from e - - -# ===== 配置更新接口 ===== - - -@router.post("/bot") -async def update_bot_config(config_data: ConfigBody, _auth: bool = Depends(require_auth)): - """更新麦麦主程序配置""" - try: - # 验证配置数据 - try: - Config.from_dict(config_data) - except Exception as e: - raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") from e - - # 保存配置文件(自动保留注释和格式) - config_path = os.path.join(CONFIG_DIR, "bot_config.toml") - save_toml_with_format(config_data, config_path) - - logger.info("麦麦主程序配置已更新") - return {"success": True, "message": "配置已保存"} - except HTTPException: - raise - except Exception as e: - logger.error(f"保存配置文件失败: {e}") - raise HTTPException(status_code=500, detail=f"保存配置文件失败: {str(e)}") from e - - -@router.post("/model") -async def update_model_config(config_data: ConfigBody, _auth: bool = Depends(require_auth)): - """更新模型配置""" - try: - # 验证配置数据 - try: - APIAdapterConfig.from_dict(config_data) - except Exception as e: - raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") from e - - # 保存配置文件(自动保留注释和格式) - config_path = os.path.join(CONFIG_DIR, "model_config.toml") - save_toml_with_format(config_data, config_path) - - logger.info("模型配置已更新") - return {"success": True, "message": "配置已保存"} - except HTTPException: - raise - except Exception as e: - logger.error(f"保存配置文件失败: {e}") - raise HTTPException(status_code=500, detail=f"保存配置文件失败: {str(e)}") from e - - -# ===== 配置节更新接口 ===== - - -@router.post("/bot/section/{section_name}") -async def update_bot_config_section(section_name: str, section_data: SectionBody, _auth: bool = Depends(require_auth)): - """更新麦麦主程序配置的指定节(保留注释和格式)""" - try: - # 读取现有配置 - config_path = os.path.join(CONFIG_DIR, "bot_config.toml") - if not os.path.exists(config_path): - raise HTTPException(status_code=404, detail="配置文件不存在") - - with open(config_path, "r", encoding="utf-8") as f: - config_data = tomlkit.load(f) - - # 更新指定节 - if section_name not in config_data: - raise HTTPException(status_code=404, detail=f"配置节 '{section_name}' 不存在") - - # 使用递归合并保留注释(对于字典类型) - # 对于数组类型(如 platforms, aliases),直接替换 - if isinstance(section_data, list): - # 列表直接替换 - config_data[section_name] = section_data - elif isinstance(section_data, dict) and isinstance(config_data[section_name], dict): - # 字典递归合并 - _update_toml_doc(config_data[section_name], section_data) - else: - # 其他类型直接替换 - config_data[section_name] = section_data - - # 验证完整配置 - try: - Config.from_dict(config_data) - except Exception as e: - raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") from e - - # 保存配置(格式化数组为多行,保留注释) - save_toml_with_format(config_data, config_path) - - logger.info(f"配置节 '{section_name}' 已更新(保留注释)") - return {"success": True, "message": f"配置节 '{section_name}' 已保存"} - except HTTPException: - raise - except Exception as e: - logger.error(f"更新配置节失败: {e}") - raise HTTPException(status_code=500, detail=f"更新配置节失败: {str(e)}") from e - - -# ===== 原始 TOML 文件操作接口 ===== - - -@router.get("/bot/raw") -async def get_bot_config_raw(_auth: bool = Depends(require_auth)): - """获取麦麦主程序配置的原始 TOML 内容""" - try: - config_path = os.path.join(CONFIG_DIR, "bot_config.toml") - if not os.path.exists(config_path): - raise HTTPException(status_code=404, detail="配置文件不存在") - - with open(config_path, "r", encoding="utf-8") as f: - raw_content = f.read() - - return {"success": True, "content": raw_content} - except HTTPException: - raise - except Exception as e: - logger.error(f"读取配置文件失败: {e}") - raise HTTPException(status_code=500, detail=f"读取配置文件失败: {str(e)}") from e - - -@router.post("/bot/raw") -async def update_bot_config_raw(raw_content: RawContentBody, _auth: bool = Depends(require_auth)): - """更新麦麦主程序配置(直接保存原始 TOML 内容,会先验证格式)""" - try: - # 验证 TOML 格式 - try: - config_data = tomlkit.loads(raw_content) - except Exception as e: - raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") from e - - # 验证配置数据结构 - try: - Config.from_dict(config_data) - except Exception as e: - raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") from e - - # 保存配置文件 - config_path = os.path.join(CONFIG_DIR, "bot_config.toml") - with open(config_path, "w", encoding="utf-8") as f: - f.write(raw_content) - - logger.info("麦麦主程序配置已更新(原始模式)") - return {"success": True, "message": "配置已保存"} - except HTTPException: - raise - except Exception as e: - logger.error(f"保存配置文件失败: {e}") - raise HTTPException(status_code=500, detail=f"保存配置文件失败: {str(e)}") from e - - -@router.post("/model/section/{section_name}") -async def update_model_config_section( - section_name: str, section_data: SectionBody, _auth: bool = Depends(require_auth) -): - """更新模型配置的指定节(保留注释和格式)""" - try: - # 读取现有配置 - config_path = os.path.join(CONFIG_DIR, "model_config.toml") - if not os.path.exists(config_path): - raise HTTPException(status_code=404, detail="配置文件不存在") - - with open(config_path, "r", encoding="utf-8") as f: - config_data = tomlkit.load(f) - - # 更新指定节 - if section_name not in config_data: - raise HTTPException(status_code=404, detail=f"配置节 '{section_name}' 不存在") - - # 使用递归合并保留注释(对于字典类型) - # 对于数组表(如 [[models]], [[api_providers]]),直接替换 - if isinstance(section_data, list): - # 列表直接替换 - config_data[section_name] = section_data - elif isinstance(section_data, dict) and isinstance(config_data[section_name], dict): - # 字典递归合并 - _update_toml_doc(config_data[section_name], section_data) - else: - # 其他类型直接替换 - config_data[section_name] = section_data - - # 验证完整配置 - try: - APIAdapterConfig.from_dict(config_data) - except Exception as e: - logger.error(f"配置数据验证失败,详细错误: {str(e)}") - # 特殊处理:如果是更新 api_providers,检查是否有模型引用了已删除的provider - if section_name == "api_providers" and "api_provider" in str(e): - provider_names = {p.get("name") for p in section_data if isinstance(p, dict)} - models = config_data.get("models", []) - orphaned_models = [ - m.get("name") for m in models if isinstance(m, dict) and m.get("api_provider") not in provider_names - ] - if orphaned_models: - error_msg = f"以下模型引用了已删除的提供商: {', '.join(orphaned_models)}。请先在模型管理页面删除这些模型,或重新分配它们的提供商。" - raise HTTPException(status_code=400, detail=error_msg) from e - raise HTTPException(status_code=400, detail=f"配置数据验证失败: {str(e)}") from e - - # 保存配置(格式化数组为多行,保留注释) - save_toml_with_format(config_data, config_path) - - logger.info(f"配置节 '{section_name}' 已更新(保留注释)") - return {"success": True, "message": f"配置节 '{section_name}' 已保存"} - except HTTPException: - raise - except Exception as e: - logger.error(f"更新配置节失败: {e}") - raise HTTPException(status_code=500, detail=f"更新配置节失败: {str(e)}") from e - - -# ===== 适配器配置管理接口 ===== - - -def _normalize_adapter_path(path: str) -> str: - """将路径转换为绝对路径(如果是相对路径,则相对于项目根目录)""" - if not path: - return path - - # 如果已经是绝对路径,直接返回 - if os.path.isabs(path): - return path - - # 相对路径,转换为相对于项目根目录的绝对路径 - return os.path.normpath(os.path.join(PROJECT_ROOT, path)) - - -def _to_relative_path(path: str) -> str: - """尝试将绝对路径转换为相对于项目根目录的相对路径,如果无法转换则返回原路径""" - if not path or not os.path.isabs(path): - return path - - try: - # 尝试获取相对路径 - rel_path = os.path.relpath(path, PROJECT_ROOT) - # 如果相对路径不是以 .. 开头(说明文件在项目目录内),则返回相对路径 - if not rel_path.startswith(".."): - return rel_path - except (ValueError, TypeError): - # 在 Windows 上,如果路径在不同驱动器,relpath 会抛出 ValueError - pass - - # 无法转换为相对路径,返回绝对路径 - return path - - -@router.get("/adapter-config/path") -async def get_adapter_config_path(_auth: bool = Depends(require_auth)): - """获取保存的适配器配置文件路径""" - try: - # 从 data/webui.json 读取路径偏好 - webui_data_path = os.path.join("data", "webui.json") - if not os.path.exists(webui_data_path): - return {"success": True, "path": None} - - import json - - with open(webui_data_path, "r", encoding="utf-8") as f: - webui_data = json.load(f) - - adapter_config_path = webui_data.get("adapter_config_path") - if not adapter_config_path: - return {"success": True, "path": None} - - # 将路径规范化为绝对路径 - abs_path = _normalize_adapter_path(adapter_config_path) - - # 检查文件是否存在并返回最后修改时间 - if os.path.exists(abs_path): - import datetime - - mtime = os.path.getmtime(abs_path) - last_modified = datetime.datetime.fromtimestamp(mtime).isoformat() - # 返回相对路径(如果可能) - display_path = _to_relative_path(abs_path) - return {"success": True, "path": display_path, "lastModified": last_modified} - else: - # 文件不存在,返回原路径 - return {"success": True, "path": adapter_config_path, "lastModified": None} - - except Exception as e: - logger.error(f"获取适配器配置路径失败: {e}") - raise HTTPException(status_code=500, detail=f"获取配置路径失败: {str(e)}") from e - - -@router.post("/adapter-config/path") -async def save_adapter_config_path(data: PathBody, _auth: bool = Depends(require_auth)): - """保存适配器配置文件路径偏好""" - try: - path = data.get("path") - if not path: - raise HTTPException(status_code=400, detail="路径不能为空") - - # 保存到 data/webui.json - webui_data_path = os.path.join("data", "webui.json") - import json - - # 读取现有数据 - if os.path.exists(webui_data_path): - with open(webui_data_path, "r", encoding="utf-8") as f: - webui_data = json.load(f) - else: - webui_data = {} - - # 将路径规范化为绝对路径 - abs_path = _normalize_adapter_path(path) - - # 尝试转换为相对路径保存(如果文件在项目目录内) - save_path = _to_relative_path(abs_path) - - # 更新路径 - webui_data["adapter_config_path"] = save_path - - # 保存 - os.makedirs("data", exist_ok=True) - with open(webui_data_path, "w", encoding="utf-8") as f: - json.dump(webui_data, f, ensure_ascii=False, indent=2) - - logger.info(f"适配器配置路径已保存: {save_path}(绝对路径: {abs_path})") - return {"success": True, "message": "路径已保存"} - - except HTTPException: - raise - except Exception as e: - logger.error(f"保存适配器配置路径失败: {e}") - raise HTTPException(status_code=500, detail=f"保存路径失败: {str(e)}") from e - - -@router.get("/adapter-config") -async def get_adapter_config(path: str, _auth: bool = Depends(require_auth)): - """从指定路径读取适配器配置文件""" - try: - if not path: - raise HTTPException(status_code=400, detail="路径参数不能为空") - - # 将路径规范化为绝对路径 - abs_path = _normalize_adapter_path(path) - - # 检查文件是否存在 - if not os.path.exists(abs_path): - raise HTTPException(status_code=404, detail=f"配置文件不存在: {path}") - - # 检查文件扩展名 - if not abs_path.endswith(".toml"): - raise HTTPException(status_code=400, detail="只支持 .toml 格式的配置文件") - - # 读取文件内容 - with open(abs_path, "r", encoding="utf-8") as f: - content = f.read() - - logger.info(f"已读取适配器配置: {path} (绝对路径: {abs_path})") - return {"success": True, "content": content} - - except HTTPException: - raise - except Exception as e: - logger.error(f"读取适配器配置失败: {e}") - raise HTTPException(status_code=500, detail=f"读取配置失败: {str(e)}") from e - - -@router.post("/adapter-config") -async def save_adapter_config(data: PathBody, _auth: bool = Depends(require_auth)): - """保存适配器配置到指定路径""" - try: - path = data.get("path") - content = data.get("content") - - if not path: - raise HTTPException(status_code=400, detail="路径不能为空") - if content is None: - raise HTTPException(status_code=400, detail="配置内容不能为空") - - # 将路径规范化为绝对路径 - abs_path = _normalize_adapter_path(path) - - # 检查文件扩展名 - if not abs_path.endswith(".toml"): - raise HTTPException(status_code=400, detail="只支持 .toml 格式的配置文件") - - # 验证 TOML 格式 - try: - tomlkit.loads(content) - except Exception as e: - raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") from e - - # 确保目录存在 - dir_path = os.path.dirname(abs_path) - if dir_path: - os.makedirs(dir_path, exist_ok=True) - - # 保存文件 - with open(abs_path, "w", encoding="utf-8") as f: - f.write(content) - - logger.info(f"适配器配置已保存: {path} (绝对路径: {abs_path})") - return {"success": True, "message": "配置已保存"} - - except HTTPException: - raise - except Exception as e: - logger.error(f"保存适配器配置失败: {e}") - raise HTTPException(status_code=500, detail=f"保存配置失败: {str(e)}") from e diff --git a/src/webui/config_schema.py b/src/webui/config_schema.py deleted file mode 100644 index 5c5763fa..00000000 --- a/src/webui/config_schema.py +++ /dev/null @@ -1,335 +0,0 @@ -""" -配置架构生成器 - 自动从配置类生成前端表单架构 -""" - -import inspect -from dataclasses import fields, MISSING -from typing import Any, get_origin, get_args, Literal, Optional -from enum import Enum - -from src.config.config_base import ConfigBase - - -class FieldType(str, Enum): - """字段类型枚举""" - - STRING = "string" - NUMBER = "number" - INTEGER = "integer" - BOOLEAN = "boolean" - SELECT = "select" - ARRAY = "array" - OBJECT = "object" - TEXTAREA = "textarea" - - -class FieldSchema: - """字段架构""" - - def __init__( - self, - name: str, - type: FieldType, - label: str, - description: str = "", - default: Any = None, - required: bool = True, - options: Optional[list[str]] = None, - min_value: Optional[float] = None, - max_value: Optional[float] = None, - items: Optional[dict] = None, - properties: Optional[dict] = None, - ): - self.name = name - self.type = type - self.label = label - self.description = description - self.default = default - self.required = required - self.options = options - self.min_value = min_value - self.max_value = max_value - self.items = items - self.properties = properties - - def to_dict(self) -> dict: - """转换为字典""" - result = { - "name": self.name, - "type": self.type.value, - "label": self.label, - "description": self.description, - "required": self.required, - } - - if self.default is not None: - result["default"] = self.default - - if self.options is not None: - result["options"] = self.options - - if self.min_value is not None: - result["minValue"] = self.min_value - - if self.max_value is not None: - result["maxValue"] = self.max_value - - if self.items is not None: - result["items"] = self.items - - if self.properties is not None: - result["properties"] = self.properties - - return result - - -class ConfigSchemaGenerator: - """配置架构生成器""" - - @staticmethod - def _extract_field_description(config_class: type, field_name: str) -> str: - """ - 从类定义中提取字段的文档字符串描述 - - Args: - config_class: 配置类 - field_name: 字段名 - - Returns: - str: 字段描述 - """ - try: - # 获取源代码 - source = inspect.getsource(config_class) - lines = source.split("\n") - - # 查找字段定义 - field_found = False - description_lines = [] - - for i, line in enumerate(lines): - # 匹配字段定义行,例如: platform: str - if f"{field_name}:" in line and "=" in line: - field_found = True - # 查找下一行的文档字符串 - if i + 1 < len(lines): - next_line = lines[i + 1].strip() - if next_line.startswith('"""') or next_line.startswith("'''"): - # 单行文档字符串 - if next_line.count('"""') == 2 or next_line.count("'''") == 2: - description_lines.append(next_line.replace('"""', "").replace("'''", "").strip()) - else: - # 多行文档字符串 - quote = '"""' if next_line.startswith('"""') else "'''" - description_lines.append(next_line.strip(quote).strip()) - for j in range(i + 2, len(lines)): - if quote in lines[j]: - description_lines.append(lines[j].split(quote)[0].strip()) - break - description_lines.append(lines[j].strip()) - break - elif f"{field_name}:" in line and "=" not in line: - # 没有默认值的字段 - field_found = True - if i + 1 < len(lines): - next_line = lines[i + 1].strip() - if next_line.startswith('"""') or next_line.startswith("'''"): - if next_line.count('"""') == 2 or next_line.count("'''") == 2: - description_lines.append(next_line.replace('"""', "").replace("'''", "").strip()) - else: - quote = '"""' if next_line.startswith('"""') else "'''" - description_lines.append(next_line.strip(quote).strip()) - for j in range(i + 2, len(lines)): - if quote in lines[j]: - description_lines.append(lines[j].split(quote)[0].strip()) - break - description_lines.append(lines[j].strip()) - break - - if field_found and description_lines: - return " ".join(description_lines) - - except Exception: - pass - - return "" - - @staticmethod - def _get_field_type_and_options(field_type: type) -> tuple[FieldType, Optional[list[str]], Optional[dict]]: - """ - 获取字段类型和选项 - - Args: - field_type: 字段类型 - - Returns: - tuple: (FieldType, options, items) - """ - origin = get_origin(field_type) - args = get_args(field_type) - - # 处理 Literal 类型(枚举选项) - if origin is Literal: - return FieldType.SELECT, [str(arg) for arg in args], None - - # 处理 list 类型 - if origin is list: - item_type = args[0] if args else str - if item_type is str: - items = {"type": "string"} - elif item_type is int: - items = {"type": "integer"} - elif item_type is float: - items = {"type": "number"} - elif item_type is bool: - items = {"type": "boolean"} - elif item_type is dict: - items = {"type": "object"} - else: - items = {"type": "string"} - return FieldType.ARRAY, None, items - - # 处理 set 类型(与 list 类似) - if origin is set: - item_type = args[0] if args else str - if item_type is str: - items = {"type": "string"} - else: - items = {"type": "string"} - return FieldType.ARRAY, None, items - - # 处理基本类型 - if field_type is bool: - return FieldType.BOOLEAN, None, None - elif field_type is int: - return FieldType.INTEGER, None, None - elif field_type is float: - return FieldType.NUMBER, None, None - elif field_type is str: - return FieldType.STRING, None, None - elif field_type is dict or origin is dict: - return FieldType.OBJECT, None, None - - # 默认为字符串 - return FieldType.STRING, None, None - - @staticmethod - def _format_field_name(name: str) -> str: - """ - 格式化字段名为可读的标签 - - Args: - name: 原始字段名 - - Returns: - str: 格式化后的标签 - """ - # 将下划线替换为空格,并首字母大写 - return " ".join(word.capitalize() for word in name.split("_")) - - @staticmethod - def generate_schema(config_class: type[ConfigBase], include_nested: bool = True) -> dict: - """ - 从配置类生成前端表单架构 - - Args: - config_class: 配置类(必须继承自 ConfigBase) - include_nested: 是否包含嵌套的配置对象 - - Returns: - dict: 前端表单架构 - """ - if not issubclass(config_class, ConfigBase): - raise ValueError(f"{config_class.__name__} 必须继承自 ConfigBase") - - schema_fields = [] - nested_schemas = {} - - for field in fields(config_class): - # 跳过私有字段和内部字段 - if field.name.startswith("_") or field.name in ["MMC_VERSION"]: - continue - - # 提取字段描述 - description = ConfigSchemaGenerator._extract_field_description(config_class, field.name) - - # 判断是否必填 - required = field.default is MISSING and field.default_factory is MISSING - - # 获取默认值 - default_value = None - if field.default is not MISSING: - default_value = field.default - elif field.default_factory is not MISSING: - try: - default_value = field.default_factory() - except Exception: - default_value = None - - # 检查是否为嵌套的 ConfigBase - if isinstance(field.type, type) and issubclass(field.type, ConfigBase): - if include_nested: - # 递归生成嵌套配置的架构 - nested_schema = ConfigSchemaGenerator.generate_schema(field.type, include_nested=True) - nested_schemas[field.name] = nested_schema - - field_schema = FieldSchema( - name=field.name, - type=FieldType.OBJECT, - label=ConfigSchemaGenerator._format_field_name(field.name), - description=description or field.type.__doc__ or "", - default=default_value, - required=required, - properties=nested_schema, - ) - else: - continue - else: - # 获取字段类型和选项 - field_type, options, items = ConfigSchemaGenerator._get_field_type_and_options(field.type) - - # 特殊处理:长文本使用 textarea - if field_type == FieldType.STRING and field.name in [ - "personality", - "reply_style", - "interest", - "plan_style", - "visual_style", - "private_plan_style", - "reaction", - "filtration_prompt", - ]: - field_type = FieldType.TEXTAREA - - field_schema = FieldSchema( - name=field.name, - type=field_type, - label=ConfigSchemaGenerator._format_field_name(field.name), - description=description, - default=default_value, - required=required, - options=options, - items=items, - ) - - schema_fields.append(field_schema.to_dict()) - - return { - "className": config_class.__name__, - "classDoc": config_class.__doc__ or "", - "fields": schema_fields, - "nested": nested_schemas if nested_schemas else None, - } - - @staticmethod - def generate_config_schema(config_class: type[ConfigBase]) -> dict: - """ - 生成完整的配置架构(包含所有嵌套的子配置) - - Args: - config_class: 配置类 - - Returns: - dict: 完整的配置架构 - """ - return ConfigSchemaGenerator.generate_schema(config_class, include_nested=True) diff --git a/src/webui/emoji_routes.py b/src/webui/emoji_routes.py deleted file mode 100644 index 90b2d60b..00000000 --- a/src/webui/emoji_routes.py +++ /dev/null @@ -1,1311 +0,0 @@ -"""表情包管理 API 路由""" - -from fastapi import APIRouter, HTTPException, Header, Query, UploadFile, File, Form, Cookie -from fastapi.responses import FileResponse, JSONResponse -from pydantic import BaseModel -from typing import Optional, List, Annotated -from src.common.logger import get_logger -from src.common.database.database_model import Emoji -from .token_manager import get_token_manager -from .auth import verify_auth_token_from_cookie_or_header -import time -import os -import hashlib -from PIL import Image -import io -from pathlib import Path -import threading -import asyncio -from concurrent.futures import ThreadPoolExecutor - -logger = get_logger("webui.emoji") - -# ==================== 缩略图缓存配置 ==================== -# 缩略图缓存目录 -THUMBNAIL_CACHE_DIR = Path("data/emoji_thumbnails") -# 缩略图尺寸 (宽, 高) -THUMBNAIL_SIZE = (200, 200) -# 缩略图质量 (WebP 格式, 1-100) -THUMBNAIL_QUALITY = 80 -# 缓存锁,防止并发生成同一缩略图 -_thumbnail_locks: dict[str, threading.Lock] = {} -_locks_lock = threading.Lock() -# 缩略图生成专用线程池(避免阻塞事件循环) -_thumbnail_executor = ThreadPoolExecutor(max_workers=2, thread_name_prefix="thumbnail") -# 正在生成中的缩略图哈希集合(防止重复提交任务) -_generating_thumbnails: set[str] = set() -_generating_lock = threading.Lock() - - -def _get_thumbnail_lock(file_hash: str) -> threading.Lock: - """获取指定文件哈希的锁,用于防止并发生成同一缩略图""" - with _locks_lock: - if file_hash not in _thumbnail_locks: - _thumbnail_locks[file_hash] = threading.Lock() - return _thumbnail_locks[file_hash] - - -def _background_generate_thumbnail(source_path: str, file_hash: str) -> None: - """ - 后台生成缩略图(在线程池中执行) - - 生成完成后自动从 generating 集合中移除 - """ - try: - _generate_thumbnail(source_path, file_hash) - except Exception as e: - logger.warning(f"后台生成缩略图失败 {file_hash}: {e}") - finally: - with _generating_lock: - _generating_thumbnails.discard(file_hash) - - -def _ensure_thumbnail_cache_dir() -> Path: - """确保缩略图缓存目录存在""" - THUMBNAIL_CACHE_DIR.mkdir(parents=True, exist_ok=True) - return THUMBNAIL_CACHE_DIR - - -def _get_thumbnail_cache_path(file_hash: str) -> Path: - """获取缩略图缓存路径""" - return THUMBNAIL_CACHE_DIR / f"{file_hash}.webp" - - -def _generate_thumbnail(source_path: str, file_hash: str) -> Path: - """ - 生成缩略图并保存到缓存目录 - - Args: - source_path: 原图路径 - file_hash: 文件哈希值,用作缓存文件名 - - Returns: - 缩略图路径 - - Features: - - GIF: 提取第一帧作为缩略图 - - 所有格式统一转为 WebP - - 保持宽高比缩放 - """ - _ensure_thumbnail_cache_dir() - cache_path = _get_thumbnail_cache_path(file_hash) - - # 使用锁防止并发生成同一缩略图 - lock = _get_thumbnail_lock(file_hash) - with lock: - # 双重检查,可能在等待锁时已被其他线程生成 - if cache_path.exists(): - return cache_path - - try: - with Image.open(source_path) as img: - # GIF 处理:提取第一帧 - if hasattr(img, "n_frames") and img.n_frames > 1: - img.seek(0) # 确保在第一帧 - - # 转换为 RGB/RGBA(WebP 支持透明度) - if img.mode in ("P", "PA"): - # 调色板模式转换为 RGBA 以保留透明度 - img = img.convert("RGBA") - elif img.mode == "LA": - img = img.convert("RGBA") - elif img.mode not in ("RGB", "RGBA"): - img = img.convert("RGB") - - # 创建缩略图(保持宽高比) - img.thumbnail(THUMBNAIL_SIZE, Image.Resampling.LANCZOS) - - # 保存为 WebP 格式 - img.save(cache_path, "WEBP", quality=THUMBNAIL_QUALITY, method=6) - - logger.debug(f"生成缩略图: {file_hash} -> {cache_path}") - - except Exception as e: - logger.warning(f"生成缩略图失败 {file_hash}: {e},将返回原图") - # 生成失败时不创建缓存文件,下次会重试 - raise - - return cache_path - - -def cleanup_orphaned_thumbnails() -> tuple[int, int]: - """ - 清理孤立的缩略图缓存(原图已不存在的缩略图) - - Returns: - (清理数量, 保留数量) - """ - if not THUMBNAIL_CACHE_DIR.exists(): - return 0, 0 - - # 获取所有表情包的哈希值 - valid_hashes = set() - for emoji in Emoji.select(Emoji.emoji_hash): - valid_hashes.add(emoji.emoji_hash) - - cleaned = 0 - kept = 0 - - for cache_file in THUMBNAIL_CACHE_DIR.glob("*.webp"): - file_hash = cache_file.stem - if file_hash not in valid_hashes: - try: - cache_file.unlink() - cleaned += 1 - logger.debug(f"清理孤立缩略图: {cache_file.name}") - except Exception as e: - logger.warning(f"清理缩略图失败 {cache_file.name}: {e}") - else: - kept += 1 - - if cleaned > 0: - logger.info(f"清理孤立缩略图: 删除 {cleaned} 个,保留 {kept} 个") - - return cleaned, kept - - -# 模块级别的类型别名(解决 B008 ruff 错误) -EmojiFile = Annotated[UploadFile, File(description="表情包图片文件")] -EmojiFiles = Annotated[List[UploadFile], File(description="多个表情包图片文件")] -DescriptionForm = Annotated[str, Form(description="表情包描述")] -EmotionForm = Annotated[str, Form(description="情感标签,多个用逗号分隔")] -IsRegisteredForm = Annotated[bool, Form(description="是否直接注册")] - -# 创建路由器 -router = APIRouter(prefix="/emoji", tags=["Emoji"]) - - -class EmojiResponse(BaseModel): - """表情包响应""" - - id: int - full_path: str - format: str - emoji_hash: str - description: str - query_count: int - is_registered: bool - is_banned: bool - emotion: Optional[str] # 直接返回字符串 - record_time: float - register_time: Optional[float] - usage_count: int - last_used_time: Optional[float] - - -class EmojiListResponse(BaseModel): - """表情包列表响应""" - - success: bool - total: int - page: int - page_size: int - data: List[EmojiResponse] - - -class EmojiDetailResponse(BaseModel): - """表情包详情响应""" - - success: bool - data: EmojiResponse - - -class EmojiUpdateRequest(BaseModel): - """表情包更新请求""" - - description: Optional[str] = None - is_registered: Optional[bool] = None - is_banned: Optional[bool] = None - emotion: Optional[str] = None - - -class EmojiUpdateResponse(BaseModel): - """表情包更新响应""" - - success: bool - message: str - data: Optional[EmojiResponse] = None - - -class EmojiDeleteResponse(BaseModel): - """表情包删除响应""" - - success: bool - message: str - - -class BatchDeleteRequest(BaseModel): - """批量删除请求""" - - emoji_ids: List[int] - - -class BatchDeleteResponse(BaseModel): - """批量删除响应""" - - success: bool - message: str - deleted_count: int - failed_count: int - failed_ids: List[int] = [] - - -def verify_auth_token( - maibot_session: Optional[str] = None, - authorization: Optional[str] = None, -) -> bool: - """验证认证 Token,支持 Cookie 和 Header""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -def emoji_to_response(emoji: Emoji) -> EmojiResponse: - """将 Emoji 模型转换为响应对象""" - return EmojiResponse( - id=emoji.id, - full_path=emoji.full_path, - format=emoji.format, - emoji_hash=emoji.emoji_hash, - description=emoji.description, - query_count=emoji.query_count, - is_registered=emoji.is_registered, - is_banned=emoji.is_banned, - emotion=str(emoji.emotion) if emoji.emotion is not None else None, - record_time=emoji.record_time, - register_time=emoji.register_time, - usage_count=emoji.usage_count, - last_used_time=emoji.last_used_time, - ) - - -@router.get("/list", response_model=EmojiListResponse) -async def get_emoji_list( - page: int = Query(1, ge=1, description="页码"), - page_size: int = Query(20, ge=1, le=100, description="每页数量"), - search: Optional[str] = Query(None, description="搜索关键词"), - is_registered: Optional[bool] = Query(None, description="是否已注册筛选"), - is_banned: Optional[bool] = Query(None, description="是否被禁用筛选"), - format: Optional[str] = Query(None, description="格式筛选"), - sort_by: Optional[str] = Query("usage_count", description="排序字段"), - sort_order: Optional[str] = Query("desc", description="排序方向"), - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取表情包列表 - - Args: - page: 页码 (从 1 开始) - page_size: 每页数量 (1-100) - search: 搜索关键词 (匹配 description, emoji_hash) - is_registered: 是否已注册筛选 - is_banned: 是否被禁用筛选 - format: 格式筛选 - sort_by: 排序字段 (usage_count, register_time, record_time, last_used_time) - sort_order: 排序方向 (asc, desc) - authorization: Authorization header - - Returns: - 表情包列表 - """ - try: - verify_auth_token(maibot_session, authorization) - - # 构建查询 - query = Emoji.select() - - # 搜索过滤 - if search: - query = query.where((Emoji.description.contains(search)) | (Emoji.emoji_hash.contains(search))) - - # 注册状态过滤 - if is_registered is not None: - query = query.where(Emoji.is_registered == is_registered) - - # 禁用状态过滤 - if is_banned is not None: - query = query.where(Emoji.is_banned == is_banned) - - # 格式过滤 - if format: - query = query.where(Emoji.format == format) - - # 排序字段映射 - sort_field_map = { - "usage_count": Emoji.usage_count, - "register_time": Emoji.register_time, - "record_time": Emoji.record_time, - "last_used_time": Emoji.last_used_time, - } - - # 获取排序字段,默认使用 usage_count - sort_field = sort_field_map.get(sort_by, Emoji.usage_count) - - # 应用排序 - if sort_order == "asc": - query = query.order_by(sort_field.asc()) - else: - query = query.order_by(sort_field.desc()) - - # 获取总数 - total = query.count() - - # 分页 - offset = (page - 1) * page_size - emojis = query.offset(offset).limit(page_size) - - # 转换为响应对象 - data = [emoji_to_response(emoji) for emoji in emojis] - - return EmojiListResponse(success=True, total=total, page=page, page_size=page_size, data=data) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取表情包列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取表情包列表失败: {str(e)}") from e - - -@router.get("/{emoji_id}", response_model=EmojiDetailResponse) -async def get_emoji_detail( - emoji_id: int, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 获取表情包详细信息 - - Args: - emoji_id: 表情包ID - authorization: Authorization header - - Returns: - 表情包详细信息 - """ - try: - verify_auth_token(maibot_session, authorization) - - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - - if not emoji: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - return EmojiDetailResponse(success=True, data=emoji_to_response(emoji)) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取表情包详情失败: {e}") - raise HTTPException(status_code=500, detail=f"获取表情包详情失败: {str(e)}") from e - - -@router.patch("/{emoji_id}", response_model=EmojiUpdateResponse) -async def update_emoji( - emoji_id: int, - request: EmojiUpdateRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 增量更新表情包(只更新提供的字段) - - Args: - emoji_id: 表情包ID - request: 更新请求(只包含需要更新的字段) - authorization: Authorization header - - Returns: - 更新结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - - if not emoji: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - # 只更新提供的字段 - update_data = request.model_dump(exclude_unset=True) - - if not update_data: - raise HTTPException(status_code=400, detail="未提供任何需要更新的字段") - - # emotion 字段直接使用字符串,无需转换 - - # 如果注册状态从 False 变为 True,记录注册时间 - if "is_registered" in update_data and update_data["is_registered"] and not emoji.is_registered: - update_data["register_time"] = time.time() - - # 执行更新 - for field, value in update_data.items(): - setattr(emoji, field, value) - - emoji.save() - - logger.info(f"表情包已更新: ID={emoji_id}, 字段: {list(update_data.keys())}") - - return EmojiUpdateResponse( - success=True, message=f"成功更新 {len(update_data)} 个字段", data=emoji_to_response(emoji) - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"更新表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"更新表情包失败: {str(e)}") from e - - -@router.delete("/{emoji_id}", response_model=EmojiDeleteResponse) -async def delete_emoji( - emoji_id: int, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 删除表情包 - - Args: - emoji_id: 表情包ID - authorization: Authorization header - - Returns: - 删除结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - - if not emoji: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - # 记录删除信息 - emoji_hash = emoji.emoji_hash - - # 执行删除 - emoji.delete_instance() - - logger.info(f"表情包已删除: ID={emoji_id}, hash={emoji_hash}") - - return EmojiDeleteResponse(success=True, message=f"成功删除表情包: {emoji_hash}") - - except HTTPException: - raise - except Exception as e: - logger.exception(f"删除表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"删除表情包失败: {str(e)}") from e - - -@router.get("/stats/summary") -async def get_emoji_stats(maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None)): - """ - 获取表情包统计数据 - - Args: - authorization: Authorization header - - Returns: - 统计数据 - """ - try: - verify_auth_token(maibot_session, authorization) - - total = Emoji.select().count() - registered = Emoji.select().where(Emoji.is_registered).count() - banned = Emoji.select().where(Emoji.is_banned).count() - - # 按格式统计 - formats = {} - for emoji in Emoji.select(Emoji.format): - fmt = emoji.format - formats[fmt] = formats.get(fmt, 0) + 1 - - # 获取最常用的表情包(前10) - top_used = Emoji.select().order_by(Emoji.usage_count.desc()).limit(10) - top_used_list = [ - { - "id": emoji.id, - "emoji_hash": emoji.emoji_hash, - "description": emoji.description, - "usage_count": emoji.usage_count, - } - for emoji in top_used - ] - - return { - "success": True, - "data": { - "total": total, - "registered": registered, - "banned": banned, - "unregistered": total - registered, - "formats": formats, - "top_used": top_used_list, - }, - } - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取统计数据失败: {e}") - raise HTTPException(status_code=500, detail=f"获取统计数据失败: {str(e)}") from e - - -@router.post("/{emoji_id}/register", response_model=EmojiUpdateResponse) -async def register_emoji( - emoji_id: int, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 注册表情包(快捷操作) - - Args: - emoji_id: 表情包ID - authorization: Authorization header - - Returns: - 更新结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - - if not emoji: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - if emoji.is_registered: - raise HTTPException(status_code=400, detail="该表情包已经注册") - - # 注册表情包(如果已封禁,自动解除封禁) - emoji.is_registered = True - emoji.is_banned = False # 注册时自动解除封禁 - emoji.register_time = time.time() - emoji.save() - - logger.info(f"表情包已注册: ID={emoji_id}") - - return EmojiUpdateResponse(success=True, message="表情包注册成功", data=emoji_to_response(emoji)) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"注册表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"注册表情包失败: {str(e)}") from e - - -@router.post("/{emoji_id}/ban", response_model=EmojiUpdateResponse) -async def ban_emoji( - emoji_id: int, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 禁用表情包(快捷操作) - - Args: - emoji_id: 表情包ID - authorization: Authorization header - - Returns: - 更新结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - - if not emoji: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - # 禁用表情包(同时取消注册) - emoji.is_banned = True - emoji.is_registered = False - emoji.save() - - logger.info(f"表情包已禁用: ID={emoji_id}") - - return EmojiUpdateResponse(success=True, message="表情包禁用成功", data=emoji_to_response(emoji)) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"禁用表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"禁用表情包失败: {str(e)}") from e - - -@router.get("/{emoji_id}/thumbnail") -async def get_emoji_thumbnail( - emoji_id: int, - token: Optional[str] = Query(None, description="访问令牌"), - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), - original: bool = Query(False, description="是否返回原图"), -): - """ - 获取表情包缩略图(懒加载生成 + 缓存) - - Args: - emoji_id: 表情包ID - token: 访问令牌(通过 query parameter,用于向后兼容) - maibot_session: Cookie 中的 token - authorization: Authorization header - original: 是否返回原图(用于详情页查看原图) - - Returns: - 表情包缩略图(WebP 格式)或原图 - - Features: - - 懒加载:首次请求时生成缩略图 - - 缓存:后续请求直接返回缓存 - - GIF 支持:提取第一帧作为缩略图 - - 格式统一:所有缩略图统一为 WebP 格式 - """ - try: - token_manager = get_token_manager() - is_valid = False - - # 1. 优先使用 Cookie - if maibot_session and token_manager.verify_token(maibot_session): - is_valid = True - # 2. 其次使用 query parameter(用于向后兼容 img 标签) - elif token and token_manager.verify_token(token): - is_valid = True - # 3. 最后使用 Authorization header - elif authorization and authorization.startswith("Bearer "): - auth_token = authorization.replace("Bearer ", "") - if token_manager.verify_token(auth_token): - is_valid = True - - if not is_valid: - raise HTTPException(status_code=401, detail="Token 无效或已过期") - - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - - if not emoji: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {emoji_id} 的表情包") - - # 检查文件是否存在 - if not os.path.exists(emoji.full_path): - raise HTTPException(status_code=404, detail="表情包文件不存在") - - # 如果请求原图,直接返回原文件 - if original: - mime_types = { - "png": "image/png", - "jpg": "image/jpeg", - "jpeg": "image/jpeg", - "gif": "image/gif", - "webp": "image/webp", - "bmp": "image/bmp", - } - media_type = mime_types.get(emoji.format.lower(), "application/octet-stream") - return FileResponse( - path=emoji.full_path, media_type=media_type, filename=f"{emoji.emoji_hash}.{emoji.format}" - ) - - # 尝试获取或生成缩略图 - cache_path = _get_thumbnail_cache_path(emoji.emoji_hash) - - # 检查缓存是否存在 - if cache_path.exists(): - # 缓存命中,直接返回 - return FileResponse( - path=str(cache_path), media_type="image/webp", filename=f"{emoji.emoji_hash}_thumb.webp" - ) - - # 缓存未命中,触发后台生成并返回 202 - with _generating_lock: - if emoji.emoji_hash not in _generating_thumbnails: - # 标记为正在生成 - _generating_thumbnails.add(emoji.emoji_hash) - # 提交到线程池后台生成 - _thumbnail_executor.submit(_background_generate_thumbnail, emoji.full_path, emoji.emoji_hash) - - # 返回 202 Accepted,告诉前端缩略图正在生成中 - return JSONResponse( - status_code=202, - content={ - "status": "generating", - "message": "缩略图正在生成中,请稍后重试", - "emoji_id": emoji_id, - }, - headers={ - "Retry-After": "1", # 建议 1 秒后重试 - }, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取表情包缩略图失败: {e}") - raise HTTPException(status_code=500, detail=f"获取表情包缩略图失败: {str(e)}") from e - - -@router.post("/batch/delete", response_model=BatchDeleteResponse) -async def batch_delete_emojis( - request: BatchDeleteRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 批量删除表情包 - - Args: - request: 包含emoji_ids列表的请求 - authorization: Authorization header - - Returns: - 批量删除结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - if not request.emoji_ids: - raise HTTPException(status_code=400, detail="未提供要删除的表情包ID") - - deleted_count = 0 - failed_count = 0 - failed_ids = [] - - for emoji_id in request.emoji_ids: - try: - emoji = Emoji.get_or_none(Emoji.id == emoji_id) - if emoji: - emoji.delete_instance() - deleted_count += 1 - logger.info(f"批量删除表情包: {emoji_id}") - else: - failed_count += 1 - failed_ids.append(emoji_id) - except Exception as e: - logger.error(f"删除表情包 {emoji_id} 失败: {e}") - failed_count += 1 - failed_ids.append(emoji_id) - - message = f"成功删除 {deleted_count} 个表情包" - if failed_count > 0: - message += f",{failed_count} 个失败" - - return BatchDeleteResponse( - success=True, - message=message, - deleted_count=deleted_count, - failed_count=failed_count, - failed_ids=failed_ids, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"批量删除表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"批量删除失败: {str(e)}") from e - - -# 表情包存储目录 -EMOJI_REGISTERED_DIR = os.path.join("data", "emoji_registed") - - -class EmojiUploadResponse(BaseModel): - """表情包上传响应""" - - success: bool - message: str - data: Optional[EmojiResponse] = None - - -@router.post("/upload", response_model=EmojiUploadResponse) -async def upload_emoji( - file: EmojiFile, - description: DescriptionForm = "", - emotion: EmotionForm = "", - is_registered: IsRegisteredForm = True, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 上传并注册表情包 - - Args: - file: 表情包图片文件 (支持 jpg, jpeg, png, gif, webp) - description: 表情包描述 - emotion: 情感标签,多个用逗号分隔 - is_registered: 是否直接注册,默认为 True - authorization: Authorization header - - Returns: - 上传结果和表情包信息 - """ - try: - verify_auth_token(maibot_session, authorization) - - # 验证文件类型 - if not file.content_type: - raise HTTPException(status_code=400, detail="无法识别文件类型") - - allowed_types = ["image/jpeg", "image/png", "image/gif", "image/webp"] - if file.content_type not in allowed_types: - raise HTTPException( - status_code=400, - detail=f"不支持的文件类型: {file.content_type},支持: {', '.join(allowed_types)}", - ) - - # 读取文件内容 - file_content = await file.read() - - if not file_content: - raise HTTPException(status_code=400, detail="文件内容为空") - - # 验证图片并获取格式 - try: - with Image.open(io.BytesIO(file_content)) as img: - img_format = img.format.lower() if img.format else "png" - # 验证图片可以正常打开 - img.verify() - except Exception as e: - raise HTTPException(status_code=400, detail=f"无效的图片文件: {str(e)}") from e - - # 重新打开图片(verify后需要重新打开) - with Image.open(io.BytesIO(file_content)) as img: - img_format = img.format.lower() if img.format else "png" - - # 计算文件哈希 - emoji_hash = hashlib.md5(file_content).hexdigest() - - # 检查是否已存在相同哈希的表情包 - existing_emoji = Emoji.get_or_none(Emoji.emoji_hash == emoji_hash) - if existing_emoji: - raise HTTPException( - status_code=409, - detail=f"已存在相同的表情包 (ID: {existing_emoji.id})", - ) - - # 确保目录存在 - os.makedirs(EMOJI_REGISTERED_DIR, exist_ok=True) - - # 生成文件名 - timestamp = int(time.time()) - filename = f"emoji_{timestamp}_{emoji_hash[:8]}.{img_format}" - full_path = os.path.join(EMOJI_REGISTERED_DIR, filename) - - # 如果文件已存在,添加随机后缀 - counter = 1 - while os.path.exists(full_path): - filename = f"emoji_{timestamp}_{emoji_hash[:8]}_{counter}.{img_format}" - full_path = os.path.join(EMOJI_REGISTERED_DIR, filename) - counter += 1 - - # 保存文件 - with open(full_path, "wb") as f: - f.write(file_content) - - logger.info(f"表情包文件已保存: {full_path}") - - # 处理情感标签 - emotion_str = ",".join(e.strip() for e in emotion.split(",") if e.strip()) if emotion else "" - - # 创建数据库记录 - current_time = time.time() - emoji = Emoji.create( - full_path=full_path, - format=img_format, - emoji_hash=emoji_hash, - description=description, - emotion=emotion_str, - query_count=0, - is_registered=is_registered, - is_banned=False, - record_time=current_time, - register_time=current_time if is_registered else None, - usage_count=0, - last_used_time=None, - ) - - logger.info(f"表情包已上传并注册: ID={emoji.id}, hash={emoji_hash}") - - return EmojiUploadResponse( - success=True, - message="表情包上传成功" + ("并已注册" if is_registered else ""), - data=emoji_to_response(emoji), - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"上传表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"上传失败: {str(e)}") from e - - -@router.post("/batch/upload") -async def batch_upload_emoji( - files: EmojiFiles, - emotion: EmotionForm = "", - is_registered: IsRegisteredForm = True, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 批量上传表情包 - - Args: - files: 多个表情包图片文件 - emotion: 共用的情感标签 - is_registered: 是否直接注册 - authorization: Authorization header - - Returns: - 批量上传结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - results = { - "success": True, - "total": len(files), - "uploaded": 0, - "failed": 0, - "details": [], - } - - allowed_types = ["image/jpeg", "image/png", "image/gif", "image/webp"] - os.makedirs(EMOJI_REGISTERED_DIR, exist_ok=True) - - for file in files: - try: - # 验证文件类型 - if file.content_type not in allowed_types: - results["failed"] += 1 - results["details"].append( - { - "filename": file.filename, - "success": False, - "error": f"不支持的文件类型: {file.content_type}", - } - ) - continue - - # 读取文件内容 - file_content = await file.read() - - if not file_content: - results["failed"] += 1 - results["details"].append( - { - "filename": file.filename, - "success": False, - "error": "文件内容为空", - } - ) - continue - - # 验证图片 - try: - with Image.open(io.BytesIO(file_content)) as img: - img_format = img.format.lower() if img.format else "png" - except Exception as e: - results["failed"] += 1 - results["details"].append( - { - "filename": file.filename, - "success": False, - "error": f"无效的图片: {str(e)}", - } - ) - continue - - # 计算哈希 - emoji_hash = hashlib.md5(file_content).hexdigest() - - # 检查重复 - if Emoji.get_or_none(Emoji.emoji_hash == emoji_hash): - results["failed"] += 1 - results["details"].append( - { - "filename": file.filename, - "success": False, - "error": "已存在相同的表情包", - } - ) - continue - - # 生成文件名并保存 - timestamp = int(time.time()) - filename = f"emoji_{timestamp}_{emoji_hash[:8]}.{img_format}" - full_path = os.path.join(EMOJI_REGISTERED_DIR, filename) - - counter = 1 - while os.path.exists(full_path): - filename = f"emoji_{timestamp}_{emoji_hash[:8]}_{counter}.{img_format}" - full_path = os.path.join(EMOJI_REGISTERED_DIR, filename) - counter += 1 - - with open(full_path, "wb") as f: - f.write(file_content) - - # 处理情感标签 - emotion_str = ",".join(e.strip() for e in emotion.split(",") if e.strip()) if emotion else "" - - # 创建数据库记录 - current_time = time.time() - emoji = Emoji.create( - full_path=full_path, - format=img_format, - emoji_hash=emoji_hash, - description="", # 批量上传暂不设置描述 - emotion=emotion_str, - query_count=0, - is_registered=is_registered, - is_banned=False, - record_time=current_time, - register_time=current_time if is_registered else None, - usage_count=0, - last_used_time=None, - ) - - results["uploaded"] += 1 - results["details"].append( - { - "filename": file.filename, - "success": True, - "id": emoji.id, - } - ) - - except Exception as e: - results["failed"] += 1 - results["details"].append( - { - "filename": file.filename, - "success": False, - "error": str(e), - } - ) - - results["message"] = f"成功上传 {results['uploaded']} 个,失败 {results['failed']} 个" - return results - - except HTTPException: - raise - except Exception as e: - logger.exception(f"批量上传表情包失败: {e}") - raise HTTPException(status_code=500, detail=f"批量上传失败: {str(e)}") from e - - -# ==================== 缩略图缓存管理 API ==================== - - -class ThumbnailCacheStatsResponse(BaseModel): - """缩略图缓存统计响应""" - - success: bool - cache_dir: str - total_count: int - total_size_mb: float - emoji_count: int - coverage_percent: float - - -class ThumbnailCleanupResponse(BaseModel): - """缩略图清理响应""" - - success: bool - message: str - cleaned_count: int - kept_count: int - - -class ThumbnailPreheatResponse(BaseModel): - """缩略图预热响应""" - - success: bool - message: str - generated_count: int - skipped_count: int - failed_count: int - - -@router.get("/thumbnail-cache/stats", response_model=ThumbnailCacheStatsResponse) -async def get_thumbnail_cache_stats( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取缩略图缓存统计信息 - - Returns: - 缓存目录、缓存数量、总大小、覆盖率等统计信息 - """ - try: - verify_auth_token(maibot_session, authorization) - - _ensure_thumbnail_cache_dir() - - # 统计缓存文件 - cache_files = list(THUMBNAIL_CACHE_DIR.glob("*.webp")) - total_count = len(cache_files) - total_size = sum(f.stat().st_size for f in cache_files) - total_size_mb = round(total_size / (1024 * 1024), 2) - - # 统计表情包总数 - emoji_count = Emoji.select().count() - - # 计算覆盖率 - coverage_percent = round((total_count / emoji_count * 100) if emoji_count > 0 else 0, 1) - - return ThumbnailCacheStatsResponse( - success=True, - cache_dir=str(THUMBNAIL_CACHE_DIR.absolute()), - total_count=total_count, - total_size_mb=total_size_mb, - emoji_count=emoji_count, - coverage_percent=coverage_percent, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取缩略图缓存统计失败: {e}") - raise HTTPException(status_code=500, detail=f"获取统计失败: {str(e)}") from e - - -@router.post("/thumbnail-cache/cleanup", response_model=ThumbnailCleanupResponse) -async def cleanup_thumbnail_cache( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 清理孤立的缩略图缓存(原图已删除的表情包对应的缩略图) - - Returns: - 清理结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - cleaned, kept = cleanup_orphaned_thumbnails() - - return ThumbnailCleanupResponse( - success=True, - message=f"清理完成:删除 {cleaned} 个孤立缓存,保留 {kept} 个有效缓存", - cleaned_count=cleaned, - kept_count=kept, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"清理缩略图缓存失败: {e}") - raise HTTPException(status_code=500, detail=f"清理失败: {str(e)}") from e - - -@router.post("/thumbnail-cache/preheat", response_model=ThumbnailPreheatResponse) -async def preheat_thumbnail_cache( - limit: int = Query(100, ge=1, le=1000, description="最多预热数量"), - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 预热缩略图缓存(提前生成未缓存的缩略图) - - 优先处理使用次数高的表情包 - - Args: - limit: 最多预热数量 (1-1000) - - Returns: - 预热结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - _ensure_thumbnail_cache_dir() - - # 获取使用次数最高的表情包(未缓存的优先) - emojis = ( - Emoji.select() - .where(Emoji.is_banned == False) # noqa: E712 Peewee ORM requires == for boolean comparison - .order_by(Emoji.usage_count.desc()) - .limit(limit * 2) # 多查一些,因为有些可能已缓存 - ) - - generated = 0 - skipped = 0 - failed = 0 - - for emoji in emojis: - if generated >= limit: - break - - cache_path = _get_thumbnail_cache_path(emoji.emoji_hash) - - # 已缓存,跳过 - if cache_path.exists(): - skipped += 1 - continue - - # 原文件不存在,跳过 - if not os.path.exists(emoji.full_path): - failed += 1 - continue - - try: - # 使用线程池异步生成缩略图,避免阻塞事件循环 - loop = asyncio.get_event_loop() - await loop.run_in_executor(_thumbnail_executor, _generate_thumbnail, emoji.full_path, emoji.emoji_hash) - generated += 1 - except Exception as e: - logger.warning(f"预热缩略图失败 {emoji.emoji_hash}: {e}") - failed += 1 - - return ThumbnailPreheatResponse( - success=True, - message=f"预热完成:生成 {generated} 个,跳过 {skipped} 个已缓存,失败 {failed} 个", - generated_count=generated, - skipped_count=skipped, - failed_count=failed, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"预热缩略图缓存失败: {e}") - raise HTTPException(status_code=500, detail=f"预热失败: {str(e)}") from e - - -@router.delete("/thumbnail-cache/clear", response_model=ThumbnailCleanupResponse) -async def clear_all_thumbnail_cache( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 清空所有缩略图缓存(下次访问时会重新生成) - - Returns: - 清理结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - if not THUMBNAIL_CACHE_DIR.exists(): - return ThumbnailCleanupResponse( - success=True, - message="缓存目录不存在,无需清理", - cleaned_count=0, - kept_count=0, - ) - - cleaned = 0 - for cache_file in THUMBNAIL_CACHE_DIR.glob("*.webp"): - try: - cache_file.unlink() - cleaned += 1 - except Exception as e: - logger.warning(f"删除缓存文件失败 {cache_file.name}: {e}") - - logger.info(f"已清空缩略图缓存: 删除 {cleaned} 个文件") - - return ThumbnailCleanupResponse( - success=True, - message=f"已清空所有缩略图缓存:删除 {cleaned} 个文件", - cleaned_count=cleaned, - kept_count=0, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"清空缩略图缓存失败: {e}") - raise HTTPException(status_code=500, detail=f"清空失败: {str(e)}") from e diff --git a/src/webui/expression_routes.py b/src/webui/expression_routes.py deleted file mode 100644 index d3586947..00000000 --- a/src/webui/expression_routes.py +++ /dev/null @@ -1,790 +0,0 @@ -"""表达方式管理 API 路由""" - -from fastapi import APIRouter, HTTPException, Header, Query, Cookie -from pydantic import BaseModel -from typing import Optional, List, Dict -from src.common.logger import get_logger -from src.common.database.database_model import Expression, ChatStreams -from .auth import verify_auth_token_from_cookie_or_header -import time - -logger = get_logger("webui.expression") - -# 创建路由器 -router = APIRouter(prefix="/expression", tags=["Expression"]) - - -class ExpressionResponse(BaseModel): - """表达方式响应""" - - id: int - situation: str - style: str - last_active_time: float - chat_id: str - create_date: Optional[float] - checked: bool - rejected: bool - modified_by: Optional[str] = None # 'ai' 或 'user' 或 None - - -class ExpressionListResponse(BaseModel): - """表达方式列表响应""" - - success: bool - total: int - page: int - page_size: int - data: List[ExpressionResponse] - - -class ExpressionDetailResponse(BaseModel): - """表达方式详情响应""" - - success: bool - data: ExpressionResponse - - -class ExpressionCreateRequest(BaseModel): - """表达方式创建请求""" - - situation: str - style: str - chat_id: str - - -class ExpressionUpdateRequest(BaseModel): - """表达方式更新请求""" - - situation: Optional[str] = None - style: Optional[str] = None - chat_id: Optional[str] = None - checked: Optional[bool] = None - rejected: Optional[bool] = None - require_unchecked: Optional[bool] = False # 用于人工审核时的冲突检测 - - -class ExpressionUpdateResponse(BaseModel): - """表达方式更新响应""" - - success: bool - message: str - data: Optional[ExpressionResponse] = None - - -class ExpressionDeleteResponse(BaseModel): - """表达方式删除响应""" - - success: bool - message: str - - -class ExpressionCreateResponse(BaseModel): - """表达方式创建响应""" - - success: bool - message: str - data: ExpressionResponse - - -def verify_auth_token( - maibot_session: Optional[str] = None, - authorization: Optional[str] = None, -) -> bool: - """验证认证 Token,支持 Cookie 和 Header""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -def expression_to_response(expression: Expression) -> ExpressionResponse: - """将 Expression 模型转换为响应对象""" - return ExpressionResponse( - id=expression.id, - situation=expression.situation, - style=expression.style, - last_active_time=expression.last_active_time, - chat_id=expression.chat_id, - create_date=expression.create_date, - checked=expression.checked, - rejected=expression.rejected, - modified_by=expression.modified_by, - ) - - -def get_chat_name(chat_id: str) -> str: - """根据 chat_id 获取聊天名称""" - try: - chat_stream = ChatStreams.get_or_none(ChatStreams.stream_id == chat_id) - if chat_stream: - # 优先使用群聊名称,否则使用用户昵称 - if chat_stream.group_name: - return chat_stream.group_name - elif chat_stream.user_nickname: - return chat_stream.user_nickname - return chat_id # 找不到时返回原始ID - except Exception: - return chat_id - - -def get_chat_names_batch(chat_ids: List[str]) -> Dict[str, str]: - """批量获取聊天名称""" - result = {cid: cid for cid in chat_ids} # 默认值为原始ID - try: - chat_streams = ChatStreams.select().where(ChatStreams.stream_id.in_(chat_ids)) - for cs in chat_streams: - if cs.group_name: - result[cs.stream_id] = cs.group_name - elif cs.user_nickname: - result[cs.stream_id] = cs.user_nickname - except Exception as e: - logger.warning(f"批量获取聊天名称失败: {e}") - return result - - -class ChatInfo(BaseModel): - """聊天信息""" - - chat_id: str - chat_name: str - platform: Optional[str] = None - is_group: bool = False - - -class ChatListResponse(BaseModel): - """聊天列表响应""" - - success: bool - data: List[ChatInfo] - - -@router.get("/chats", response_model=ChatListResponse) -async def get_chat_list(maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None)): - """ - 获取所有聊天列表(用于下拉选择) - - Args: - authorization: Authorization header - - Returns: - 聊天列表 - """ - try: - verify_auth_token(maibot_session, authorization) - - chat_list = [] - for cs in ChatStreams.select(): - chat_name = cs.group_name if cs.group_name else (cs.user_nickname if cs.user_nickname else cs.stream_id) - chat_list.append( - ChatInfo( - chat_id=cs.stream_id, - chat_name=chat_name, - platform=cs.platform, - is_group=bool(cs.group_id), - ) - ) - - # 按名称排序 - chat_list.sort(key=lambda x: x.chat_name) - - return ChatListResponse(success=True, data=chat_list) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取聊天列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取聊天列表失败: {str(e)}") from e - - -@router.get("/list", response_model=ExpressionListResponse) -async def get_expression_list( - page: int = Query(1, ge=1, description="页码"), - page_size: int = Query(20, ge=1, le=100, description="每页数量"), - search: Optional[str] = Query(None, description="搜索关键词"), - chat_id: Optional[str] = Query(None, description="聊天ID筛选"), - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取表达方式列表 - - Args: - page: 页码 (从 1 开始) - page_size: 每页数量 (1-100) - search: 搜索关键词 (匹配 situation, style) - chat_id: 聊天ID筛选 - authorization: Authorization header - - Returns: - 表达方式列表 - """ - try: - verify_auth_token(maibot_session, authorization) - - # 构建查询 - query = Expression.select() - - # 搜索过滤 - if search: - query = query.where( - (Expression.situation.contains(search)) - | (Expression.style.contains(search)) - ) - - # 聊天ID过滤 - if chat_id: - query = query.where(Expression.chat_id == chat_id) - - # 排序:最后活跃时间倒序(NULL 值放在最后) - from peewee import Case - - query = query.order_by( - Case(None, [(Expression.last_active_time.is_null(), 1)], 0), Expression.last_active_time.desc() - ) - - # 获取总数 - total = query.count() - - # 分页 - offset = (page - 1) * page_size - expressions = query.offset(offset).limit(page_size) - - # 转换为响应对象 - data = [expression_to_response(expr) for expr in expressions] - - return ExpressionListResponse(success=True, total=total, page=page, page_size=page_size, data=data) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取表达方式列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取表达方式列表失败: {str(e)}") from e - - -@router.get("/{expression_id}", response_model=ExpressionDetailResponse) -async def get_expression_detail( - expression_id: int, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 获取表达方式详细信息 - - Args: - expression_id: 表达方式ID - authorization: Authorization header - - Returns: - 表达方式详细信息 - """ - try: - verify_auth_token(maibot_session, authorization) - - expression = Expression.get_or_none(Expression.id == expression_id) - - if not expression: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {expression_id} 的表达方式") - - return ExpressionDetailResponse(success=True, data=expression_to_response(expression)) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取表达方式详情失败: {e}") - raise HTTPException(status_code=500, detail=f"获取表达方式详情失败: {str(e)}") from e - - -@router.post("/", response_model=ExpressionCreateResponse) -async def create_expression( - request: ExpressionCreateRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 创建新的表达方式 - - Args: - request: 创建请求 - authorization: Authorization header - - Returns: - 创建结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - current_time = time.time() - - # 创建表达方式 - expression = Expression.create( - situation=request.situation, - style=request.style, - chat_id=request.chat_id, - last_active_time=current_time, - create_date=current_time, - ) - - logger.info(f"表达方式已创建: ID={expression.id}, situation={request.situation}") - - return ExpressionCreateResponse( - success=True, message="表达方式创建成功", data=expression_to_response(expression) - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"创建表达方式失败: {e}") - raise HTTPException(status_code=500, detail=f"创建表达方式失败: {str(e)}") from e - - -@router.patch("/{expression_id}", response_model=ExpressionUpdateResponse) -async def update_expression( - expression_id: int, - request: ExpressionUpdateRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 增量更新表达方式(只更新提供的字段) - - Args: - expression_id: 表达方式ID - request: 更新请求(只包含需要更新的字段) - authorization: Authorization header - - Returns: - 更新结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - expression = Expression.get_or_none(Expression.id == expression_id) - - if not expression: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {expression_id} 的表达方式") - - # 冲突检测:如果要求未检查状态,但已经被检查了 - if request.require_unchecked and expression.checked: - raise HTTPException( - status_code=409, - detail=f"此表达方式已被{'AI自动' if expression.modified_by == 'ai' else '人工'}检查,请刷新列表" - ) - - # 只更新提供的字段 - update_data = request.model_dump(exclude_unset=True) - - # 移除 require_unchecked,它不是数据库字段 - update_data.pop('require_unchecked', None) - - if not update_data: - raise HTTPException(status_code=400, detail="未提供任何需要更新的字段") - - # 如果更新了 checked 或 rejected,标记为用户修改 - if 'checked' in update_data or 'rejected' in update_data: - update_data['modified_by'] = 'user' - - # 更新最后活跃时间 - update_data["last_active_time"] = time.time() - - # 执行更新 - for field, value in update_data.items(): - setattr(expression, field, value) - - expression.save() - - logger.info(f"表达方式已更新: ID={expression_id}, 字段: {list(update_data.keys())}") - - return ExpressionUpdateResponse( - success=True, message=f"成功更新 {len(update_data)} 个字段", data=expression_to_response(expression) - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"更新表达方式失败: {e}") - raise HTTPException(status_code=500, detail=f"更新表达方式失败: {str(e)}") from e - - -@router.delete("/{expression_id}", response_model=ExpressionDeleteResponse) -async def delete_expression( - expression_id: int, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 删除表达方式 - - Args: - expression_id: 表达方式ID - authorization: Authorization header - - Returns: - 删除结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - expression = Expression.get_or_none(Expression.id == expression_id) - - if not expression: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {expression_id} 的表达方式") - - # 记录删除信息 - situation = expression.situation - - # 执行删除 - expression.delete_instance() - - logger.info(f"表达方式已删除: ID={expression_id}, situation={situation}") - - return ExpressionDeleteResponse(success=True, message=f"成功删除表达方式: {situation}") - - except HTTPException: - raise - except Exception as e: - logger.exception(f"删除表达方式失败: {e}") - raise HTTPException(status_code=500, detail=f"删除表达方式失败: {str(e)}") from e - - -class BatchDeleteRequest(BaseModel): - """批量删除请求""" - - ids: List[int] - - -@router.post("/batch/delete", response_model=ExpressionDeleteResponse) -async def batch_delete_expressions( - request: BatchDeleteRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 批量删除表达方式 - - Args: - request: 包含要删除的ID列表的请求 - authorization: Authorization header - - Returns: - 删除结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - if not request.ids: - raise HTTPException(status_code=400, detail="未提供要删除的表达方式ID") - - # 查找所有要删除的表达方式 - expressions = Expression.select().where(Expression.id.in_(request.ids)) - found_ids = [expr.id for expr in expressions] - - # 检查是否有未找到的ID - not_found_ids = set(request.ids) - set(found_ids) - if not_found_ids: - logger.warning(f"部分表达方式未找到: {not_found_ids}") - - # 执行批量删除 - deleted_count = Expression.delete().where(Expression.id.in_(found_ids)).execute() - - logger.info(f"批量删除了 {deleted_count} 个表达方式") - - return ExpressionDeleteResponse(success=True, message=f"成功删除 {deleted_count} 个表达方式") - - except HTTPException: - raise - except Exception as e: - logger.exception(f"批量删除表达方式失败: {e}") - raise HTTPException(status_code=500, detail=f"批量删除表达方式失败: {str(e)}") from e - - -@router.get("/stats/summary") -async def get_expression_stats( - maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 获取表达方式统计数据 - - Args: - authorization: Authorization header - - Returns: - 统计数据 - """ - try: - verify_auth_token(maibot_session, authorization) - - total = Expression.select().count() - - # 按 chat_id 统计 - chat_stats = {} - for expr in Expression.select(Expression.chat_id): - chat_id = expr.chat_id - chat_stats[chat_id] = chat_stats.get(chat_id, 0) + 1 - - # 获取最近创建的记录数(7天内) - seven_days_ago = time.time() - (7 * 24 * 60 * 60) - recent = ( - Expression.select() - .where((Expression.create_date.is_null(False)) & (Expression.create_date >= seven_days_ago)) - .count() - ) - - return { - "success": True, - "data": { - "total": total, - "recent_7days": recent, - "chat_count": len(chat_stats), - "top_chats": dict(sorted(chat_stats.items(), key=lambda x: x[1], reverse=True)[:10]), - }, - } - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取统计数据失败: {e}") - raise HTTPException(status_code=500, detail=f"获取统计数据失败: {str(e)}") from e - - -# ============ 审核相关接口 ============ - -class ReviewStatsResponse(BaseModel): - """审核统计响应""" - total: int - unchecked: int - passed: int - rejected: int - ai_checked: int - user_checked: int - - -@router.get("/review/stats", response_model=ReviewStatsResponse) -async def get_review_stats( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None) -): - """ - 获取审核统计数据 - - Returns: - 审核统计数据 - """ - try: - verify_auth_token(maibot_session, authorization) - - total = Expression.select().count() - unchecked = Expression.select().where(Expression.checked == False).count() - passed = Expression.select().where( - (Expression.checked == True) & (Expression.rejected == False) - ).count() - rejected = Expression.select().where( - (Expression.checked == True) & (Expression.rejected == True) - ).count() - ai_checked = Expression.select().where(Expression.modified_by == 'ai').count() - user_checked = Expression.select().where(Expression.modified_by == 'user').count() - - return ReviewStatsResponse( - total=total, - unchecked=unchecked, - passed=passed, - rejected=rejected, - ai_checked=ai_checked, - user_checked=user_checked - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取审核统计失败: {e}") - raise HTTPException(status_code=500, detail=f"获取审核统计失败: {str(e)}") from e - - -class ReviewListResponse(BaseModel): - """审核列表响应""" - success: bool - total: int - page: int - page_size: int - data: List[ExpressionResponse] - - -@router.get("/review/list", response_model=ReviewListResponse) -async def get_review_list( - page: int = Query(1, ge=1, description="页码"), - page_size: int = Query(20, ge=1, le=100, description="每页数量"), - filter_type: str = Query("unchecked", description="筛选类型: unchecked/passed/rejected/all"), - search: Optional[str] = Query(None, description="搜索关键词"), - chat_id: Optional[str] = Query(None, description="聊天ID筛选"), - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取待审核/已审核的表达方式列表 - - Args: - page: 页码 - page_size: 每页数量 - filter_type: 筛选类型 (unchecked/passed/rejected/all) - search: 搜索关键词 - chat_id: 聊天ID筛选 - - Returns: - 表达方式列表 - """ - try: - verify_auth_token(maibot_session, authorization) - - query = Expression.select() - - # 根据筛选类型过滤 - if filter_type == "unchecked": - query = query.where(Expression.checked == False) - elif filter_type == "passed": - query = query.where((Expression.checked == True) & (Expression.rejected == False)) - elif filter_type == "rejected": - query = query.where((Expression.checked == True) & (Expression.rejected == True)) - # all 不需要额外过滤 - - # 搜索过滤 - if search: - query = query.where( - (Expression.situation.contains(search)) | (Expression.style.contains(search)) - ) - - # 聊天ID过滤 - if chat_id: - query = query.where(Expression.chat_id == chat_id) - - # 排序:创建时间倒序 - from peewee import Case - query = query.order_by( - Case(None, [(Expression.create_date.is_null(), 1)], 0), - Expression.create_date.desc() - ) - - total = query.count() - offset = (page - 1) * page_size - expressions = query.offset(offset).limit(page_size) - - return ReviewListResponse( - success=True, - total=total, - page=page, - page_size=page_size, - data=[expression_to_response(expr) for expr in expressions] - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取审核列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取审核列表失败: {str(e)}") from e - - -class BatchReviewItem(BaseModel): - """批量审核项""" - id: int - rejected: bool - require_unchecked: bool = True # 默认要求未检查状态 - - -class BatchReviewRequest(BaseModel): - """批量审核请求""" - items: List[BatchReviewItem] - - -class BatchReviewResultItem(BaseModel): - """批量审核结果项""" - id: int - success: bool - message: str - - -class BatchReviewResponse(BaseModel): - """批量审核响应""" - success: bool - total: int - succeeded: int - failed: int - results: List[BatchReviewResultItem] - - -@router.post("/review/batch", response_model=BatchReviewResponse) -async def batch_review_expressions( - request: BatchReviewRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 批量审核表达方式 - - Args: - request: 批量审核请求 - - Returns: - 批量审核结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - if not request.items: - raise HTTPException(status_code=400, detail="未提供要审核的表达方式") - - results = [] - succeeded = 0 - failed = 0 - - for item in request.items: - try: - expression = Expression.get_or_none(Expression.id == item.id) - - if not expression: - results.append(BatchReviewResultItem( - id=item.id, - success=False, - message=f"未找到 ID 为 {item.id} 的表达方式" - )) - failed += 1 - continue - - # 冲突检测 - if item.require_unchecked and expression.checked: - results.append(BatchReviewResultItem( - id=item.id, - success=False, - message=f"已被{'AI自动' if expression.modified_by == 'ai' else '人工'}检查" - )) - failed += 1 - continue - - # 更新状态 - expression.checked = True - expression.rejected = item.rejected - expression.modified_by = 'user' - expression.last_active_time = time.time() - expression.save() - - results.append(BatchReviewResultItem( - id=item.id, - success=True, - message="通过" if not item.rejected else "拒绝" - )) - succeeded += 1 - - except Exception as e: - results.append(BatchReviewResultItem( - id=item.id, - success=False, - message=str(e) - )) - failed += 1 - - logger.info(f"批量审核完成: 成功 {succeeded}, 失败 {failed}") - - return BatchReviewResponse( - success=True, - total=len(request.items), - succeeded=succeeded, - failed=failed, - results=results - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"批量审核失败: {e}") - raise HTTPException(status_code=500, detail=f"批量审核失败: {str(e)}") from e diff --git a/src/webui/git_mirror_service.py b/src/webui/git_mirror_service.py deleted file mode 100644 index a6a9b1bc..00000000 --- a/src/webui/git_mirror_service.py +++ /dev/null @@ -1,662 +0,0 @@ -"""Git 镜像源服务 - 支持多镜像源、错误重试、Git 克隆和 Raw 文件获取""" - -from typing import Optional, List, Dict, Any -from enum import Enum -import httpx -import json -import asyncio -import subprocess -import shutil -from pathlib import Path -from datetime import datetime -from src.common.logger import get_logger - -logger = get_logger("webui.git_mirror") - -# 导入进度更新函数(避免循环导入) -_update_progress = None - - -def set_update_progress_callback(callback): - """设置进度更新回调函数""" - global _update_progress - _update_progress = callback - - -class MirrorType(str, Enum): - """镜像源类型""" - - GH_PROXY = "gh-proxy" # gh-proxy 主节点 - HK_GH_PROXY = "hk-gh-proxy" # gh-proxy 香港节点 - CDN_GH_PROXY = "cdn-gh-proxy" # gh-proxy CDN 节点 - EDGEONE_GH_PROXY = "edgeone-gh-proxy" # gh-proxy EdgeOne 节点 - MEYZH_GITHUB = "meyzh-github" # Meyzh GitHub 镜像 - GITHUB = "github" # GitHub 官方源(兜底) - CUSTOM = "custom" # 自定义镜像源 - - -class GitMirrorConfig: - """Git 镜像源配置管理""" - - # 配置文件路径 - CONFIG_FILE = Path("data/webui.json") - - # 默认镜像源配置 - DEFAULT_MIRRORS = [ - { - "id": "gh-proxy", - "name": "gh-proxy 镜像", - "raw_prefix": "https://gh-proxy.org/https://raw.githubusercontent.com", - "clone_prefix": "https://gh-proxy.org/https://github.com", - "enabled": True, - "priority": 1, - "created_at": None, - }, - { - "id": "hk-gh-proxy", - "name": "gh-proxy 香港节点", - "raw_prefix": "https://hk.gh-proxy.org/https://raw.githubusercontent.com", - "clone_prefix": "https://hk.gh-proxy.org/https://github.com", - "enabled": True, - "priority": 2, - "created_at": None, - }, - { - "id": "cdn-gh-proxy", - "name": "gh-proxy CDN 节点", - "raw_prefix": "https://cdn.gh-proxy.org/https://raw.githubusercontent.com", - "clone_prefix": "https://cdn.gh-proxy.org/https://github.com", - "enabled": True, - "priority": 3, - "created_at": None, - }, - { - "id": "edgeone-gh-proxy", - "name": "gh-proxy EdgeOne 节点", - "raw_prefix": "https://edgeone.gh-proxy.org/https://raw.githubusercontent.com", - "clone_prefix": "https://edgeone.gh-proxy.org/https://github.com", - "enabled": True, - "priority": 4, - "created_at": None, - }, - { - "id": "meyzh-github", - "name": "Meyzh GitHub 镜像", - "raw_prefix": "https://meyzh.github.io/https://raw.githubusercontent.com", - "clone_prefix": "https://meyzh.github.io/https://github.com", - "enabled": True, - "priority": 5, - "created_at": None, - }, - { - "id": "github", - "name": "GitHub 官方源(兜底)", - "raw_prefix": "https://raw.githubusercontent.com", - "clone_prefix": "https://github.com", - "enabled": True, - "priority": 999, - "created_at": None, - }, - ] - - def __init__(self): - """初始化配置管理器""" - self.config_file = self.CONFIG_FILE - self.mirrors: List[Dict[str, Any]] = [] - self._load_config() - - def _load_config(self) -> None: - """加载配置文件""" - try: - if self.config_file.exists(): - with open(self.config_file, "r", encoding="utf-8") as f: - data = json.load(f) - - # 检查是否有镜像源配置 - if "git_mirrors" not in data or not data["git_mirrors"]: - logger.info("配置文件中未找到镜像源配置,使用默认配置") - self._init_default_mirrors() - else: - self.mirrors = data["git_mirrors"] - logger.info(f"已加载 {len(self.mirrors)} 个镜像源配置") - else: - logger.info("配置文件不存在,创建默认配置") - self._init_default_mirrors() - except Exception as e: - logger.error(f"加载配置文件失败: {e}") - self._init_default_mirrors() - - def _init_default_mirrors(self) -> None: - """初始化默认镜像源""" - current_time = datetime.now().isoformat() - self.mirrors = [] - - for mirror in self.DEFAULT_MIRRORS: - mirror_copy = mirror.copy() - mirror_copy["created_at"] = current_time - self.mirrors.append(mirror_copy) - - self._save_config() - logger.info(f"已初始化 {len(self.mirrors)} 个默认镜像源") - - def _save_config(self) -> None: - """保存配置到文件""" - try: - # 确保目录存在 - self.config_file.parent.mkdir(parents=True, exist_ok=True) - - # 读取现有配置 - existing_data = {} - if self.config_file.exists(): - with open(self.config_file, "r", encoding="utf-8") as f: - existing_data = json.load(f) - - # 更新镜像源配置 - existing_data["git_mirrors"] = self.mirrors - - # 写入文件 - with open(self.config_file, "w", encoding="utf-8") as f: - json.dump(existing_data, f, indent=2, ensure_ascii=False) - - logger.debug(f"配置已保存到 {self.config_file}") - except Exception as e: - logger.error(f"保存配置文件失败: {e}") - - def get_all_mirrors(self) -> List[Dict[str, Any]]: - """获取所有镜像源""" - return self.mirrors.copy() - - def get_enabled_mirrors(self) -> List[Dict[str, Any]]: - """获取所有启用的镜像源,按优先级排序""" - enabled = [m for m in self.mirrors if m.get("enabled", False)] - return sorted(enabled, key=lambda x: x.get("priority", 999)) - - def get_mirror_by_id(self, mirror_id: str) -> Optional[Dict[str, Any]]: - """根据 ID 获取镜像源""" - for mirror in self.mirrors: - if mirror.get("id") == mirror_id: - return mirror.copy() - return None - - def add_mirror( - self, - mirror_id: str, - name: str, - raw_prefix: str, - clone_prefix: str, - enabled: bool = True, - priority: Optional[int] = None, - ) -> Dict[str, Any]: - """ - 添加新的镜像源 - - Returns: - 添加的镜像源配置 - - Raises: - ValueError: 如果镜像源 ID 已存在 - """ - # 检查 ID 是否已存在 - if self.get_mirror_by_id(mirror_id): - raise ValueError(f"镜像源 ID 已存在: {mirror_id}") - - # 如果未指定优先级,使用最大优先级 + 1 - if priority is None: - max_priority = max((m.get("priority", 0) for m in self.mirrors), default=0) - priority = max_priority + 1 - - new_mirror = { - "id": mirror_id, - "name": name, - "raw_prefix": raw_prefix, - "clone_prefix": clone_prefix, - "enabled": enabled, - "priority": priority, - "created_at": datetime.now().isoformat(), - } - - self.mirrors.append(new_mirror) - self._save_config() - - logger.info(f"已添加镜像源: {mirror_id} - {name}") - return new_mirror.copy() - - def update_mirror( - self, - mirror_id: str, - name: Optional[str] = None, - raw_prefix: Optional[str] = None, - clone_prefix: Optional[str] = None, - enabled: Optional[bool] = None, - priority: Optional[int] = None, - ) -> Optional[Dict[str, Any]]: - """ - 更新镜像源配置 - - Returns: - 更新后的镜像源配置,如果不存在则返回 None - """ - for mirror in self.mirrors: - if mirror.get("id") == mirror_id: - if name is not None: - mirror["name"] = name - if raw_prefix is not None: - mirror["raw_prefix"] = raw_prefix - if clone_prefix is not None: - mirror["clone_prefix"] = clone_prefix - if enabled is not None: - mirror["enabled"] = enabled - if priority is not None: - mirror["priority"] = priority - - mirror["updated_at"] = datetime.now().isoformat() - self._save_config() - - logger.info(f"已更新镜像源: {mirror_id}") - return mirror.copy() - - return None - - def delete_mirror(self, mirror_id: str) -> bool: - """ - 删除镜像源 - - Returns: - True 如果删除成功,False 如果镜像源不存在 - """ - for i, mirror in enumerate(self.mirrors): - if mirror.get("id") == mirror_id: - self.mirrors.pop(i) - self._save_config() - logger.info(f"已删除镜像源: {mirror_id}") - return True - - return False - - def get_default_priority_list(self) -> List[str]: - """获取默认优先级列表(仅启用的镜像源 ID)""" - enabled = self.get_enabled_mirrors() - return [m["id"] for m in enabled] - - -class GitMirrorService: - """Git 镜像源服务""" - - def __init__(self, max_retries: int = 3, timeout: int = 30, config: Optional[GitMirrorConfig] = None): - """ - 初始化 Git 镜像源服务 - - Args: - max_retries: 最大重试次数 - timeout: 请求超时时间(秒) - config: 镜像源配置管理器(可选,默认创建新实例) - """ - self.max_retries = max_retries - self.timeout = timeout - self.config = config or GitMirrorConfig() - logger.info(f"Git镜像源服务初始化完成,已加载 {len(self.config.get_enabled_mirrors())} 个启用的镜像源") - - def get_mirror_config(self) -> GitMirrorConfig: - """获取镜像源配置管理器""" - return self.config - - @staticmethod - def check_git_installed() -> Dict[str, Any]: - """ - 检查本机是否安装了 Git - - Returns: - Dict 包含: - - installed: bool - 是否已安装 Git - - version: str - Git 版本号(如果已安装) - - path: str - Git 可执行文件路径(如果已安装) - - error: str - 错误信息(如果未安装或检测失败) - """ - import subprocess - import shutil - - try: - # 查找 git 可执行文件路径 - git_path = shutil.which("git") - - if not git_path: - logger.warning("未找到 Git 可执行文件") - return {"installed": False, "error": "系统中未找到 Git,请先安装 Git"} - - # 获取 Git 版本 - result = subprocess.run(["git", "--version"], capture_output=True, text=True, timeout=5) - - if result.returncode == 0: - version = result.stdout.strip() - logger.info(f"检测到 Git: {version} at {git_path}") - return {"installed": True, "version": version, "path": git_path} - else: - logger.warning(f"Git 命令执行失败: {result.stderr}") - return {"installed": False, "error": f"Git 命令执行失败: {result.stderr}"} - - except subprocess.TimeoutExpired: - logger.error("Git 版本检测超时") - return {"installed": False, "error": "Git 版本检测超时"} - except Exception as e: - logger.error(f"检测 Git 时发生错误: {e}") - return {"installed": False, "error": f"检测 Git 时发生错误: {str(e)}"} - - async def fetch_raw_file( - self, - owner: str, - repo: str, - branch: str, - file_path: str, - mirror_id: Optional[str] = None, - custom_url: Optional[str] = None, - ) -> Dict[str, Any]: - """ - 获取 GitHub 仓库的 Raw 文件内容 - - Args: - owner: 仓库所有者 - repo: 仓库名称 - branch: 分支名称 - file_path: 文件路径 - mirror_id: 指定的镜像源 ID - custom_url: 自定义完整 URL(如果提供,将忽略其他参数) - - Returns: - Dict 包含: - - success: bool - 是否成功 - - data: str - 文件内容(成功时) - - error: str - 错误信息(失败时) - - mirror_used: str - 使用的镜像源 - - attempts: int - 尝试次数 - """ - logger.info(f"开始获取 Raw 文件: {owner}/{repo}/{branch}/{file_path}") - - if custom_url: - # 使用自定义 URL - return await self._fetch_with_url(custom_url, "custom") - - # 确定要使用的镜像源列表 - if mirror_id: - # 使用指定的镜像源 - mirror = self.config.get_mirror_by_id(mirror_id) - if not mirror: - return {"success": False, "error": f"未找到镜像源: {mirror_id}", "mirror_used": None, "attempts": 0} - mirrors_to_try = [mirror] - else: - # 使用所有启用的镜像源 - mirrors_to_try = self.config.get_enabled_mirrors() - - total_mirrors = len(mirrors_to_try) - - # 依次尝试每个镜像源 - for index, mirror in enumerate(mirrors_to_try, 1): - # 推送进度:正在尝试第 N 个镜像源 - if _update_progress: - try: - progress = 30 + int((index - 1) / total_mirrors * 40) # 30% - 70% - await _update_progress( - stage="loading", - progress=progress, - message=f"正在尝试镜像源 {index}/{total_mirrors}: {mirror['name']}", - total_plugins=0, - loaded_plugins=0, - ) - except Exception as e: - logger.warning(f"推送进度失败: {e}") - - result = await self._fetch_raw_from_mirror(owner, repo, branch, file_path, mirror) - - if result["success"]: - # 成功,推送进度 - if _update_progress: - try: - await _update_progress( - stage="loading", - progress=70, - message=f"成功从 {mirror['name']} 获取数据", - total_plugins=0, - loaded_plugins=0, - ) - except Exception as e: - logger.warning(f"推送进度失败: {e}") - return result - - # 失败,记录日志并推送失败信息 - logger.warning(f"镜像源 {mirror['id']} 失败: {result.get('error')}") - - if _update_progress and index < total_mirrors: - try: - await _update_progress( - stage="loading", - progress=30 + int(index / total_mirrors * 40), - message=f"镜像源 {mirror['name']} 失败,尝试下一个...", - total_plugins=0, - loaded_plugins=0, - ) - except Exception as e: - logger.warning(f"推送进度失败: {e}") - - # 所有镜像源都失败 - return {"success": False, "error": "所有镜像源均失败", "mirror_used": None, "attempts": len(mirrors_to_try)} - - async def _fetch_raw_from_mirror( - self, owner: str, repo: str, branch: str, file_path: str, mirror: Dict[str, Any] - ) -> Dict[str, Any]: - """从指定镜像源获取文件""" - # 构建 URL - raw_prefix = mirror["raw_prefix"] - url = f"{raw_prefix}/{owner}/{repo}/{branch}/{file_path}" - - return await self._fetch_with_url(url, mirror["id"]) - - async def _fetch_with_url(self, url: str, mirror_type: str) -> Dict[str, Any]: - """使用指定 URL 获取文件,支持重试""" - attempts = 0 - last_error = None - - for attempt in range(self.max_retries): - attempts += 1 - try: - logger.debug(f"尝试 #{attempt + 1}: {url}") - async with httpx.AsyncClient(timeout=self.timeout) as client: - response = await client.get(url) - response.raise_for_status() - - logger.info(f"成功获取文件: {url}") - return { - "success": True, - "data": response.text, - "mirror_used": mirror_type, - "attempts": attempts, - "url": url, - } - except httpx.HTTPStatusError as e: - last_error = f"HTTP {e.response.status_code}: {e}" - logger.warning(f"HTTP 错误 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - except httpx.TimeoutException as e: - last_error = f"请求超时: {e}" - logger.warning(f"超时 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - except Exception as e: - last_error = f"未知错误: {e}" - logger.error(f"错误 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - - return {"success": False, "error": last_error, "mirror_used": mirror_type, "attempts": attempts, "url": url} - - async def clone_repository( - self, - owner: str, - repo: str, - target_path: Path, - branch: Optional[str] = None, - mirror_id: Optional[str] = None, - custom_url: Optional[str] = None, - depth: Optional[int] = None, - ) -> Dict[str, Any]: - """ - 克隆 GitHub 仓库 - - Args: - owner: 仓库所有者 - repo: 仓库名称 - target_path: 目标路径 - branch: 分支名称(可选) - mirror_id: 指定的镜像源 ID - custom_url: 自定义克隆 URL - depth: 克隆深度(浅克隆) - - Returns: - Dict 包含: - - success: bool - 是否成功 - - path: str - 克隆路径(成功时) - - error: str - 错误信息(失败时) - - mirror_used: str - 使用的镜像源 - - attempts: int - 尝试次数 - """ - logger.info(f"开始克隆仓库: {owner}/{repo} 到 {target_path}") - - if custom_url: - # 使用自定义 URL - return await self._clone_with_url(custom_url, target_path, branch, depth, "custom") - - # 确定要使用的镜像源列表 - if mirror_id: - # 使用指定的镜像源 - mirror = self.config.get_mirror_by_id(mirror_id) - if not mirror: - return {"success": False, "error": f"未找到镜像源: {mirror_id}", "mirror_used": None, "attempts": 0} - mirrors_to_try = [mirror] - else: - # 使用所有启用的镜像源 - mirrors_to_try = self.config.get_enabled_mirrors() - - # 依次尝试每个镜像源 - for mirror in mirrors_to_try: - result = await self._clone_from_mirror(owner, repo, target_path, branch, depth, mirror) - if result["success"]: - return result - logger.warning(f"镜像源 {mirror['id']} 克隆失败: {result.get('error')}") - - # 所有镜像源都失败 - return {"success": False, "error": "所有镜像源克隆均失败", "mirror_used": None, "attempts": len(mirrors_to_try)} - - async def _clone_from_mirror( - self, - owner: str, - repo: str, - target_path: Path, - branch: Optional[str], - depth: Optional[int], - mirror: Dict[str, Any], - ) -> Dict[str, Any]: - """从指定镜像源克隆仓库""" - # 构建克隆 URL - clone_prefix = mirror["clone_prefix"] - url = f"{clone_prefix}/{owner}/{repo}.git" - - return await self._clone_with_url(url, target_path, branch, depth, mirror["id"]) - - async def _clone_with_url( - self, url: str, target_path: Path, branch: Optional[str], depth: Optional[int], mirror_type: str - ) -> Dict[str, Any]: - """使用指定 URL 克隆仓库,支持重试""" - attempts = 0 - last_error = None - - for attempt in range(self.max_retries): - attempts += 1 - - try: - # 确保目标路径不存在 - if target_path.exists(): - logger.warning(f"目标路径已存在,删除: {target_path}") - shutil.rmtree(target_path, ignore_errors=True) - - # 构建 git clone 命令 - cmd = ["git", "clone"] - - # 添加分支参数 - if branch: - cmd.extend(["-b", branch]) - - # 添加深度参数(浅克隆) - if depth: - cmd.extend(["--depth", str(depth)]) - - # 添加 URL 和目标路径 - cmd.extend([url, str(target_path)]) - - logger.info(f"尝试克隆 #{attempt + 1}: {' '.join(cmd)}") - - # 推送进度 - if _update_progress: - try: - await _update_progress( - stage="loading", - progress=20 + attempt * 10, - message=f"正在克隆仓库 (尝试 {attempt + 1}/{self.max_retries})...", - operation="install", - ) - except Exception as e: - logger.warning(f"推送进度失败: {e}") - - # 执行 git clone(在线程池中运行以避免阻塞) - loop = asyncio.get_event_loop() - - def run_git_clone(clone_cmd=cmd): - return subprocess.run( - clone_cmd, - capture_output=True, - text=True, - timeout=300, # 5分钟超时 - ) - - process = await loop.run_in_executor(None, run_git_clone) - - if process.returncode == 0: - logger.info(f"成功克隆仓库: {url} -> {target_path}") - return { - "success": True, - "path": str(target_path), - "mirror_used": mirror_type, - "attempts": attempts, - "url": url, - "branch": branch or "default", - } - else: - last_error = f"Git 克隆失败: {process.stderr}" - logger.warning(f"克隆失败 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - - except subprocess.TimeoutExpired: - last_error = "克隆超时(超过 5 分钟)" - logger.warning(f"克隆超时 (尝试 {attempt + 1}/{self.max_retries})") - - # 清理可能的部分克隆 - if target_path.exists(): - shutil.rmtree(target_path, ignore_errors=True) - - except FileNotFoundError: - last_error = "Git 未安装或不在 PATH 中" - logger.error(f"Git 未找到: {last_error}") - break # Git 不存在,不需要重试 - - except Exception as e: - last_error = f"未知错误: {e}" - logger.error(f"克隆错误 (尝试 {attempt + 1}/{self.max_retries}): {last_error}") - - # 清理可能的部分克隆 - if target_path.exists(): - shutil.rmtree(target_path, ignore_errors=True) - - return {"success": False, "error": last_error, "mirror_used": mirror_type, "attempts": attempts, "url": url} - - -# 全局服务实例 -_git_mirror_service: Optional[GitMirrorService] = None - - -def get_git_mirror_service() -> GitMirrorService: - """获取 Git 镜像源服务实例(单例)""" - global _git_mirror_service - if _git_mirror_service is None: - _git_mirror_service = GitMirrorService() - return _git_mirror_service diff --git a/src/webui/jargon_routes.py b/src/webui/jargon_routes.py deleted file mode 100644 index 8d372688..00000000 --- a/src/webui/jargon_routes.py +++ /dev/null @@ -1,532 +0,0 @@ -"""黑话(俚语)管理路由""" - -import json -from typing import Optional, List, Annotated -from fastapi import APIRouter, HTTPException, Query -from pydantic import BaseModel, Field -from peewee import fn - -from src.common.logger import get_logger -from src.common.database.database_model import Jargon, ChatStreams - -logger = get_logger("webui.jargon") - -router = APIRouter(prefix="/jargon", tags=["Jargon"]) - - -# ==================== 辅助函数 ==================== - - -def parse_chat_id_to_stream_ids(chat_id_str: str) -> List[str]: - """ - 解析 chat_id 字段,提取所有 stream_id - chat_id 格式: [["stream_id", user_id], ...] 或直接是 stream_id 字符串 - """ - if not chat_id_str: - return [] - - try: - # 尝试解析为 JSON - parsed = json.loads(chat_id_str) - if isinstance(parsed, list): - # 格式: [["stream_id", user_id], ...] - stream_ids = [] - for item in parsed: - if isinstance(item, list) and len(item) >= 1: - stream_ids.append(str(item[0])) - return stream_ids - else: - # 其他格式,返回原始字符串 - return [chat_id_str] - except (json.JSONDecodeError, TypeError): - # 不是有效的 JSON,可能是直接的 stream_id - return [chat_id_str] - - -def get_display_name_for_chat_id(chat_id_str: str) -> str: - """ - 获取 chat_id 的显示名称 - 尝试解析 JSON 并查询 ChatStreams 表获取群聊名称 - """ - stream_ids = parse_chat_id_to_stream_ids(chat_id_str) - - if not stream_ids: - return chat_id_str - - # 查询所有 stream_id 对应的名称 - names = [] - for stream_id in stream_ids: - chat_stream = ChatStreams.get_or_none(ChatStreams.stream_id == stream_id) - if chat_stream and chat_stream.group_name: - names.append(chat_stream.group_name) - else: - # 如果没找到,显示截断的 stream_id - names.append(stream_id[:8] + "..." if len(stream_id) > 8 else stream_id) - - return ", ".join(names) if names else chat_id_str - - -# ==================== 请求/响应模型 ==================== - - -class JargonResponse(BaseModel): - """黑话信息响应""" - - id: int - content: str - raw_content: Optional[str] = None - meaning: Optional[str] = None - chat_id: str - stream_id: Optional[str] = None # 解析后的 stream_id,用于前端编辑时匹配 - chat_name: Optional[str] = None # 解析后的聊天名称,用于前端显示 - is_global: bool = False - count: int = 0 - is_jargon: Optional[bool] = None - is_complete: bool = False - inference_with_context: Optional[str] = None - inference_content_only: Optional[str] = None - - -class JargonListResponse(BaseModel): - """黑话列表响应""" - - success: bool = True - total: int - page: int - page_size: int - data: List[JargonResponse] - - -class JargonDetailResponse(BaseModel): - """黑话详情响应""" - - success: bool = True - data: JargonResponse - - -class JargonCreateRequest(BaseModel): - """黑话创建请求""" - - content: str = Field(..., description="黑话内容") - raw_content: Optional[str] = Field(None, description="原始内容") - meaning: Optional[str] = Field(None, description="含义") - chat_id: str = Field(..., description="聊天ID") - is_global: bool = Field(False, description="是否全局") - - -class JargonUpdateRequest(BaseModel): - """黑话更新请求""" - - content: Optional[str] = None - raw_content: Optional[str] = None - meaning: Optional[str] = None - chat_id: Optional[str] = None - is_global: Optional[bool] = None - is_jargon: Optional[bool] = None - - -class JargonCreateResponse(BaseModel): - """黑话创建响应""" - - success: bool = True - message: str - data: JargonResponse - - -class JargonUpdateResponse(BaseModel): - """黑话更新响应""" - - success: bool = True - message: str - data: Optional[JargonResponse] = None - - -class JargonDeleteResponse(BaseModel): - """黑话删除响应""" - - success: bool = True - message: str - deleted_count: int = 0 - - -class BatchDeleteRequest(BaseModel): - """批量删除请求""" - - ids: List[int] = Field(..., description="要删除的黑话ID列表") - - -class JargonStatsResponse(BaseModel): - """黑话统计响应""" - - success: bool = True - data: dict - - -class ChatInfoResponse(BaseModel): - """聊天信息响应""" - - chat_id: str - chat_name: str - platform: Optional[str] = None - is_group: bool = False - - -class ChatListResponse(BaseModel): - """聊天列表响应""" - - success: bool = True - data: List[ChatInfoResponse] - - -# ==================== 工具函数 ==================== - - -def jargon_to_dict(jargon: Jargon) -> dict: - """将 Jargon ORM 对象转换为字典""" - # 解析 chat_id 获取显示名称和 stream_id - chat_name = get_display_name_for_chat_id(jargon.chat_id) if jargon.chat_id else None - stream_ids = parse_chat_id_to_stream_ids(jargon.chat_id) if jargon.chat_id else [] - stream_id = stream_ids[0] if stream_ids else None - - return { - "id": jargon.id, - "content": jargon.content, - "raw_content": jargon.raw_content, - "meaning": jargon.meaning, - "chat_id": jargon.chat_id, - "stream_id": stream_id, - "chat_name": chat_name, - "is_global": jargon.is_global, - "count": jargon.count, - "is_jargon": jargon.is_jargon, - "is_complete": jargon.is_complete, - "inference_with_context": jargon.inference_with_context, - "inference_content_only": jargon.inference_content_only, - } - - -# ==================== API 端点 ==================== - - -@router.get("/list", response_model=JargonListResponse) -async def get_jargon_list( - page: int = Query(1, ge=1, description="页码"), - page_size: int = Query(20, ge=1, le=100, description="每页数量"), - search: Optional[str] = Query(None, description="搜索关键词"), - chat_id: Optional[str] = Query(None, description="按聊天ID筛选"), - is_jargon: Optional[bool] = Query(None, description="按是否是黑话筛选"), - is_global: Optional[bool] = Query(None, description="按是否全局筛选"), -): - """获取黑话列表""" - try: - # 构建查询 - query = Jargon.select() - - # 搜索过滤 - if search: - query = query.where( - (Jargon.content.contains(search)) - | (Jargon.meaning.contains(search)) - | (Jargon.raw_content.contains(search)) - ) - - # 按聊天ID筛选(使用 contains 匹配,因为 chat_id 是 JSON 格式) - if chat_id: - # 从传入的 chat_id 中解析出 stream_id - stream_ids = parse_chat_id_to_stream_ids(chat_id) - if stream_ids: - # 使用第一个 stream_id 进行模糊匹配 - query = query.where(Jargon.chat_id.contains(stream_ids[0])) - else: - # 如果无法解析,使用精确匹配 - query = query.where(Jargon.chat_id == chat_id) - - # 按是否是黑话筛选 - if is_jargon is not None: - query = query.where(Jargon.is_jargon == is_jargon) - - # 按是否全局筛选 - if is_global is not None: - query = query.where(Jargon.is_global == is_global) - - # 获取总数 - total = query.count() - - # 分页和排序(按使用次数降序) - query = query.order_by(Jargon.count.desc(), Jargon.id.desc()) - query = query.paginate(page, page_size) - - # 转换为响应格式 - data = [jargon_to_dict(j) for j in query] - - return JargonListResponse( - success=True, - total=total, - page=page, - page_size=page_size, - data=data, - ) - - except Exception as e: - logger.error(f"获取黑话列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取黑话列表失败: {str(e)}") from e - - -@router.get("/chats", response_model=ChatListResponse) -async def get_chat_list(): - """获取所有有黑话记录的聊天列表""" - try: - # 获取所有不同的 chat_id - chat_ids = Jargon.select(Jargon.chat_id).distinct().where(Jargon.chat_id.is_null(False)) - - chat_id_list = [j.chat_id for j in chat_ids if j.chat_id] - - # 用于按 stream_id 去重 - seen_stream_ids: set[str] = set() - - for chat_id in chat_id_list: - stream_ids = parse_chat_id_to_stream_ids(chat_id) - if stream_ids: - seen_stream_ids.add(stream_ids[0]) - - result = [] - for stream_id in seen_stream_ids: - # 尝试从 ChatStreams 表获取聊天名称 - chat_stream = ChatStreams.get_or_none(ChatStreams.stream_id == stream_id) - if chat_stream: - result.append( - ChatInfoResponse( - chat_id=stream_id, # 使用 stream_id,方便筛选匹配 - chat_name=chat_stream.group_name or stream_id, - platform=chat_stream.platform, - is_group=True, - ) - ) - else: - result.append( - ChatInfoResponse( - chat_id=stream_id, # 使用 stream_id - chat_name=stream_id[:8] + "..." if len(stream_id) > 8 else stream_id, - platform=None, - is_group=False, - ) - ) - - return ChatListResponse(success=True, data=result) - - except Exception as e: - logger.error(f"获取聊天列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取聊天列表失败: {str(e)}") from e - - -@router.get("/stats/summary", response_model=JargonStatsResponse) -async def get_jargon_stats(): - """获取黑话统计数据""" - try: - # 总数量 - total = Jargon.select().count() - - # 已确认是黑话的数量 - confirmed_jargon = Jargon.select().where(Jargon.is_jargon).count() - - # 已确认不是黑话的数量 - confirmed_not_jargon = Jargon.select().where(~Jargon.is_jargon).count() - - # 未判定的数量 - pending = Jargon.select().where(Jargon.is_jargon.is_null()).count() - - # 全局黑话数量 - global_count = Jargon.select().where(Jargon.is_global).count() - - # 已完成推断的数量 - complete_count = Jargon.select().where(Jargon.is_complete).count() - - # 关联的聊天数量 - chat_count = Jargon.select(Jargon.chat_id).distinct().where(Jargon.chat_id.is_null(False)).count() - - # 按聊天统计 TOP 5 - top_chats = ( - Jargon.select(Jargon.chat_id, fn.COUNT(Jargon.id).alias("count")) - .group_by(Jargon.chat_id) - .order_by(fn.COUNT(Jargon.id).desc()) - .limit(5) - ) - top_chats_dict = {j.chat_id: j.count for j in top_chats if j.chat_id} - - return JargonStatsResponse( - success=True, - data={ - "total": total, - "confirmed_jargon": confirmed_jargon, - "confirmed_not_jargon": confirmed_not_jargon, - "pending": pending, - "global_count": global_count, - "complete_count": complete_count, - "chat_count": chat_count, - "top_chats": top_chats_dict, - }, - ) - - except Exception as e: - logger.error(f"获取黑话统计失败: {e}") - raise HTTPException(status_code=500, detail=f"获取黑话统计失败: {str(e)}") from e - - -@router.get("/{jargon_id}", response_model=JargonDetailResponse) -async def get_jargon_detail(jargon_id: int): - """获取黑话详情""" - try: - jargon = Jargon.get_or_none(Jargon.id == jargon_id) - if not jargon: - raise HTTPException(status_code=404, detail="黑话不存在") - - return JargonDetailResponse(success=True, data=jargon_to_dict(jargon)) - - except HTTPException: - raise - except Exception as e: - logger.error(f"获取黑话详情失败: {e}") - raise HTTPException(status_code=500, detail=f"获取黑话详情失败: {str(e)}") from e - - -@router.post("/", response_model=JargonCreateResponse) -async def create_jargon(request: JargonCreateRequest): - """创建黑话""" - try: - # 检查是否已存在相同内容的黑话 - existing = Jargon.get_or_none((Jargon.content == request.content) & (Jargon.chat_id == request.chat_id)) - if existing: - raise HTTPException(status_code=400, detail="该聊天中已存在相同内容的黑话") - - # 创建黑话 - jargon = Jargon.create( - content=request.content, - raw_content=request.raw_content, - meaning=request.meaning, - chat_id=request.chat_id, - is_global=request.is_global, - count=0, - is_jargon=None, - is_complete=False, - ) - - logger.info(f"创建黑话成功: id={jargon.id}, content={request.content}") - - return JargonCreateResponse( - success=True, - message="创建成功", - data=jargon_to_dict(jargon), - ) - - except HTTPException: - raise - except Exception as e: - logger.error(f"创建黑话失败: {e}") - raise HTTPException(status_code=500, detail=f"创建黑话失败: {str(e)}") from e - - -@router.patch("/{jargon_id}", response_model=JargonUpdateResponse) -async def update_jargon(jargon_id: int, request: JargonUpdateRequest): - """更新黑话(增量更新)""" - try: - jargon = Jargon.get_or_none(Jargon.id == jargon_id) - if not jargon: - raise HTTPException(status_code=404, detail="黑话不存在") - - # 增量更新字段 - update_data = request.model_dump(exclude_unset=True) - if update_data: - for field, value in update_data.items(): - if value is not None or field in ["meaning", "raw_content", "is_jargon"]: - setattr(jargon, field, value) - jargon.save() - - logger.info(f"更新黑话成功: id={jargon_id}") - - return JargonUpdateResponse( - success=True, - message="更新成功", - data=jargon_to_dict(jargon), - ) - - except HTTPException: - raise - except Exception as e: - logger.error(f"更新黑话失败: {e}") - raise HTTPException(status_code=500, detail=f"更新黑话失败: {str(e)}") from e - - -@router.delete("/{jargon_id}", response_model=JargonDeleteResponse) -async def delete_jargon(jargon_id: int): - """删除黑话""" - try: - jargon = Jargon.get_or_none(Jargon.id == jargon_id) - if not jargon: - raise HTTPException(status_code=404, detail="黑话不存在") - - content = jargon.content - jargon.delete_instance() - - logger.info(f"删除黑话成功: id={jargon_id}, content={content}") - - return JargonDeleteResponse( - success=True, - message="删除成功", - deleted_count=1, - ) - - except HTTPException: - raise - except Exception as e: - logger.error(f"删除黑话失败: {e}") - raise HTTPException(status_code=500, detail=f"删除黑话失败: {str(e)}") from e - - -@router.post("/batch/delete", response_model=JargonDeleteResponse) -async def batch_delete_jargons(request: BatchDeleteRequest): - """批量删除黑话""" - try: - if not request.ids: - raise HTTPException(status_code=400, detail="ID列表不能为空") - - deleted_count = Jargon.delete().where(Jargon.id.in_(request.ids)).execute() - - logger.info(f"批量删除黑话成功: 删除了 {deleted_count} 条记录") - - return JargonDeleteResponse( - success=True, - message=f"成功删除 {deleted_count} 条黑话", - deleted_count=deleted_count, - ) - - except HTTPException: - raise - except Exception as e: - logger.error(f"批量删除黑话失败: {e}") - raise HTTPException(status_code=500, detail=f"批量删除黑话失败: {str(e)}") from e - - -@router.post("/batch/set-jargon", response_model=JargonUpdateResponse) -async def batch_set_jargon_status( - ids: Annotated[List[int], Query(description="黑话ID列表")], - is_jargon: Annotated[bool, Query(description="是否是黑话")], -): - """批量设置黑话状态""" - try: - if not ids: - raise HTTPException(status_code=400, detail="ID列表不能为空") - - updated_count = Jargon.update(is_jargon=is_jargon).where(Jargon.id.in_(ids)).execute() - - logger.info(f"批量更新黑话状态成功: 更新了 {updated_count} 条记录,is_jargon={is_jargon}") - - return JargonUpdateResponse( - success=True, - message=f"成功更新 {updated_count} 条黑话状态", - ) - - except HTTPException: - raise - except Exception as e: - logger.error(f"批量更新黑话状态失败: {e}") - raise HTTPException(status_code=500, detail=f"批量更新黑话状态失败: {str(e)}") from e diff --git a/src/webui/knowledge_routes.py b/src/webui/knowledge_routes.py deleted file mode 100644 index 87b2e7b5..00000000 --- a/src/webui/knowledge_routes.py +++ /dev/null @@ -1,298 +0,0 @@ -"""知识库图谱可视化 API 路由""" - -from typing import List, Optional -from fastapi import APIRouter, Query, Depends, Cookie, Header -from pydantic import BaseModel -import logging -from src.webui.auth import verify_auth_token_from_cookie_or_header - -logger = logging.getLogger(__name__) - -router = APIRouter(prefix="/api/webui/knowledge", tags=["knowledge"]) - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -class KnowledgeNode(BaseModel): - """知识节点""" - - id: str - type: str # 'entity' or 'paragraph' - content: str - create_time: Optional[float] = None - - -class KnowledgeEdge(BaseModel): - """知识边""" - - source: str - target: str - weight: float - create_time: Optional[float] = None - update_time: Optional[float] = None - - -class KnowledgeGraph(BaseModel): - """知识图谱""" - - nodes: List[KnowledgeNode] - edges: List[KnowledgeEdge] - - -class KnowledgeStats(BaseModel): - """知识库统计信息""" - - total_nodes: int - total_edges: int - entity_nodes: int - paragraph_nodes: int - avg_connections: float - - -def _load_kg_manager(): - """延迟加载 KGManager""" - try: - from src.chat.knowledge.kg_manager import KGManager - - kg_manager = KGManager() - kg_manager.load_from_file() - return kg_manager - except Exception as e: - logger.error(f"加载 KGManager 失败: {e}") - return None - - -def _convert_graph_to_json(kg_manager) -> KnowledgeGraph: - """将 DiGraph 转换为 JSON 格式""" - if kg_manager is None or kg_manager.graph is None: - return KnowledgeGraph(nodes=[], edges=[]) - - graph = kg_manager.graph - nodes = [] - edges = [] - - # 转换节点 - node_list = graph.get_node_list() - for node_id in node_list: - try: - node_data = graph[node_id] - # 节点类型: "ent" -> "entity", "pg" -> "paragraph" - node_type = "entity" if ("type" in node_data and node_data["type"] == "ent") else "paragraph" - content = node_data["content"] if "content" in node_data else node_id - create_time = node_data["create_time"] if "create_time" in node_data else None - - nodes.append(KnowledgeNode(id=node_id, type=node_type, content=content, create_time=create_time)) - except Exception as e: - logger.warning(f"跳过节点 {node_id}: {e}") - continue - - # 转换边 - edge_list = graph.get_edge_list() - for edge_tuple in edge_list: - try: - # edge_tuple 是 (source, target) 元组 - source, target = edge_tuple[0], edge_tuple[1] - # 通过 graph[source, target] 获取边的属性数据 - edge_data = graph[source, target] - - # edge_data 支持 [] 操作符但不支持 .get() - weight = edge_data["weight"] if "weight" in edge_data else 1.0 - create_time = edge_data["create_time"] if "create_time" in edge_data else None - update_time = edge_data["update_time"] if "update_time" in edge_data else None - - edges.append( - KnowledgeEdge( - source=source, target=target, weight=weight, create_time=create_time, update_time=update_time - ) - ) - except Exception as e: - logger.warning(f"跳过边 {edge_tuple}: {e}") - continue - - return KnowledgeGraph(nodes=nodes, edges=edges) - - -@router.get("/graph", response_model=KnowledgeGraph) -async def get_knowledge_graph( - limit: int = Query(100, ge=1, le=10000, description="返回的最大节点数"), - node_type: str = Query("all", description="节点类型过滤: all, entity, paragraph"), - _auth: bool = Depends(require_auth), -): - """获取知识图谱(限制节点数量) - - Args: - limit: 返回的最大节点数,默认 100,最大 10000 - node_type: 节点类型过滤 - all(全部), entity(实体), paragraph(段落) - - Returns: - KnowledgeGraph: 包含指定数量节点和相关边的知识图谱 - """ - try: - kg_manager = _load_kg_manager() - if kg_manager is None: - logger.warning("KGManager 未初始化,返回空图谱") - return KnowledgeGraph(nodes=[], edges=[]) - - graph = kg_manager.graph - all_node_list = graph.get_node_list() - - # 按类型过滤节点 - if node_type == "entity": - all_node_list = [ - n for n in all_node_list if n in graph and "type" in graph[n] and graph[n]["type"] == "ent" - ] - elif node_type == "paragraph": - all_node_list = [n for n in all_node_list if n in graph and "type" in graph[n] and graph[n]["type"] == "pg"] - - # 限制节点数量 - total_nodes = len(all_node_list) - if len(all_node_list) > limit: - node_list = all_node_list[:limit] - else: - node_list = all_node_list - - logger.info(f"总节点数: {total_nodes}, 返回节点: {len(node_list)} (limit={limit}, type={node_type})") - - # 转换节点 - nodes = [] - node_ids = set() - for node_id in node_list: - try: - node_data = graph[node_id] - node_type_val = "entity" if ("type" in node_data and node_data["type"] == "ent") else "paragraph" - content = node_data["content"] if "content" in node_data else node_id - create_time = node_data["create_time"] if "create_time" in node_data else None - - nodes.append(KnowledgeNode(id=node_id, type=node_type_val, content=content, create_time=create_time)) - node_ids.add(node_id) - except Exception as e: - logger.warning(f"跳过节点 {node_id}: {e}") - continue - - # 只获取涉及当前节点集的边(保证图的完整性) - edges = [] - edge_list = graph.get_edge_list() - for edge_tuple in edge_list: - try: - source, target = edge_tuple[0], edge_tuple[1] - # 只包含两端都在当前节点集中的边 - if source not in node_ids or target not in node_ids: - continue - - edge_data = graph[source, target] - weight = edge_data["weight"] if "weight" in edge_data else 1.0 - create_time = edge_data["create_time"] if "create_time" in edge_data else None - update_time = edge_data["update_time"] if "update_time" in edge_data else None - - edges.append( - KnowledgeEdge( - source=source, target=target, weight=weight, create_time=create_time, update_time=update_time - ) - ) - except Exception as e: - logger.warning(f"跳过边 {edge_tuple}: {e}") - continue - - graph_data = KnowledgeGraph(nodes=nodes, edges=edges) - logger.info(f"返回知识图谱: {len(nodes)} 个节点, {len(edges)} 条边") - return graph_data - - except Exception as e: - logger.error(f"获取知识图谱失败: {e}", exc_info=True) - return KnowledgeGraph(nodes=[], edges=[]) - - -@router.get("/stats", response_model=KnowledgeStats) -async def get_knowledge_stats(_auth: bool = Depends(require_auth)): - """获取知识库统计信息 - - Returns: - KnowledgeStats: 统计信息 - """ - try: - kg_manager = _load_kg_manager() - if kg_manager is None or kg_manager.graph is None: - return KnowledgeStats(total_nodes=0, total_edges=0, entity_nodes=0, paragraph_nodes=0, avg_connections=0.0) - - graph = kg_manager.graph - node_list = graph.get_node_list() - edge_list = graph.get_edge_list() - - total_nodes = len(node_list) - total_edges = len(edge_list) - - # 统计节点类型 - entity_nodes = 0 - paragraph_nodes = 0 - for node_id in node_list: - try: - node_data = graph[node_id] - node_type = node_data["type"] if "type" in node_data else "ent" - if node_type == "ent": - entity_nodes += 1 - elif node_type == "pg": - paragraph_nodes += 1 - except Exception: - continue - - # 计算平均连接数 - avg_connections = (total_edges * 2) / total_nodes if total_nodes > 0 else 0.0 - - return KnowledgeStats( - total_nodes=total_nodes, - total_edges=total_edges, - entity_nodes=entity_nodes, - paragraph_nodes=paragraph_nodes, - avg_connections=round(avg_connections, 2), - ) - - except Exception as e: - logger.error(f"获取统计信息失败: {e}", exc_info=True) - return KnowledgeStats(total_nodes=0, total_edges=0, entity_nodes=0, paragraph_nodes=0, avg_connections=0.0) - - -@router.get("/search", response_model=List[KnowledgeNode]) -async def search_knowledge_node(query: str = Query(..., min_length=1), _auth: bool = Depends(require_auth)): - """搜索知识节点 - - Args: - query: 搜索关键词 - - Returns: - List[KnowledgeNode]: 匹配的节点列表 - """ - try: - kg_manager = _load_kg_manager() - if kg_manager is None or kg_manager.graph is None: - return [] - - graph = kg_manager.graph - node_list = graph.get_node_list() - results = [] - query_lower = query.lower() - - # 在节点内容中搜索 - for node_id in node_list: - try: - node_data = graph[node_id] - content = node_data["content"] if "content" in node_data else node_id - node_type = "entity" if ("type" in node_data and node_data["type"] == "ent") else "paragraph" - - if query_lower in content.lower() or query_lower in node_id.lower(): - create_time = node_data["create_time"] if "create_time" in node_data else None - results.append(KnowledgeNode(id=node_id, type=node_type, content=content, create_time=create_time)) - except Exception: - continue - - logger.info(f"搜索 '{query}' 找到 {len(results)} 个节点") - return results[:50] # 限制返回数量 - - except Exception as e: - logger.error(f"搜索节点失败: {e}", exc_info=True) - return [] diff --git a/src/webui/log_broadcaster.py b/src/webui/log_broadcaster.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/webui/logs_routes.py b/src/webui/logs_routes.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/webui/logs_ws.py b/src/webui/logs_ws.py deleted file mode 100644 index 5ae92189..00000000 --- a/src/webui/logs_ws.py +++ /dev/null @@ -1,177 +0,0 @@ -"""WebSocket 日志推送模块""" - -from fastapi import APIRouter, WebSocket, WebSocketDisconnect, Query -from typing import Set, Optional -import json -from pathlib import Path -from src.common.logger import get_logger -from src.webui.token_manager import get_token_manager -from src.webui.ws_auth import verify_ws_token - -logger = get_logger("webui.logs_ws") -router = APIRouter() - -# 全局 WebSocket 连接池 -active_connections: Set[WebSocket] = set() - - -def load_recent_logs(limit: int = 100) -> list[dict]: - """从日志文件中加载最近的日志 - - Args: - limit: 返回的最大日志条数 - - Returns: - 日志列表 - """ - logs = [] - log_dir = Path("logs") - - if not log_dir.exists(): - return logs - - # 获取所有日志文件,按修改时间排序 - log_files = sorted(log_dir.glob("app_*.log.jsonl"), key=lambda f: f.stat().st_mtime, reverse=True) - - # 用于生成唯一 ID 的计数器 - log_counter = 0 - - # 从最新的文件开始读取 - for log_file in log_files: - if len(logs) >= limit: - break - - try: - with open(log_file, "r", encoding="utf-8") as f: - lines = f.readlines() - # 从文件末尾开始读取 - for line in reversed(lines): - if len(logs) >= limit: - break - try: - log_entry = json.loads(line.strip()) - # 转换为前端期望的格式 - # 使用时间戳 + 计数器生成唯一 ID - timestamp_id = ( - log_entry.get("timestamp", "0").replace("-", "").replace(" ", "").replace(":", "") - ) - formatted_log = { - "id": f"{timestamp_id}_{log_counter}", - "timestamp": log_entry.get("timestamp", ""), - "level": log_entry.get("level", "INFO").upper(), - "module": log_entry.get("logger_name", ""), - "message": log_entry.get("event", ""), - } - logs.append(formatted_log) - log_counter += 1 - except (json.JSONDecodeError, KeyError): - continue - except Exception as e: - logger.error(f"读取日志文件失败 {log_file}: {e}") - continue - - # 反转列表,使其按时间顺序排列(旧到新) - return list(reversed(logs)) - - -@router.websocket("/ws/logs") -async def websocket_logs(websocket: WebSocket, token: Optional[str] = Query(None)): - """WebSocket 日志推送端点 - - 客户端连接后会持续接收服务器端的日志消息 - 支持三种认证方式(按优先级): - 1. query 参数 token(推荐,通过 /api/webui/ws-token 获取临时 token) - 2. Cookie 中的 maibot_session - 3. 直接使用 session token(兼容) - - 示例:ws://host/ws/logs?token=xxx - """ - is_authenticated = False - - # 方式 1: 尝试验证临时 WebSocket token(推荐方式) - if token and verify_ws_token(token): - is_authenticated = True - logger.debug("WebSocket 使用临时 token 认证成功") - - # 方式 2: 尝试从 Cookie 获取 session token - if not is_authenticated: - cookie_token = websocket.cookies.get("maibot_session") - if cookie_token: - token_manager = get_token_manager() - if token_manager.verify_token(cookie_token): - is_authenticated = True - logger.debug("WebSocket 使用 Cookie 认证成功") - - # 方式 3: 尝试直接验证 query 参数作为 session token(兼容旧方式) - if not is_authenticated and token: - token_manager = get_token_manager() - if token_manager.verify_token(token): - is_authenticated = True - logger.debug("WebSocket 使用 session token 认证成功") - - if not is_authenticated: - logger.warning("WebSocket 连接被拒绝:认证失败") - await websocket.close(code=4001, reason="认证失败,请重新登录") - return - - await websocket.accept() - active_connections.add(websocket) - logger.info(f"📡 WebSocket 客户端已连接(已认证),当前连接数: {len(active_connections)}") - - # 连接建立后,立即发送历史日志 - try: - recent_logs = load_recent_logs(limit=100) - logger.info(f"发送 {len(recent_logs)} 条历史日志到客户端") - - for log_entry in recent_logs: - await websocket.send_text(json.dumps(log_entry, ensure_ascii=False)) - except Exception as e: - logger.error(f"发送历史日志失败: {e}") - - try: - # 保持连接,等待客户端消息或断开 - while True: - # 接收客户端消息(用于心跳或控制指令) - data = await websocket.receive_text() - - # 可以处理客户端的控制消息,例如: - # - "ping" -> 心跳检测 - # - {"filter": "ERROR"} -> 设置日志级别过滤 - if data == "ping": - await websocket.send_text("pong") - - except WebSocketDisconnect: - active_connections.discard(websocket) - logger.info(f"📡 WebSocket 客户端已断开,当前连接数: {len(active_connections)}") - except Exception as e: - logger.error(f"❌ WebSocket 错误: {e}") - active_connections.discard(websocket) - - -async def broadcast_log(log_data: dict): - """广播日志到所有连接的 WebSocket 客户端 - - Args: - log_data: 日志数据字典 - """ - if not active_connections: - return - - # 格式化为 JSON - message = json.dumps(log_data, ensure_ascii=False) - - # 记录需要断开的连接 - disconnected = set() - - # 广播到所有客户端 - for connection in active_connections: - try: - await connection.send_text(message) - except Exception: - # 发送失败,标记为断开 - disconnected.add(connection) - - # 清理断开的连接 - if disconnected: - active_connections.difference_update(disconnected) - logger.debug(f"清理了 {len(disconnected)} 个断开的 WebSocket 连接") diff --git a/src/webui/model_routes.py b/src/webui/model_routes.py deleted file mode 100644 index a84241b9..00000000 --- a/src/webui/model_routes.py +++ /dev/null @@ -1,383 +0,0 @@ -""" -模型列表获取API路由 - -提供从各个 AI 厂商 API 获取可用模型列表的代理接口 -""" - -import os -import httpx -from fastapi import APIRouter, HTTPException, Query, Depends, Cookie, Header -from typing import Optional -import tomlkit - -from src.common.logger import get_logger -from src.config.config import CONFIG_DIR -from src.webui.auth import verify_auth_token_from_cookie_or_header - -logger = get_logger("webui") - -router = APIRouter(prefix="/models", tags=["models"]) - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -# 模型获取器配置 -MODEL_FETCHER_CONFIG = { - # OpenAI 兼容格式的提供商 - "openai": { - "endpoint": "/models", - "parser": "openai", - }, - # Gemini 格式 - "gemini": { - "endpoint": "/models", - "parser": "gemini", - }, -} - - -def _normalize_url(url: str) -> str: - """规范化 URL(去掉尾部斜杠)""" - if not url: - return "" - return url.rstrip("/") - - -def _parse_openai_response(data: dict) -> list[dict]: - """ - 解析 OpenAI 格式的模型列表响应 - - 格式: { "data": [{ "id": "gpt-4", "object": "model", ... }] } - """ - models = [] - if "data" in data and isinstance(data["data"], list): - for model in data["data"]: - if isinstance(model, dict) and "id" in model: - models.append( - { - "id": model["id"], - "name": model.get("name") or model["id"], - "owned_by": model.get("owned_by", ""), - } - ) - return models - - -def _parse_gemini_response(data: dict) -> list[dict]: - """ - 解析 Gemini 格式的模型列表响应 - - 格式: { "models": [{ "name": "models/gemini-pro", "displayName": "Gemini Pro", ... }] } - """ - models = [] - if "models" in data and isinstance(data["models"], list): - for model in data["models"]: - if isinstance(model, dict) and "name" in model: - # Gemini 的 name 格式是 "models/gemini-pro",我们只取后面部分 - model_id = model["name"] - if model_id.startswith("models/"): - model_id = model_id[7:] # 去掉 "models/" 前缀 - models.append( - { - "id": model_id, - "name": model.get("displayName") or model_id, - "owned_by": "google", - } - ) - return models - - -async def _fetch_models_from_provider( - base_url: str, - api_key: str, - endpoint: str, - parser: str, - client_type: str = "openai", -) -> list[dict]: - """ - 从提供商 API 获取模型列表 - - Args: - base_url: 提供商的基础 URL - api_key: API 密钥 - endpoint: 获取模型列表的端点 - parser: 响应解析器类型 ('openai' | 'gemini') - client_type: 客户端类型 ('openai' | 'gemini') - - Returns: - 模型列表 - """ - url = f"{_normalize_url(base_url)}{endpoint}" - - # 根据客户端类型设置请求头 - headers = {} - params = {} - - if client_type == "gemini": - # Gemini 使用 URL 参数传递 API Key - params["key"] = api_key - else: - # OpenAI 兼容格式使用 Authorization 头 - headers["Authorization"] = f"Bearer {api_key}" - - try: - async with httpx.AsyncClient(timeout=30.0) as client: - response = await client.get(url, headers=headers, params=params) - response.raise_for_status() - data = response.json() - except httpx.TimeoutException as e: - raise HTTPException(status_code=504, detail="请求超时,请稍后重试") from e - except httpx.HTTPStatusError as e: - # 注意:使用 502 Bad Gateway 而不是原始的 401/403, - # 因为前端的 fetchWithAuth 会把 401 当作 WebUI 认证失败处理 - if e.response.status_code == 401: - raise HTTPException(status_code=502, detail="API Key 无效或已过期") from e - elif e.response.status_code == 403: - raise HTTPException(status_code=502, detail="没有权限访问模型列表,请检查 API Key 权限") from e - elif e.response.status_code == 404: - raise HTTPException(status_code=502, detail="该提供商不支持获取模型列表") from e - else: - raise HTTPException( - status_code=502, detail=f"上游服务请求失败 ({e.response.status_code}): {e.response.text[:200]}" - ) from e - except Exception as e: - logger.error(f"获取模型列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取模型列表失败: {str(e)}") from e - - # 根据解析器类型解析响应 - if parser == "openai": - return _parse_openai_response(data) - elif parser == "gemini": - return _parse_gemini_response(data) - else: - raise HTTPException(status_code=400, detail=f"不支持的解析器类型: {parser}") - - -def _get_provider_config(provider_name: str) -> Optional[dict]: - """ - 从 model_config.toml 获取指定提供商的配置 - - Args: - provider_name: 提供商名称 - - Returns: - 提供商配置,如果未找到则返回 None - """ - config_path = os.path.join(CONFIG_DIR, "model_config.toml") - if not os.path.exists(config_path): - return None - - try: - with open(config_path, "r", encoding="utf-8") as f: - config_data = tomlkit.load(f) - - providers = config_data.get("api_providers", []) - for provider in providers: - if provider.get("name") == provider_name: - return dict(provider) - - return None - except Exception as e: - logger.error(f"读取提供商配置失败: {e}") - return None - - -@router.get("/list") -async def get_provider_models( - provider_name: str = Query(..., description="提供商名称"), - parser: str = Query("openai", description="响应解析器类型 (openai | gemini)"), - endpoint: str = Query("/models", description="获取模型列表的端点"), - _auth: bool = Depends(require_auth), -): - """ - 获取指定提供商的可用模型列表 - - 通过提供商名称查找配置,然后请求对应的模型列表端点 - """ - # 获取提供商配置 - provider_config = _get_provider_config(provider_name) - if not provider_config: - raise HTTPException(status_code=404, detail=f"未找到提供商: {provider_name}") - - base_url = provider_config.get("base_url") - api_key = provider_config.get("api_key") - client_type = provider_config.get("client_type", "openai") - - if not base_url: - raise HTTPException(status_code=400, detail="提供商配置缺少 base_url") - if not api_key: - raise HTTPException(status_code=400, detail="提供商配置缺少 api_key") - - # 获取模型列表 - models = await _fetch_models_from_provider( - base_url=base_url, - api_key=api_key, - endpoint=endpoint, - parser=parser, - client_type=client_type, - ) - - return { - "success": True, - "models": models, - "provider": provider_name, - "count": len(models), - } - - -@router.get("/list-by-url") -async def get_models_by_url( - base_url: str = Query(..., description="提供商的基础 URL"), - api_key: str = Query(..., description="API Key"), - parser: str = Query("openai", description="响应解析器类型 (openai | gemini)"), - endpoint: str = Query("/models", description="获取模型列表的端点"), - client_type: str = Query("openai", description="客户端类型 (openai | gemini)"), - _auth: bool = Depends(require_auth), -): - """ - 通过 URL 直接获取模型列表(用于自定义提供商) - """ - models = await _fetch_models_from_provider( - base_url=base_url, - api_key=api_key, - endpoint=endpoint, - parser=parser, - client_type=client_type, - ) - - return { - "success": True, - "models": models, - "count": len(models), - } - - -@router.get("/test-connection") -async def test_provider_connection( - base_url: str = Query(..., description="提供商的基础 URL"), - api_key: Optional[str] = Query(None, description="API Key(可选,用于验证 Key 有效性)"), - _auth: bool = Depends(require_auth), -): - """ - 测试提供商连接状态 - - 分两步测试: - 1. 网络连通性测试:向 base_url 发送请求,检查是否能连接 - 2. API Key 验证(可选):如果提供了 api_key,尝试获取模型列表验证 Key 是否有效 - - 返回: - - network_ok: 网络是否连通 - - api_key_valid: API Key 是否有效(仅在提供 api_key 时返回) - - latency_ms: 响应延迟(毫秒) - - error: 错误信息(如果有) - """ - import time - - base_url = _normalize_url(base_url) - if not base_url: - raise HTTPException(status_code=400, detail="base_url 不能为空") - - result = { - "network_ok": False, - "api_key_valid": None, - "latency_ms": None, - "error": None, - "http_status": None, - } - - # 第一步:测试网络连通性 - try: - start_time = time.time() - async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client: - # 尝试 GET 请求 base_url(不需要 API Key) - response = await client.get(base_url) - latency = (time.time() - start_time) * 1000 - - result["network_ok"] = True - result["latency_ms"] = round(latency, 2) - result["http_status"] = response.status_code - - except httpx.ConnectError as e: - result["error"] = f"连接失败:无法连接到服务器 ({str(e)})" - return result - except httpx.TimeoutException: - result["error"] = "连接超时:服务器响应时间过长" - return result - except httpx.RequestError as e: - result["error"] = f"请求错误:{str(e)}" - return result - except Exception as e: - result["error"] = f"未知错误:{str(e)}" - return result - - # 第二步:如果提供了 API Key,验证其有效性 - if api_key: - try: - start_time = time.time() - async with httpx.AsyncClient(timeout=15.0, follow_redirects=True) as client: - headers = { - "Authorization": f"Bearer {api_key}", - "Content-Type": "application/json", - } - # 尝试获取模型列表 - models_url = f"{base_url}/models" - response = await client.get(models_url, headers=headers) - - if response.status_code == 200: - result["api_key_valid"] = True - elif response.status_code in (401, 403): - result["api_key_valid"] = False - result["error"] = "API Key 无效或已过期" - else: - # 其他状态码,可能是端点不支持,但 Key 可能是有效的 - result["api_key_valid"] = None - - except Exception as e: - # API Key 验证失败不影响网络连通性结果 - logger.warning(f"API Key 验证失败: {e}") - result["api_key_valid"] = None - - return result - - -@router.post("/test-connection-by-name") -async def test_provider_connection_by_name( - provider_name: str = Query(..., description="提供商名称"), - _auth: bool = Depends(require_auth), -): - """ - 通过提供商名称测试连接(从配置文件读取信息) - """ - # 读取配置文件 - model_config_path = os.path.join(CONFIG_DIR, "model_config.toml") - if not os.path.exists(model_config_path): - raise HTTPException(status_code=404, detail="配置文件不存在") - - with open(model_config_path, "r", encoding="utf-8") as f: - config = tomlkit.load(f) - - # 查找提供商 - providers = config.get("api_providers", []) - provider = None - for p in providers: - if p.get("name") == provider_name: - provider = p - break - - if not provider: - raise HTTPException(status_code=404, detail=f"未找到提供商: {provider_name}") - - base_url = provider.get("base_url", "") - api_key = provider.get("api_key", "") - - if not base_url: - raise HTTPException(status_code=400, detail="提供商配置缺少 base_url") - - # 调用测试接口 - return await test_provider_connection(base_url=base_url, api_key=api_key if api_key else None) diff --git a/src/webui/person_routes.py b/src/webui/person_routes.py deleted file mode 100644 index 9881d44e..00000000 --- a/src/webui/person_routes.py +++ /dev/null @@ -1,416 +0,0 @@ -"""人物信息管理 API 路由""" - -from fastapi import APIRouter, HTTPException, Header, Query, Cookie -from pydantic import BaseModel -from typing import Optional, List, Dict -from src.common.logger import get_logger -from src.common.database.database_model import PersonInfo -from .auth import verify_auth_token_from_cookie_or_header -import json -import time - -logger = get_logger("webui.person") - -# 创建路由器 -router = APIRouter(prefix="/person", tags=["Person"]) - - -class PersonInfoResponse(BaseModel): - """人物信息响应""" - - id: int - is_known: bool - person_id: str - person_name: Optional[str] - name_reason: Optional[str] - platform: str - user_id: str - nickname: Optional[str] - group_nick_name: Optional[List[Dict[str, str]]] # 解析后的 JSON - memory_points: Optional[str] - know_times: Optional[float] - know_since: Optional[float] - last_know: Optional[float] - - -class PersonListResponse(BaseModel): - """人物列表响应""" - - success: bool - total: int - page: int - page_size: int - data: List[PersonInfoResponse] - - -class PersonDetailResponse(BaseModel): - """人物详情响应""" - - success: bool - data: PersonInfoResponse - - -class PersonUpdateRequest(BaseModel): - """人物信息更新请求""" - - person_name: Optional[str] = None - name_reason: Optional[str] = None - nickname: Optional[str] = None - memory_points: Optional[str] = None - is_known: Optional[bool] = None - - -class PersonUpdateResponse(BaseModel): - """人物信息更新响应""" - - success: bool - message: str - data: Optional[PersonInfoResponse] = None - - -class PersonDeleteResponse(BaseModel): - """人物删除响应""" - - success: bool - message: str - - -class BatchDeleteRequest(BaseModel): - """批量删除请求""" - - person_ids: List[str] - - -class BatchDeleteResponse(BaseModel): - """批量删除响应""" - - success: bool - message: str - deleted_count: int - failed_count: int - failed_ids: List[str] = [] - - -def verify_auth_token( - maibot_session: Optional[str] = None, - authorization: Optional[str] = None, -) -> bool: - """验证认证 Token,支持 Cookie 和 Header""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -def parse_group_nick_name(group_nick_name_str: Optional[str]) -> Optional[List[Dict[str, str]]]: - """解析群昵称 JSON 字符串""" - if not group_nick_name_str: - return None - try: - return json.loads(group_nick_name_str) - except (json.JSONDecodeError, TypeError): - return None - - -def person_to_response(person: PersonInfo) -> PersonInfoResponse: - """将 PersonInfo 模型转换为响应对象""" - return PersonInfoResponse( - id=person.id, - is_known=person.is_known, - person_id=person.person_id, - person_name=person.person_name, - name_reason=person.name_reason, - platform=person.platform, - user_id=person.user_id, - nickname=person.nickname, - group_nick_name=parse_group_nick_name(person.group_nick_name), - memory_points=person.memory_points, - know_times=person.know_times, - know_since=person.know_since, - last_know=person.last_know, - ) - - -@router.get("/list", response_model=PersonListResponse) -async def get_person_list( - page: int = Query(1, ge=1, description="页码"), - page_size: int = Query(20, ge=1, le=100, description="每页数量"), - search: Optional[str] = Query(None, description="搜索关键词"), - is_known: Optional[bool] = Query(None, description="是否已认识筛选"), - platform: Optional[str] = Query(None, description="平台筛选"), - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取人物信息列表 - - Args: - page: 页码 (从 1 开始) - page_size: 每页数量 (1-100) - search: 搜索关键词 (匹配 person_name, nickname, user_id) - is_known: 是否已认识筛选 - platform: 平台筛选 - authorization: Authorization header - - Returns: - 人物信息列表 - """ - try: - verify_auth_token(maibot_session, authorization) - - # 构建查询 - query = PersonInfo.select() - - # 搜索过滤 - if search: - query = query.where( - (PersonInfo.person_name.contains(search)) - | (PersonInfo.nickname.contains(search)) - | (PersonInfo.user_id.contains(search)) - ) - - # 已认识状态过滤 - if is_known is not None: - query = query.where(PersonInfo.is_known == is_known) - - # 平台过滤 - if platform: - query = query.where(PersonInfo.platform == platform) - - # 排序:最后更新时间倒序(NULL 值放在最后) - # Peewee 不支持 nulls_last,使用 CASE WHEN 来实现 - from peewee import Case - - query = query.order_by(Case(None, [(PersonInfo.last_know.is_null(), 1)], 0), PersonInfo.last_know.desc()) - - # 获取总数 - total = query.count() - - # 分页 - offset = (page - 1) * page_size - persons = query.offset(offset).limit(page_size) - - # 转换为响应对象 - data = [person_to_response(person) for person in persons] - - return PersonListResponse(success=True, total=total, page=page, page_size=page_size, data=data) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取人物列表失败: {e}") - raise HTTPException(status_code=500, detail=f"获取人物列表失败: {str(e)}") from e - - -@router.get("/{person_id}", response_model=PersonDetailResponse) -async def get_person_detail( - person_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 获取人物详细信息 - - Args: - person_id: 人物唯一 ID - authorization: Authorization header - - Returns: - 人物详细信息 - """ - try: - verify_auth_token(maibot_session, authorization) - - person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - - if not person: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {person_id} 的人物信息") - - return PersonDetailResponse(success=True, data=person_to_response(person)) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取人物详情失败: {e}") - raise HTTPException(status_code=500, detail=f"获取人物详情失败: {str(e)}") from e - - -@router.patch("/{person_id}", response_model=PersonUpdateResponse) -async def update_person( - person_id: str, - request: PersonUpdateRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 增量更新人物信息(只更新提供的字段) - - Args: - person_id: 人物唯一 ID - request: 更新请求(只包含需要更新的字段) - authorization: Authorization header - - Returns: - 更新结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - - if not person: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {person_id} 的人物信息") - - # 只更新提供的字段 - update_data = request.model_dump(exclude_unset=True) - - if not update_data: - raise HTTPException(status_code=400, detail="未提供任何需要更新的字段") - - # 更新最后修改时间 - update_data["last_know"] = time.time() - - # 执行更新 - for field, value in update_data.items(): - setattr(person, field, value) - - person.save() - - logger.info(f"人物信息已更新: {person_id}, 字段: {list(update_data.keys())}") - - return PersonUpdateResponse( - success=True, message=f"成功更新 {len(update_data)} 个字段", data=person_to_response(person) - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"更新人物信息失败: {e}") - raise HTTPException(status_code=500, detail=f"更新人物信息失败: {str(e)}") from e - - -@router.delete("/{person_id}", response_model=PersonDeleteResponse) -async def delete_person( - person_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -): - """ - 删除人物信息 - - Args: - person_id: 人物唯一 ID - authorization: Authorization header - - Returns: - 删除结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - - if not person: - raise HTTPException(status_code=404, detail=f"未找到 ID 为 {person_id} 的人物信息") - - # 记录删除信息 - person_name = person.person_name or person.nickname or person.user_id - - # 执行删除 - person.delete_instance() - - logger.info(f"人物信息已删除: {person_id} ({person_name})") - - return PersonDeleteResponse(success=True, message=f"成功删除人物信息: {person_name}") - - except HTTPException: - raise - except Exception as e: - logger.exception(f"删除人物信息失败: {e}") - raise HTTPException(status_code=500, detail=f"删除人物信息失败: {str(e)}") from e - - -@router.get("/stats/summary") -async def get_person_stats(maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None)): - """ - 获取人物信息统计数据 - - Args: - authorization: Authorization header - - Returns: - 统计数据 - """ - try: - verify_auth_token(maibot_session, authorization) - - total = PersonInfo.select().count() - known = PersonInfo.select().where(PersonInfo.is_known).count() - unknown = total - known - - # 按平台统计 - platforms = {} - for person in PersonInfo.select(PersonInfo.platform): - platform = person.platform - platforms[platform] = platforms.get(platform, 0) + 1 - - return {"success": True, "data": {"total": total, "known": known, "unknown": unknown, "platforms": platforms}} - - except HTTPException: - raise - except Exception as e: - logger.exception(f"获取统计数据失败: {e}") - raise HTTPException(status_code=500, detail=f"获取统计数据失败: {str(e)}") from e - - -@router.post("/batch/delete", response_model=BatchDeleteResponse) -async def batch_delete_persons( - request: BatchDeleteRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 批量删除人物信息 - - Args: - request: 包含person_ids列表的请求 - authorization: Authorization header - - Returns: - 批量删除结果 - """ - try: - verify_auth_token(maibot_session, authorization) - - if not request.person_ids: - raise HTTPException(status_code=400, detail="未提供要删除的人物ID") - - deleted_count = 0 - failed_count = 0 - failed_ids = [] - - for person_id in request.person_ids: - try: - person = PersonInfo.get_or_none(PersonInfo.person_id == person_id) - if person: - person.delete_instance() - deleted_count += 1 - logger.info(f"批量删除: {person_id}") - else: - failed_count += 1 - failed_ids.append(person_id) - except Exception as e: - logger.error(f"删除 {person_id} 失败: {e}") - failed_count += 1 - failed_ids.append(person_id) - - message = f"成功删除 {deleted_count} 个人物" - if failed_count > 0: - message += f",{failed_count} 个失败" - - return BatchDeleteResponse( - success=True, - message=message, - deleted_count=deleted_count, - failed_count=failed_count, - failed_ids=failed_ids, - ) - - except HTTPException: - raise - except Exception as e: - logger.exception(f"批量删除人物信息失败: {e}") - raise HTTPException(status_code=500, detail=f"批量删除失败: {str(e)}") from e diff --git a/src/webui/plugin_progress_ws.py b/src/webui/plugin_progress_ws.py deleted file mode 100644 index 8d0a18c6..00000000 --- a/src/webui/plugin_progress_ws.py +++ /dev/null @@ -1,164 +0,0 @@ -"""WebSocket 插件加载进度推送模块""" - -from fastapi import APIRouter, WebSocket, WebSocketDisconnect, Query -from typing import Set, Dict, Any, Optional -import json -import asyncio -from src.common.logger import get_logger -from src.webui.token_manager import get_token_manager -from src.webui.ws_auth import verify_ws_token - -logger = get_logger("webui.plugin_progress") - -# 创建路由器 -router = APIRouter() - -# 全局 WebSocket 连接池 -active_connections: Set[WebSocket] = set() - -# 当前加载进度状态 -current_progress: Dict[str, Any] = { - "operation": "idle", # idle, fetch, install, uninstall, update - "stage": "idle", # idle, loading, success, error - "progress": 0, # 0-100 - "message": "", - "error": None, - "plugin_id": None, # 当前操作的插件 ID - "total_plugins": 0, - "loaded_plugins": 0, -} - - -async def broadcast_progress(progress_data: Dict[str, Any]): - """广播进度更新到所有连接的客户端""" - global current_progress - current_progress = progress_data.copy() - - if not active_connections: - return - - message = json.dumps(progress_data, ensure_ascii=False) - disconnected = set() - - for websocket in active_connections: - try: - await websocket.send_text(message) - except Exception as e: - logger.error(f"发送进度更新失败: {e}") - disconnected.add(websocket) - - # 移除断开的连接 - for websocket in disconnected: - active_connections.discard(websocket) - - -async def update_progress( - stage: str, - progress: int, - message: str, - operation: str = "fetch", - error: str = None, - plugin_id: str = None, - total_plugins: int = 0, - loaded_plugins: int = 0, -): - """更新并广播进度 - - Args: - stage: 阶段 (idle, loading, success, error) - progress: 进度百分比 (0-100) - message: 当前消息 - operation: 操作类型 (fetch, install, uninstall, update) - error: 错误信息(可选) - plugin_id: 当前操作的插件 ID - total_plugins: 总插件数 - loaded_plugins: 已加载插件数 - """ - progress_data = { - "operation": operation, - "stage": stage, - "progress": progress, - "message": message, - "error": error, - "plugin_id": plugin_id, - "total_plugins": total_plugins, - "loaded_plugins": loaded_plugins, - "timestamp": asyncio.get_event_loop().time(), - } - - await broadcast_progress(progress_data) - logger.debug(f"进度更新: [{operation}] {stage} - {progress}% - {message}") - - -@router.websocket("/ws/plugin-progress") -async def websocket_plugin_progress(websocket: WebSocket, token: Optional[str] = Query(None)): - """WebSocket 插件加载进度推送端点 - - 客户端连接后会立即收到当前进度状态 - 支持三种认证方式(按优先级): - 1. query 参数 token(推荐,通过 /api/webui/ws-token 获取临时 token) - 2. Cookie 中的 maibot_session - 3. 直接使用 session token(兼容) - - 示例:ws://host/ws/plugin-progress?token=xxx - """ - is_authenticated = False - - # 方式 1: 尝试验证临时 WebSocket token(推荐方式) - if token and verify_ws_token(token): - is_authenticated = True - logger.debug("插件进度 WebSocket 使用临时 token 认证成功") - - # 方式 2: 尝试从 Cookie 获取 session token - if not is_authenticated: - cookie_token = websocket.cookies.get("maibot_session") - if cookie_token: - token_manager = get_token_manager() - if token_manager.verify_token(cookie_token): - is_authenticated = True - logger.debug("插件进度 WebSocket 使用 Cookie 认证成功") - - # 方式 3: 尝试直接验证 query 参数作为 session token(兼容旧方式) - if not is_authenticated and token: - token_manager = get_token_manager() - if token_manager.verify_token(token): - is_authenticated = True - logger.debug("插件进度 WebSocket 使用 session token 认证成功") - - if not is_authenticated: - logger.warning("插件进度 WebSocket 连接被拒绝:认证失败") - await websocket.close(code=4001, reason="认证失败,请重新登录") - return - - await websocket.accept() - active_connections.add(websocket) - logger.info(f"📡 插件进度 WebSocket 客户端已连接(已认证),当前连接数: {len(active_connections)}") - - try: - # 发送当前进度状态 - await websocket.send_text(json.dumps(current_progress, ensure_ascii=False)) - - # 保持连接并处理客户端消息 - while True: - try: - data = await websocket.receive_text() - - # 处理客户端心跳 - if data == "ping": - await websocket.send_text("pong") - - except Exception as e: - logger.error(f"处理客户端消息时出错: {e}") - break - - except WebSocketDisconnect: - active_connections.discard(websocket) - logger.info(f"📡 插件进度 WebSocket 客户端已断开,当前连接数: {len(active_connections)}") - except Exception as e: - logger.error(f"❌ WebSocket 错误: {e}") - active_connections.discard(websocket) - - -def get_progress_router() -> APIRouter: - """获取插件进度 WebSocket 路由器""" - return router diff --git a/src/webui/plugin_routes.py b/src/webui/plugin_routes.py deleted file mode 100644 index e85e1263..00000000 --- a/src/webui/plugin_routes.py +++ /dev/null @@ -1,2060 +0,0 @@ -from fastapi import APIRouter, HTTPException, Header, Cookie -from pydantic import BaseModel, Field -from typing import Optional, List, Dict, Any, get_origin -from pathlib import Path -import json -from src.common.logger import get_logger -from src.common.toml_utils import save_toml_with_format -from src.config.config import MMC_VERSION -from src.plugin_system.base.config_types import ConfigField -from .git_mirror_service import get_git_mirror_service, set_update_progress_callback -from .token_manager import get_token_manager -from .plugin_progress_ws import update_progress - -logger = get_logger("webui.plugin_routes") - -# 创建路由器 -router = APIRouter(prefix="/plugins", tags=["插件管理"]) - -# 设置进度更新回调 -set_update_progress_callback(update_progress) - - -def get_token_from_cookie_or_header( - maibot_session: Optional[str] = None, - authorization: Optional[str] = None, -) -> Optional[str]: - """从 Cookie 或 Header 获取 token""" - # 优先从 Cookie 获取 - if maibot_session: - return maibot_session - # 其次从 Header 获取 - if authorization and authorization.startswith("Bearer "): - return authorization.replace("Bearer ", "") - return None - - -def validate_safe_path(user_path: str, base_path: Path) -> Path: - """ - 验证用户提供的路径是否安全,防止路径遍历攻击 - - Args: - user_path: 用户输入的路径(相对路径) - base_path: 允许的基础目录 - - Returns: - 安全的绝对路径 - - Raises: - HTTPException: 如果检测到路径遍历攻击 - """ - # 规范化基础路径 - base_resolved = base_path.resolve() - - # 检查用户路径是否包含可疑字符 - # 禁止: .., 绝对路径开头, 空字节等 - if any(pattern in user_path for pattern in ["..", "\x00"]): - logger.warning(f"检测到可疑路径: {user_path}") - raise HTTPException(status_code=400, detail="路径包含非法字符") - - # 检查是否为绝对路径(Windows 和 Unix) - if user_path.startswith("/") or user_path.startswith("\\") or (len(user_path) > 1 and user_path[1] == ":"): - logger.warning(f"检测到绝对路径: {user_path}") - raise HTTPException(status_code=400, detail="不允许使用绝对路径") - - # 构建目标路径并解析 - target_path = (base_path / user_path).resolve() - - # 验证解析后的路径仍在基础目录内 - try: - target_path.relative_to(base_resolved) - except ValueError as e: - logger.warning(f"路径遍历攻击检测: {user_path} -> {target_path}") - raise HTTPException(status_code=400, detail="路径超出允许范围") from e - - return target_path - - -def validate_plugin_id(plugin_id: str) -> str: - """ - 验证插件 ID 格式是否安全 - - Args: - plugin_id: 插件 ID (支持 author.name 格式,允许中文) - - Returns: - 验证通过的插件 ID - - Raises: - HTTPException: 如果插件 ID 格式不安全 - """ - # 禁止空字符串 - if not plugin_id or not plugin_id.strip(): - logger.warning("非法插件 ID: 空字符串") - raise HTTPException(status_code=400, detail="插件 ID 不能为空") - - # 禁止危险字符: 路径分隔符、空字节、控制字符等 - dangerous_patterns = ["/", "\\", "\x00", "..", "\n", "\r", "\t"] - for pattern in dangerous_patterns: - if pattern in plugin_id: - logger.warning(f"非法插件 ID 格式: {plugin_id} (包含危险字符)") - raise HTTPException(status_code=400, detail="插件 ID 包含非法字符") - - # 禁止以点开头或结尾(防止隐藏文件和路径问题) - if plugin_id.startswith(".") or plugin_id.endswith("."): - logger.warning(f"非法插件 ID: {plugin_id}") - raise HTTPException(status_code=400, detail="插件 ID 不能以点开头或结尾") - - # 禁止特殊名称 - if plugin_id in (".", ".."): - logger.warning(f"非法插件 ID: {plugin_id}") - raise HTTPException(status_code=400, detail="插件 ID 不能为特殊目录名") - - return plugin_id - - -def parse_version(version_str: str) -> tuple[int, int, int]: - """ - 解析版本号字符串 - - 支持格式: - - 0.11.2 -> (0, 11, 2) - - 0.11.2.snapshot.2 -> (0, 11, 2) - - Returns: - (major, minor, patch) 三元组 - """ - # 移除 snapshot、dev、alpha、beta 等后缀(支持 - 和 . 分隔符) - import re - - # 匹配 -snapshot.X, .snapshot, -dev, .dev, -alpha, .alpha, -beta, .beta 等后缀 - base_version = re.split(r"[-.](?:snapshot|dev|alpha|beta|rc)", version_str, flags=re.IGNORECASE)[0] - - parts = base_version.split(".") - if len(parts) < 3: - # 补齐到 3 位 - parts.extend(["0"] * (3 - len(parts))) - - try: - major = int(parts[0]) - minor = int(parts[1]) - patch = int(parts[2]) - return (major, minor, patch) - except (ValueError, IndexError): - logger.warning(f"无法解析版本号: {version_str},返回默认值 (0, 0, 0)") - return (0, 0, 0) - - -# ============ 工具函数(避免在请求内重复定义) ============ - - -def _deep_merge(dst: Dict[str, Any], src: Dict[str, Any]) -> None: - """深度合并两个字典,src 的值会覆盖或合并到 dst 中。""" - for k, v in src.items(): - if k in dst and isinstance(dst[k], dict) and isinstance(v, dict): - _deep_merge(dst[k], v) - else: - dst[k] = v - - -def normalize_dotted_keys(obj: Dict[str, Any]) -> Dict[str, Any]: - """ - 将形如 {'a.b': 1} 的键展开为嵌套结构 {'a': {'b': 1}}。 - 若遇到中间节点已存在且非字典,记录日志并覆盖为字典。 - """ - result: Dict[str, Any] = {} - dotted_items = [] - - # 先处理非点号键,避免后续展开覆盖已有结构 - for k, v in obj.items(): - if "." in k: - dotted_items.append((k, v)) - else: - result[k] = normalize_dotted_keys(v) if isinstance(v, dict) else v - - # 再处理点号键 - for dotted_key, v in dotted_items: - value = normalize_dotted_keys(v) if isinstance(v, dict) else v - parts = dotted_key.split(".") - if "" in parts: - logger.warning(f"键路径包含空段: '{dotted_key}'") - parts = [p for p in parts if p] - if not parts: - logger.warning(f"忽略空键路径: '{dotted_key}'") - continue - current = result - # 中间层 - for idx, part in enumerate(parts[:-1]): - if part in current and not isinstance(current[part], dict): - path_ctx = ".".join(parts[: idx + 1]) - logger.warning(f"键冲突:{part} 已存在且非字典,覆盖为字典以展开 {dotted_key} (路径 {path_ctx})") - current[part] = {} - current = current.setdefault(part, {}) - # 最后一层 - last_part = parts[-1] - if last_part in current and isinstance(current[last_part], dict) and isinstance(value, dict): - _deep_merge(current[last_part], value) - else: - current[last_part] = value - - return result - - -def coerce_types(schema_part: Dict[str, Any], config_part: Dict[str, Any]) -> None: - """ - 根据 schema 将配置中的类型纠正(目前只纠正 list-from-str)。 - """ - - def _is_list_type(tp: Any) -> bool: - origin = get_origin(tp) - return tp is list or origin is list - - for key, schema_val in schema_part.items(): - if key not in config_part: - continue - value = config_part[key] - if isinstance(schema_val, ConfigField): - if _is_list_type(schema_val.type) and isinstance(value, str): - config_part[key] = [item.strip() for item in value.split(",") if item.strip()] - elif isinstance(schema_val, dict) and isinstance(value, dict): - coerce_types(schema_val, value) - - -def find_plugin_instance(plugin_id: str) -> Optional[Any]: - """ - 按 plugin_id 或 plugin_name 查找已加载的插件实例。 - 局部导入 plugin_manager 以规避循环依赖。 - """ - from src.plugin_system.core.plugin_manager import plugin_manager - - for loaded_plugin_name in plugin_manager.list_loaded_plugins(): - instance = plugin_manager.get_plugin_instance(loaded_plugin_name) - if instance and (instance.plugin_name == plugin_id or instance.get_manifest_info("id", "") == plugin_id): - return instance - return None - - -# ============ 请求/响应模型 ============ - - -class FetchRawFileRequest(BaseModel): - """获取 Raw 文件请求""" - - owner: str = Field(..., description="仓库所有者", example="MaiM-with-u") - repo: str = Field(..., description="仓库名称", example="plugin-repo") - branch: str = Field(..., description="分支名称", example="main") - file_path: str = Field(..., description="文件路径", example="plugin_details.json") - mirror_id: Optional[str] = Field(None, description="指定镜像源 ID") - custom_url: Optional[str] = Field(None, description="自定义完整 URL") - - -class FetchRawFileResponse(BaseModel): - """获取 Raw 文件响应""" - - success: bool = Field(..., description="是否成功") - data: Optional[str] = Field(None, description="文件内容") - error: Optional[str] = Field(None, description="错误信息") - mirror_used: Optional[str] = Field(None, description="使用的镜像源") - attempts: int = Field(..., description="尝试次数") - url: Optional[str] = Field(None, description="实际请求的 URL") - - -class CloneRepositoryRequest(BaseModel): - """克隆仓库请求""" - - owner: str = Field(..., description="仓库所有者", example="MaiM-with-u") - repo: str = Field(..., description="仓库名称", example="plugin-repo") - target_path: str = Field(..., description="目标路径(相对于插件目录)") - branch: Optional[str] = Field(None, description="分支名称", example="main") - mirror_id: Optional[str] = Field(None, description="指定镜像源 ID") - custom_url: Optional[str] = Field(None, description="自定义克隆 URL") - depth: Optional[int] = Field(None, description="克隆深度(浅克隆)", ge=1) - - -class CloneRepositoryResponse(BaseModel): - """克隆仓库响应""" - - success: bool = Field(..., description="是否成功") - path: Optional[str] = Field(None, description="克隆路径") - error: Optional[str] = Field(None, description="错误信息") - mirror_used: Optional[str] = Field(None, description="使用的镜像源") - attempts: int = Field(..., description="尝试次数") - url: Optional[str] = Field(None, description="实际克隆的 URL") - message: Optional[str] = Field(None, description="附加信息") - - -class MirrorConfigResponse(BaseModel): - """镜像源配置响应""" - - id: str = Field(..., description="镜像源 ID") - name: str = Field(..., description="镜像源名称") - raw_prefix: str = Field(..., description="Raw 文件前缀") - clone_prefix: str = Field(..., description="克隆前缀") - enabled: bool = Field(..., description="是否启用") - priority: int = Field(..., description="优先级(数字越小优先级越高)") - - -class AvailableMirrorsResponse(BaseModel): - """可用镜像源列表响应""" - - mirrors: List[MirrorConfigResponse] = Field(..., description="镜像源列表") - default_priority: List[str] = Field(..., description="默认优先级顺序(ID 列表)") - - -class AddMirrorRequest(BaseModel): - """添加镜像源请求""" - - id: str = Field(..., description="镜像源 ID", example="custom-mirror") - name: str = Field(..., description="镜像源名称", example="自定义镜像源") - raw_prefix: str = Field(..., description="Raw 文件前缀", example="https://example.com/raw") - clone_prefix: str = Field(..., description="克隆前缀", example="https://example.com/clone") - enabled: bool = Field(True, description="是否启用") - priority: Optional[int] = Field(None, description="优先级") - - -class UpdateMirrorRequest(BaseModel): - """更新镜像源请求""" - - name: Optional[str] = Field(None, description="镜像源名称") - raw_prefix: Optional[str] = Field(None, description="Raw 文件前缀") - clone_prefix: Optional[str] = Field(None, description="克隆前缀") - enabled: Optional[bool] = Field(None, description="是否启用") - priority: Optional[int] = Field(None, description="优先级") - - -class GitStatusResponse(BaseModel): - """Git 安装状态响应""" - - installed: bool = Field(..., description="是否已安装 Git") - version: Optional[str] = Field(None, description="Git 版本号") - path: Optional[str] = Field(None, description="Git 可执行文件路径") - error: Optional[str] = Field(None, description="错误信息") - - -class InstallPluginRequest(BaseModel): - """安装插件请求""" - - plugin_id: str = Field(..., description="插件 ID") - repository_url: str = Field(..., description="插件仓库 URL") - branch: Optional[str] = Field("main", description="分支名称") - mirror_id: Optional[str] = Field(None, description="指定镜像源 ID") - - -class VersionResponse(BaseModel): - """麦麦版本响应""" - - version: str = Field(..., description="麦麦版本号") - version_major: int = Field(..., description="主版本号") - version_minor: int = Field(..., description="次版本号") - version_patch: int = Field(..., description="补丁版本号") - - -class UninstallPluginRequest(BaseModel): - """卸载插件请求""" - - plugin_id: str = Field(..., description="插件 ID") - - -class UpdatePluginRequest(BaseModel): - """更新插件请求""" - - plugin_id: str = Field(..., description="插件 ID") - repository_url: str = Field(..., description="插件仓库 URL") - branch: Optional[str] = Field("main", description="分支名称") - mirror_id: Optional[str] = Field(None, description="指定镜像源 ID") - - -# ============ API 路由 ============ - - -@router.get("/version", response_model=VersionResponse) -async def get_maimai_version() -> VersionResponse: - """ - 获取麦麦版本信息 - - 此接口无需认证,用于前端检查插件兼容性 - """ - major, minor, patch = parse_version(MMC_VERSION) - - return VersionResponse(version=MMC_VERSION, version_major=major, version_minor=minor, version_patch=patch) - - -@router.get("/git-status", response_model=GitStatusResponse) -async def check_git_status() -> GitStatusResponse: - """ - 检查本机 Git 安装状态 - - 此接口无需认证,用于前端快速检测是否可以使用插件安装功能 - """ - service = get_git_mirror_service() - result = service.check_git_installed() - - return GitStatusResponse(**result) - - -@router.get("/mirrors", response_model=AvailableMirrorsResponse) -async def get_available_mirrors( - maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> AvailableMirrorsResponse: - """ - 获取所有可用的镜像源配置 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - service = get_git_mirror_service() - config = service.get_mirror_config() - - all_mirrors = config.get_all_mirrors() - mirrors = [ - MirrorConfigResponse( - id=m["id"], - name=m["name"], - raw_prefix=m["raw_prefix"], - clone_prefix=m["clone_prefix"], - enabled=m["enabled"], - priority=m["priority"], - ) - for m in all_mirrors - ] - - return AvailableMirrorsResponse(mirrors=mirrors, default_priority=config.get_default_priority_list()) - - -@router.post("/mirrors", response_model=MirrorConfigResponse) -async def add_mirror( - request: AddMirrorRequest, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> MirrorConfigResponse: - """ - 添加新的镜像源 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - try: - service = get_git_mirror_service() - config = service.get_mirror_config() - - mirror = config.add_mirror( - mirror_id=request.id, - name=request.name, - raw_prefix=request.raw_prefix, - clone_prefix=request.clone_prefix, - enabled=request.enabled, - priority=request.priority, - ) - - return MirrorConfigResponse( - id=mirror["id"], - name=mirror["name"], - raw_prefix=mirror["raw_prefix"], - clone_prefix=mirror["clone_prefix"], - enabled=mirror["enabled"], - priority=mirror["priority"], - ) - except ValueError as e: - raise HTTPException(status_code=400, detail=str(e)) from e - except Exception as e: - logger.error(f"添加镜像源失败: {e}") - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.put("/mirrors/{mirror_id}", response_model=MirrorConfigResponse) -async def update_mirror( - mirror_id: str, - request: UpdateMirrorRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> MirrorConfigResponse: - """ - 更新镜像源配置 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - try: - service = get_git_mirror_service() - config = service.get_mirror_config() - - mirror = config.update_mirror( - mirror_id=mirror_id, - name=request.name, - raw_prefix=request.raw_prefix, - clone_prefix=request.clone_prefix, - enabled=request.enabled, - priority=request.priority, - ) - - if not mirror: - raise HTTPException(status_code=404, detail=f"未找到镜像源: {mirror_id}") - - return MirrorConfigResponse( - id=mirror["id"], - name=mirror["name"], - raw_prefix=mirror["raw_prefix"], - clone_prefix=mirror["clone_prefix"], - enabled=mirror["enabled"], - priority=mirror["priority"], - ) - except HTTPException: - raise - except Exception as e: - logger.error(f"更新镜像源失败: {e}") - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.delete("/mirrors/{mirror_id}") -async def delete_mirror( - mirror_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 删除镜像源 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - service = get_git_mirror_service() - config = service.get_mirror_config() - - success = config.delete_mirror(mirror_id) - - if not success: - raise HTTPException(status_code=404, detail=f"未找到镜像源: {mirror_id}") - - return {"success": True, "message": f"已删除镜像源: {mirror_id}"} - - -@router.post("/fetch-raw", response_model=FetchRawFileResponse) -async def fetch_raw_file( - request: FetchRawFileRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> FetchRawFileResponse: - """ - 获取 GitHub 仓库的 Raw 文件内容 - - 支持多镜像源自动切换和错误重试 - - 需要认证才能访问,防止被滥用作为 SSRF 跳板 - """ - # Token 验证(强制) - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"收到获取 Raw 文件请求: {request.owner}/{request.repo}/{request.branch}/{request.file_path}") - - # 发送开始加载进度 - await update_progress( - stage="loading", - progress=10, - message=f"正在获取插件列表: {request.file_path}", - total_plugins=0, - loaded_plugins=0, - ) - - try: - service = get_git_mirror_service() - - # git_mirror_service 会自动推送 30%-70% 的详细镜像源尝试进度 - result = await service.fetch_raw_file( - owner=request.owner, - repo=request.repo, - branch=request.branch, - file_path=request.file_path, - mirror_id=request.mirror_id, - custom_url=request.custom_url, - ) - - if result.get("success"): - # 更新进度:成功获取 - await update_progress( - stage="loading", progress=70, message="正在解析插件数据...", total_plugins=0, loaded_plugins=0 - ) - - # 尝试解析插件数量 - try: - import json - - data = json.loads(result.get("data", "[]")) - total = len(data) if isinstance(data, list) else 0 - - # 发送成功状态 - await update_progress( - stage="success", - progress=100, - message=f"成功加载 {total} 个插件", - total_plugins=total, - loaded_plugins=total, - ) - except Exception: - # 如果解析失败,仍然发送成功状态 - await update_progress( - stage="success", progress=100, message="加载完成", total_plugins=0, loaded_plugins=0 - ) - - return FetchRawFileResponse(**result) - - except Exception as e: - logger.error(f"获取 Raw 文件失败: {e}") - - # 发送错误进度 - await update_progress( - stage="error", progress=0, message="加载失败", error=str(e), total_plugins=0, loaded_plugins=0 - ) - - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.post("/clone", response_model=CloneRepositoryResponse) -async def clone_repository( - request: CloneRepositoryRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> CloneRepositoryResponse: - """ - 克隆 GitHub 仓库到本地 - - 支持多镜像源自动切换和错误重试 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"收到克隆仓库请求: {request.owner}/{request.repo} -> {request.target_path}") - - try: - # 验证 target_path 的安全性,防止路径遍历攻击 - base_plugin_path = Path("./plugins").resolve() - base_plugin_path.mkdir(exist_ok=True) - target_path = validate_safe_path(request.target_path, base_plugin_path) - - service = get_git_mirror_service() - result = await service.clone_repository( - owner=request.owner, - repo=request.repo, - target_path=target_path, - branch=request.branch, - mirror_id=request.mirror_id, - custom_url=request.custom_url, - depth=request.depth, - ) - - return CloneRepositoryResponse(**result) - - except Exception as e: - logger.error(f"克隆仓库失败: {e}") - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.post("/install") -async def install_plugin( - request: InstallPluginRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> Dict[str, Any]: - """ - 安装插件 - - 从 Git 仓库克隆插件到本地插件目录 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"收到安装插件请求: {request.plugin_id}") - - try: - # 验证插件 ID 格式安全性 - plugin_id = validate_plugin_id(request.plugin_id) - - # 推送进度:开始安装 - await update_progress( - stage="loading", - progress=5, - message=f"开始安装插件: {plugin_id}", - operation="install", - plugin_id=plugin_id, - ) - - # 1. 解析仓库 URL - # repository_url 格式: https://github.com/owner/repo - repo_url = request.repository_url.rstrip("/") - if repo_url.endswith(".git"): - repo_url = repo_url[:-4] - - parts = repo_url.split("/") - if len(parts) < 2: - raise HTTPException(status_code=400, detail="无效的仓库 URL") - - owner = parts[-2] - repo = parts[-1] - - await update_progress( - stage="loading", - progress=10, - message=f"解析仓库信息: {owner}/{repo}", - operation="install", - plugin_id=plugin_id, - ) - - # 2. 确定插件安装路径 - plugins_dir = Path("plugins").resolve() - plugins_dir.mkdir(exist_ok=True) - - # 将插件 ID 中的点替换为下划线作为文件夹名称(避免文件系统问题) - # 例如: SengokuCola.Mute-Plugin -> SengokuCola_Mute-Plugin - folder_name = plugin_id.replace(".", "_") - # 使用安全路径验证,防止路径遍历 - target_path = validate_safe_path(folder_name, plugins_dir) - - # 检查插件是否已安装(需要检查两种格式:新格式下划线和旧格式点) - old_format_path = plugins_dir / plugin_id - if target_path.exists() or old_format_path.exists(): - await update_progress( - stage="error", - progress=0, - message="插件已存在", - operation="install", - plugin_id=plugin_id, - error="插件已安装,请先卸载", - ) - raise HTTPException(status_code=400, detail="插件已安装") - - await update_progress( - stage="loading", - progress=15, - message=f"准备克隆到: {target_path}", - operation="install", - plugin_id=plugin_id, - ) - - # 3. 克隆仓库(这里会自动推送 20%-80% 的进度) - service = get_git_mirror_service() - - # 如果是 GitHub 仓库,使用镜像源 - if "github.com" in repo_url: - result = await service.clone_repository( - owner=owner, - repo=repo, - target_path=target_path, - branch=request.branch, - mirror_id=request.mirror_id, - depth=1, # 浅克隆,节省时间和空间 - ) - else: - # 自定义仓库,直接使用 URL - result = await service.clone_repository( - owner=owner, repo=repo, target_path=target_path, branch=request.branch, custom_url=repo_url, depth=1 - ) - - if not result.get("success"): - error_msg = result.get("error", "克隆失败") - await update_progress( - stage="error", - progress=0, - message="克隆仓库失败", - operation="install", - plugin_id=plugin_id, - error=error_msg, - ) - raise HTTPException(status_code=500, detail=error_msg) - - # 4. 验证插件完整性 - await update_progress( - stage="loading", progress=85, message="验证插件文件...", operation="install", plugin_id=plugin_id - ) - - manifest_path = target_path / "_manifest.json" - if not manifest_path.exists(): - # 清理失败的安装 - import shutil - - shutil.rmtree(target_path, ignore_errors=True) - - await update_progress( - stage="error", - progress=0, - message="插件缺少 _manifest.json", - operation="install", - plugin_id=plugin_id, - error="无效的插件格式", - ) - raise HTTPException(status_code=400, detail="无效的插件:缺少 _manifest.json") - - # 5. 读取并验证 manifest - await update_progress( - stage="loading", progress=90, message="读取插件配置...", operation="install", plugin_id=plugin_id - ) - - try: - import json as json_module - - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json_module.load(f) - - # 基本验证 - required_fields = ["manifest_version", "name", "version", "author"] - for field in required_fields: - if field not in manifest: - raise ValueError(f"缺少必需字段: {field}") - - # 将插件 ID 写入 manifest(用于后续准确识别) - # 这样即使文件夹名称改变,也能通过 manifest 准确识别插件 - manifest["id"] = plugin_id - with open(manifest_path, "w", encoding="utf-8") as f: - json_module.dump(manifest, f, ensure_ascii=False, indent=2) - - except Exception as e: - # 清理失败的安装 - import shutil - - shutil.rmtree(target_path, ignore_errors=True) - - await update_progress( - stage="error", - progress=0, - message="_manifest.json 无效", - operation="install", - plugin_id=plugin_id, - error=str(e), - ) - raise HTTPException(status_code=400, detail=f"无效的 _manifest.json: {e}") from e - - # 6. 安装成功 - await update_progress( - stage="success", - progress=100, - message=f"成功安装插件: {manifest['name']} v{manifest['version']}", - operation="install", - plugin_id=plugin_id, - ) - - return { - "success": True, - "message": "插件安装成功", - "plugin_id": plugin_id, - "plugin_name": manifest["name"], - "version": manifest["version"], - "path": str(target_path), - } - - except HTTPException: - raise - except Exception as e: - logger.error(f"安装插件失败: {e}", exc_info=True) - - await update_progress( - stage="error", - progress=0, - message="安装失败", - operation="install", - plugin_id=plugin_id, - error=str(e), - ) - - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.post("/uninstall") -async def uninstall_plugin( - request: UninstallPluginRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> Dict[str, Any]: - """ - 卸载插件 - - 删除插件目录及其所有文件 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"收到卸载插件请求: {request.plugin_id}") - - try: - # 验证插件 ID 格式安全性 - plugin_id = validate_plugin_id(request.plugin_id) - - # 推送进度:开始卸载 - await update_progress( - stage="loading", - progress=10, - message=f"开始卸载插件: {plugin_id}", - operation="uninstall", - plugin_id=plugin_id, - ) - - # 1. 检查插件是否存在(支持新旧两种格式) - plugins_dir = Path("plugins").resolve() - # 新格式:下划线 - folder_name = plugin_id.replace(".", "_") - # 使用安全路径验证 - plugin_path = validate_safe_path(folder_name, plugins_dir) - # 旧格式:点 - old_format_path = validate_safe_path(plugin_id, plugins_dir) - - # 优先使用新格式,如果不存在则尝试旧格式 - if not plugin_path.exists(): - if old_format_path.exists(): - plugin_path = old_format_path - else: - await update_progress( - stage="error", - progress=0, - message="插件不存在", - operation="uninstall", - plugin_id=plugin_id, - error="插件未安装或已被删除", - ) - raise HTTPException(status_code=404, detail="插件未安装") - - await update_progress( - stage="loading", - progress=30, - message=f"正在删除插件文件: {plugin_path}", - operation="uninstall", - plugin_id=plugin_id, - ) - - # 2. 读取插件信息(用于日志) - manifest_path = plugin_path / "_manifest.json" - plugin_name = plugin_id - - if manifest_path.exists(): - try: - import json as json_module - - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json_module.load(f) - plugin_name = manifest.get("name", plugin_id) - except Exception: - pass # 如果读取失败,使用插件 ID 作为名称 - - await update_progress( - stage="loading", - progress=50, - message=f"正在删除 {plugin_name}...", - operation="uninstall", - plugin_id=plugin_id, - ) - - # 3. 删除插件目录 - import shutil - import stat - - def remove_readonly(func, path, _): - """清除只读属性并删除文件""" - import os - - os.chmod(path, stat.S_IWRITE) - func(path) - - shutil.rmtree(plugin_path, onerror=remove_readonly) - - logger.info(f"成功卸载插件: {plugin_id} ({plugin_name})") - - # 4. 推送成功状态 - await update_progress( - stage="success", - progress=100, - message=f"成功卸载插件: {plugin_name}", - operation="uninstall", - plugin_id=plugin_id, - ) - - return {"success": True, "message": "插件卸载成功", "plugin_id": plugin_id, "plugin_name": plugin_name} - - except HTTPException: - raise - except PermissionError as e: - logger.error(f"卸载插件失败(权限错误): {e}") - - await update_progress( - stage="error", - progress=0, - message="卸载失败", - operation="uninstall", - plugin_id=plugin_id, - error="权限不足,无法删除插件文件", - ) - - raise HTTPException(status_code=500, detail="权限不足,无法删除插件文件") from e - except Exception as e: - logger.error(f"卸载插件失败: {e}", exc_info=True) - - await update_progress( - stage="error", - progress=0, - message="卸载失败", - operation="uninstall", - plugin_id=plugin_id, - error=str(e), - ) - - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.post("/update") -async def update_plugin( - request: UpdatePluginRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> Dict[str, Any]: - """ - 更新插件 - - 删除旧版本,重新克隆新版本 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"收到更新插件请求: {request.plugin_id}") - - try: - # 验证插件 ID 格式安全性 - plugin_id = validate_plugin_id(request.plugin_id) - - # 推送进度:开始更新 - await update_progress( - stage="loading", - progress=5, - message=f"开始更新插件: {plugin_id}", - operation="update", - plugin_id=plugin_id, - ) - - # 1. 检查插件是否已安装(支持新旧两种格式) - plugins_dir = Path("plugins").resolve() - # 新格式:下划线 - folder_name = plugin_id.replace(".", "_") - # 使用安全路径验证 - plugin_path = validate_safe_path(folder_name, plugins_dir) - # 旧格式:点 - old_format_path = validate_safe_path(plugin_id, plugins_dir) - - # 优先使用新格式,如果不存在则尝试旧格式 - if not plugin_path.exists(): - if old_format_path.exists(): - plugin_path = old_format_path - else: - await update_progress( - stage="error", - progress=0, - message="插件不存在", - operation="update", - plugin_id=plugin_id, - error="插件未安装,请先安装", - ) - raise HTTPException(status_code=404, detail="插件未安装") - - # 2. 读取旧版本信息 - manifest_path = plugin_path / "_manifest.json" - old_version = "unknown" - - if manifest_path.exists(): - try: - import json as json_module - - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json_module.load(f) - old_version = manifest.get("version", "unknown") - except Exception: - pass - - await update_progress( - stage="loading", - progress=10, - message=f"当前版本: {old_version},准备更新...", - operation="update", - plugin_id=plugin_id, - ) - - # 3. 删除旧版本 - await update_progress( - stage="loading", progress=20, message="正在删除旧版本...", operation="update", plugin_id=plugin_id - ) - - import shutil - import stat - - def remove_readonly(func, path, _): - """清除只读属性并删除文件""" - import os - - os.chmod(path, stat.S_IWRITE) - func(path) - - shutil.rmtree(plugin_path, onerror=remove_readonly) - - logger.info(f"已删除旧版本: {plugin_id} v{old_version}") - - # 4. 解析仓库 URL - await update_progress( - stage="loading", - progress=30, - message="正在准备下载新版本...", - operation="update", - plugin_id=plugin_id, - ) - - repo_url = request.repository_url.rstrip("/") - if repo_url.endswith(".git"): - repo_url = repo_url[:-4] - - parts = repo_url.split("/") - if len(parts) < 2: - raise HTTPException(status_code=400, detail="无效的仓库 URL") - - owner = parts[-2] - repo = parts[-1] - - # 5. 克隆新版本(这里会推送 35%-85% 的进度) - service = get_git_mirror_service() - - if "github.com" in repo_url: - result = await service.clone_repository( - owner=owner, - repo=repo, - target_path=plugin_path, - branch=request.branch, - mirror_id=request.mirror_id, - depth=1, - ) - else: - result = await service.clone_repository( - owner=owner, repo=repo, target_path=plugin_path, branch=request.branch, custom_url=repo_url, depth=1 - ) - - if not result.get("success"): - error_msg = result.get("error", "克隆失败") - await update_progress( - stage="error", - progress=0, - message="下载新版本失败", - operation="update", - plugin_id=plugin_id, - error=error_msg, - ) - raise HTTPException(status_code=500, detail=error_msg) - - # 6. 验证新版本 - await update_progress( - stage="loading", progress=90, message="验证新版本...", operation="update", plugin_id=plugin_id - ) - - new_manifest_path = plugin_path / "_manifest.json" - if not new_manifest_path.exists(): - # 清理失败的更新 - def remove_readonly(func, path, _): - """清除只读属性并删除文件""" - import os - - os.chmod(path, stat.S_IWRITE) - func(path) - - shutil.rmtree(plugin_path, onerror=remove_readonly) - - await update_progress( - stage="error", - progress=0, - message="新版本缺少 _manifest.json", - operation="update", - plugin_id=plugin_id, - error="无效的插件格式", - ) - raise HTTPException(status_code=400, detail="无效的插件:缺少 _manifest.json") - - # 7. 读取新版本信息 - try: - with open(new_manifest_path, "r", encoding="utf-8") as f: - new_manifest = json_module.load(f) - - new_version = new_manifest.get("version", "unknown") - new_name = new_manifest.get("name", plugin_id) - - logger.info(f"成功更新插件: {plugin_id} {old_version} → {new_version}") - - # 8. 推送成功状态 - await update_progress( - stage="success", - progress=100, - message=f"成功更新 {new_name}: {old_version} → {new_version}", - operation="update", - plugin_id=plugin_id, - ) - - return { - "success": True, - "message": "插件更新成功", - "plugin_id": plugin_id, - "plugin_name": new_name, - "old_version": old_version, - "new_version": new_version, - } - - except Exception as e: - # 清理失败的更新 - shutil.rmtree(plugin_path, ignore_errors=True) - - await update_progress( - stage="error", - progress=0, - message="_manifest.json 无效", - operation="update", - plugin_id=plugin_id, - error=str(e), - ) - raise HTTPException(status_code=400, detail=f"无效的 _manifest.json: {e}") from e - - except HTTPException: - raise - except Exception as e: - logger.error(f"更新插件失败: {e}", exc_info=True) - - await update_progress( - stage="error", progress=0, message="更新失败", operation="update", plugin_id=plugin_id, error=str(e) - ) - - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.get("/installed") -async def get_installed_plugins( - maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 获取已安装的插件列表 - - 扫描 plugins 目录,返回所有已安装插件的 ID 和基本信息 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info("收到获取已安装插件列表请求") - - try: - plugins_dir = Path("plugins") - - # 如果插件目录不存在,返回空列表 - if not plugins_dir.exists(): - logger.info("插件目录不存在,创建目录") - plugins_dir.mkdir(exist_ok=True) - return {"success": True, "plugins": []} - - installed_plugins = [] - - # 遍历插件目录 - for plugin_path in plugins_dir.iterdir(): - # 只处理目录 - if not plugin_path.is_dir(): - continue - - # 目录名(可能是下划线格式、点格式或其他格式) - folder_name = plugin_path.name - - # 跳过隐藏目录和特殊目录 - if folder_name.startswith(".") or folder_name.startswith("__"): - continue - - # 读取 _manifest.json - manifest_path = plugin_path / "_manifest.json" - - if not manifest_path.exists(): - logger.warning(f"插件文件夹 {folder_name} 缺少 _manifest.json,跳过") - continue - - try: - import json as json_module - - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json_module.load(f) - - # 基本验证 - if "name" not in manifest or "version" not in manifest: - logger.warning(f"插件文件夹 {folder_name} 的 _manifest.json 格式无效,跳过") - continue - - # 获取插件 ID(优先从 manifest,否则从文件夹名推断) - if "id" in manifest: - # 优先使用 manifest 中的 id(最准确) - plugin_id = manifest["id"] - else: - # 从 manifest 信息构建 ID - # 尝试从 author.name 和 repository_url 构建标准 ID - author_name = None - repo_name = None - - # 获取作者名 - if "author" in manifest: - if isinstance(manifest["author"], dict) and "name" in manifest["author"]: - author_name = manifest["author"]["name"] - elif isinstance(manifest["author"], str): - author_name = manifest["author"] - - # 从 repository_url 获取仓库名 - if "repository_url" in manifest: - repo_url = manifest["repository_url"].rstrip("/") - if repo_url.endswith(".git"): - repo_url = repo_url[:-4] - repo_name = repo_url.split("/")[-1] - - # 构建 ID - if author_name and repo_name: - # 标准格式: Author.RepoName - plugin_id = f"{author_name}.{repo_name}" - elif author_name: - # 如果只有作者,使用 Author.FolderName - plugin_id = f"{author_name}.{folder_name}" - else: - # 从文件夹名推断 - if "_" in folder_name and "." not in folder_name: - # 假设格式为 Author_PluginName,转换为 Author.PluginName - plugin_id = folder_name.replace("_", ".", 1) - else: - # 直接使用文件夹名 - plugin_id = folder_name - - # 将推断的 ID 写入 manifest(方便下次识别) - logger.info(f"为插件 {folder_name} 自动生成 ID: {plugin_id}") - manifest["id"] = plugin_id - try: - with open(manifest_path, "w", encoding="utf-8") as f: - json_module.dump(manifest, f, ensure_ascii=False, indent=2) - except Exception as write_error: - logger.warning(f"无法写入 ID 到 manifest: {write_error}") - - # 添加到已安装列表(返回完整的 manifest 信息) - installed_plugins.append( - { - "id": plugin_id, - "manifest": manifest, # 返回完整的 manifest 对象 - "path": str(plugin_path.absolute()), - } - ) - - except json.JSONDecodeError as e: - logger.warning(f"插件 {folder_name} 的 _manifest.json 解析失败: {e}") - continue - except Exception as e: - logger.error(f"读取插件 {folder_name} 信息时出错: {e}") - continue - - # 去重:如果有重复的 plugin_id,只保留第一个(按路径) - seen_ids = {} # 记录 ID -> 路径的映射 - unique_plugins = [] - duplicates = [] - - for plugin in installed_plugins: - plugin_id = plugin["id"] - plugin_path = plugin["path"] - - if plugin_id not in seen_ids: - seen_ids[plugin_id] = plugin_path - unique_plugins.append(plugin) - else: - duplicates.append(plugin) - first_path = seen_ids[plugin_id] - logger.warning( - f"重复插件 {plugin_id}: 保留 {first_path}, 跳过 {plugin_path}" - ) - - if duplicates: - logger.warning(f"共检测到 {len(duplicates)} 个重复插件已去重") - - logger.info(f"找到 {len(unique_plugins)} 个已安装插件") - - return {"success": True, "plugins": unique_plugins, "total": len(unique_plugins)} - - except Exception as e: - logger.error(f"获取已安装插件列表失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.get("/local-readme/{plugin_id}") -async def get_local_plugin_readme( - plugin_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 获取本地已安装插件的 README 文件内容 - - Args: - plugin_id: 插件 ID - - Returns: - 包含 success 和 data(README 内容) 的字典,如果文件不存在则返回 success=False - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"获取本地插件 README: {plugin_id}") - - try: - plugins_dir = Path("plugins") - - # 查找插件目录 - plugin_path = None - for folder in plugins_dir.iterdir(): - if not folder.is_dir(): - continue - - manifest_path = folder / "_manifest.json" - if manifest_path.exists(): - try: - import json as json_module - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json_module.load(f) - - # 检查是否匹配 plugin_id - if manifest.get("id") == plugin_id: - plugin_path = folder - break - except Exception: - continue - - if not plugin_path: - return {"success": False, "error": "插件未安装"} - - # 查找 README 文件(支持多种命名) - readme_files = ["README.md", "readme.md", "Readme.md", "README.MD"] - readme_content = None - - for readme_name in readme_files: - readme_path = plugin_path / readme_name - if readme_path.exists(): - try: - with open(readme_path, "r", encoding="utf-8") as f: - readme_content = f.read() - logger.info(f"成功读取本地 README: {readme_path}") - break - except Exception as e: - logger.warning(f"读取 {readme_path} 失败: {e}") - continue - - if readme_content: - return {"success": True, "data": readme_content} - else: - return {"success": False, "error": "本地未找到 README 文件"} - - except Exception as e: - logger.error(f"获取本地 README 失败: {e}", exc_info=True) - return {"success": False, "error": str(e)} - - -# ============ 插件配置管理 API ============ - - -class UpdatePluginConfigRequest(BaseModel): - """更新插件配置请求""" - - config: Dict[str, Any] = Field(..., description="配置数据") - - -@router.get("/config/{plugin_id}/schema") -async def get_plugin_config_schema( - plugin_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 获取插件配置 Schema - - 返回插件的完整配置 schema,包含所有 section、字段定义和布局信息。 - 用于前端动态生成配置表单。 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"获取插件配置 Schema: {plugin_id}") - - try: - # 尝试从已加载的插件中获取 - from src.plugin_system.core.plugin_manager import plugin_manager - - # 查找插件实例 - plugin_instance = None - - # 遍历所有已加载的插件 - for loaded_plugin_name in plugin_manager.list_loaded_plugins(): - instance = plugin_manager.get_plugin_instance(loaded_plugin_name) - if instance: - # 匹配 plugin_name 或 manifest 中的 id - if instance.plugin_name == plugin_id: - plugin_instance = instance - break - # 也尝试匹配 manifest 中的 id - manifest_id = instance.get_manifest_info("id", "") - if manifest_id == plugin_id: - plugin_instance = instance - break - - if plugin_instance and hasattr(plugin_instance, "get_webui_config_schema"): - # 从插件实例获取 schema - schema = plugin_instance.get_webui_config_schema() - return {"success": True, "schema": schema} - - # 如果插件未加载,尝试从文件系统读取 - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - # 读取配置文件获取当前配置 - config_path = plugin_path / "config.toml" - current_config = {} - if config_path.exists(): - import tomlkit - - with open(config_path, "r", encoding="utf-8") as f: - current_config = tomlkit.load(f) - - # 构建基础 schema(无法获取完整的 ConfigField 信息) - schema = { - "plugin_id": plugin_id, - "plugin_info": { - "name": plugin_id, - "version": "", - "description": "", - "author": "", - }, - "sections": {}, - "layout": {"type": "auto", "tabs": []}, - "_note": "插件未加载,仅返回当前配置结构", - } - - # 从当前配置推断 schema - for section_name, section_data in current_config.items(): - if isinstance(section_data, dict): - schema["sections"][section_name] = { - "name": section_name, - "title": section_name, - "description": None, - "icon": None, - "collapsed": False, - "order": 0, - "fields": {}, - } - for field_name, field_value in section_data.items(): - # 推断字段类型 - field_type = type(field_value).__name__ - ui_type = "text" - item_type = None - item_fields = None - - if isinstance(field_value, bool): - ui_type = "switch" - elif isinstance(field_value, (int, float)): - ui_type = "number" - elif isinstance(field_value, list): - ui_type = "list" - # 推断数组元素类型 - if field_value: - first_item = field_value[0] - if isinstance(first_item, dict): - item_type = "object" - # 从第一个元素推断字段结构 - item_fields = {} - for k, v in first_item.items(): - item_fields[k] = { - "type": "number" if isinstance(v, (int, float)) else "string", - "label": k, - "default": "" if isinstance(v, str) else 0, - } - elif isinstance(first_item, (int, float)): - item_type = "number" - else: - item_type = "string" - else: - item_type = "string" - elif isinstance(field_value, dict): - ui_type = "json" - - schema["sections"][section_name]["fields"][field_name] = { - "name": field_name, - "type": field_type, - "default": field_value, - "description": field_name, - "label": field_name, - "ui_type": ui_type, - "required": False, - "hidden": False, - "disabled": False, - "order": 0, - "item_type": item_type, - "item_fields": item_fields, - "min_items": None, - "max_items": None, - # 补充缺失的字段 - "placeholder": None, - "hint": None, - "icon": None, - "example": None, - "choices": None, - "min": None, - "max": None, - "step": None, - "pattern": None, - "max_length": None, - "input_type": None, - "rows": 3, - "group": None, - "depends_on": None, - "depends_value": None, - } - - return {"success": True, "schema": schema} - - except HTTPException: - raise - except Exception as e: - logger.error(f"获取插件配置 Schema 失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.get("/config/{plugin_id}/raw") -async def get_plugin_config_raw( - plugin_id: str, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> Dict[str, Any]: - """ - 获取插件原始 TOML 配置文件内容 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"获取插件原始配置: {plugin_id}") - - try: - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - # 读取配置文件 - config_path = plugin_path / "config.toml" - if not config_path.exists(): - return {"success": True, "config": "", "message": "配置文件不存在"} - - with open(config_path, "r", encoding="utf-8") as f: - config_content = f.read() - - return {"success": True, "config": config_content} - - except HTTPException: - raise - except Exception as e: - logger.error(f"获取插件原始配置失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.put("/config/{plugin_id}/raw") -async def update_plugin_config_raw( - plugin_id: str, - request: UpdatePluginConfigRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> Dict[str, Any]: - """ - 更新插件原始 TOML 配置文件 - - 直接保存 TOML 字符串到配置文件。 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"更新插件原始配置: {plugin_id}") - - try: - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - config_path = plugin_path / "config.toml" - - # 验证 TOML 格式 - import tomlkit - - if not isinstance(request.config, str): - raise HTTPException(status_code=400, detail="配置必须是字符串格式的 TOML 内容") - - try: - tomlkit.loads(request.config) - except Exception as e: - raise HTTPException(status_code=400, detail=f"TOML 格式错误: {str(e)}") - - # 备份旧配置 - import shutil - import datetime - - if config_path.exists(): - backup_name = f"config.toml.backup.{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}" - backup_path = plugin_path / backup_name - shutil.copy(config_path, backup_path) - logger.info(f"已备份配置文件: {backup_path}") - - # 写入新配置 - with open(config_path, "w", encoding="utf-8") as f: - f.write(request.config) - - logger.info(f"已更新插件原始配置: {plugin_id}") - - return {"success": True, "message": "配置已保存", "note": "配置更改将在插件重新加载后生效"} - - except HTTPException: - raise - except Exception as e: - logger.error(f"更新插件原始配置失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.get("/config/{plugin_id}") -async def get_plugin_config( - plugin_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 获取插件当前配置值 - - 返回插件的当前配置值。 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"获取插件配置: {plugin_id}") - - try: - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - # 读取配置文件 - config_path = plugin_path / "config.toml" - if not config_path.exists(): - return {"success": True, "config": {}, "message": "配置文件不存在"} - - import tomlkit - - with open(config_path, "r", encoding="utf-8") as f: - config = tomlkit.load(f) - - return {"success": True, "config": dict(config)} - - except HTTPException: - raise - except Exception as e: - logger.error(f"获取插件配置失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.put("/config/{plugin_id}") -async def update_plugin_config( - plugin_id: str, - request: UpdatePluginConfigRequest, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> Dict[str, Any]: - """ - 更新插件配置 - - 保存新的配置值到插件的配置文件。 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"更新插件配置: {plugin_id}") - - try: - plugin_instance = find_plugin_instance(plugin_id) - - # 纠正 WebUI 提交的数据结构(扁平键与字符串列表) - if plugin_instance and isinstance(request.config, dict): - request.config = normalize_dotted_keys(request.config) - if isinstance(plugin_instance.config_schema, dict): - coerce_types(plugin_instance.config_schema, request.config) - - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - config_path = plugin_path / "config.toml" - - # 备份旧配置 - import shutil - import datetime - - if config_path.exists(): - backup_name = f"config.toml.backup.{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}" - backup_path = plugin_path / backup_name - shutil.copy(config_path, backup_path) - logger.info(f"已备份配置文件: {backup_path}") - - # 写入新配置(自动保留注释和格式) - save_toml_with_format(request.config, str(config_path)) - - logger.info(f"已更新插件配置: {plugin_id}") - - return {"success": True, "message": "配置已保存", "note": "配置更改将在插件重新加载后生效"} - - except HTTPException: - raise - except Exception as e: - logger.error(f"更新插件配置失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.post("/config/{plugin_id}/reset") -async def reset_plugin_config( - plugin_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 重置插件配置为默认值 - - 删除当前配置文件,下次加载插件时将使用默认配置。 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"重置插件配置: {plugin_id}") - - try: - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - config_path = plugin_path / "config.toml" - - if not config_path.exists(): - return {"success": True, "message": "配置文件不存在,无需重置"} - - # 备份并删除 - import shutil - import datetime - - backup_name = f"config.toml.reset.{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}" - backup_path = plugin_path / backup_name - shutil.move(config_path, backup_path) - - logger.info(f"已重置插件配置: {plugin_id},备份: {backup_path}") - - return {"success": True, "message": "配置已重置,下次加载插件时将使用默认配置", "backup": str(backup_path)} - - except HTTPException: - raise - except Exception as e: - logger.error(f"重置插件配置失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e - - -@router.post("/config/{plugin_id}/toggle") -async def toggle_plugin( - plugin_id: str, maibot_session: Optional[str] = Cookie(None), authorization: Optional[str] = Header(None) -) -> Dict[str, Any]: - """ - 切换插件启用状态 - - 切换插件配置中的 enabled 字段。 - """ - # Token 验证 - token = get_token_from_cookie_or_header(maibot_session, authorization) - token_manager = get_token_manager() - if not token or not token_manager.verify_token(token): - raise HTTPException(status_code=401, detail="未授权:无效的访问令牌") - - logger.info(f"切换插件状态: {plugin_id}") - - try: - # 查找插件目录 - plugins_dir = Path("plugins") - plugin_path = None - - for p in plugins_dir.iterdir(): - if p.is_dir(): - manifest_path = p / "_manifest.json" - if manifest_path.exists(): - try: - with open(manifest_path, "r", encoding="utf-8") as f: - manifest = json.load(f) - if manifest.get("id") == plugin_id or p.name == plugin_id: - plugin_path = p - break - except Exception: - continue - - if not plugin_path: - raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") - - config_path = plugin_path / "config.toml" - - import tomlkit - - # 读取当前配置(保留注释和格式) - config = tomlkit.document() - if config_path.exists(): - with open(config_path, "r", encoding="utf-8") as f: - config = tomlkit.load(f) - - # 切换 enabled 状态 - if "plugin" not in config: - config["plugin"] = tomlkit.table() - - current_enabled = config["plugin"].get("enabled", True) - new_enabled = not current_enabled - config["plugin"]["enabled"] = new_enabled - - # 写入配置(保留注释,格式化数组) - save_toml_with_format(config, str(config_path)) - - status = "启用" if new_enabled else "禁用" - logger.info(f"已{status}插件: {plugin_id}") - - return { - "success": True, - "enabled": new_enabled, - "message": f"插件已{status}", - "note": "状态更改将在下次加载插件时生效", - } - - except HTTPException: - raise - except Exception as e: - logger.error(f"切换插件状态失败: {e}", exc_info=True) - raise HTTPException(status_code=500, detail=f"服务器错误: {str(e)}") from e diff --git a/src/webui/rate_limiter.py b/src/webui/rate_limiter.py deleted file mode 100644 index 23cfc0f0..00000000 --- a/src/webui/rate_limiter.py +++ /dev/null @@ -1,245 +0,0 @@ -""" -WebUI 请求频率限制模块 -防止暴力破解和 API 滥用 -""" - -import time -from collections import defaultdict -from typing import Dict, Tuple, Optional -from fastapi import Request, HTTPException -from src.common.logger import get_logger - -logger = get_logger("webui.rate_limiter") - - -class RateLimiter: - """ - 简单的内存请求频率限制器 - - 使用滑动窗口算法实现 - """ - - def __init__(self): - # 存储格式: {key: [(timestamp, count), ...]} - self._requests: Dict[str, list] = defaultdict(list) - # 被封禁的 IP: {ip: unblock_timestamp} - self._blocked: Dict[str, float] = {} - - def _get_client_ip(self, request: Request) -> str: - """获取客户端 IP 地址""" - # 检查代理头 - forwarded = request.headers.get("X-Forwarded-For") - if forwarded: - # 取第一个 IP(最原始的客户端) - return forwarded.split(",")[0].strip() - - real_ip = request.headers.get("X-Real-IP") - if real_ip: - return real_ip - - # 直接连接的客户端 - if request.client: - return request.client.host - - return "unknown" - - def _cleanup_old_requests(self, key: str, window_seconds: int): - """清理过期的请求记录""" - now = time.time() - cutoff = now - window_seconds - self._requests[key] = [(ts, count) for ts, count in self._requests[key] if ts > cutoff] - - def _cleanup_expired_blocks(self): - """清理过期的封禁""" - now = time.time() - expired = [ip for ip, unblock_time in self._blocked.items() if now > unblock_time] - for ip in expired: - del self._blocked[ip] - logger.info(f"🔓 IP {ip} 封禁已解除") - - def is_blocked(self, request: Request) -> Tuple[bool, Optional[int]]: - """ - 检查 IP 是否被封禁 - - Returns: - (是否被封禁, 剩余封禁秒数) - """ - self._cleanup_expired_blocks() - ip = self._get_client_ip(request) - - if ip in self._blocked: - remaining = int(self._blocked[ip] - time.time()) - return True, max(0, remaining) - - return False, None - - def check_rate_limit( - self, request: Request, max_requests: int, window_seconds: int, key_suffix: str = "" - ) -> Tuple[bool, int]: - """ - 检查请求是否超过频率限制 - - Args: - request: FastAPI Request 对象 - max_requests: 窗口期内允许的最大请求数 - window_seconds: 窗口时间(秒) - key_suffix: 键后缀,用于区分不同的限制规则 - - Returns: - (是否允许, 剩余请求数) - """ - ip = self._get_client_ip(request) - key = f"{ip}:{key_suffix}" if key_suffix else ip - - # 清理过期记录 - self._cleanup_old_requests(key, window_seconds) - - # 计算当前窗口内的请求数 - current_count = sum(count for _, count in self._requests[key]) - - if current_count >= max_requests: - return False, 0 - - # 记录新请求 - now = time.time() - self._requests[key].append((now, 1)) - - remaining = max_requests - current_count - 1 - return True, remaining - - def block_ip(self, request: Request, duration_seconds: int): - """ - 封禁 IP - - Args: - request: FastAPI Request 对象 - duration_seconds: 封禁时长(秒) - """ - ip = self._get_client_ip(request) - self._blocked[ip] = time.time() + duration_seconds - logger.warning(f"🔒 IP {ip} 已被封禁 {duration_seconds} 秒") - - def record_failed_attempt( - self, request: Request, max_failures: int = 5, window_seconds: int = 300, block_duration: int = 600 - ) -> Tuple[bool, int]: - """ - 记录失败尝试(如登录失败) - - 如果在窗口期内失败次数过多,自动封禁 IP - - Args: - request: FastAPI Request 对象 - max_failures: 允许的最大失败次数 - window_seconds: 统计窗口(秒) - block_duration: 封禁时长(秒) - - Returns: - (是否被封禁, 剩余尝试次数) - """ - ip = self._get_client_ip(request) - key = f"{ip}:auth_failures" - - # 清理过期记录 - self._cleanup_old_requests(key, window_seconds) - - # 计算当前失败次数 - current_failures = sum(count for _, count in self._requests[key]) - - # 记录本次失败 - now = time.time() - self._requests[key].append((now, 1)) - current_failures += 1 - - remaining = max_failures - current_failures - - # 检查是否需要封禁 - if current_failures >= max_failures: - self.block_ip(request, block_duration) - logger.warning(f"⚠️ IP {ip} 认证失败次数过多 ({current_failures}/{max_failures}),已封禁") - return True, 0 - - if current_failures >= max_failures - 2: - logger.warning(f"⚠️ IP {ip} 认证失败 {current_failures}/{max_failures} 次") - - return False, max(0, remaining) - - def reset_failures(self, request: Request): - """ - 重置失败计数(认证成功后调用) - """ - ip = self._get_client_ip(request) - key = f"{ip}:auth_failures" - if key in self._requests: - del self._requests[key] - - -# 全局单例 -_rate_limiter: Optional[RateLimiter] = None - - -def get_rate_limiter() -> RateLimiter: - """获取 RateLimiter 单例""" - global _rate_limiter - if _rate_limiter is None: - _rate_limiter = RateLimiter() - return _rate_limiter - - -async def check_auth_rate_limit(request: Request): - """ - 认证接口的频率限制依赖 - - 规则: - - 每个 IP 每分钟最多 10 次认证请求 - - 连续失败 5 次后封禁 10 分钟 - """ - limiter = get_rate_limiter() - - # 检查是否被封禁 - blocked, remaining_block = limiter.is_blocked(request) - if blocked: - raise HTTPException( - status_code=429, - detail=f"请求过于频繁,请在 {remaining_block} 秒后重试", - headers={"Retry-After": str(remaining_block)}, - ) - - # 检查频率限制 - allowed, remaining = limiter.check_rate_limit( - request, - max_requests=10, # 每分钟 10 次 - window_seconds=60, - key_suffix="auth", - ) - - if not allowed: - raise HTTPException(status_code=429, detail="认证请求过于频繁,请稍后重试", headers={"Retry-After": "60"}) - - -async def check_api_rate_limit(request: Request): - """ - 普通 API 的频率限制依赖 - - 规则:每个 IP 每分钟最多 100 次请求 - """ - limiter = get_rate_limiter() - - # 检查是否被封禁 - blocked, remaining_block = limiter.is_blocked(request) - if blocked: - raise HTTPException( - status_code=429, - detail=f"请求过于频繁,请在 {remaining_block} 秒后重试", - headers={"Retry-After": str(remaining_block)}, - ) - - # 检查频率限制 - allowed, _ = limiter.check_rate_limit( - request, - max_requests=100, # 每分钟 100 次 - window_seconds=60, - key_suffix="api", - ) - - if not allowed: - raise HTTPException(status_code=429, detail="请求过于频繁,请稍后重试", headers={"Retry-After": "60"}) diff --git a/src/webui/routers/system.py b/src/webui/routers/system.py deleted file mode 100644 index b1d3729a..00000000 --- a/src/webui/routers/system.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -系统控制路由 - -提供系统重启、状态查询等功能 -""" - -import os -import time -from datetime import datetime -from typing import Optional -from fastapi import APIRouter, HTTPException, Depends, Cookie, Header -from pydantic import BaseModel -from src.config.config import MMC_VERSION -from src.common.logger import get_logger -from src.webui.auth import verify_auth_token_from_cookie_or_header - -router = APIRouter(prefix="/system", tags=["system"]) -logger = get_logger("webui_system") - -# 记录启动时间 -_start_time = time.time() - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -class RestartResponse(BaseModel): - """重启响应""" - - success: bool - message: str - - -class StatusResponse(BaseModel): - """状态响应""" - - running: bool - uptime: float - version: str - start_time: str - - -@router.post("/restart", response_model=RestartResponse) -async def restart_maibot(_auth: bool = Depends(require_auth)): - """ - 重启麦麦主程序 - - 请求重启当前进程,配置更改将在重启后生效。 - 注意:此操作会使麦麦暂时离线。 - """ - import asyncio - - try: - # 记录重启操作 - logger.info("WebUI 触发重启操作") - - # 定义延迟重启的异步任务 - async def delayed_restart(): - await asyncio.sleep(0.5) # 延迟0.5秒,确保响应已发送 - # 使用 os._exit(42) 退出当前进程,配合外部 runner 脚本进行重启 - # 42 是约定的重启状态码 - logger.info("WebUI 请求重启,退出代码 42") - os._exit(42) - - # 创建后台任务执行重启 - asyncio.create_task(delayed_restart()) - - # 立即返回成功响应 - return RestartResponse(success=True, message="麦麦正在重启中...") - except Exception as e: - raise HTTPException(status_code=500, detail=f"重启失败: {str(e)}") from e - - -@router.get("/status", response_model=StatusResponse) -async def get_maibot_status(_auth: bool = Depends(require_auth)): - """ - 获取麦麦运行状态 - - 返回麦麦的运行状态、运行时长和版本信息。 - """ - try: - uptime = time.time() - _start_time - - # 尝试获取版本信息(需要根据实际情况调整) - version = MMC_VERSION # 可以从配置或常量中读取 - - return StatusResponse( - running=True, uptime=uptime, version=version, start_time=datetime.fromtimestamp(_start_time).isoformat() - ) - except Exception as e: - raise HTTPException(status_code=500, detail=f"获取状态失败: {str(e)}") from e - - -# 可选:添加更多系统控制功能 - - -@router.post("/reload-config") -async def reload_config(_auth: bool = Depends(require_auth)): - """ - 热重载配置(不重启进程) - - 仅重新加载配置文件,某些配置可能需要重启才能生效。 - 此功能需要在主程序中实现配置热重载逻辑。 - """ - # 这里需要调用主程序的配置重载函数 - # 示例:await app_instance.reload_config() - - return {"success": True, "message": "配置重载功能待实现"} diff --git a/src/webui/routes.py b/src/webui/routes.py deleted file mode 100644 index 0479dc51..00000000 --- a/src/webui/routes.py +++ /dev/null @@ -1,456 +0,0 @@ -"""WebUI API 路由""" - -from fastapi import APIRouter, HTTPException, Header, Response, Request, Cookie, Depends -from pydantic import BaseModel, Field -from typing import Optional -from src.common.logger import get_logger -from .token_manager import get_token_manager -from .auth import set_auth_cookie, clear_auth_cookie -from .rate_limiter import get_rate_limiter, check_auth_rate_limit -from .config_routes import router as config_router -from .statistics_routes import router as statistics_router -from .person_routes import router as person_router -from .expression_routes import router as expression_router -from .jargon_routes import router as jargon_router -from .emoji_routes import router as emoji_router -from .plugin_routes import router as plugin_router -from .plugin_progress_ws import get_progress_router -from .routers.system import router as system_router -from .model_routes import router as model_router -from .ws_auth import router as ws_auth_router -from .annual_report_routes import router as annual_report_router - -logger = get_logger("webui.api") - -# 创建路由器 -router = APIRouter(prefix="/api/webui", tags=["WebUI"]) - -# 注册配置管理路由 -router.include_router(config_router) -# 注册统计数据路由 -router.include_router(statistics_router) -# 注册人物信息管理路由 -router.include_router(person_router) -# 注册表达方式管理路由 -router.include_router(expression_router) -# 注册黑话管理路由 -router.include_router(jargon_router) -# 注册表情包管理路由 -router.include_router(emoji_router) -# 注册插件管理路由 -router.include_router(plugin_router) -# 注册插件进度 WebSocket 路由 -router.include_router(get_progress_router()) -# 注册系统控制路由 -router.include_router(system_router) -# 注册模型列表获取路由 -router.include_router(model_router) -# 注册 WebSocket 认证路由 -router.include_router(ws_auth_router) -# 注册年度报告路由 -router.include_router(annual_report_router) - - -class TokenVerifyRequest(BaseModel): - """Token 验证请求""" - - token: str = Field(..., description="访问令牌") - - -class TokenVerifyResponse(BaseModel): - """Token 验证响应""" - - valid: bool = Field(..., description="Token 是否有效") - message: str = Field(..., description="验证结果消息") - is_first_setup: bool = Field(False, description="是否为首次设置") - - -class TokenUpdateRequest(BaseModel): - """Token 更新请求""" - - new_token: str = Field(..., description="新的访问令牌", min_length=10) - - -class TokenUpdateResponse(BaseModel): - """Token 更新响应""" - - success: bool = Field(..., description="是否更新成功") - message: str = Field(..., description="更新结果消息") - - -class TokenRegenerateResponse(BaseModel): - """Token 重新生成响应""" - - success: bool = Field(..., description="是否生成成功") - token: str = Field(..., description="新生成的令牌") - message: str = Field(..., description="生成结果消息") - - -class FirstSetupStatusResponse(BaseModel): - """首次配置状态响应""" - - is_first_setup: bool = Field(..., description="是否为首次配置") - message: str = Field(..., description="状态消息") - - -class CompleteSetupResponse(BaseModel): - """完成配置响应""" - - success: bool = Field(..., description="是否成功") - message: str = Field(..., description="结果消息") - - -class ResetSetupResponse(BaseModel): - """重置配置响应""" - - success: bool = Field(..., description="是否成功") - message: str = Field(..., description="结果消息") - - -@router.get("/health") -async def health_check(): - """健康检查""" - return {"status": "healthy", "service": "MaiBot WebUI"} - - -@router.post("/auth/verify", response_model=TokenVerifyResponse) -async def verify_token( - request_body: TokenVerifyRequest, - request: Request, - response: Response, - _rate_limit: None = Depends(check_auth_rate_limit), -): - """ - 验证访问令牌,验证成功后设置 HttpOnly Cookie - - Args: - request_body: 包含 token 的验证请求 - request: FastAPI Request 对象(用于获取客户端 IP) - response: FastAPI Response 对象 - - Returns: - 验证结果(包含首次配置状态) - """ - try: - token_manager = get_token_manager() - rate_limiter = get_rate_limiter() - - is_valid = token_manager.verify_token(request_body.token) - - if is_valid: - # 认证成功,重置失败计数 - rate_limiter.reset_failures(request) - # 设置 HttpOnly Cookie(传入 request 以检测协议) - set_auth_cookie(response, request_body.token, request) - # 同时返回首次配置状态,避免额外请求 - is_first_setup = token_manager.is_first_setup() - return TokenVerifyResponse(valid=True, message="Token 验证成功", is_first_setup=is_first_setup) - else: - # 记录失败尝试 - blocked, remaining = rate_limiter.record_failed_attempt( - request, - max_failures=5, # 5 次失败 - window_seconds=300, # 5 分钟窗口 - block_duration=600, # 封禁 10 分钟 - ) - - if blocked: - raise HTTPException(status_code=429, detail="认证失败次数过多,您的 IP 已被临时封禁 10 分钟") - - message = "Token 无效或已过期" - if remaining <= 2: - message += f"(剩余 {remaining} 次尝试机会)" - - return TokenVerifyResponse(valid=False, message=message) - except HTTPException: - raise - except Exception as e: - logger.error(f"Token 验证失败: {e}") - raise HTTPException(status_code=500, detail="Token 验证失败") from e - - -@router.post("/auth/logout") -async def logout(response: Response): - """ - 登出并清除认证 Cookie - - Args: - response: FastAPI Response 对象 - - Returns: - 登出结果 - """ - clear_auth_cookie(response) - return {"success": True, "message": "已成功登出"} - - -@router.get("/auth/check") -async def check_auth_status( - request: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 检查当前认证状态(用于前端判断是否已登录) - - Returns: - 认证状态 - """ - try: - token = None - - # 记录请求信息用于调试 - logger.debug(f"检查认证状态 - Cookie: {maibot_session[:20] if maibot_session else 'None'}..., Authorization: {'Present' if authorization else 'None'}") - - # 优先从 Cookie 获取 - if maibot_session: - token = maibot_session - logger.debug("使用 Cookie 中的 token") - # 其次从 Header 获取 - elif authorization and authorization.startswith("Bearer "): - token = authorization.replace("Bearer ", "") - logger.debug("使用 Header 中的 token") - - if not token: - logger.debug("未找到 token,返回未认证") - return {"authenticated": False} - - token_manager = get_token_manager() - is_valid = token_manager.verify_token(token) - logger.debug(f"Token 验证结果: {is_valid}") - - if is_valid: - return {"authenticated": True} - else: - return {"authenticated": False} - except Exception as e: - logger.error(f"认证检查失败: {e}", exc_info=True) - return {"authenticated": False} - - -@router.post("/auth/update", response_model=TokenUpdateResponse) -async def update_token( - request: TokenUpdateRequest, - response: Response, - req: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 更新访问令牌(需要当前有效的 token) - - Args: - request: 包含新 token 的更新请求 - response: FastAPI Response 对象 - maibot_session: Cookie 中的 token - authorization: Authorization header (Bearer token) - - Returns: - 更新结果 - """ - try: - # 验证当前 token(优先 Cookie,其次 Header) - current_token = None - if maibot_session: - current_token = maibot_session - elif authorization and authorization.startswith("Bearer "): - current_token = authorization.replace("Bearer ", "") - - if not current_token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - token_manager = get_token_manager() - - if not token_manager.verify_token(current_token): - raise HTTPException(status_code=401, detail="当前 Token 无效") - - # 更新 token - success, message = token_manager.update_token(request.new_token) - - # 如果更新成功,清除 Cookie,要求用户重新登录 - if success: - clear_auth_cookie(response) - - return TokenUpdateResponse(success=success, message=message) - except HTTPException: - raise - except Exception as e: - logger.error(f"Token 更新失败: {e}") - raise HTTPException(status_code=500, detail="Token 更新失败") from e - - -@router.post("/auth/regenerate", response_model=TokenRegenerateResponse) -async def regenerate_token( - response: Response, - request: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 重新生成访问令牌(需要当前有效的 token) - - Args: - response: FastAPI Response 对象 - maibot_session: Cookie 中的 token - authorization: Authorization header (Bearer token) - - Returns: - 新生成的 token - """ - try: - # 验证当前 token(优先 Cookie,其次 Header) - current_token = None - if maibot_session: - current_token = maibot_session - elif authorization and authorization.startswith("Bearer "): - current_token = authorization.replace("Bearer ", "") - - if not current_token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - token_manager = get_token_manager() - - if not token_manager.verify_token(current_token): - raise HTTPException(status_code=401, detail="当前 Token 无效") - - # 重新生成 token - new_token = token_manager.regenerate_token() - - # 清除 Cookie,要求用户重新登录 - clear_auth_cookie(response) - - return TokenRegenerateResponse(success=True, token=new_token, message="Token 已重新生成") - except HTTPException: - raise - except Exception as e: - logger.error(f"Token 重新生成失败: {e}") - raise HTTPException(status_code=500, detail="Token 重新生成失败") from e - - -@router.get("/setup/status", response_model=FirstSetupStatusResponse) -async def get_setup_status( - request: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取首次配置状态 - - Args: - maibot_session: Cookie 中的 token - authorization: Authorization header (Bearer token) - - Returns: - 首次配置状态 - """ - try: - # 验证 token(优先 Cookie,其次 Header) - current_token = None - if maibot_session: - current_token = maibot_session - elif authorization and authorization.startswith("Bearer "): - current_token = authorization.replace("Bearer ", "") - - if not current_token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - token_manager = get_token_manager() - - if not token_manager.verify_token(current_token): - raise HTTPException(status_code=401, detail="Token 无效") - - # 检查是否为首次配置 - is_first = token_manager.is_first_setup() - - return FirstSetupStatusResponse(is_first_setup=is_first, message="首次配置" if is_first else "已完成配置") - except HTTPException: - raise - except Exception as e: - logger.error(f"获取配置状态失败: {e}") - raise HTTPException(status_code=500, detail="获取配置状态失败") from e - - -@router.post("/setup/complete", response_model=CompleteSetupResponse) -async def complete_setup( - request: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 标记首次配置完成 - - Args: - maibot_session: Cookie 中的 token - authorization: Authorization header (Bearer token) - - Returns: - 完成结果 - """ - try: - # 验证 token(优先 Cookie,其次 Header) - current_token = None - if maibot_session: - current_token = maibot_session - elif authorization and authorization.startswith("Bearer "): - current_token = authorization.replace("Bearer ", "") - - if not current_token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - token_manager = get_token_manager() - - if not token_manager.verify_token(current_token): - raise HTTPException(status_code=401, detail="Token 无效") - - # 标记配置完成 - success = token_manager.mark_setup_completed() - - return CompleteSetupResponse(success=success, message="配置已完成" if success else "标记失败") - except HTTPException: - raise - except Exception as e: - logger.error(f"标记配置完成失败: {e}") - raise HTTPException(status_code=500, detail="标记配置完成失败") from e - - -@router.post("/setup/reset", response_model=ResetSetupResponse) -async def reset_setup( - request: Request, - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 重置首次配置状态,允许重新进入配置向导 - - Args: - maibot_session: Cookie 中的 token - authorization: Authorization header (Bearer token) - - Returns: - 重置结果 - """ - try: - # 验证 token(优先 Cookie,其次 Header) - current_token = None - if maibot_session: - current_token = maibot_session - elif authorization and authorization.startswith("Bearer "): - current_token = authorization.replace("Bearer ", "") - - if not current_token: - raise HTTPException(status_code=401, detail="未提供有效的认证信息") - - token_manager = get_token_manager() - - if not token_manager.verify_token(current_token): - raise HTTPException(status_code=401, detail="Token 无效") - - # 重置配置状态 - success = token_manager.reset_setup_status() - - return ResetSetupResponse(success=success, message="配置状态已重置" if success else "重置失败") - except HTTPException: - raise - except Exception as e: - logger.error(f"重置配置状态失败: {e}") - raise HTTPException(status_code=500, detail="重置配置状态失败") from e diff --git a/src/webui/statistics_routes.py b/src/webui/statistics_routes.py deleted file mode 100644 index e5628538..00000000 --- a/src/webui/statistics_routes.py +++ /dev/null @@ -1,319 +0,0 @@ -"""统计数据 API 路由""" - -from fastapi import APIRouter, HTTPException, Depends, Cookie, Header -from pydantic import BaseModel, Field -from typing import Dict, Any, List, Optional -from datetime import datetime, timedelta -from peewee import fn - -from src.common.logger import get_logger -from src.common.database.database_model import LLMUsage, OnlineTime, Messages -from src.webui.auth import verify_auth_token_from_cookie_or_header - -logger = get_logger("webui.statistics") - -router = APIRouter(prefix="/statistics", tags=["statistics"]) - - -def require_auth( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -) -> bool: - """认证依赖:验证用户是否已登录""" - return verify_auth_token_from_cookie_or_header(maibot_session, authorization) - - -class StatisticsSummary(BaseModel): - """统计数据摘要""" - - total_requests: int = Field(0, description="总请求数") - total_cost: float = Field(0.0, description="总花费") - total_tokens: int = Field(0, description="总token数") - online_time: float = Field(0.0, description="在线时间(秒)") - total_messages: int = Field(0, description="总消息数") - total_replies: int = Field(0, description="总回复数") - avg_response_time: float = Field(0.0, description="平均响应时间") - cost_per_hour: float = Field(0.0, description="每小时花费") - tokens_per_hour: float = Field(0.0, description="每小时token数") - - -class ModelStatistics(BaseModel): - """模型统计""" - - model_name: str - request_count: int - total_cost: float - total_tokens: int - avg_response_time: float - - -class TimeSeriesData(BaseModel): - """时间序列数据""" - - timestamp: str - requests: int = 0 - cost: float = 0.0 - tokens: int = 0 - - -class DashboardData(BaseModel): - """仪表盘数据""" - - summary: StatisticsSummary - model_stats: List[ModelStatistics] - hourly_data: List[TimeSeriesData] - daily_data: List[TimeSeriesData] - recent_activity: List[Dict[str, Any]] - - -@router.get("/dashboard", response_model=DashboardData) -async def get_dashboard_data(hours: int = 24, _auth: bool = Depends(require_auth)): - """ - 获取仪表盘统计数据 - - Args: - hours: 统计时间范围(小时),默认24小时 - - Returns: - 仪表盘数据 - """ - try: - now = datetime.now() - start_time = now - timedelta(hours=hours) - - # 获取摘要数据 - summary = await _get_summary_statistics(start_time, now) - - # 获取模型统计 - model_stats = await _get_model_statistics(start_time) - - # 获取小时级时间序列数据 - hourly_data = await _get_hourly_statistics(start_time, now) - - # 获取日级时间序列数据(最近7天) - daily_start = now - timedelta(days=7) - daily_data = await _get_daily_statistics(daily_start, now) - - # 获取最近活动 - recent_activity = await _get_recent_activity(limit=10) - - return DashboardData( - summary=summary, - model_stats=model_stats, - hourly_data=hourly_data, - daily_data=daily_data, - recent_activity=recent_activity, - ) - except Exception as e: - logger.error(f"获取仪表盘数据失败: {e}") - raise HTTPException(status_code=500, detail=f"获取统计数据失败: {str(e)}") from e - - -async def _get_summary_statistics(start_time: datetime, end_time: datetime) -> StatisticsSummary: - """获取摘要统计数据(优化:使用数据库聚合)""" - summary = StatisticsSummary() - - # 使用聚合查询替代全量加载 - query = LLMUsage.select( - fn.COUNT(LLMUsage.id).alias("total_requests"), - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("total_cost"), - fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("total_tokens"), - fn.COALESCE(fn.AVG(LLMUsage.time_cost), 0).alias("avg_response_time"), - ).where((LLMUsage.timestamp >= start_time) & (LLMUsage.timestamp <= end_time)) - - result = query.dicts().get() - summary.total_requests = result["total_requests"] - summary.total_cost = result["total_cost"] - summary.total_tokens = result["total_tokens"] - summary.avg_response_time = result["avg_response_time"] or 0.0 - - # 查询在线时间 - 这个数据量通常不大,保留原逻辑 - online_records = list( - OnlineTime.select().where((OnlineTime.start_timestamp >= start_time) | (OnlineTime.end_timestamp >= start_time)) - ) - - for record in online_records: - start = max(record.start_timestamp, start_time) - end = min(record.end_timestamp, end_time) - if end > start: - summary.online_time += (end - start).total_seconds() - - # 查询消息数量 - 使用聚合优化 - messages_query = Messages.select(fn.COUNT(Messages.id).alias("total")).where( - (Messages.time >= start_time.timestamp()) & (Messages.time <= end_time.timestamp()) - ) - summary.total_messages = messages_query.scalar() or 0 - - # 统计回复数量 - replies_query = Messages.select(fn.COUNT(Messages.id).alias("total")).where( - (Messages.time >= start_time.timestamp()) - & (Messages.time <= end_time.timestamp()) - & (Messages.reply_to.is_null(False)) - ) - summary.total_replies = replies_query.scalar() or 0 - - # 计算派生指标 - if summary.online_time > 0: - online_hours = summary.online_time / 3600.0 - summary.cost_per_hour = summary.total_cost / online_hours - summary.tokens_per_hour = summary.total_tokens / online_hours - - return summary - - -async def _get_model_statistics(start_time: datetime) -> List[ModelStatistics]: - """获取模型统计数据(优化:使用数据库聚合和分组)""" - # 使用GROUP BY聚合,避免全量加载 - query = ( - LLMUsage.select( - fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name, "unknown").alias("model_name"), - fn.COUNT(LLMUsage.id).alias("request_count"), - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("total_cost"), - fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("total_tokens"), - fn.COALESCE(fn.AVG(LLMUsage.time_cost), 0).alias("avg_response_time"), - ) - .where(LLMUsage.timestamp >= start_time) - .group_by(fn.COALESCE(LLMUsage.model_assign_name, LLMUsage.model_name, "unknown")) - .order_by(fn.COUNT(LLMUsage.id).desc()) - .limit(10) # 只取前10个 - ) - - result = [] - for row in query.dicts(): - result.append( - ModelStatistics( - model_name=row["model_name"], - request_count=row["request_count"], - total_cost=row["total_cost"], - total_tokens=row["total_tokens"], - avg_response_time=row["avg_response_time"] or 0.0, - ) - ) - - return result - - -async def _get_hourly_statistics(start_time: datetime, end_time: datetime) -> List[TimeSeriesData]: - """获取小时级统计数据(优化:使用数据库聚合)""" - # SQLite的日期时间函数进行小时分组 - # 使用strftime将timestamp格式化为小时级别 - query = ( - LLMUsage.select( - fn.strftime("%Y-%m-%dT%H:00:00", LLMUsage.timestamp).alias("hour"), - fn.COUNT(LLMUsage.id).alias("requests"), - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("cost"), - fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("tokens"), - ) - .where((LLMUsage.timestamp >= start_time) & (LLMUsage.timestamp <= end_time)) - .group_by(fn.strftime("%Y-%m-%dT%H:00:00", LLMUsage.timestamp)) - ) - - # 转换为字典以快速查找 - data_dict = {row["hour"]: row for row in query.dicts()} - - # 填充所有小时(包括没有数据的) - result = [] - current = start_time.replace(minute=0, second=0, microsecond=0) - while current <= end_time: - hour_str = current.strftime("%Y-%m-%dT%H:00:00") - if hour_str in data_dict: - row = data_dict[hour_str] - result.append( - TimeSeriesData(timestamp=hour_str, requests=row["requests"], cost=row["cost"], tokens=row["tokens"]) - ) - else: - result.append(TimeSeriesData(timestamp=hour_str, requests=0, cost=0.0, tokens=0)) - current += timedelta(hours=1) - - return result - - -async def _get_daily_statistics(start_time: datetime, end_time: datetime) -> List[TimeSeriesData]: - """获取日级统计数据(优化:使用数据库聚合)""" - # 使用strftime按日期分组 - query = ( - LLMUsage.select( - fn.strftime("%Y-%m-%dT00:00:00", LLMUsage.timestamp).alias("day"), - fn.COUNT(LLMUsage.id).alias("requests"), - fn.COALESCE(fn.SUM(LLMUsage.cost), 0).alias("cost"), - fn.COALESCE(fn.SUM(LLMUsage.prompt_tokens + LLMUsage.completion_tokens), 0).alias("tokens"), - ) - .where((LLMUsage.timestamp >= start_time) & (LLMUsage.timestamp <= end_time)) - .group_by(fn.strftime("%Y-%m-%dT00:00:00", LLMUsage.timestamp)) - ) - - # 转换为字典 - data_dict = {row["day"]: row for row in query.dicts()} - - # 填充所有天 - result = [] - current = start_time.replace(hour=0, minute=0, second=0, microsecond=0) - while current <= end_time: - day_str = current.strftime("%Y-%m-%dT00:00:00") - if day_str in data_dict: - row = data_dict[day_str] - result.append( - TimeSeriesData(timestamp=day_str, requests=row["requests"], cost=row["cost"], tokens=row["tokens"]) - ) - else: - result.append(TimeSeriesData(timestamp=day_str, requests=0, cost=0.0, tokens=0)) - current += timedelta(days=1) - - return result - - -async def _get_recent_activity(limit: int = 10) -> List[Dict[str, Any]]: - """获取最近活动""" - records = list(LLMUsage.select().order_by(LLMUsage.timestamp.desc()).limit(limit)) - - activities = [] - for record in records: - activities.append( - { - "timestamp": record.timestamp.isoformat(), - "model": record.model_assign_name or record.model_name, - "request_type": record.request_type, - "tokens": (record.prompt_tokens or 0) + (record.completion_tokens or 0), - "cost": record.cost or 0.0, - "time_cost": record.time_cost or 0.0, - "status": record.status, - } - ) - - return activities - - -@router.get("/summary") -async def get_summary(hours: int = 24, _auth: bool = Depends(require_auth)): - """ - 获取统计摘要 - - Args: - hours: 统计时间范围(小时) - """ - try: - now = datetime.now() - start_time = now - timedelta(hours=hours) - summary = await _get_summary_statistics(start_time, now) - return summary - except Exception as e: - logger.error(f"获取统计摘要失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e - - -@router.get("/models") -async def get_model_stats(hours: int = 24, _auth: bool = Depends(require_auth)): - """ - 获取模型统计 - - Args: - hours: 统计时间范围(小时) - """ - try: - now = datetime.now() - start_time = now - timedelta(hours=hours) - stats = await _get_model_statistics(start_time) - return stats - except Exception as e: - logger.error(f"获取模型统计失败: {e}") - raise HTTPException(status_code=500, detail=str(e)) from e diff --git a/src/webui/token_manager.py b/src/webui/token_manager.py deleted file mode 100644 index bd1e5fbb..00000000 --- a/src/webui/token_manager.py +++ /dev/null @@ -1,309 +0,0 @@ -""" -WebUI Token 管理模块 -负责生成、保存、验证和更新访问令牌 -""" - -import json -import secrets -from pathlib import Path -from typing import Optional - -from src.common.logger import get_logger - -logger = get_logger("webui") - - -class TokenManager: - """Token 管理器""" - - def __init__(self, config_path: Optional[Path] = None): - """ - 初始化 Token 管理器 - - Args: - config_path: 配置文件路径,默认为项目根目录的 data/webui.json - """ - if config_path is None: - # 获取项目根目录 (src/webui -> src -> 根目录) - project_root = Path(__file__).parent.parent.parent - config_path = project_root / "data" / "webui.json" - - self.config_path = config_path - self.config_path.parent.mkdir(parents=True, exist_ok=True) - - # 确保配置文件存在并包含有效的 token - self._ensure_config() - - def _ensure_config(self): - """确保配置文件存在且包含有效的 token""" - if not self.config_path.exists(): - logger.info(f"WebUI 配置文件不存在,正在创建: {self.config_path}") - self._create_new_token() - else: - # 验证配置文件格式 - try: - config = self._load_config() - if not config.get("access_token"): - logger.warning("WebUI 配置文件中缺少 access_token,正在重新生成") - self._create_new_token() - else: - logger.info(f"WebUI Token 已加载: {config['access_token'][:8]}...") - except Exception as e: - logger.error(f"读取 WebUI 配置文件失败: {e},正在重新创建") - self._create_new_token() - - def _load_config(self) -> dict: - """加载配置文件""" - try: - with open(self.config_path, "r", encoding="utf-8") as f: - return json.load(f) - except Exception as e: - logger.error(f"加载 WebUI 配置失败: {e}") - return {} - - def _save_config(self, config: dict): - """保存配置文件""" - try: - with open(self.config_path, "w", encoding="utf-8") as f: - json.dump(config, f, ensure_ascii=False, indent=2) - logger.info(f"WebUI 配置已保存到: {self.config_path}") - except Exception as e: - logger.error(f"保存 WebUI 配置失败: {e}") - raise - - def _create_new_token(self) -> str: - """生成新的 64 位随机 token""" - # 生成 64 位十六进制字符串 (32 字节 = 64 hex 字符) - token = secrets.token_hex(32) - - config = { - "access_token": token, - "created_at": self._get_current_timestamp(), - "updated_at": self._get_current_timestamp(), - "first_setup_completed": False, # 标记首次配置未完成 - } - - self._save_config(config) - logger.info(f"新的 WebUI Token 已生成: {token[:8]}...") - - return token - - def _get_current_timestamp(self) -> str: - """获取当前时间戳字符串""" - from datetime import datetime - - return datetime.now().isoformat() - - def get_token(self) -> str: - """获取当前有效的 token""" - config = self._load_config() - return config.get("access_token", "") - - def verify_token(self, token: str) -> bool: - """ - 验证 token 是否有效 - - Args: - token: 待验证的 token - - Returns: - bool: token 是否有效 - """ - if not token: - return False - - current_token = self.get_token() - if not current_token: - logger.error("系统中没有有效的 token") - return False - - # 使用 secrets.compare_digest 防止时序攻击 - is_valid = secrets.compare_digest(token, current_token) - - if is_valid: - logger.debug("Token 验证成功") - else: - logger.warning("Token 验证失败") - - return is_valid - - def update_token(self, new_token: str) -> tuple[bool, str]: - """ - 更新 token - - Args: - new_token: 新的 token (最少 10 位,必须包含大小写字母和特殊符号) - - Returns: - tuple[bool, str]: (是否更新成功, 错误消息) - """ - # 验证新 token 格式 - is_valid, error_msg = self._validate_custom_token(new_token) - if not is_valid: - logger.error(f"Token 格式无效: {error_msg}") - return False, error_msg - - try: - config = self._load_config() - old_token = config.get("access_token", "")[:8] - - config["access_token"] = new_token - config["updated_at"] = self._get_current_timestamp() - - self._save_config(config) - logger.info(f"Token 已更新: {old_token}... -> {new_token[:8]}...") - - return True, "Token 更新成功" - except Exception as e: - logger.error(f"更新 Token 失败: {e}") - return False, f"更新失败: {str(e)}" - - def regenerate_token(self) -> str: - """ - 重新生成 token(保留 first_setup_completed 状态) - - Returns: - str: 新生成的 token - """ - logger.info("正在重新生成 WebUI Token...") - - # 生成新的 64 位十六进制字符串 - new_token = secrets.token_hex(32) - - # 加载现有配置,保留 first_setup_completed 状态 - config = self._load_config() - old_token = config.get("access_token", "")[:8] if config.get("access_token") else "无" - first_setup_completed = config.get("first_setup_completed", True) # 默认为 True,表示已完成配置 - - config["access_token"] = new_token - config["updated_at"] = self._get_current_timestamp() - config["first_setup_completed"] = first_setup_completed # 保留原来的状态 - - self._save_config(config) - logger.info(f"WebUI Token 已重新生成: {old_token}... -> {new_token[:8]}...") - - return new_token - - def _validate_token_format(self, token: str) -> bool: - """ - 验证 token 格式是否正确(旧的 64 位十六进制验证,保留用于系统生成的 token) - - Args: - token: 待验证的 token - - Returns: - bool: 格式是否正确 - """ - if not token or not isinstance(token, str): - return False - - # 必须是 64 位十六进制字符串 - if len(token) != 64: - return False - - # 验证是否为有效的十六进制字符串 - try: - int(token, 16) - return True - except ValueError: - return False - - def _validate_custom_token(self, token: str) -> tuple[bool, str]: - """ - 验证自定义 token 格式 - - 要求: - - 最少 10 位 - - 包含大写字母 - - 包含小写字母 - - 包含特殊符号 - - Args: - token: 待验证的 token - - Returns: - tuple[bool, str]: (是否有效, 错误消息) - """ - if not token or not isinstance(token, str): - return False, "Token 不能为空" - - # 检查长度 - if len(token) < 10: - return False, "Token 长度至少为 10 位" - - # 检查是否包含大写字母 - has_upper = any(c.isupper() for c in token) - if not has_upper: - return False, "Token 必须包含大写字母" - - # 检查是否包含小写字母 - has_lower = any(c.islower() for c in token) - if not has_lower: - return False, "Token 必须包含小写字母" - - # 检查是否包含特殊符号 - special_chars = "!@#$%^&*()_+-=[]{}|;:,.<>?/" - has_special = any(c in special_chars for c in token) - if not has_special: - return False, f"Token 必须包含特殊符号 ({special_chars})" - - return True, "Token 格式正确" - - def is_first_setup(self) -> bool: - """ - 检查是否为首次配置 - - Returns: - bool: 是否为首次配置 - """ - config = self._load_config() - return not config.get("first_setup_completed", False) - - def mark_setup_completed(self) -> bool: - """ - 标记首次配置已完成 - - Returns: - bool: 是否标记成功 - """ - try: - config = self._load_config() - config["first_setup_completed"] = True - config["setup_completed_at"] = self._get_current_timestamp() - self._save_config(config) - logger.info("首次配置已标记为完成") - return True - except Exception as e: - logger.error(f"标记首次配置完成失败: {e}") - return False - - def reset_setup_status(self) -> bool: - """ - 重置首次配置状态,允许重新进入配置向导 - - Returns: - bool: 是否重置成功 - """ - try: - config = self._load_config() - config["first_setup_completed"] = False - if "setup_completed_at" in config: - del config["setup_completed_at"] - self._save_config(config) - logger.info("首次配置状态已重置") - return True - except Exception as e: - logger.error(f"重置首次配置状态失败: {e}") - return False - - -# 全局单例 -_token_manager_instance: Optional[TokenManager] = None - - -def get_token_manager() -> TokenManager: - """获取 TokenManager 单例""" - global _token_manager_instance - if _token_manager_instance is None: - _token_manager_instance = TokenManager() - return _token_manager_instance diff --git a/src/webui/webui_server.py b/src/webui/webui_server.py deleted file mode 100644 index fca2cee1..00000000 --- a/src/webui/webui_server.py +++ /dev/null @@ -1,295 +0,0 @@ -"""独立的 WebUI 服务器 - 运行在 0.0.0.0:8001""" - -import asyncio -import mimetypes -from pathlib import Path -from fastapi import FastAPI -from fastapi.middleware.cors import CORSMiddleware -from fastapi.responses import FileResponse -from uvicorn import Config, Server as UvicornServer -from src.common.logger import get_logger - -logger = get_logger("webui_server") - - -class WebUIServer: - """独立的 WebUI 服务器""" - - def __init__(self, host: str = "0.0.0.0", port: int = 8001): - self.host = host - self.port = port - self.app = FastAPI(title="MaiBot WebUI") - self._server = None - - # 配置防爬虫中间件(需要在CORS之前注册) - self._setup_anti_crawler() - - # 配置 CORS(支持开发环境跨域请求) - self._setup_cors() - - # 显示 Access Token - self._show_access_token() - - # 重要:先注册 API 路由,再设置静态文件 - self._register_api_routes() - self._setup_static_files() - - # 注册robots.txt路由 - self._setup_robots_txt() - - def _setup_cors(self): - """配置 CORS 中间件""" - # 开发环境需要允许前端开发服务器的跨域请求 - self.app.add_middleware( - CORSMiddleware, - allow_origins=[ - "http://localhost:5173", # Vite 开发服务器 - "http://127.0.0.1:5173", - "http://localhost:7999", # 前端开发服务器备用端口 - "http://127.0.0.1:7999", - "http://localhost:8001", # 生产环境 - "http://127.0.0.1:8001", - ], - allow_credentials=True, # 允许携带 Cookie - allow_methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"], # 明确指定允许的方法 - allow_headers=[ - "Content-Type", - "Authorization", - "Accept", - "Origin", - "X-Requested-With", - ], # 明确指定允许的头 - expose_headers=["Content-Length", "Content-Type"], # 允许前端读取的响应头 - ) - logger.debug("✅ CORS 中间件已配置") - - def _show_access_token(self): - """显示 WebUI Access Token""" - try: - from src.webui.token_manager import get_token_manager - - token_manager = get_token_manager() - current_token = token_manager.get_token() - logger.info(f"🔑 WebUI Access Token: {current_token}") - logger.info("💡 请使用此 Token 登录 WebUI") - except Exception as e: - logger.error(f"❌ 获取 Access Token 失败: {e}") - - def _setup_static_files(self): - """设置静态文件服务""" - # 确保正确的 MIME 类型映射 - mimetypes.init() - mimetypes.add_type("application/javascript", ".js") - mimetypes.add_type("application/javascript", ".mjs") - mimetypes.add_type("text/css", ".css") - mimetypes.add_type("application/json", ".json") - - base_dir = Path(__file__).parent.parent.parent - static_path = base_dir / "webui" / "dist" - - if not static_path.exists(): - logger.warning(f"❌ WebUI 静态文件目录不存在: {static_path}") - logger.warning("💡 请先构建前端: cd webui && npm run build") - return - - if not (static_path / "index.html").exists(): - logger.warning(f"❌ 未找到 index.html: {static_path / 'index.html'}") - logger.warning("💡 请确认前端已正确构建") - return - - # 处理 SPA 路由 - 注意:这个路由优先级最低 - @self.app.get("/{full_path:path}", include_in_schema=False) - async def serve_spa(full_path: str): - """服务单页应用 - 只处理非 API 请求""" - # 如果是根路径,直接返回 index.html - if not full_path or full_path == "/": - response = FileResponse(static_path / "index.html", media_type="text/html") - response.headers["X-Robots-Tag"] = "noindex, nofollow, noarchive" - return response - - # 检查是否是静态文件 - file_path = static_path / full_path - if file_path.is_file() and file_path.exists(): - # 自动检测 MIME 类型 - media_type = mimetypes.guess_type(str(file_path))[0] - response = FileResponse(file_path, media_type=media_type) - # HTML 文件添加防索引头 - if str(file_path).endswith(".html"): - response.headers["X-Robots-Tag"] = "noindex, nofollow, noarchive" - return response - - # 其他路径返回 index.html(SPA 路由) - response = FileResponse(static_path / "index.html", media_type="text/html") - response.headers["X-Robots-Tag"] = "noindex, nofollow, noarchive" - return response - - logger.info(f"✅ WebUI 静态文件服务已配置: {static_path}") - - def _setup_anti_crawler(self): - """配置防爬虫中间件""" - try: - from src.webui.anti_crawler import AntiCrawlerMiddleware - from src.config.config import global_config - - # 从配置读取防爬虫模式 - anti_crawler_mode = global_config.webui.anti_crawler_mode - - # 注意:中间件按注册顺序反向执行,所以先注册的中间件后执行 - # 我们需要在CORS之前注册,这样防爬虫检查会在CORS之前执行 - self.app.add_middleware(AntiCrawlerMiddleware, mode=anti_crawler_mode) - - mode_descriptions = {"false": "已禁用", "strict": "严格模式", "loose": "宽松模式", "basic": "基础模式"} - mode_desc = mode_descriptions.get(anti_crawler_mode, "基础模式") - logger.info(f"🛡️ 防爬虫中间件已配置: {mode_desc}") - except Exception as e: - logger.error(f"❌ 配置防爬虫中间件失败: {e}", exc_info=True) - - def _setup_robots_txt(self): - """设置robots.txt路由""" - try: - from src.webui.anti_crawler import create_robots_txt_response - - @self.app.get("/robots.txt", include_in_schema=False) - async def robots_txt(): - """返回robots.txt,禁止所有爬虫""" - return create_robots_txt_response() - - logger.debug("✅ robots.txt 路由已注册") - except Exception as e: - logger.error(f"❌ 注册robots.txt路由失败: {e}", exc_info=True) - - def _register_api_routes(self): - """注册所有 WebUI API 路由""" - try: - # 导入所有 WebUI 路由 - from src.webui.routes import router as webui_router - from src.webui.logs_ws import router as logs_router - from src.webui.knowledge_routes import router as knowledge_router - - # 导入本地聊天室路由 - from src.webui.chat_routes import router as chat_router - - # 导入规划器监控路由 - from src.webui.api.planner import router as planner_router - - # 导入回复器监控路由 - from src.webui.api.replier import router as replier_router - - # 注册路由 - self.app.include_router(webui_router) - self.app.include_router(logs_router) - self.app.include_router(knowledge_router) - self.app.include_router(chat_router) - self.app.include_router(planner_router) - self.app.include_router(replier_router) - - logger.info("✅ WebUI API 路由已注册") - except Exception as e: - logger.error(f"❌ 注册 WebUI API 路由失败: {e}", exc_info=True) - - async def start(self): - """启动服务器""" - # 预先检查端口是否可用 - if not self._check_port_available(): - error_msg = f"❌ WebUI 服务器启动失败: 端口 {self.port} 已被占用" - logger.error(error_msg) - logger.error(f"💡 请检查是否有其他程序正在使用端口 {self.port}") - logger.error("💡 可以在 .env 文件中修改 WEBUI_PORT 来更改 WebUI 端口") - logger.error(f"💡 Windows 用户可以运行: netstat -ano | findstr :{self.port}") - logger.error(f"💡 Linux/Mac 用户可以运行: lsof -i :{self.port}") - raise OSError(f"端口 {self.port} 已被占用,无法启动 WebUI 服务器") - - config = Config( - app=self.app, - host=self.host, - port=self.port, - log_config=None, - access_log=False, - ) - self._server = UvicornServer(config=config) - - logger.info("🌐 WebUI 服务器启动中...") - - # 根据地址类型显示正确的访问地址 - if ':' in self.host: - # IPv6 地址需要用方括号包裹 - logger.info(f"🌐 访问地址: http://[{self.host}]:{self.port}") - if self.host == "::": - logger.info(f"💡 IPv6 本机访问: http://[::1]:{self.port}") - logger.info(f"💡 IPv4 本机访问: http://127.0.0.1:{self.port}") - elif self.host == "::1": - logger.info("💡 仅支持 IPv6 本地访问") - else: - # IPv4 地址 - logger.info(f"🌐 访问地址: http://{self.host}:{self.port}") - if self.host == "0.0.0.0": - logger.info(f"💡 本机访问: http://localhost:{self.port} 或 http://127.0.0.1:{self.port}") - - try: - await self._server.serve() - except OSError as e: - # 处理端口绑定相关的错误 - if "address already in use" in str(e).lower() or e.errno in (98, 10048): # 98: Linux, 10048: Windows - logger.error(f"❌ WebUI 服务器启动失败: 端口 {self.port} 已被占用") - logger.error(f"💡 请检查是否有其他程序正在使用端口 {self.port}") - logger.error("💡 可以在 .env 文件中修改 WEBUI_PORT 来更改 WebUI 端口") - else: - logger.error(f"❌ WebUI 服务器启动失败 (网络错误): {e}") - raise - except Exception as e: - logger.error(f"❌ WebUI 服务器运行错误: {e}", exc_info=True) - raise - - def _check_port_available(self) -> bool: - """检查端口是否可用(支持 IPv4 和 IPv6)""" - import socket - - # 判断使用 IPv4 还是 IPv6 - if ':' in self.host: - # IPv6 地址 - family = socket.AF_INET6 - test_host = self.host if self.host != "::" else "::1" - else: - # IPv4 地址 - family = socket.AF_INET - test_host = self.host if self.host != "0.0.0.0" else "127.0.0.1" - - try: - with socket.socket(family, socket.SOCK_STREAM) as s: - s.settimeout(1) - # 尝试绑定端口 - s.bind((test_host, self.port)) - return True - except OSError: - return False - - async def shutdown(self): - """关闭服务器""" - if self._server: - logger.info("正在关闭 WebUI 服务器...") - self._server.should_exit = True - try: - await asyncio.wait_for(self._server.shutdown(), timeout=3.0) - logger.info("✅ WebUI 服务器已关闭") - except asyncio.TimeoutError: - logger.warning("⚠️ WebUI 服务器关闭超时") - except Exception as e: - logger.error(f"❌ WebUI 服务器关闭失败: {e}") - finally: - self._server = None - - -# 全局 WebUI 服务器实例 -_webui_server = None - - -def get_webui_server() -> WebUIServer: - """获取全局 WebUI 服务器实例""" - global _webui_server - if _webui_server is None: - # 从环境变量读取 - import os - host = os.getenv("WEBUI_HOST", "127.0.0.1") - port = int(os.getenv("WEBUI_PORT", "8001")) - _webui_server = WebUIServer(host=host, port=port) - return _webui_server diff --git a/src/webui/ws_auth.py b/src/webui/ws_auth.py deleted file mode 100644 index e6bb00e7..00000000 --- a/src/webui/ws_auth.py +++ /dev/null @@ -1,114 +0,0 @@ -"""WebSocket 认证模块 - -提供所有 WebSocket 端点统一使用的临时 token 认证机制。 -临时 token 有效期 60 秒,且只能使用一次,用于解决 WebSocket 握手时 Cookie 不可用的问题。 -""" - -from fastapi import APIRouter, Cookie, Header -from typing import Optional -import secrets -import time -from src.common.logger import get_logger -from src.webui.token_manager import get_token_manager - -logger = get_logger("webui.ws_auth") -router = APIRouter() - -# WebSocket 临时 token 存储 {token: (expire_time, session_token)} -# 临时 token 有效期 60 秒,仅用于 WebSocket 握手 -_ws_temp_tokens: dict[str, tuple[float, str]] = {} -_WS_TOKEN_EXPIRE_SECONDS = 60 - - -def _cleanup_expired_ws_tokens(): - """清理过期的临时 token""" - now = time.time() - expired = [t for t, (exp, _) in _ws_temp_tokens.items() if now > exp] - for t in expired: - del _ws_temp_tokens[t] - - -def generate_ws_token(session_token: str) -> str: - """生成 WebSocket 临时 token - - Args: - session_token: 原始的 session token - - Returns: - 临时 token 字符串 - """ - _cleanup_expired_ws_tokens() - temp_token = secrets.token_urlsafe(32) - _ws_temp_tokens[temp_token] = (time.time() + _WS_TOKEN_EXPIRE_SECONDS, session_token) - logger.debug(f"生成 WS 临时 token: {temp_token[:8]}... 有效期 {_WS_TOKEN_EXPIRE_SECONDS}s") - return temp_token - - -def verify_ws_token(temp_token: str) -> bool: - """验证并消费 WebSocket 临时 token(一次性使用) - - Args: - temp_token: 临时 token - - Returns: - 验证是否通过 - """ - _cleanup_expired_ws_tokens() - if temp_token not in _ws_temp_tokens: - logger.warning(f"WS token 不存在: {temp_token[:8]}...") - return False - expire_time, session_token = _ws_temp_tokens[temp_token] - if time.time() > expire_time: - del _ws_temp_tokens[temp_token] - logger.warning(f"WS token 已过期: {temp_token[:8]}...") - return False - # 验证原始 session token 仍然有效 - token_manager = get_token_manager() - if not token_manager.verify_token(session_token): - del _ws_temp_tokens[temp_token] - logger.warning(f"WS token 关联的 session 已失效: {temp_token[:8]}...") - return False - # 消费 token(一次性使用) - del _ws_temp_tokens[temp_token] - logger.debug(f"WS token 验证成功: {temp_token[:8]}...") - return True - - -@router.get("/ws-token") -async def get_ws_token( - maibot_session: Optional[str] = Cookie(None), - authorization: Optional[str] = Header(None), -): - """ - 获取 WebSocket 连接用的临时 token - - 此端点验证当前会话的 Cookie 或 Authorization header, - 然后返回一个临时 token 用于 WebSocket 握手认证。 - 临时 token 有效期 60 秒,且只能使用一次。 - - 注意:在未认证时返回 200 状态码但 success=False,避免前端因 401 刷新页面。 - """ - # 获取当前 session token - session_token = None - if maibot_session: - session_token = maibot_session - elif authorization and authorization.startswith("Bearer "): - session_token = authorization.replace("Bearer ", "") - - if not session_token: - # 返回 200 但 success=False,避免前端因 401 刷新页面 - # 这在登录页面是正常情况,不应该触发错误处理 - logger.debug("ws-token 请求:未提供认证信息(可能在登录页面)") - return {"success": False, "message": "未提供认证信息,请先登录", "token": None, "expires_in": 0} - - # 验证 session token - token_manager = get_token_manager() - if not token_manager.verify_token(session_token): - # 同样返回 200 但 success=False,避免前端刷新 - logger.debug("ws-token 请求:认证已过期") - return {"success": False, "message": "认证已过期,请重新登录", "token": None, "expires_in": 0} - - # 生成临时 WebSocket token - ws_token = generate_ws_token(session_token) - - return {"success": True, "token": ws_token, "expires_in": _WS_TOKEN_EXPIRE_SECONDS} diff --git a/webui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 b/webui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 deleted file mode 100644 index 0acaaff0..00000000 Binary files a/webui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff b/webui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff deleted file mode 100644 index b804d7b3..00000000 Binary files a/webui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf b/webui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf deleted file mode 100644 index c6f9a5e7..00000000 Binary files a/webui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf b/webui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf deleted file mode 100644 index 9ff4a5e0..00000000 Binary files a/webui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff b/webui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff deleted file mode 100644 index 9759710d..00000000 Binary files a/webui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 b/webui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 deleted file mode 100644 index f390922e..00000000 Binary files a/webui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff b/webui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff deleted file mode 100644 index 9bdd534f..00000000 Binary files a/webui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 b/webui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 deleted file mode 100644 index 75344a1f..00000000 Binary files a/webui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf b/webui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf deleted file mode 100644 index f522294f..00000000 Binary files a/webui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf b/webui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf deleted file mode 100644 index 4e98259c..00000000 Binary files a/webui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff b/webui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff deleted file mode 100644 index e7730f66..00000000 Binary files a/webui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 b/webui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 deleted file mode 100644 index 395f28be..00000000 Binary files a/webui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf b/webui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf deleted file mode 100644 index b8461b27..00000000 Binary files a/webui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 b/webui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 deleted file mode 100644 index 735f6948..00000000 Binary files a/webui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff b/webui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff deleted file mode 100644 index acab069f..00000000 Binary files a/webui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 b/webui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 deleted file mode 100644 index ab2ad21d..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff b/webui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff deleted file mode 100644 index f38136ac..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf b/webui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf deleted file mode 100644 index 4060e627..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 b/webui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 deleted file mode 100644 index 5931794d..00000000 Binary files a/webui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf b/webui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf deleted file mode 100644 index dc007977..00000000 Binary files a/webui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff b/webui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff deleted file mode 100644 index 67807b0b..00000000 Binary files a/webui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf b/webui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf deleted file mode 100644 index 0e9b0f35..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff b/webui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff deleted file mode 100644 index 6f43b594..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 b/webui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 deleted file mode 100644 index b50920e1..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 b/webui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 deleted file mode 100644 index eb24a7ba..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff b/webui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff deleted file mode 100644 index 21f58129..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf b/webui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf deleted file mode 100644 index dd45e1ed..00000000 Binary files a/webui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf b/webui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf deleted file mode 100644 index 728ce7a1..00000000 Binary files a/webui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 b/webui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 deleted file mode 100644 index 29657023..00000000 Binary files a/webui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff b/webui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff deleted file mode 100644 index 0ae390d7..00000000 Binary files a/webui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff b/webui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff deleted file mode 100644 index eb5159d4..00000000 Binary files a/webui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf b/webui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf deleted file mode 100644 index 70d559b4..00000000 Binary files a/webui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 b/webui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 deleted file mode 100644 index 215c143f..00000000 Binary files a/webui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf b/webui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf deleted file mode 100644 index 2f65a8a3..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 b/webui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 deleted file mode 100644 index cfaa3bda..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff b/webui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff deleted file mode 100644 index 8d47c02d..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 b/webui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 deleted file mode 100644 index 349c06dc..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff b/webui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff deleted file mode 100644 index 7e02df96..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf b/webui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf deleted file mode 100644 index d5850df9..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf b/webui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf deleted file mode 100644 index 537279f6..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff b/webui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff deleted file mode 100644 index 31b84829..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 b/webui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 deleted file mode 100644 index a90eea85..00000000 Binary files a/webui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf b/webui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf deleted file mode 100644 index fd679bf3..00000000 Binary files a/webui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 b/webui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 deleted file mode 100644 index b3048fc1..00000000 Binary files a/webui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff b/webui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff deleted file mode 100644 index 0e7da821..00000000 Binary files a/webui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff b/webui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff deleted file mode 100644 index 7f292d91..00000000 Binary files a/webui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf b/webui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf deleted file mode 100644 index 871fd7d1..00000000 Binary files a/webui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 b/webui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 deleted file mode 100644 index c5a8462f..00000000 Binary files a/webui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf b/webui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf deleted file mode 100644 index 7a212caf..00000000 Binary files a/webui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 b/webui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 deleted file mode 100644 index e1bccfe2..00000000 Binary files a/webui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff b/webui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff deleted file mode 100644 index d241d9be..00000000 Binary files a/webui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff b/webui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff deleted file mode 100644 index e6e9b658..00000000 Binary files a/webui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf b/webui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf deleted file mode 100644 index 00bff349..00000000 Binary files a/webui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff b/webui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff deleted file mode 100644 index e1ec5457..00000000 Binary files a/webui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf b/webui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf deleted file mode 100644 index 74f08921..00000000 Binary files a/webui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 b/webui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 deleted file mode 100644 index 680c1308..00000000 Binary files a/webui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff b/webui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff deleted file mode 100644 index 2432419f..00000000 Binary files a/webui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 b/webui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 deleted file mode 100644 index 771f1af7..00000000 Binary files a/webui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 and /dev/null differ diff --git a/webui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf b/webui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf deleted file mode 100644 index c83252c5..00000000 Binary files a/webui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf and /dev/null differ diff --git a/webui/dist/assets/charts-simvewUa.js b/webui/dist/assets/charts-simvewUa.js deleted file mode 100644 index 389f665b..00000000 --- a/webui/dist/assets/charts-simvewUa.js +++ /dev/null @@ -1,36 +0,0 @@ -import{r as h,w as cb,b as Nl,a as sb,i as fb}from"./router-9vIXuQkh.js";import{c as H}from"./utils-BqoaXoQ1.js";import{g as Qt,a as db}from"./react-vendor-BmxF9s7Q.js";var vb=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function $l(e){if(typeof e!="string")return!1;var t=vb;return t.includes(e)}var hb=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],pb=new Set(hb);function cp(e){return typeof e!="string"?!1:pb.has(e)}function sp(e){return typeof e=="string"&&e.startsWith("data-")}function Ze(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(cp(r)||sp(r))&&(t[r]=e[r]);return t}function hr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Ze(t)}return typeof e=="object"&&!Array.isArray(e)?Ze(e):null}function $e(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(cp(r)||sp(r)||$l(r))&&(t[r]=e[r]);return t}function mb(e){return e==null?null:h.isValidElement(e)?$e(e.props):typeof e=="object"&&!Array.isArray(e)?$e(e):null}var yb=["children","width","height","viewBox","className","style","title","desc"];function Tu(){return Tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,width:n,height:i,viewBox:a,className:o,style:u,title:l,desc:s}=e,c=gb(e,yb),f=a||{width:n,height:i,x:0,y:0},d=H("recharts-surface",o);return h.createElement("svg",Tu({},$e(c),{className:d,width:n,height:i,style:u,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,s),r)}),wb=["children","className"];function Du(){return Du=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:r,className:n}=e,i=xb(e,wb),a=H("recharts-layer",n);return h.createElement("g",Du({className:a},$e(i),{ref:t}),r)}),fp=h.createContext(null),Ob=()=>h.useContext(fp);function J(e){return function(){return e}}const dp=Math.cos,wi=Math.sin,ht=Math.sqrt,xi=Math.PI,fa=2*xi,Nu=Math.PI,$u=2*Nu,ar=1e-6,Ab=$u-ar;function vp(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return vp;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iar)if(!(Math.abs(f*l-s*c)>ar)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let v=n-o,p=i-u,y=l*l+s*s,m=v*v+p*p,g=Math.sqrt(y),x=Math.sqrt(d),w=a*Math.tan((Nu-Math.acos((y+d-m)/(2*g*x)))/2),P=w/x,b=w/g;Math.abs(P-1)>ar&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*v>c*p)},${this._x1=t+b*l},${this._y1=r+b*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),l=n*Math.sin(i),s=t+u,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${s},${c}`:(Math.abs(this._x1-s)>ar||Math.abs(this._y1-c)>ar)&&this._append`L${s},${c}`,n&&(d<0&&(d=d%$u+$u),d>Ab?this._append`A${n},${n},0,1,${f},${t-u},${r-l}A${n},${n},0,1,${f},${this._x1=s},${this._y1=c}`:d>ar&&this._append`A${n},${n},0,${+(d>=Nu)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Ll(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Eb(t)}function zl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hp(e){this._context=e}hp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function da(e){return new hp(e)}function pp(e){return e[0]}function mp(e){return e[1]}function yp(e,t){var r=J(!0),n=null,i=da,a=null,o=Ll(u);e=typeof e=="function"?e:e===void 0?pp:J(e),t=typeof t=="function"?t:t===void 0?mp:J(t);function u(l){var s,c=(l=zl(l)).length,f,d=!1,v;for(n==null&&(a=i(v=o())),s=0;s<=c;++s)!(s=v;--p)u.point(w[p],P[p]);u.lineEnd(),u.areaEnd()}g&&(w[d]=+e(m,d,f),P[d]=+t(m,d,f),u.point(n?+n(m,d,f):w[d],r?+r(m,d,f):P[d]))}if(x)return u=null,x+""||null}function c(){return yp().defined(i).curve(o).context(a)}return s.x=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),n=null,s):e},s.x0=function(f){return arguments.length?(e=typeof f=="function"?f:J(+f),s):e},s.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:J(+f),s):n},s.y=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),r=null,s):t},s.y0=function(f){return arguments.length?(t=typeof f=="function"?f:J(+f),s):t},s.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:J(+f),s):r},s.lineX0=s.lineY0=function(){return c().x(e).y(t)},s.lineY1=function(){return c().x(e).y(r)},s.lineX1=function(){return c().x(n).y(t)},s.defined=function(f){return arguments.length?(i=typeof f=="function"?f:J(!!f),s):i},s.curve=function(f){return arguments.length?(o=f,a!=null&&(u=o(a)),s):o},s.context=function(f){return arguments.length?(f==null?a=u=null:u=o(a=f),s):a},s}class gp{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function _b(e){return new gp(e,!0)}function kb(e){return new gp(e,!1)}const Bl={draw(e,t){const r=ht(t/xi);e.moveTo(r,0),e.arc(0,0,r,0,fa)}},jb={draw(e,t){const r=ht(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},bp=ht(1/3),Cb=bp*2,Ib={draw(e,t){const r=ht(t/Cb),n=r*bp;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Mb={draw(e,t){const r=ht(t),n=-r/2;e.rect(n,n,r,r)}},Tb=.8908130915292852,wp=wi(xi/10)/wi(7*xi/10),Db=wi(fa/10)*wp,Nb=-dp(fa/10)*wp,$b={draw(e,t){const r=ht(t*Tb),n=Db*r,i=Nb*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=fa*a/5,u=dp(o),l=wi(o);e.lineTo(l*r,-u*r),e.lineTo(u*n-l*i,l*n+u*i)}e.closePath()}},ro=ht(3),Rb={draw(e,t){const r=-ht(t/(ro*3));e.moveTo(0,r*2),e.lineTo(-ro*r,-r),e.lineTo(ro*r,-r),e.closePath()}},et=-.5,tt=ht(3)/2,Ru=1/ht(12),Lb=(Ru/2+1)*3,zb={draw(e,t){const r=ht(t/Lb),n=r/2,i=r*Ru,a=n,o=r*Ru+r,u=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,l),e.lineTo(et*n-tt*i,tt*n+et*i),e.lineTo(et*a-tt*o,tt*a+et*o),e.lineTo(et*u-tt*l,tt*u+et*l),e.lineTo(et*n+tt*i,et*i-tt*n),e.lineTo(et*a+tt*o,et*o-tt*a),e.lineTo(et*u+tt*l,et*l-tt*u),e.closePath()}};function Bb(e,t){let r=null,n=Ll(i);e=typeof e=="function"?e:J(e||Bl),t=typeof t=="function"?t:J(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:J(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:J(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Pi(){}function Oi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function xp(e){this._context=e}xp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Oi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fb(e){return new xp(e)}function Pp(e){this._context=e}Pp.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Kb(e){return new Pp(e)}function Op(e){this._context=e}Op.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Oi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function qb(e){return new Op(e)}function Ap(e){this._context=e}Ap.prototype={areaStart:Pi,areaEnd:Pi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Wb(e){return new Ap(e)}function Fs(e){return e<0?-1:1}function Ks(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Fs(a)+Fs(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function qs(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function no(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Ai(e){this._context=e}Ai.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:no(this,this._t0,qs(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,no(this,qs(this,r=Ks(this,e,t)),r);break;default:no(this,this._t0,r=Ks(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Sp(e){this._context=new Ep(e)}(Sp.prototype=Object.create(Ai.prototype)).point=function(e,t){Ai.prototype.point.call(this,t,e)};function Ep(e){this._context=e}Ep.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function Ub(e){return new Ai(e)}function Hb(e){return new Sp(e)}function _p(e){this._context=e}_p.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Ws(e),i=Ws(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function Gb(e){return new va(e,.5)}function Vb(e){return new va(e,0)}function Xb(e){return new va(e,1)}function Ir(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function Zb(e,t){return e[t]}function Qb(e){const t=[];return t.key=e,t}function Jb(){var e=J([]),t=Lu,r=Ir,n=Zb;function i(a){var o=Array.from(e.apply(this,arguments),Qb),u,l=o.length,s=-1,c;for(const f of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;ne===0?0:e>0?1:-1,dt=e=>typeof e=="number"&&e!=+e,Ct=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,N=e=>(typeof e=="number"||e instanceof Number)&&!dt(e),bt=e=>N(e)||typeof e=="string",uw=0,cn=e=>{var t=++uw;return"".concat(e||"").concat(t)},Ie=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!N(t)&&typeof t!="string")return n;var a;if(Ct(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return dt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},jp=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):pr(n,t))===r)}var ae=e=>e===null||typeof e>"u",An=e=>ae(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function lw(e){return e!=null}function Sn(){}var cw=["type","size","sizeType"];function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(An(e));return Ip[t]||Bl},yw=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*pw;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gw=(e,t)=>{Ip["symbol".concat(An(e))]=t},Wl=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=vw(e,cw),a=Js(Js({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var u=()=>{var d=mw(o),v=Bb().type(d).size(yw(r,n,o)),p=v();if(p!==null)return p},{className:l,cx:s,cy:c}=a,f=$e(a);return N(s)&&N(c)&&N(r)?h.createElement("path",zu({},f,{className:H("recharts-symbols",l),transform:"translate(".concat(s,", ").concat(c,")"),d:u()})):null};Wl.registerSymbol=gw;var Mp=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Ul=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{$l(i)&&(n[i]=(a=>r[i](r,a)))}),n},bw=(e,t,r)=>n=>(e(t,r,n),null),En=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];$l(i)&&typeof a=="function"&&(n||(n={}),n[i]=bw(a,t,r))}),n};function ef(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ww(e){for(var t=1;t(o[u]===void 0&&n[u]!==void 0&&(o[u]=n[u]),o),r);return a}function Si(){return Si=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var d=c.formatter||i,v=H({"recharts-legend-item":!0,["legend-item-".concat(f)]:!0,inactive:c.inactive});if(c.type==="none")return null;var p=c.inactive?a:c.color,y=d?d(c.value,c,f):c.value;return h.createElement("li",Si({className:v,style:l,key:"legend-item-".concat(f)},En(e,c,f)),h.createElement(Rl,{width:r,height:r,viewBox:u,style:s,"aria-label":"".concat(y," legend icon")},h.createElement(jw,{data:c,iconType:o,inactiveColor:a})),h.createElement("span",{className:"recharts-legend-item-text",style:{color:p}},y))})}var Iw=e=>{var t=pe(e,kw),{payload:r,layout:n,align:i}=t;if(!r||!r.length)return null;var a={padding:0,margin:0,textAlign:n==="horizontal"?i:"left"};return h.createElement("ul",{className:"recharts-default-legend",style:a},h.createElement(Cw,Si({},t,{payload:r})))},fo={},vo={},rf;function Mw(){return rf||(rf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let a=0;a=0}e.isLength=t})(yo)),yo}var of;function Hl(){return of||(of=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Tw();function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(mo)),mo}var go={},uf;function Dw(){return uf||(uf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(go)),go}var lf;function Nw(){return lf||(lf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Hl(),r=Dw();function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(po)),po}var bo={},wo={},cf;function $w(){return cf||(cf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ql();function r(n){return function(i){return t.get(i,n)}}e.property=r})(wo)),wo}var xo={},Po={},Oo={},Ao={},sf;function Dp(){return sf||(sf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(Ao)),Ao}var So={},ff;function Np(){return ff||(ff=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(So)),So}var Eo={},df;function $p(){return df||(df=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.eq=t})(Eo)),Eo}var vf;function Rw(){return vf||(vf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Dp(),r=Np(),n=$p();function i(c,f,d){return typeof d!="function"?i(c,f,()=>{}):a(c,f,function v(p,y,m,g,x,w){const P=d(p,y,m,g,x,w);return P!==void 0?!!P:a(p,y,v,w)},new Map)}function a(c,f,d,v){if(f===c)return!0;switch(typeof f){case"object":return o(c,f,d,v);case"function":return Object.keys(f).length>0?a(c,{...f},d,v):n.eq(c,f);default:return t.isObject(c)?typeof f=="string"?f==="":!0:n.eq(c,f)}}function o(c,f,d,v){if(f==null)return!0;if(Array.isArray(f))return l(c,f,d,v);if(f instanceof Map)return u(c,f,d,v);if(f instanceof Set)return s(c,f,d,v);const p=Object.keys(f);if(c==null)return p.length===0;if(p.length===0)return!0;if(v?.has(f))return v.get(f)===c;v?.set(f,c);try{for(let y=0;y{})}e.isMatch=r})(Po)),Po}var _o={},ko={},jo={},pf;function Lw(){return pf||(pf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(jo)),jo}var Co={},mf;function Lp(){return mf||(mf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(Co)),Co}var Io={},yf;function zp(){return yf||(yf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",u="[object Date]",l="[object Map]",s="[object Set]",c="[object Array]",f="[object Function]",d="[object ArrayBuffer]",v="[object Object]",p="[object Error]",y="[object DataView]",m="[object Uint8Array]",g="[object Uint8ClampedArray]",x="[object Uint16Array]",w="[object Uint32Array]",P="[object BigUint64Array]",b="[object Int8Array]",O="[object Int16Array]",S="[object Int32Array]",_="[object BigInt64Array]",I="[object Float32Array]",M="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=d,e.arrayTag=c,e.bigInt64ArrayTag=_,e.bigUint64ArrayTag=P,e.booleanTag=i,e.dataViewTag=y,e.dateTag=u,e.errorTag=p,e.float32ArrayTag=I,e.float64ArrayTag=M,e.functionTag=f,e.int16ArrayTag=O,e.int32ArrayTag=S,e.int8ArrayTag=b,e.mapTag=l,e.numberTag=n,e.objectTag=v,e.regexpTag=t,e.setTag=s,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=x,e.uint32ArrayTag=w,e.uint8ArrayTag=m,e.uint8ClampedArrayTag=g})(Io)),Io}var Mo={},gf;function zw(){return gf||(gf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(Mo)),Mo}var bf;function Bp(){return bf||(bf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Lw(),r=Lp(),n=zp(),i=Np(),a=zw();function o(c,f){return u(c,void 0,c,new Map,f)}function u(c,f,d,v=new Map,p=void 0){const y=p?.(c,f,d,v);if(y!==void 0)return y;if(i.isPrimitive(c))return c;if(v.has(c))return v.get(c);if(Array.isArray(c)){const m=new Array(c.length);v.set(c,m);for(let g=0;gt.isMatch(a,i)}e.matches=n})(xo)),xo}var To={},Do={},No={},Pf;function Kw(){return Pf||(Pf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Bp(),r=zp();function n(i,a){return t.cloneDeepWith(i,(o,u,l,s)=>{const c=a?.(o,u,l,s);if(c!==void 0)return c;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case r.numberTag:case r.stringTag:case r.booleanTag:{const f=new i.constructor(i?.valueOf());return t.copyProperties(f,i),f}case r.argumentsTag:{const f={};return t.copyProperties(f,i),f.length=i.length,f[Symbol.iterator]=i[Symbol.iterator],f}default:return}})}e.cloneDeepWith=n})(No)),No}var Of;function qw(){return Of||(Of=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Kw();function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(Do)),Do}var $o={},Ro={},Af;function Fp(){return Af||(Af=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&ne,ee=()=>{var e=h.useContext(Yl);return e?e.store.dispatch:Zw},pi=()=>{},Qw=()=>pi,Jw=(e,t)=>e===t;function T(e){var t=h.useContext(Yl);return cb.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Qw,t?t.store.getState:pi,t?t.store.getState:pi,t?e:pi,Jw)}function ex(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function tx(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function rx(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Mf=e=>Array.isArray(e)?e:[e];function nx(e){const t=Array.isArray(e[0])?e[0]:e;return rx(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ix(e,t){const r=[],{length:n}=e;for(let i=0;i{r=Qn(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function lx(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,u,l={},s=i.pop();typeof s=="object"&&(l=s,s=i.pop()),ex(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:v=qp,argsMemoizeOptions:p=[]}=c,y=Mf(d),m=Mf(p),g=nx(i),x=f(function(){return a++,s.apply(null,arguments)},...y),w=v(function(){o++;const b=ix(g,arguments);return u=x.apply(null,b),u},...m);return Object.assign(w,{resultFunc:s,memoizedResultFunc:x,dependencies:g,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>u,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:v})};return Object.assign(n,{withTypes:()=>n}),n}var A=lx(qp),cx=Object.assign((e,t=A)=>{tx(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,u,l)=>(o[r[l]]=u,o),{}))},{withTypes:()=>cx}),Bo={},Fo={},Ko={},Df;function sx(){return Df||(Df=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,i,a)=>{if(n!==i){const o=t(n),u=t(i);if(o===u&&o===0){if(ni)return a==="desc"?-1:1}return a==="desc"?u-o:o-u}return 0};e.compareValues=r})(Ko)),Ko}var qo={},Wo={},Nf;function Wp(){return Nf||(Nf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(Wo)),Wo}var $f;function fx(){return $f||($f=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wp(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(n.test(a)||!r.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(qo)),qo}var Rf;function dx(){return Rf||(Rf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=sx(),r=fx(),n=Kl();function i(a,o,u,l){if(a==null)return[];u=l?void 0:u,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(u)||(u=u==null?[]:[u]),u=u.map(v=>String(v));const s=(v,p)=>{let y=v;for(let m=0;mp==null||v==null?p:typeof v=="object"&&"key"in v?Object.hasOwn(p,v.key)?p[v.key]:s(p,v.path):typeof v=="function"?v(p):Array.isArray(v)?s(p,v):typeof p=="object"?p[v]:p,f=o.map(v=>(Array.isArray(v)&&v.length===1&&(v=v[0]),v==null||typeof v=="function"||Array.isArray(v)||r.isKey(v)?v:{key:v,path:n.toPath(v)}));return a.map(v=>({original:v,criteria:f.map(p=>c(p,v))})).slice().sort((v,p)=>{for(let y=0;yv.original)}e.orderBy=i})(Fo)),Fo}var Uo={},Lf;function vx(){return Lf||(Lf=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const i=[],a=Math.floor(n),o=(u,l)=>{for(let s=0;s1&&n.isIterateeCall(a,o[0],o[1])?o=[]:u>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,r.flatten(o),["asc"])}e.sortBy=i})(Bo)),Bo}var Yo,Ff;function px(){return Ff||(Ff=1,Yo=hx().sortBy),Yo}var mx=px();const ha=Qt(mx);var Hp=e=>e.legend.settings,yx=e=>e.legend.size,gx=e=>e.legend.payload,bx=A([gx,Hp],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?ha(n,r):n});function wx(){return T(bx)}var Jn=1;function Yp(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Jn||Math.abs(o.left-t.left)>Jn||Math.abs(o.top-t.top)>Jn||Math.abs(o.width-t.width)>Jn)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function _e(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var xx=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kf=xx,Go=()=>Math.random().toString(36).substring(7).split("").join("."),Px={INIT:`@@redux/INIT${Go()}`,REPLACE:`@@redux/REPLACE${Go()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Go()}`},Ei=Px;function Gl(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Gp(e,t,r){if(typeof e!="function")throw new Error(_e(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(_e(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(_e(1));return r(Gp)(e,t)}let n=e,i=t,a=new Map,o=a,u=0,l=!1;function s(){o===a&&(o=new Map,a.forEach((m,g)=>{o.set(g,m)}))}function c(){if(l)throw new Error(_e(3));return i}function f(m){if(typeof m!="function")throw new Error(_e(4));if(l)throw new Error(_e(5));let g=!0;s();const x=u++;return o.set(x,m),function(){if(g){if(l)throw new Error(_e(6));g=!1,s(),o.delete(x),a=null}}}function d(m){if(!Gl(m))throw new Error(_e(7));if(typeof m.type>"u")throw new Error(_e(8));if(typeof m.type!="string")throw new Error(_e(17));if(l)throw new Error(_e(9));try{l=!0,i=n(i,m)}finally{l=!1}return(a=o).forEach(x=>{x()}),m}function v(m){if(typeof m!="function")throw new Error(_e(10));n=m,d({type:Ei.REPLACE})}function p(){const m=f;return{subscribe(g){if(typeof g!="object"||g===null)throw new Error(_e(11));function x(){const P=g;P.next&&P.next(c())}return x(),{unsubscribe:m(x)}},[Kf](){return this}}}return d({type:Ei.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:v,[Kf]:p}}function Ox(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ei.INIT})>"u")throw new Error(_e(12));if(typeof r(void 0,{type:Ei.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(_e(13))})}function Vp(e){const t=Object.keys(e),r={};for(let a=0;a"u")throw u&&u.type,new Error(_e(14));s[f]=p,l=l||p!==v}return l=l||n.length!==Object.keys(o).length,l?s:o}}function _i(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function Ax(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(_e(15))};const o={getState:i.getState,dispatch:(l,...s)=>a(l,...s)},u=e.map(l=>l(o));return a=_i(...u)(i.dispatch),{...i,dispatch:a}}}function Xp(e){return Gl(e)&&"type"in e&&typeof e.type=="string"}var Zp=Symbol.for("immer-nothing"),qf=Symbol.for("immer-draftable"),Re=Symbol.for("immer-state");function lt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ve=Object,Mr=Ve.getPrototypeOf,ki="constructor",pa="prototype",Bu="configurable",ji="enumerable",mi="writable",sn="value",It=e=>!!e&&!!e[Re];function vt(e){return e?Qp(e)||ma(e)||!!e[qf]||!!e[ki]?.[qf]||ya(e)||ga(e):!1}var Sx=Ve[pa][ki].toString(),Wf=new WeakMap;function Qp(e){if(!e||!Vl(e))return!1;const t=Mr(e);if(t===null||t===Ve[pa])return!0;const r=Ve.hasOwnProperty.call(t,ki)&&t[ki];if(r===Object)return!0;if(!Er(r))return!1;let n=Wf.get(r);return n===void 0&&(n=Function.toString.call(r),Wf.set(r,n)),n===Sx}function _n(e,t,r=!0){kn(e)===0?(r?Reflect.ownKeys(e):Ve.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function kn(e){const t=e[Re];return t?t.type_:ma(e)?1:ya(e)?2:ga(e)?3:0}var Uf=(e,t,r=kn(e))=>r===2?e.has(t):Ve[pa].hasOwnProperty.call(e,t),Fu=(e,t,r=kn(e))=>r===2?e.get(t):e[t],Ci=(e,t,r,n=kn(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function Ex(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ma=Array.isArray,ya=e=>e instanceof Map,ga=e=>e instanceof Set,Vl=e=>typeof e=="object",Er=e=>typeof e=="function",Vo=e=>typeof e=="boolean",Ot=e=>e.copy_||e.base_,Xl=e=>e.modified_?e.copy_:e.base_;function Ku(e,t){if(ya(e))return new Map(e);if(ga(e))return new Set(e);if(ma(e))return Array[pa].slice.call(e);const r=Qp(e);if(t===!0||t==="class_only"&&!r){const n=Ve.getOwnPropertyDescriptors(e);delete n[Re];let i=Reflect.ownKeys(n);for(let a=0;a1&&Ve.defineProperties(e,{set:ei,add:ei,clear:ei,delete:ei}),Ve.freeze(e),t&&_n(e,(r,n)=>{Zl(n,!0)},!1)),e}function _x(){lt(2)}var ei={[sn]:_x};function ba(e){return e===null||!Vl(e)?!0:Ve.isFrozen(e)}var Ii="MapSet",qu="Patches",Jp={};function Tr(e){const t=Jp[e];return t||lt(0,e),t}var kx=e=>!!Jp[e],fn,em=()=>fn,jx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:kx(Ii)?Tr(Ii):void 0});function Hf(e,t){t&&(e.patchPlugin_=Tr(qu),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Wu(e){Uu(e),e.drafts_.forEach(Cx),e.drafts_=null}function Uu(e){e===fn&&(fn=e.parent_)}var Yf=e=>fn=jx(fn,e);function Cx(e){const t=e[Re];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gf(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Re].modified_&&(Wu(t),lt(4)),vt(e)&&(e=Vf(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[Re].base_,e,t)}else e=Vf(t,r);return Ix(t,e,!0),Wu(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zp?e:void 0}function Vf(e,t){if(ba(t))return t;const r=t[Re];if(!r)return Ql(t,e.handledSet_,e);if(!wa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);nm(r,e)}return r.copy_}function Ix(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zl(t,r)}function tm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var wa=(e,t)=>e.scope_===t,Mx=[];function rm(e,t,r,n){const i=Ot(e),a=e.type_;if(n!==void 0&&Fu(i,n,a)===t){Ci(i,n,r,a);return}if(!e.draftLocations_){const u=e.draftLocations_=new Map;_n(i,(l,s)=>{if(It(s)){const c=u.get(s)||[];c.push(l),u.set(s,c)}})}const o=e.draftLocations_.get(t)??Mx;for(const u of o)Ci(i,u,r,a)}function Tx(e,t,r){e.callbacks_.push(function(i){const a=t;if(!a||!wa(a,i))return;i.mapSetPlugin_?.fixSetContents(a);const o=Xl(a);rm(e,a.draft_??a,o,r),nm(a,i)})}function nm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const i=n.getPath(e);i&&n.generatePatches_(e,i,t)}tm(e)}}function Dx(e,t,r){const{scope_:n}=e;if(It(r)){const i=r[Re];wa(i,n)&&i.callbacks_.push(function(){yi(e);const o=Xl(i);rm(e,r,o,t)})}else vt(r)&&e.callbacks_.push(function(){const a=Ot(e);Fu(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ql(Fu(e.copy_,t,e.type_),n.handledSet_,n)})}function Ql(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||It(e)||t.has(e)||!vt(e)||ba(e)||(t.add(e),_n(e,(n,i)=>{if(It(i)){const a=i[Re];if(wa(a,r)){const o=Xl(a);Ci(e,n,o,e.type_),tm(a)}}else vt(i)&&Ql(i,t,r)})),e}function Nx(e,t){const r=ma(e),n={type_:r?1:0,scope_:t?t.scope_:em(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Jl;r&&(i=[n],a=dn);const{revoke:o,proxy:u}=Proxy.revocable(i,a);return n.draft_=u,n.revoke_=o,[u,n]}var Jl={get(e,t){if(t===Re)return e;const r=Ot(e);if(!Uf(r,t,e.type_))return $x(e,r,t);const n=r[t];if(e.finalized_||!vt(n))return n;if(n===Xo(e.base_,t)){yi(e);const i=e.type_===1?+t:t,a=Yu(e.scope_,n,e,i);return e.copy_[i]=a}return n},has(e,t){return t in Ot(e)},ownKeys(e){return Reflect.ownKeys(Ot(e))},set(e,t,r){const n=im(Ot(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Xo(Ot(e),t),a=i?.[Re];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Ex(r,i)&&(r!==void 0||Uf(e.base_,t,e.type_)))return!0;yi(e),Hu(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Dx(e,t,r)),!0},deleteProperty(e,t){return yi(e),Xo(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Hu(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ot(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[mi]:!0,[Bu]:e.type_!==1||t!=="length",[ji]:n[ji],[sn]:r[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return Mr(e.base_)},setPrototypeOf(){lt(12)}},dn={};_n(Jl,(e,t)=>{dn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}});dn.deleteProperty=function(e,t){return dn.set.call(this,e,t,void 0)};dn.set=function(e,t,r){return Jl.set.call(this,e[0],t,r,e[0])};function Xo(e,t){const r=e[Re];return(r?Ot(r):e)[t]}function $x(e,t,r){const n=im(t,r);return n?sn in n?n[sn]:n.get?.call(e.draft_):void 0}function im(e,t){if(!(t in e))return;let r=Mr(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Mr(r)}}function Hu(e){e.modified_||(e.modified_=!0,e.parent_&&Hu(e.parent_))}function yi(e){e.copy_||(e.assigned_=new Map,e.copy_=Ku(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Rx=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(Er(r)&&!Er(n)){const o=n;n=r;const u=this;return function(s=o,...c){return u.produce(s,f=>n.call(this,f,...c))}}Er(n)||lt(6),i!==void 0&&!Er(i)&<(7);let a;if(vt(r)){const o=Yf(this),u=Yu(o,r,void 0);let l=!0;try{a=n(u),l=!1}finally{l?Wu(o):Uu(o)}return Hf(o,i),Gf(a,o)}else if(!r||!Vl(r)){if(a=n(r),a===void 0&&(a=r),a===Zp&&(a=void 0),this.autoFreeze_&&Zl(a,!0),i){const o=[],u=[];Tr(qu).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:u}),i(o,u)}return a}else lt(1,r)},this.produceWithPatches=(r,n)=>{if(Er(r))return(u,...l)=>this.produceWithPatches(u,s=>r(s,...l));let i,a;return[this.produce(r,n,(u,l)=>{i=u,a=l}),i,a]},Vo(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Vo(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Vo(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){vt(t)||lt(8),It(t)&&(t=ft(t));const r=Yf(this),n=Yu(r,t,void 0);return n[Re].isManual_=!0,Uu(r),n}finishDraft(t,r){const n=t&&t[Re];(!n||!n.isManual_)&<(9);const{scope_:i}=n;return Hf(i,r),Gf(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Tr(qu).applyPatches_;return It(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Yu(e,t,r,n){const[i,a]=ya(t)?Tr(Ii).proxyMap_(t,r):ga(t)?Tr(Ii).proxySet_(t,r):Nx(t,r);return(r?.scope_??em()).drafts_.push(i),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&n!==void 0?Tx(r,a,n):a.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:s}=l;a.modified_&&s&&s.generatePatches_(a,[],l)}),i}function ft(e){return It(e)||lt(10,e),am(e)}function am(e){if(!vt(e)||ba(e))return e;const t=e[Re];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ku(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ku(e,!0);return _n(r,(i,a)=>{Ci(r,i,am(a))},n),t&&(t.finalized_=!1),r}var Lx=new Rx,om=Lx.produce;function um(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var zx=um(),Bx=um,Fx=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?_i:_i.apply(null,arguments)};function at(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(Xe(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Xp(n)&&n.type===e,r}var lm=class on extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,on.prototype)}static get[Symbol.species](){return on}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new on(...t[0].concat(this)):new on(...t.concat(this))}};function Xf(e){return vt(e)?om(e,()=>{}):e}function ti(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function Kx(e){return typeof e=="boolean"}var qx=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new lm;return r&&(Kx(r)?o.push(zx):o.push(Bx(r.extraArgument))),o},cm="RTK_autoBatch",re=()=>e=>({payload:e,meta:{[cm]:!0}}),Zf=e=>t=>{setTimeout(t,e)},sm=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const u=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Zf(10):e.type==="callback"?e.queueNotification:Zf(e.timeout),s=()=>{o=!1,a&&(a=!1,u.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return u.add(c),()=>{d(),u.delete(c)}},dispatch(c){try{return i=!c?.meta?.[cm],a=!i,a&&(o||(o=!0,l(s))),n.dispatch(c)}finally{i=!0}}})},Wx=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new lm(e);return n&&i.push(sm(typeof n=="object"?n:void 0)),i};function Ux(e){const t=qx(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let u;if(typeof r=="function")u=r;else if(Gl(r))u=Vp(r);else throw new Error(Xe(1));let l;typeof n=="function"?l=n(t):l=t();let s=_i;i&&(s=Fx({trace:!1,...typeof i=="object"&&i}));const c=Ax(...l),f=Wx(c);let d=typeof o=="function"?o(f):f();const v=s(...d);return Gp(u,a,v)}function fm(e){const t={},r=[];let n;const i={addCase(a,o){const u=typeof a=="string"?a:a.type;if(!u)throw new Error(Xe(28));if(u in t)throw new Error(Xe(29));return t[u]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function Hx(e){return typeof e=="function"}function Yx(e,t){let[r,n,i]=fm(t),a;if(Hx(e))a=()=>Xf(e());else{const u=Xf(e);a=()=>u}function o(u=a(),l){let s=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return s.filter(c=>!!c).length===0&&(s=[i]),s.reduce((c,f)=>{if(f)if(It(c)){const v=f(c,l);return v===void 0?c:v}else{if(vt(c))return om(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},u)}return o.getInitialState=a,o}var Gx="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Vx=(e=21)=>{let t="",r=e;for(;r--;)t+=Gx[Math.random()*64|0];return t},Xx=Symbol.for("rtk-slice-createasyncthunk");function Zx(e,t){return`${e}/${t}`}function Qx({creators:e}={}){const t=e?.asyncThunk?.[Xx];return function(n){const{name:i,reducerPath:a=i}=n;if(!i)throw new Error(Xe(11));const o=(typeof n.reducers=="function"?n.reducers(eP()):n.reducers)||{},u=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(w,P){const b=typeof w=="string"?w:w.type;if(!b)throw new Error(Xe(12));if(b in l.sliceCaseReducersByType)throw new Error(Xe(13));return l.sliceCaseReducersByType[b]=P,s},addMatcher(w,P){return l.sliceMatchers.push({matcher:w,reducer:P}),s},exposeAction(w,P){return l.actionCreators[w]=P,s},exposeCaseReducer(w,P){return l.sliceCaseReducersByName[w]=P,s}};u.forEach(w=>{const P=o[w],b={reducerName:w,type:Zx(i,w),createNotation:typeof n.reducers=="function"};rP(P)?iP(b,P,s,t):tP(b,P,s)});function c(){const[w={},P=[],b=void 0]=typeof n.extraReducers=="function"?fm(n.extraReducers):[n.extraReducers],O={...w,...l.sliceCaseReducersByType};return Yx(n.initialState,S=>{for(let _ in O)S.addCase(_,O[_]);for(let _ of l.sliceMatchers)S.addMatcher(_.matcher,_.reducer);for(let _ of P)S.addMatcher(_.matcher,_.reducer);b&&S.addDefaultCase(b)})}const f=w=>w,d=new Map,v=new WeakMap;let p;function y(w,P){return p||(p=c()),p(w,P)}function m(){return p||(p=c()),p.getInitialState()}function g(w,P=!1){function b(S){let _=S[w];return typeof _>"u"&&P&&(_=ti(v,b,m)),_}function O(S=f){const _=ti(d,P,()=>new WeakMap);return ti(_,S,()=>{const I={};for(const[M,E]of Object.entries(n.selectors??{}))I[M]=Jx(E,S,()=>ti(v,S,m),P);return I})}return{reducerPath:w,getSelectors:O,get selectors(){return O(b)},selectSlice:b}}const x={name:i,reducer:y,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:m,...g(a),injectInto(w,{reducerPath:P,...b}={}){const O=P??a;return w.inject({reducerPath:O,reducer:y},b),{...x,...g(O,!0)}}};return x}}function Jx(e,t,r,n){function i(a,...o){let u=t(a);return typeof u>"u"&&n&&(u=r()),e(u,...o)}return i.unwrapped=e,i}var qe=Qx();function eP(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function tP({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!nP(n))throw new Error(Xe(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?at(e,o):at(e))}function rP(e){return e._reducerDefinitionType==="asyncThunk"}function nP(e){return e._reducerDefinitionType==="reducerWithPrepare"}function iP({type:e,reducerName:t},r,n,i){if(!i)throw new Error(Xe(18));const{payloadCreator:a,fulfilled:o,pending:u,rejected:l,settled:s,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),u&&n.addCase(f.pending,u),l&&n.addCase(f.rejected,l),s&&n.addMatcher(f.settled,s),n.exposeCaseReducer(t,{fulfilled:o||ri,pending:u||ri,rejected:l||ri,settled:s||ri})}function ri(){}var aP="task",dm="listener",vm="completed",ec="cancelled",oP=`task-${ec}`,uP=`task-${vm}`,Gu=`${dm}-${ec}`,lP=`${dm}-${vm}`,xa=class{constructor(e){this.code=e,this.message=`${aP} ${ec} (reason: ${e})`}name="TaskAbortError";message},tc=(e,t)=>{if(typeof e!="function")throw new TypeError(Xe(32))},Mi=()=>{},hm=(e,t=Mi)=>(e.catch(t),e),pm=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),fr=e=>{if(e.aborted)throw new xa(e.reason)};function mm(e,t){let r=Mi;return new Promise((n,i)=>{const a=()=>i(new xa(e.reason));if(e.aborted){a();return}r=pm(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Mi})}var cP=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof xa?"cancelled":"rejected",error:r}}finally{t?.()}},Ti=e=>t=>hm(mm(e,t).then(r=>(fr(e),r))),ym=e=>{const t=Ti(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:jr}=Object,Qf={},Pa="listenerMiddleware",sP=(e,t)=>{const r=n=>pm(e,()=>n.abort(e.reason));return(n,i)=>{tc(n);const a=new AbortController;r(a);const o=cP(async()=>{fr(e),fr(a.signal);const u=await n({pause:Ti(a.signal),delay:ym(a.signal),signal:a.signal});return fr(a.signal),u},()=>a.abort(uP));return i?.autoJoin&&t.push(o.catch(Mi)),{result:Ti(e)(o),cancel(){a.abort(oP)}}}},fP=(e,t)=>{const r=async(n,i)=>{fr(t);let a=()=>{};const u=[new Promise((l,s)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),s()}})];i!=null&&u.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await mm(t,Promise.race(u));return fr(t),l}finally{a()}};return(n,i)=>hm(r(n,i))},gm=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=at(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(Xe(21));return tc(a),{predicate:i,type:t,effect:a}},bm=jr(e=>{const{type:t,predicate:r,effect:n}=gm(e);return{id:Vx(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(Xe(22))}}},{withTypes:()=>bm}),Jf=(e,t)=>{const{type:r,effect:n,predicate:i}=gm(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Vu=e=>{e.pending.forEach(t=>{t.abort(Gu)})},dP=(e,t)=>()=>{for(const r of t.keys())Vu(r);e.clear()},ed=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},wm=jr(at(`${Pa}/add`),{withTypes:()=>wm}),vP=at(`${Pa}/removeAll`),xm=jr(at(`${Pa}/remove`),{withTypes:()=>xm}),hP=(...e)=>{console.error(`${Pa}/error`,...e)},jn=(e={})=>{const t=new Map,r=new Map,n=v=>{const p=r.get(v)??0;r.set(v,p+1)},i=v=>{const p=r.get(v)??1;p===1?r.delete(v):r.set(v,p-1)},{extra:a,onError:o=hP}=e;tc(o);const u=v=>(v.unsubscribe=()=>t.delete(v.id),t.set(v.id,v),p=>{v.unsubscribe(),p?.cancelActive&&Vu(v)}),l=v=>{const p=Jf(t,v)??bm(v);return u(p)};jr(l,{withTypes:()=>l});const s=v=>{const p=Jf(t,v);return p&&(p.unsubscribe(),v.cancelActive&&Vu(p)),!!p};jr(s,{withTypes:()=>s});const c=async(v,p,y,m)=>{const g=new AbortController,x=fP(l,g.signal),w=[];try{v.pending.add(g),n(v),await Promise.resolve(v.effect(p,jr({},y,{getOriginalState:m,condition:(P,b)=>x(P,b).then(Boolean),take:x,delay:ym(g.signal),pause:Ti(g.signal),extra:a,signal:g.signal,fork:sP(g.signal,w),unsubscribe:v.unsubscribe,subscribe:()=>{t.set(v.id,v)},cancelActiveListeners:()=>{v.pending.forEach((P,b,O)=>{P!==g&&(P.abort(Gu),O.delete(P))})},cancel:()=>{g.abort(Gu),v.pending.delete(g)},throwIfCancelled:()=>{fr(g.signal)}})))}catch(P){P instanceof xa||ed(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),g.abort(lP),i(v),v.pending.delete(g)}},f=dP(t,r);return{middleware:v=>p=>y=>{if(!Xp(y))return p(y);if(wm.match(y))return l(y.payload);if(vP.match(y)){f();return}if(xm.match(y))return s(y.payload);let m=v.getState();const g=()=>{if(m===Qf)throw new Error(Xe(23));return m};let x;try{if(x=p(y),t.size>0){const w=v.getState(),P=Array.from(t.values());for(const b of P){let O=!1;try{O=b.predicate(y,w,m)}catch(S){O=!1,ed(o,S,{raisedBy:"predicate"})}O&&c(b,y,v,g)}}}finally{m=Qf}return x},startListening:l,stopListening:s,clearListeners:f}};function Xe(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var pP={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Pm=qe({name:"chartLayout",initialState:pP,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:mP,setLayout:yP,setChartSize:gP,setScale:bP}=Pm.actions,wP=Pm.reducer;function Om(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function _r(e){for(var t=1;t{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:u}=t;if((u==="vertical"||u==="horizontal"&&o==="middle")&&a!=="center"&&N(e[a]))return _r(_r({},e),{},{[a]:e[a]+(n||0)});if((u==="horizontal"||u==="vertical"&&a==="center")&&o!=="middle"&&N(e[o]))return _r(_r({},e),{},{[o]:e[o]+(i||0)})}return e},Jt=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",Am=(e,t,r,n)=>{if(n)return e.map(u=>u.coordinate);var i,a,o=e.map(u=>(u.coordinate===t&&(i=!0),u.coordinate===r&&(a=!0),u.coordinate));return i||o.push(t),a||o.push(r),o},Sm=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:u,isCategorical:l,categoricalDomain:s,tickCount:c,ticks:f,niceTicks:d,axisType:v}=e;if(!o)return null;var p=u==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,y=i==="category"&&o.bandwidth?o.bandwidth()/p:0;if(y=v==="angleAxis"&&a&&a.length>=2?Ae(a[0]-a[1])*2*y:y,f||d){var m=(f||d||[]).map((g,x)=>{var w=n?n.indexOf(g):g;return{coordinate:o(w)+y,value:g,offset:y,index:x}});return m.filter(g=>!dt(g.coordinate))}return l&&s?s.map((g,x)=>({coordinate:o(g)+y,value:g,index:x,offset:y})):o.ticks&&c!=null?o.ticks(c).map((g,x)=>({coordinate:o(g)+y,value:g,offset:y,index:x})):o.domain().map((g,x)=>({coordinate:o(g)+y,value:n?n[g]:g,index:x,offset:y}))},rd=1e-4,SP=e=>{var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),i=Math.min(n[0],n[1])-rd,a=Math.max(n[0],n[1])+rd,o=e(t[0]),u=e(t[r-1]);(oa||ua)&&e.domain([t[0],t[r-1]])}},EP=(e,t)=>{if(!t||t.length!==2||!N(t[0])||!N(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!N(e[0])||e[0]n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[o][r][0]=i,e[o][r][1]=i+u,i=e[o][r][1]):(e[o][r][0]=a,e[o][r][1]=a+u,a=e[o][r][1])}},kP=e=>{var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r=0?(e[a][r][0]=i,e[a][r][1]=i+o,i=e[a][r][1]):(e[a][r][0]=0,e[a][r][1]=0)}},jP={sign:_P,expand:ew,none:Ir,silhouette:tw,wiggle:rw,positive:kP},CP=(e,t,r)=>{var n=jP[r],i=Jb().keys(t).value((a,o)=>Number(X(a,o,0))).order(Lu).offset(n);return i(e)};function IP(e){return e==null?void 0:String(e)}function nd(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ae(i[t.dataKey])){var u=Cp(r,"value",i[t.dataKey]);if(u)return u.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var l=X(i,ae(o)?t.dataKey:o);return ae(l)?null:t.scale(l)}var id=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var u=X(a,t.dataKey,t.scale.domain()[o]);return ae(u)?null:t.scale(u)-i/2+n},MP=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},TP=e=>{var t=e.flat(2).filter(N);return[Math.min(...t),Math.max(...t)]},DP=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],NP=(e,t,r)=>{if(e!=null)return DP(Object.keys(e).reduce((n,i)=>{var a=e[i],{stackedData:o}=a,u=o.reduce((l,s)=>{var c=Om(s,t,r),f=TP(c);return[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(u[0],n[0]),Math.max(u[1],n[1])]},[1/0,-1/0]))},ad=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,od=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Dr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=ha(t,c=>c.coordinate),a=1/0,o=1,u=i.length;o{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},RP=(e,t)=>t==="centric"?e.angle:e.radius,Rt=e=>e.layout.width,Lt=e=>e.layout.height,LP=e=>e.layout.scale,Em=e=>e.layout.margin,Oa=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Aa=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),_m="data-recharts-item-index",km="data-recharts-item-data-key",Cn=60;function ld(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ni(e){for(var t=1;te.brush.height;function qP(e){var t=Aa(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Cn;return r+i}return r},0)}function WP(e){var t=Aa(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Cn;return r+i}return r},0)}function UP(e){var t=Oa(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function HP(e){var t=Oa(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var ye=A([Rt,Lt,Em,KP,qP,WP,UP,HP,Hp,yx],(e,t,r,n,i,a,o,u,l,s)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+u},d=ni(ni({},f),c),v=d.bottom;d.bottom+=n,d=AP(d,l,s);var p=e-d.left-d.right,y=t-d.top-d.bottom;return ni(ni({brushBottom:v},d),{},{width:Math.max(p,0),height:Math.max(y,0)})}),YP=A(ye,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),rc=A(Rt,Lt,(e,t)=>({x:0,y:0,width:e,height:t})),GP=h.createContext(null),Me=()=>h.useContext(GP)!=null,Sa=e=>e.brush,Ea=A([Sa,ye,Em],(e,t,r)=>({height:e.height,x:N(e.x)?e.x:t.left,y:N(e.y)?e.y:t.top+t.height+t.brushBottom-(r?.bottom||0),width:N(e.width)?e.width:t.width})),Zo={},Qo={},Jo={},cd;function VP(){return cd||(cd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:i,edges:a}={}){let o,u=null;const l=a!=null&&a.includes("leading"),s=a==null||a.includes("trailing"),c=()=>{u!==null&&(r.apply(o,u),o=void 0,u=null)},f=()=>{s&&c(),y()};let d=null;const v=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,f()},n)},p=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{p(),o=void 0,u=null},m=()=>{c()},g=function(...x){if(i?.aborted)return;o=this,u=x;const w=d==null;v(),l&&w&&c()};return g.schedule=v,g.cancel=y,g.flush=m,i?.addEventListener("abort",y,{once:!0}),g}e.debounce=t})(Jo)),Jo}var sd;function XP(){return sd||(sd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=VP();function r(n,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:u=!0,maxWait:l}=a,s=Array(2);o&&(s[0]="leading"),u&&(s[1]="trailing");let c,f=null;const d=t.debounce(function(...y){c=n.apply(this,y),f=null},i,{edges:s}),v=function(...y){return l!=null&&(f===null&&(f=Date.now()),Date.now()-f>=l)?(c=n.apply(this,y),f=Date.now(),d.cancel(),d.schedule(),c):(d.apply(this,y),c)},p=()=>(d.flush(),c);return v.cancel=d.cancel,v.flush=p,v}e.debounce=r})(Qo)),Qo}var fd;function ZP(){return fd||(fd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=XP();function r(n,i=0,a={}){const{leading:o=!0,trailing:u=!0}=a;return t.debounce(n,i,{leading:o,maxWait:i,trailing:u})}e.throttle=r})(Zo)),Zo}var eu,dd;function QP(){return dd||(dd=1,eu=ZP().throttle),eu}var JP=QP();const eO=Qt(JP);var Di=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;ai[o++]))}},jm=(e,t,r)=>{var{width:n="100%",height:i="100%",aspect:a,maxHeight:o}=r,u=Ct(n)?e:Number(n),l=Ct(i)?t:Number(i);return a&&a>0&&(u?l=u/a:l&&(u=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:u,calculatedHeight:l}},tO={width:0,height:0,overflow:"visible"},rO={width:0,overflowX:"visible"},nO={height:0,overflowY:"visible"},iO={},aO=e=>{var{width:t,height:r}=e,n=Ct(t),i=Ct(r);return n&&i?tO:n?rO:i?nO:iO};function oO(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i="100%",a="100%"):i===void 0?i=n&&n>0?void 0:"100%":a===void 0&&(a=n&&n>0?void 0:"100%"),{width:i,height:a}}function se(e){return Number.isFinite(e)}function wt(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Xu(){return Xu=Object.assign?Object.assign.bind():function(e){for(var t=1;t({width:r,height:n}),[r,n]);return sO(i)?h.createElement(Cm.Provider,{value:i},t):null}var nc=()=>h.useContext(Cm),fO=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:u,maxHeight:l,children:s,debounce:c=0,id:f,className:d,onResize:v,style:p={}}=e,y=h.useRef(null),m=h.useRef();m.current=v,h.useImperativeHandle(t,()=>y.current);var[g,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((_,I)=>{x(M=>{var E=Math.round(_),j=Math.round(I);return M.containerWidth===E&&M.containerHeight===j?M:{containerWidth:E,containerHeight:j}})},[]);h.useEffect(()=>{if(y.current==null||typeof ResizeObserver>"u")return Sn;var _=j=>{var $,{width:L,height:z}=j[0].contentRect;w(L,z),($=m.current)===null||$===void 0||$.call(m,L,z)};c>0&&(_=eO(_,c,{trailing:!0,leading:!1}));var I=new ResizeObserver(_),{width:M,height:E}=y.current.getBoundingClientRect();return w(M,E),I.observe(y.current),()=>{I.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:b}=g;Di(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:O,calculatedHeight:S}=jm(P,b,{width:i,height:a,aspect:r,maxHeight:l});return Di(O!=null&&O>0||S!=null&&S>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,O,S,i,a,o,u,r),h.createElement("div",{id:f?"".concat(f):void 0,className:H("recharts-responsive-container",d),style:hd(hd({},p),{},{width:i,height:a,minWidth:o,minHeight:u,maxHeight:l}),ref:y},h.createElement("div",{style:aO({width:i,height:a})},h.createElement(Im,{width:O,height:S},s)))}),I$=h.forwardRef((e,t)=>{var r=nc();if(wt(r.width)&&wt(r.height))return e.children;var{width:n,height:i}=oO({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=jm(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return N(a)&&N(o)?h.createElement(Im,{width:a,height:o},e.children):h.createElement(fO,Xu({},e,{width:n,height:i,ref:t}))});function Mm(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var _a=()=>{var e,t=Me(),r=T(YP),n=T(Ea),i=(e=T(Sa))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},dO={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Tm=()=>{var e;return(e=T(ye))!==null&&e!==void 0?e:dO},ic=()=>T(Rt),ac=()=>T(Lt),vO=()=>T(e=>e.layout.margin),q=e=>e.layout.layoutType,In=()=>T(q),hO=()=>{var e=In();return e!==void 0},ka=e=>{var t=ee(),r=Me(),{width:n,height:i}=e,a=nc(),o=n,u=i;return a&&(o=a.width>0?a.width:n,u=a.height>0?a.height:i),h.useEffect(()=>{!r&&wt(o)&&wt(u)&&t(gP({width:o,height:u}))},[t,r,o,u]),null},Dm=Symbol.for("immer-nothing"),pd=Symbol.for("immer-draftable"),Qe=Symbol.for("immer-state");function ct(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var vn=Object.getPrototypeOf;function Nr(e){return!!e&&!!e[Qe]}function mr(e){return e?Nm(e)||Array.isArray(e)||!!e[pd]||!!e.constructor?.[pd]||Mn(e)||Ca(e):!1}var pO=Object.prototype.constructor.toString(),md=new WeakMap;function Nm(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=md.get(r);return n===void 0&&(n=Function.toString.call(r),md.set(r,n)),n===pO}function Ni(e,t,r=!0){ja(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function ja(e){const t=e[Qe];return t?t.type_:Array.isArray(e)?1:Mn(e)?2:Ca(e)?3:0}function Zu(e,t){return ja(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $m(e,t,r){const n=ja(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function mO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mn(e){return e instanceof Map}function Ca(e){return e instanceof Set}function or(e){return e.copy_||e.base_}function Qu(e,t){if(Mn(e))return new Map(e);if(Ca(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Nm(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[Qe];let i=Reflect.ownKeys(n);for(let a=0;a1&&Object.defineProperties(e,{set:ii,add:ii,clear:ii,delete:ii}),Object.freeze(e),t&&Object.values(e).forEach(r=>oc(r,!0))),e}function yO(){ct(2)}var ii={value:yO};function Ia(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var gO={};function yr(e){const t=gO[e];return t||ct(0,e),t}var hn;function Rm(){return hn}function bO(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yd(e,t){t&&(yr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ju(e){el(e),e.drafts_.forEach(wO),e.drafts_=null}function el(e){e===hn&&(hn=e.parent_)}function gd(e){return hn=bO(hn,e)}function wO(e){const t=e[Qe];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[Qe].modified_&&(Ju(t),ct(4)),mr(e)&&(e=$i(t,e),t.parent_||Ri(t,e)),t.patches_&&yr("Patches").generateReplacementPatches_(r[Qe].base_,e,t.patches_,t.inversePatches_)):e=$i(t,r,[]),Ju(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Dm?e:void 0}function $i(e,t,r){if(Ia(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[Qe];if(!i)return Ni(t,(a,o)=>wd(e,i,t,a,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return Ri(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,u=!1;i.type_===3&&(o=new Set(a),a.clear(),u=!0),Ni(o,(l,s)=>wd(e,i,a,l,s,r,u),n),Ri(e,a,!1),r&&e.patches_&&yr("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function wd(e,t,r,n,i,a,o){if(i==null||typeof i!="object"&&!o)return;const u=Ia(i);if(!(u&&!o)){if(Nr(i)){const l=a&&t&&t.type_!==3&&!Zu(t.assigned_,n)?a.concat(n):void 0,s=$i(e,i,l);if($m(r,n,s),Nr(s))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(mr(i)&&!u){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&u)return;$i(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(Mn(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Ri(e,i)}}}function Ri(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oc(t,r)}function xO(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Rm(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=uc;r&&(i=[n],a=pn);const{revoke:o,proxy:u}=Proxy.revocable(i,a);return n.draft_=u,n.revoke_=o,u}var uc={get(e,t){if(t===Qe)return e;const r=or(e);if(!Zu(r,t))return PO(e,r,t);const n=r[t];return e.finalized_||!mr(n)?n:n===tu(e.base_,t)?(ru(e),e.copy_[t]=rl(n,e)):n},has(e,t){return t in or(e)},ownKeys(e){return Reflect.ownKeys(or(e))},set(e,t,r){const n=Lm(or(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=tu(or(e),t),a=i?.[Qe];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(mO(r,i)&&(r!==void 0||Zu(e.base_,t)))return!0;ru(e),tl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tu(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ru(e),tl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=or(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){ct(11)},getPrototypeOf(e){return vn(e.base_)},setPrototypeOf(){ct(12)}},pn={};Ni(uc,(e,t)=>{pn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});pn.deleteProperty=function(e,t){return pn.set.call(this,e,t,void 0)};pn.set=function(e,t,r){return uc.set.call(this,e[0],t,r,e[0])};function tu(e,t){const r=e[Qe];return(r?or(r):e)[t]}function PO(e,t,r){const n=Lm(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function Lm(e,t){if(!(t in e))return;let r=vn(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=vn(r)}}function tl(e){e.modified_||(e.modified_=!0,e.parent_&&tl(e.parent_))}function ru(e){e.copy_||(e.copy_=Qu(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var OO=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(l=a,...s){return o.produce(l,c=>r.call(this,c,...s))}}typeof r!="function"&&ct(6),n!==void 0&&typeof n!="function"&&ct(7);let i;if(mr(t)){const a=gd(this),o=rl(t,void 0);let u=!0;try{i=r(o),u=!1}finally{u?Ju(a):el(a)}return yd(a,n),bd(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===Dm&&(i=void 0),this.autoFreeze_&&oc(i,!0),n){const a=[],o=[];yr("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else ct(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...u)=>this.produceWithPatches(o,l=>t(l,...u));let n,i;return[this.produce(t,r,(o,u)=>{n=o,i=u}),n,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){mr(e)||ct(8),Nr(e)&&(e=AO(e));const t=gd(this),r=rl(e,void 0);return r[Qe].isManual_=!0,el(t),r}finishDraft(e,t){const r=e&&e[Qe];(!r||!r.isManual_)&&ct(9);const{scope_:n}=r;return yd(n,t),bd(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=yr("Patches").applyPatches_;return Nr(e)?n(e,t):this.produce(e,i=>n(i,t))}};function rl(e,t){const r=Mn(e)?yr("MapSet").proxyMap_(e,t):Ca(e)?yr("MapSet").proxySet_(e,t):xO(e,t);return(t?t.scope_:Rm()).drafts_.push(r),r}function AO(e){return Nr(e)||ct(10,e),zm(e)}function zm(e){if(!mr(e)||Ia(e))return e;const t=e[Qe];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Qu(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Qu(e,!0);return Ni(r,(i,a)=>{$m(r,i,zm(a))},n),t&&(t.finalized_=!1),r}var SO=new OO;SO.produce;var EO={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},Bm=qe({name:"legend",initialState:EO,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:re()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=ft(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:re()},removeLegendPayload:{reducer(e,t){var r=ft(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:re()}}}),{setLegendSize:xd,setLegendSettings:_O,addLegendPayload:Fm,replaceLegendPayload:Km,removeLegendPayload:qm}=Bm.actions,kO=Bm.reducer,jO=["contextPayload"];function nl(){return nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t(_O(e))},[t,e]),null}function zO(e){var t=ee();return h.useEffect(()=>(t(xd(e)),()=>{t(xd({width:0,height:0}))}),[t,e]),null}function BO(e,t,r,n){return e==="vertical"&&N(t)?{height:t}:e==="horizontal"?{width:r||n}:null}var FO={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function KO(e){var t=pe(e,FO),r=wx(),n=Ob(),i=vO(),{width:a,height:o,wrapperStyle:u,portal:l}=t,[s,c]=Yp([r]),f=ic(),d=ac();if(f==null||d==null)return null;var v=f-(i?.left||0)-(i?.right||0),p=BO(t.layout,o,a,v),y=l?u:$r($r({position:"absolute",width:p?.width||a||"auto",height:p?.height||o||"auto"},RO(u,t,i,f,d,s)),u),m=l??n;if(m==null||r==null)return null;var g=h.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:c},h.createElement(LO,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!l&&h.createElement(zO,{width:s.width,height:s.height}),h.createElement($O,nl({},t,p,{margin:i,chartWidth:f,chartHeight:d,contextPayload:r})));return Nl.createPortal(g,m)}KO.displayName="Legend";function il(){return il=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{separator:t=" : ",contentStyle:r={},itemStyle:n={},labelStyle:i={},payload:a,formatter:o,itemSorter:u,wrapperClassName:l,labelClassName:s,label:c,labelFormatter:f,accessibilityLayer:d=!1}=e,v=()=>{if(a&&a.length){var b={padding:0,margin:0},O=(u?ha(a,u):a).map((S,_)=>{if(S.type==="none")return null;var I=S.formatter||o||HO,{value:M,name:E}=S,j=M,$=E;if(I){var L=I(M,E,S,_,a);if(Array.isArray(L))[j,$]=L;else if(L!=null)j=L;else return null}var z=nu({display:"block",paddingTop:4,paddingBottom:4,color:S.color||"#000"},n);return h.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(_),style:z},bt($)?h.createElement("span",{className:"recharts-tooltip-item-name"},$):null,bt($)?h.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,h.createElement("span",{className:"recharts-tooltip-item-value"},j),h.createElement("span",{className:"recharts-tooltip-item-unit"},S.unit||""))});return h.createElement("ul",{className:"recharts-tooltip-item-list",style:b},O)}return null},p=nu({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},r),y=nu({margin:0},i),m=!ae(c),g=m?c:"",x=H("recharts-default-tooltip",l),w=H("recharts-tooltip-label",s);m&&f&&a!==void 0&&a!==null&&(g=f(c,a));var P=d?{role:"status","aria-live":"assertive"}:{};return h.createElement("div",il({className:x,style:p},P),h.createElement("p",{className:w,style:y},h.isValidElement(g)?g:"".concat(g)),v())},Zr="recharts-tooltip-wrapper",GO={visibility:"hidden"};function VO(e){var{coordinate:t,translateX:r,translateY:n}=e;return H(Zr,{["".concat(Zr,"-right")]:N(r)&&t&&N(t.x)&&r>=t.x,["".concat(Zr,"-left")]:N(r)&&t&&N(t.x)&&r=t.y,["".concat(Zr,"-top")]:N(n)&&t&&N(t.y)&&n0?i:0),f=r[n]+i;if(t[n])return o[n]?c:f;var d=l[n];if(d==null)return 0;if(o[n]){var v=c,p=d;return vm?Math.max(c,d):Math.max(f,d)}function XO(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function ZO(e){var{allowEscapeViewBox:t,coordinate:r,offsetTopLeft:n,position:i,reverseDirection:a,tooltipBox:o,useTranslate3d:u,viewBox:l}=e,s,c,f;return o.height>0&&o.width>0&&r?(c=Ad({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:l,viewBoxDimension:l.width}),f=Ad({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:l,viewBoxDimension:l.height}),s=XO({translateX:c,translateY:f,useTranslate3d:u})):s=GO,{cssProperties:s,cssClasses:VO({translateX:c,translateY:f,coordinate:r})}}function Sd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ai(e){for(var t=1;t{if(t.key==="Escape"){var r,n,i,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(r=(n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==null&&r!==void 0?r:0,y:(i=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&i!==void 0?i:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,r;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:r,animationDuration:n,animationEasing:i,children:a,coordinate:o,hasPayload:u,isAnimationActive:l,offset:s,position:c,reverseDirection:f,useTranslate3d:d,viewBox:v,wrapperStyle:p,lastBoundingBox:y,innerRef:m,hasPortalFromProps:g}=this.props,{cssClasses:x,cssProperties:w}=ZO({allowEscapeViewBox:r,coordinate:o,offsetTopLeft:s,position:c,reverseDirection:f,tooltipBox:{height:y.height,width:y.width},useTranslate3d:d,viewBox:v}),P=g?{}:ai(ai({transition:l&&t?"transform ".concat(n,"ms ").concat(i):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&u?"visible":"hidden",position:"absolute",top:0,left:0}),b=ai(ai({},P),{},{visibility:!this.state.dismissed&&t&&u?"visible":"hidden"},p);return h.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:b,ref:m},a)}}var Wm=()=>{var e;return(e=T(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function ol(){return ol=Object.assign?Object.assign.bind():function(e){for(var t=1;tse(e.x)&&se(e.y),jd=e=>e.base!=null&&Li(e.base)&&Li(e),Qr=e=>e.x,Jr=e=>e.y,i1=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(An(e));return(r==="curveMonotone"||r==="curveBump")&&t?kd["".concat(r).concat(t==="vertical"?"Y":"X")]:kd[r]||da},a1=e=>{var{type:t="linear",points:r=[],baseLine:n,layout:i,connectNulls:a=!1}=e,o=i1(t,i),u=a?r.filter(Li):r,l;if(Array.isArray(n)){var s=r.map((v,p)=>_d(_d({},v),{},{base:n[p]}));i==="vertical"?l=Zn().y(Jr).x1(Qr).x0(v=>v.base.x):l=Zn().x(Qr).y1(Jr).y0(v=>v.base.y);var c=l.defined(jd).curve(o),f=a?s.filter(jd):s;return c(f)}i==="vertical"&&N(n)?l=Zn().y(Jr).x1(Qr).x0(n):N(n)?l=Zn().x(Qr).y1(Jr).y0(n):l=yp().x(Qr).y(Jr);var d=l.defined(Li).curve(o);return d(u)},lc=e=>{var{className:t,points:r,path:n,pathRef:i}=e;if((!r||!r.length)&&!n)return null;var a=r&&r.length?a1(e):n;return h.createElement("path",ol({},Ze(e),Ul(e),{className:H("recharts-curve",t),d:a===null?void 0:a,ref:i}))},o1=["x","y","top","left","width","height","className"];function ul(){return ul=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(i,"v").concat(n,"M").concat(a,",").concat(t,"h").concat(r),h1=e=>{var{x:t=0,y:r=0,top:n=0,left:i=0,width:a=0,height:o=0,className:u}=e,l=f1(e,o1),s=u1({x:t,y:r,top:n,left:i,width:a,height:o},l);return!N(t)||!N(r)||!N(a)||!N(o)||!N(n)||!N(i)?null:h.createElement("path",ul({},$e(s),{className:H("recharts-cross",u),d:v1(t,r,a,o,n,i)}))};function p1(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function Id(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Md(e){for(var t=1;te.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),Um=(e,t,r)=>e.map(n=>"".concat(b1(n)," ").concat(t,"ms ").concat(r)).join(","),w1=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(i=>n.includes(i))),mn=(e,t)=>Object.keys(t).reduce((r,n)=>Md(Md({},r),{},{[n]:e(n,t[n])}),{});function Td(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function me(e){for(var t=1;te+(t-e)*r,ll=e=>{var{from:t,to:r}=e;return t!==r},Hm=(e,t,r)=>{var n=mn((i,a)=>{if(ll(a)){var[o,u]=e(a.from,a.to,a.velocity);return me(me({},a),{},{from:o,velocity:u})}return a},t);return r<1?mn((i,a)=>ll(a)?me(me({},a),{},{velocity:zi(a.velocity,n[i].velocity,r),from:zi(a.from,n[i].from,r)}):a,t):Hm(e,n,r-1)};function A1(e,t,r,n,i,a){var o,u=n.reduce((d,v)=>me(me({},d),{},{[v]:{from:e[v],velocity:0,to:t[v]}}),{}),l=()=>mn((d,v)=>v.from,u),s=()=>!Object.values(u).filter(ll).length,c=null,f=d=>{o||(o=d);var v=d-o,p=v/r.dt;u=Hm(r,u,p),i(me(me(me({},e),t),l())),o=d,s()||(c=a.setTimeout(f))};return()=>(c=a.setTimeout(f),()=>{var d;(d=c)===null||d===void 0||d()})}function S1(e,t,r,n,i,a,o){var u=null,l=i.reduce((f,d)=>me(me({},f),{},{[d]:[e[d],t[d]]}),{}),s,c=f=>{s||(s=f);var d=(f-s)/n,v=mn((y,m)=>zi(...m,r(d)),l);if(a(me(me(me({},e),t),v)),d<1)u=o.setTimeout(c);else{var p=mn((y,m)=>zi(...m,r(1)),l);a(me(me(me({},e),t),p))}};return()=>(u=o.setTimeout(c),()=>{var f;(f=u)===null||f===void 0||f()})}const E1=(e,t,r,n,i,a)=>{var o=w1(e,t);return r==null?()=>(i(me(me({},e),t)),()=>{}):r.isStepper===!0?A1(e,t,r,o,i,a):S1(e,t,r,n,o,i,a)};var Bi=1e-4,Ym=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Gm=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),Dd=(e,t)=>r=>{var n=Ym(e,t);return Gm(n,r)},_1=(e,t)=>r=>{var n=Ym(e,t),i=[...n.map((a,o)=>a*o).slice(1),0];return Gm(i,r)},k1=function(){for(var t=arguments.length,r=new Array(t),n=0;nparseFloat(u));return[o[0],o[1],o[2],o[3]]}}}return r.length===4?r:[0,0,1,1]},j1=(e,t,r,n)=>{var i=Dd(e,r),a=Dd(t,n),o=_1(e,r),u=s=>s>1?1:s<0?0:s,l=s=>{for(var c=s>1?1:s,f=c,d=0;d<8;++d){var v=i(f)-c,p=o(f);if(Math.abs(v-c)0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:i=17}=t,a=(o,u,l)=>{var s=-(o-u)*r,c=l*n,f=l+(s-c)*i/1e3,d=l*i/1e3+o;return Math.abs(d-u){if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Nd(e);case"spring":return C1();default:if(e.split("(")[0]==="cubic-bezier")return Nd(e)}return typeof e=="function"?e:null};function M1(e){var t,r=()=>null,n=!1,i=null,a=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var u=o,[l,...s]=u;if(typeof l=="number"){i=e.setTimeout(a.bind(null,s),l);return}a(l),i=e.setTimeout(a.bind(null,s));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,i&&(i(),i=null),a(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class T1{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),i=null,a=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function D1(){return M1(new T1)}var N1=h.createContext(D1);function $1(e,t){var r=h.useContext(N1);return h.useMemo(()=>t??r(e),[e,t,r])}var R1=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Tn={devToolsEnabled:!1,isSsr:R1()},L1={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},$d={t:0},iu={t:1};function Dn(e){var t=pe(e,L1),{isActive:r,canBegin:n,duration:i,easing:a,begin:o,onAnimationEnd:u,onAnimationStart:l,children:s}=t,c=r==="auto"?!Tn.isSsr:r,f=$1(t.animationId,t.animationManager),[d,v]=h.useState(c?$d:iu),p=h.useRef(null);return h.useEffect(()=>{c||v(iu)},[c]),h.useEffect(()=>{if(!c||!n)return Sn;var y=E1($d,iu,I1(a),i,v,f.getTimeoutController()),m=()=>{p.current=y()};return f.start([l,o,m,i,u]),()=>{f.stop(),p.current&&p.current(),u()}},[c,n,i,a,o,l,u,f]),s(d.t)}function Nn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=h.useRef(cn(t)),n=h.useRef(e);return n.current!==e&&(r.current=cn(t),n.current=e),r.current}var z1=["radius"],B1=["radius"];function Rd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ld(e){for(var t=1;t{var a=Math.min(Math.abs(r)/2,Math.abs(n)/2),o=n>=0?1:-1,u=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0,s;if(a>0&&i instanceof Array){for(var c=[0,0,0,0],f=0,d=4;fa?a:i[f];s="M".concat(e,",").concat(t+o*c[0]),c[0]>0&&(s+="A ".concat(c[0],",").concat(c[0],",0,0,").concat(l,",").concat(e+u*c[0],",").concat(t)),s+="L ".concat(e+r-u*c[1],",").concat(t),c[1]>0&&(s+="A ".concat(c[1],",").concat(c[1],",0,0,").concat(l,`, - `).concat(e+r,",").concat(t+o*c[1])),s+="L ".concat(e+r,",").concat(t+n-o*c[2]),c[2]>0&&(s+="A ".concat(c[2],",").concat(c[2],",0,0,").concat(l,`, - `).concat(e+r-u*c[2],",").concat(t+n)),s+="L ".concat(e+u*c[3],",").concat(t+n),c[3]>0&&(s+="A ".concat(c[3],",").concat(c[3],",0,0,").concat(l,`, - `).concat(e,",").concat(t+n-o*c[3])),s+="Z"}else if(a>0&&i===+i&&i>0){var v=Math.min(a,i);s="M ".concat(e,",").concat(t+o*v,` - A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e+u*v,",").concat(t,` - L `).concat(e+r-u*v,",").concat(t,` - A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e+r,",").concat(t+o*v,` - L `).concat(e+r,",").concat(t+n-o*v,` - A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e+r-u*v,",").concat(t+n,` - L `).concat(e+u*v,",").concat(t+n,` - A `).concat(v,",").concat(v,",0,0,").concat(l,",").concat(e,",").concat(t+n-o*v," Z")}else s="M ".concat(e,",").concat(t," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return s},Fd={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vm=e=>{var t=pe(e,Fd),r=h.useRef(null),[n,i]=h.useState(-1);h.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var B=r.current.getTotalLength();B&&i(B)}catch{}},[]);var{x:a,y:o,width:u,height:l,radius:s,className:c}=t,{animationEasing:f,animationDuration:d,animationBegin:v,isAnimationActive:p,isUpdateAnimationActive:y}=t,m=h.useRef(u),g=h.useRef(l),x=h.useRef(a),w=h.useRef(o),P=h.useMemo(()=>({x:a,y:o,width:u,height:l,radius:s}),[a,o,u,l,s]),b=Nn(P,"rectangle-");if(a!==+a||o!==+o||u!==+u||l!==+l||u===0||l===0)return null;var O=H("recharts-rectangle",c);if(!y){var S=$e(t),{radius:_}=S,I=zd(S,z1);return h.createElement("path",Fi({},I,{radius:typeof s=="number"?s:void 0,className:O,d:Bd(a,o,u,l,s)}))}var M=m.current,E=g.current,j=x.current,$=w.current,L="0px ".concat(n===-1?1:n,"px"),z="".concat(n,"px 0px"),K=Um(["strokeDasharray"],d,typeof f=="string"?f:Fd.animationEasing);return h.createElement(Dn,{animationId:b,key:b,canBegin:n>0,duration:d,easing:f,isActive:y,begin:v},B=>{var W=ne(M,u,B),R=ne(E,l,B),ke=ne(j,a,B),Te=ne($,o,B);r.current&&(m.current=W,g.current=R,x.current=ke,w.current=Te);var Le;p?B>0?Le={transition:K,strokeDasharray:z}:Le={strokeDasharray:L}:Le={strokeDasharray:z};var Pt=$e(t),{radius:Je}=Pt,nr=zd(Pt,B1);return h.createElement("path",Fi({},nr,{radius:typeof s=="number"?s:void 0,className:O,d:Bd(ke,Te,W,R,s),ref:r,style:Ld(Ld({},Le),t.style)}))})};function Kd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qd(e){for(var t=1;te*180/Math.PI,de=(e,t,r,n)=>({x:e+Math.cos(-Ki*n)*r,y:t+Math.sin(-Ki*n)*r}),Xm=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},V1=(e,t)=>{var{x:r,y:n}=e,{x:i,y:a}=t;return Math.sqrt((r-i)**2+(n-a)**2)},X1=(e,t)=>{var{x:r,y:n}=e,{cx:i,cy:a}=t,o=V1({x:r,y:n},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var u=(r-i)/o,l=Math.acos(u);return n>a&&(l=2*Math.PI-l),{radius:o,angle:G1(l),angleInRadian:l}},Z1=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),i=Math.floor(r/360),a=Math.min(n,i);return{startAngle:t-a*360,endAngle:r-a*360}},Q1=(e,t)=>{var{startAngle:r,endAngle:n}=t,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return e+o*360},J1=(e,t)=>{var{chartX:r,chartY:n}=e,{radius:i,angle:a}=X1({x:r,y:n},t),{innerRadius:o,outerRadius:u}=t;if(iu||i===0)return null;var{startAngle:l,endAngle:s}=Z1(t),c=a,f;if(l<=s){for(;c>s;)c-=360;for(;c=l&&c<=s}else{for(;c>l;)c-=360;for(;c=s&&c<=l}return f?qd(qd({},t),{},{radius:i,angle:Q1(c,t)}):null};function Zm(e){var{cx:t,cy:r,radius:n,startAngle:i,endAngle:a}=e,o=de(t,r,n,i),u=de(t,r,n,a);return{points:[o,u],cx:t,cy:r,radius:n,startAngle:i,endAngle:a}}function cl(){return cl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=Ae(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},oi=e=>{var{cx:t,cy:r,radius:n,angle:i,sign:a,isExternal:o,cornerRadius:u,cornerIsExternal:l}=e,s=u*(o?1:-1)+n,c=Math.asin(u/s)/Ki,f=l?i:i+a*c,d=de(t,r,s,f),v=de(t,r,n,f),p=l?i-a*c:i,y=de(t,r,s*Math.cos(c*Ki),p);return{center:d,circleTangency:v,lineTangency:y,theta:c}},Qm=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:a,endAngle:o}=e,u=eA(a,o),l=a+u,s=de(t,r,i,a),c=de(t,r,i,l),f="M ".concat(s.x,",").concat(s.y,` - A `).concat(i,",").concat(i,`,0, - `).concat(+(Math.abs(u)>180),",").concat(+(a>l),`, - `).concat(c.x,",").concat(c.y,` - `);if(n>0){var d=de(t,r,n,a),v=de(t,r,n,l);f+="L ".concat(v.x,",").concat(v.y,` - A `).concat(n,",").concat(n,`,0, - `).concat(+(Math.abs(u)>180),",").concat(+(a<=l),`, - `).concat(d.x,",").concat(d.y," Z")}else f+="L ".concat(t,",").concat(r," Z");return f},tA=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:u,startAngle:l,endAngle:s}=e,c=Ae(s-l),{circleTangency:f,lineTangency:d,theta:v}=oi({cx:t,cy:r,radius:i,angle:l,sign:c,cornerRadius:a,cornerIsExternal:u}),{circleTangency:p,lineTangency:y,theta:m}=oi({cx:t,cy:r,radius:i,angle:s,sign:-c,cornerRadius:a,cornerIsExternal:u}),g=u?Math.abs(l-s):Math.abs(l-s)-v-m;if(g<0)return o?"M ".concat(d.x,",").concat(d.y,` - a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0 - a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0 - `):Qm({cx:t,cy:r,innerRadius:n,outerRadius:i,startAngle:l,endAngle:s});var x="M ".concat(d.x,",").concat(d.y,` - A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(f.x,",").concat(f.y,` - A`).concat(i,",").concat(i,",0,").concat(+(g>180),",").concat(+(c<0),",").concat(p.x,",").concat(p.y,` - A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(y.x,",").concat(y.y,` - `);if(n>0){var{circleTangency:w,lineTangency:P,theta:b}=oi({cx:t,cy:r,radius:n,angle:l,sign:c,isExternal:!0,cornerRadius:a,cornerIsExternal:u}),{circleTangency:O,lineTangency:S,theta:_}=oi({cx:t,cy:r,radius:n,angle:s,sign:-c,isExternal:!0,cornerRadius:a,cornerIsExternal:u}),I=u?Math.abs(l-s):Math.abs(l-s)-b-_;if(I<0&&a===0)return"".concat(x,"L").concat(t,",").concat(r,"Z");x+="L".concat(S.x,",").concat(S.y,` - A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(O.x,",").concat(O.y,` - A`).concat(n,",").concat(n,",0,").concat(+(I>180),",").concat(+(c>0),",").concat(w.x,",").concat(w.y,` - A`).concat(a,",").concat(a,",0,0,").concat(+(c<0),",").concat(P.x,",").concat(P.y,"Z")}else x+="L".concat(t,",").concat(r,"Z");return x},rA={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jm=e=>{var t=pe(e,rA),{cx:r,cy:n,innerRadius:i,outerRadius:a,cornerRadius:o,forceCornerRadius:u,cornerIsExternal:l,startAngle:s,endAngle:c,className:f}=t;if(a0&&Math.abs(s-c)<360?y=tA({cx:r,cy:n,innerRadius:i,outerRadius:a,cornerRadius:Math.min(p,v/2),forceCornerRadius:u,cornerIsExternal:l,startAngle:s,endAngle:c}):y=Qm({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:s,endAngle:c}),h.createElement("path",cl({},$e(t),{className:d,d:y}))};function nA(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(Mp(t)){if(e==="centric"){var{cx:n,cy:i,innerRadius:a,outerRadius:o,angle:u}=t,l=de(n,i,a,u),s=de(n,i,o,u);return[{x:l.x,y:l.y},{x:s.x,y:s.y}]}return Zm(t)}}var au={},ou={},uu={},Wd;function iA(){return Wd||(Wd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Wp();function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(uu)),uu}var Ud;function aA(){return Ud||(Ud=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=iA();function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(ou)),ou}var Hd;function oA(){return Hd||(Hd=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Up(),r=aA();function n(i,a,o){o&&typeof o!="number"&&t.isIterateeCall(i,a,o)&&(a=o=void 0),i=r.toFinite(i),a===void 0?(a=i,i=0):a=r.toFinite(a),o=o===void 0?it?1:e>=t?0:NaN}function cA(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function cc(e){let t,r,n;e.length!==2?(t=Ht,r=(u,l)=>Ht(e(u),l),n=(u,l)=>e(u)-l):(t=e===Ht||e===cA?e:sA,r=e,n=e);function i(u,l,s=0,c=u.length){if(s>>1;r(u[f],l)<0?s=f+1:c=f}while(s>>1;r(u[f],l)<=0?s=f+1:c=f}while(ss&&n(u[f-1],l)>-n(u[f],l)?f-1:f}return{left:i,center:o,right:a}}function sA(){return 0}function ty(e){return e===null?NaN:+e}function*fA(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const dA=cc(Ht),$n=dA.right;cc(ty).center;class Gd extends Map{constructor(t,r=pA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,i]of t)this.set(n,i)}get(t){return super.get(Vd(this,t))}has(t){return super.has(Vd(this,t))}set(t,r){return super.set(vA(this,t),r)}delete(t){return super.delete(hA(this,t))}}function Vd({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function vA({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function hA({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function pA(e){return e!==null&&typeof e=="object"?e.valueOf():e}function mA(e=Ht){if(e===Ht)return ry;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function ry(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const yA=Math.sqrt(50),gA=Math.sqrt(10),bA=Math.sqrt(2);function qi(e,t,r){const n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=yA?10:a>=gA?5:a>=bA?2:1;let u,l,s;return i<0?(s=Math.pow(10,-i)/o,u=Math.round(e*s),l=Math.round(t*s),u/st&&--l,s=-s):(s=Math.pow(10,i)*o,u=Math.round(e/s),l=Math.round(t/s),u*st&&--l),l0))return[];if(e===t)return[e];const n=t=i))return[];const u=a-i+1,l=new Array(u);if(n)if(o<0)for(let s=0;s=n)&&(r=n);return r}function Zd(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function ny(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?ry:mA(i);n>r;){if(n-r>600){const l=n-r+1,s=t-r+1,c=Math.log(l),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(l-f)/l)*(s-l/2<0?-1:1),v=Math.max(r,Math.floor(t-s*f/l+d)),p=Math.min(n,Math.floor(t+(l-s)*f/l+d));ny(e,t,v,p,i)}const a=e[t];let o=r,u=n;for(en(e,r,t),i(e[n],a)>0&&en(e,r,n);o0;)--u}i(e[r],a)===0?en(e,r,u):(++u,en(e,u,n)),u<=t&&(r=u+1),t<=u&&(n=u-1)}return e}function en(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function wA(e,t,r){if(e=Float64Array.from(fA(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Zd(e);if(t>=1)return Xd(e);var n,i=(n-1)*t,a=Math.floor(i),o=Xd(ny(e,a).subarray(0,a+1)),u=Zd(e.subarray(a+1));return o+(u-o)*(i-a)}}function xA(e,t,r=ty){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,a=Math.floor(i),o=+r(e[a],a,e),u=+r(e[a+1],a+1,e);return o+(u-o)*(i-a)}}function PA(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(i);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ui(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ui(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=SA.exec(e))?new Ke(t[1],t[2],t[3],1):(t=EA.exec(e))?new Ke(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=_A.exec(e))?ui(t[1],t[2],t[3],t[4]):(t=kA.exec(e))?ui(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jA.exec(e))?iv(t[1],t[2]/100,t[3]/100,1):(t=CA.exec(e))?iv(t[1],t[2]/100,t[3]/100,t[4]):Qd.hasOwnProperty(e)?tv(Qd[e]):e==="transparent"?new Ke(NaN,NaN,NaN,0):null}function tv(e){return new Ke(e>>16&255,e>>8&255,e&255,1)}function ui(e,t,r,n){return n<=0&&(e=t=r=NaN),new Ke(e,t,r,n)}function TA(e){return e instanceof Rn||(e=bn(e)),e?(e=e.rgb(),new Ke(e.r,e.g,e.b,e.opacity)):new Ke}function hl(e,t,r,n){return arguments.length===1?TA(e):new Ke(e,t,r,n??1)}function Ke(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}dc(Ke,hl,ay(Rn,{brighter(e){return e=e==null?Wi:Math.pow(Wi,e),new Ke(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yn:Math.pow(yn,e),new Ke(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ke(dr(this.r),dr(this.g),dr(this.b),Ui(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rv,formatHex:rv,formatHex8:DA,formatRgb:nv,toString:nv}));function rv(){return`#${lr(this.r)}${lr(this.g)}${lr(this.b)}`}function DA(){return`#${lr(this.r)}${lr(this.g)}${lr(this.b)}${lr((isNaN(this.opacity)?1:this.opacity)*255)}`}function nv(){const e=Ui(this.opacity);return`${e===1?"rgb(":"rgba("}${dr(this.r)}, ${dr(this.g)}, ${dr(this.b)}${e===1?")":`, ${e})`}`}function Ui(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function lr(e){return e=dr(e),(e<16?"0":"")+e.toString(16)}function iv(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new st(e,t,r,n)}function oy(e){if(e instanceof st)return new st(e.h,e.s,e.l,e.opacity);if(e instanceof Rn||(e=bn(e)),!e)return new st;if(e instanceof st)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,u=a-i,l=(a+i)/2;return u?(t===a?o=(r-n)/u+(r0&&l<1?0:o,new st(o,u,l,e.opacity)}function NA(e,t,r,n){return arguments.length===1?oy(e):new st(e,t,r,n??1)}function st(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}dc(st,NA,ay(Rn,{brighter(e){return e=e==null?Wi:Math.pow(Wi,e),new st(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yn:Math.pow(yn,e),new st(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Ke(cu(e>=240?e-240:e+120,i,n),cu(e,i,n),cu(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new st(av(this.h),li(this.s),li(this.l),Ui(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ui(this.opacity);return`${e===1?"hsl(":"hsla("}${av(this.h)}, ${li(this.s)*100}%, ${li(this.l)*100}%${e===1?")":`, ${e})`}`}}));function av(e){return e=(e||0)%360,e<0?e+360:e}function li(e){return Math.max(0,Math.min(1,e||0))}function cu(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const vc=e=>()=>e;function $A(e,t){return function(r){return e+r*t}}function RA(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function LA(e){return(e=+e)==1?uy:function(t,r){return r-t?RA(t,r,e):vc(isNaN(t)?r:t)}}function uy(e,t){var r=t-e;return r?$A(e,r):vc(isNaN(e)?t:e)}const ov=(function e(t){var r=LA(t);function n(i,a){var o=r((i=hl(i)).r,(a=hl(a)).r),u=r(i.g,a.g),l=r(i.b,a.b),s=uy(i.opacity,a.opacity);return function(c){return i.r=o(c),i.g=u(c),i.b=l(c),i.opacity=s(c),i+""}}return n.gamma=e,n})(1);function zA(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;ir&&(a=t.slice(r,a),u[o]?u[o]+=a:u[++o]=a),(n=n[0])===(i=i[0])?u[o]?u[o]+=i:u[++o]=i:(u[++o]=null,l.push({i:o,x:pt(n,i)})),r=su.lastIndex;return r180?c+=360:c-s>180&&(s+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:pt(s,c)})):c&&f.push(i(f)+"rotate("+c+n)}function u(s,c,f,d){s!==c?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:pt(s,c)}):c&&f.push(i(f)+"skewX("+c+n)}function l(s,c,f,d,v,p){if(s!==f||c!==d){var y=v.push(i(v)+"scale(",null,",",null,")");p.push({i:y-4,x:pt(s,f)},{i:y-2,x:pt(c,d)})}else(f!==1||d!==1)&&v.push(i(v)+"scale("+f+","+d+")")}return function(s,c){var f=[],d=[];return s=e(s),c=e(c),a(s.translateX,s.translateY,c.translateX,c.translateY,f,d),o(s.rotate,c.rotate,f,d),u(s.skewX,c.skewX,f,d),l(s.scaleX,s.scaleY,c.scaleX,c.scaleY,f,d),s=c=null,function(v){for(var p=-1,y=d.length,m;++pt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function tS(e,t,r){var n=e[0],i=e[1],a=t[0],o=t[1];return i2?rS:tS,l=s=null,f}function f(d){return d==null||isNaN(d=+d)?a:(l||(l=u(e.map(n),t,r)))(n(o(d)))}return f.invert=function(d){return o(i((s||(s=u(t,e.map(n),pt)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Hi),c()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=hc,c()},f.clamp=function(d){return arguments.length?(o=d?!0:Ne,c()):o!==Ne},f.interpolate=function(d){return arguments.length?(r=d,c()):r},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,v){return n=d,i=v,c()}}function pc(){return Ma()(Ne,Ne)}function nS(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Yi(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Rr(e){return e=Yi(Math.abs(e)),e?e[1]:NaN}function iS(e,t){return function(r,n){for(var i=r.length,a=[],o=0,u=e[0],l=0;i>0&&u>0&&(l+u+1>n&&(u=Math.max(1,n-l)),a.push(r.substring(i-=u,i+u)),!((l+=u+1)>n));)u=e[o=(o+1)%e.length];return a.reverse().join(t)}}function aS(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var oS=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wn(e){if(!(t=oS.exec(e)))throw new Error("invalid format: "+e);var t;return new mc({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}wn.prototype=mc.prototype;function mc(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}mc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function uS(e){e:for(var t=e.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var sy;function lS(e,t){var r=Yi(e,t);if(!r)return e+"";var n=r[0],i=r[1],a=i-(sy=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Yi(e,Math.max(0,t+a-1))[0]}function sv(e,t){var r=Yi(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const fv={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:nS,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>sv(e*100,t),r:sv,s:lS,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function dv(e){return e}var vv=Array.prototype.map,hv=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function cS(e){var t=e.grouping===void 0||e.thousands===void 0?dv:iS(vv.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?dv:aS(vv.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",u=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function s(f){f=wn(f);var d=f.fill,v=f.align,p=f.sign,y=f.symbol,m=f.zero,g=f.width,x=f.comma,w=f.precision,P=f.trim,b=f.type;b==="n"?(x=!0,b="g"):fv[b]||(w===void 0&&(w=12),P=!0,b="g"),(m||d==="0"&&v==="=")&&(m=!0,d="0",v="=");var O=y==="$"?r:y==="#"&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",S=y==="$"?n:/[%p]/.test(b)?o:"",_=fv[b],I=/[defgprs%]/.test(b);w=w===void 0?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(E){var j=O,$=S,L,z,K;if(b==="c")$=_(E)+$,E="";else{E=+E;var B=E<0||1/E<0;if(E=isNaN(E)?l:_(Math.abs(E),w),P&&(E=uS(E)),B&&+E==0&&p!=="+"&&(B=!1),j=(B?p==="("?p:u:p==="-"||p==="("?"":p)+j,$=(b==="s"?hv[8+sy/3]:"")+$+(B&&p==="("?")":""),I){for(L=-1,z=E.length;++LK||K>57){$=(K===46?i+E.slice(L+1):E.slice(L))+$,E=E.slice(0,L);break}}}x&&!m&&(E=t(E,1/0));var W=j.length+E.length+$.length,R=W>1)+j+E+$+R.slice(W);break;default:E=R+j+E+$;break}return a(E)}return M.toString=function(){return f+""},M}function c(f,d){var v=s((f=wn(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Rr(d)/3)))*3,y=Math.pow(10,-p),m=hv[8+p/3];return function(g){return v(y*g)+m}}return{format:s,formatPrefix:c}}var si,yc,fy;sS({thousands:",",grouping:[3],currency:["$",""]});function sS(e){return si=cS(e),yc=si.format,fy=si.formatPrefix,si}function fS(e){return Math.max(0,-Rr(Math.abs(e)))}function dS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Rr(t)/3)))*3-Rr(Math.abs(e)))}function vS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Rr(t)-Rr(e))+1}function dy(e,t,r,n){var i=dl(e,t,r),a;switch(n=wn(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=dS(i,o))&&(n.precision=a),fy(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=vS(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=fS(i))&&(n.precision=a-(n.type==="%")*2);break}}return yc(n)}function er(e){var t=e.domain;return e.ticks=function(r){var n=t();return sl(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return dy(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,a=n.length-1,o=n[i],u=n[a],l,s,c=10;for(u0;){if(s=fl(o,u,r),s===l)return n[i]=o,n[a]=u,t(n);if(s>0)o=Math.floor(o/s)*s,u=Math.ceil(u/s)*s;else if(s<0)o=Math.ceil(o*s)/s,u=Math.floor(u*s)/s;else break;l=s}return e},e}function vy(){var e=pc();return e.copy=function(){return Ln(e,vy())},ut.apply(e,arguments),er(e)}function hy(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Hi),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return hy(e).unknown(t)},e=arguments.length?Array.from(e,Hi):[0,1],er(r)}function py(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],a=e[n],o;return aMath.pow(e,t)}function gS(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function yv(e){return(t,r)=>-e(-t,r)}function gc(e){const t=e(pv,mv),r=t.domain;let n=10,i,a;function o(){return i=gS(n),a=yS(n),r()[0]<0?(i=yv(i),a=yv(a),e(hS,pS)):e(pv,mv),t}return t.base=function(u){return arguments.length?(n=+u,o()):n},t.domain=function(u){return arguments.length?(r(u),o()):r()},t.ticks=u=>{const l=r();let s=l[0],c=l[l.length-1];const f=c0){for(;d<=v;++d)for(p=1;pc)break;g.push(y)}}else for(;d<=v;++d)for(p=n-1;p>=1;--p)if(y=d>0?p/a(-d):p*a(d),!(yc)break;g.push(y)}g.length*2{if(u==null&&(u=10),l==null&&(l=n===10?"s":","),typeof l!="function"&&(!(n%1)&&(l=wn(l)).precision==null&&(l.trim=!0),l=yc(l)),u===1/0)return l;const s=Math.max(1,n*u/t.ticks().length);return c=>{let f=c/a(Math.round(i(c)));return f*nr(py(r(),{floor:u=>a(Math.floor(i(u))),ceil:u=>a(Math.ceil(i(u)))})),t}function my(){const e=gc(Ma()).domain([1,10]);return e.copy=()=>Ln(e,my()).base(e.base()),ut.apply(e,arguments),e}function gv(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function bv(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function bc(e){var t=1,r=e(gv(t),bv(t));return r.constant=function(n){return arguments.length?e(gv(t=+n),bv(t)):t},er(r)}function yy(){var e=bc(Ma());return e.copy=function(){return Ln(e,yy()).constant(e.constant())},ut.apply(e,arguments)}function wv(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function bS(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function wS(e){return e<0?-e*e:e*e}function wc(e){var t=e(Ne,Ne),r=1;function n(){return r===1?e(Ne,Ne):r===.5?e(bS,wS):e(wv(r),wv(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},er(t)}function xc(){var e=wc(Ma());return e.copy=function(){return Ln(e,xc()).exponent(e.exponent())},ut.apply(e,arguments),e}function xS(){return xc.apply(null,arguments).exponent(.5)}function xv(e){return Math.sign(e)*e*e}function PS(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function gy(){var e=pc(),t=[0,1],r=!1,n;function i(a){var o=PS(e(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return e.invert(xv(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,Hi)).map(xv)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return gy(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},ut.apply(i,arguments),er(i)}function by(){var e=[],t=[],r=[],n;function i(){var o=0,u=Math.max(1,t.length);for(r=new Array(u-1);++o0?r[u-1]:e[0],u=r?[n[r-1],t]:[n[s-1],n[s]]},o.unknown=function(l){return arguments.length&&(a=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return wy().domain([e,t]).range(i).unknown(a)},ut.apply(er(o),arguments)}function xy(){var e=[.5],t=[0,1],r,n=1;function i(a){return a!=null&&a<=a?t[$n(e,a,0,n)]:r}return i.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return xy().domain(e).range(t).unknown(r)},ut.apply(i,arguments)}const fu=new Date,du=new Date;function ge(e,t,r,n){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),u=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,u)=>{const l=[];if(a=i.ceil(a),u=u==null?1:Math.floor(u),!(a0))return l;let s;do l.push(s=new Date(+a)),t(a,u),e(a);while(sge(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!a(o););else for(;--u>=0;)for(;t(o,1),!a(o););}),r&&(i.count=(a,o)=>(fu.setTime(+a),du.setTime(+o),e(fu),e(du),Math.floor(r(fu,du))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Gi=ge(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Gi.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ge(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Gi);Gi.range;const Et=1e3,it=Et*60,_t=it*60,Mt=_t*24,Pc=Mt*7,Pv=Mt*30,vu=Mt*365,cr=ge(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Et)},(e,t)=>(t-e)/Et,e=>e.getUTCSeconds());cr.range;const Oc=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Et)},(e,t)=>{e.setTime(+e+t*it)},(e,t)=>(t-e)/it,e=>e.getMinutes());Oc.range;const Ac=ge(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*it)},(e,t)=>(t-e)/it,e=>e.getUTCMinutes());Ac.range;const Sc=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Et-e.getMinutes()*it)},(e,t)=>{e.setTime(+e+t*_t)},(e,t)=>(t-e)/_t,e=>e.getHours());Sc.range;const Ec=ge(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*_t)},(e,t)=>(t-e)/_t,e=>e.getUTCHours());Ec.range;const zn=ge(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*it)/Mt,e=>e.getDate()-1);zn.range;const Ta=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Mt,e=>e.getUTCDate()-1);Ta.range;const Py=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Mt,e=>Math.floor(e/Mt));Py.range;function xr(e){return ge(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*it)/Pc)}const Da=xr(0),Vi=xr(1),OS=xr(2),AS=xr(3),Lr=xr(4),SS=xr(5),ES=xr(6);Da.range;Vi.range;OS.range;AS.range;Lr.range;SS.range;ES.range;function Pr(e){return ge(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Pc)}const Na=Pr(0),Xi=Pr(1),_S=Pr(2),kS=Pr(3),zr=Pr(4),jS=Pr(5),CS=Pr(6);Na.range;Xi.range;_S.range;kS.range;zr.range;jS.range;CS.range;const _c=ge(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());_c.range;const kc=ge(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());kc.range;const Tt=ge(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Tt.range;const Dt=ge(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Dt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Dt.range;function Oy(e,t,r,n,i,a){const o=[[cr,1,Et],[cr,5,5*Et],[cr,15,15*Et],[cr,30,30*Et],[a,1,it],[a,5,5*it],[a,15,15*it],[a,30,30*it],[i,1,_t],[i,3,3*_t],[i,6,6*_t],[i,12,12*_t],[n,1,Mt],[n,2,2*Mt],[r,1,Pc],[t,1,Pv],[t,3,3*Pv],[e,1,vu]];function u(s,c,f){const d=cm).right(o,d);if(v===o.length)return e.every(dl(s/vu,c/vu,f));if(v===0)return Gi.every(Math.max(dl(s,c,f),1));const[p,y]=o[d/o[v-1][2]53)return null;"w"in C||(C.w=1),"Z"in C?(Q=pu(tn(C.y,0,1)),Ue=Q.getUTCDay(),Q=Ue>4||Ue===0?Xi.ceil(Q):Xi(Q),Q=Ta.offset(Q,(C.V-1)*7),C.y=Q.getUTCFullYear(),C.m=Q.getUTCMonth(),C.d=Q.getUTCDate()+(C.w+6)%7):(Q=hu(tn(C.y,0,1)),Ue=Q.getDay(),Q=Ue>4||Ue===0?Vi.ceil(Q):Vi(Q),Q=zn.offset(Q,(C.V-1)*7),C.y=Q.getFullYear(),C.m=Q.getMonth(),C.d=Q.getDate()+(C.w+6)%7)}else("W"in C||"U"in C)&&("w"in C||(C.w="u"in C?C.u%7:"W"in C?1:0),Ue="Z"in C?pu(tn(C.y,0,1)).getUTCDay():hu(tn(C.y,0,1)).getDay(),C.m=0,C.d="W"in C?(C.w+6)%7+C.W*7-(Ue+5)%7:C.w+C.U*7-(Ue+6)%7);return"Z"in C?(C.H+=C.Z/100|0,C.M+=C.Z%100,pu(C)):hu(C)}}function _(k,F,U,C){for(var Be=0,Q=F.length,Ue=U.length,He,ir;Be=Ue)return-1;if(He=F.charCodeAt(Be++),He===37){if(He=F.charAt(Be++),ir=b[He in Ov?F.charAt(Be++):He],!ir||(C=ir(k,U,C))<0)return-1}else if(He!=U.charCodeAt(C++))return-1}return C}function I(k,F,U){var C=s.exec(F.slice(U));return C?(k.p=c.get(C[0].toLowerCase()),U+C[0].length):-1}function M(k,F,U){var C=v.exec(F.slice(U));return C?(k.w=p.get(C[0].toLowerCase()),U+C[0].length):-1}function E(k,F,U){var C=f.exec(F.slice(U));return C?(k.w=d.get(C[0].toLowerCase()),U+C[0].length):-1}function j(k,F,U){var C=g.exec(F.slice(U));return C?(k.m=x.get(C[0].toLowerCase()),U+C[0].length):-1}function $(k,F,U){var C=y.exec(F.slice(U));return C?(k.m=m.get(C[0].toLowerCase()),U+C[0].length):-1}function L(k,F,U){return _(k,t,F,U)}function z(k,F,U){return _(k,r,F,U)}function K(k,F,U){return _(k,n,F,U)}function B(k){return o[k.getDay()]}function W(k){return a[k.getDay()]}function R(k){return l[k.getMonth()]}function ke(k){return u[k.getMonth()]}function Te(k){return i[+(k.getHours()>=12)]}function Le(k){return 1+~~(k.getMonth()/3)}function Pt(k){return o[k.getUTCDay()]}function Je(k){return a[k.getUTCDay()]}function nr(k){return l[k.getUTCMonth()]}function Xr(k){return u[k.getUTCMonth()]}function ze(k){return i[+(k.getUTCHours()>=12)]}function to(k){return 1+~~(k.getUTCMonth()/3)}return{format:function(k){var F=O(k+="",w);return F.toString=function(){return k},F},parse:function(k){var F=S(k+="",!1);return F.toString=function(){return k},F},utcFormat:function(k){var F=O(k+="",P);return F.toString=function(){return k},F},utcParse:function(k){var F=S(k+="",!0);return F.toString=function(){return k},F}}}var Ov={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,$S=/^%/,RS=/[\\^$*+?|[\]().{}]/g;function Y(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",a=i.length;return n+(a[t.toLowerCase(),r]))}function zS(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function BS(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function FS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function KS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function qS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Av(e,t,r){var n=Ee.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Sv(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function WS(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function US(e,t,r){var n=Ee.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function HS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Ev(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function YS(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function _v(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function GS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function VS(e,t,r){var n=Ee.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function XS(e,t,r){var n=Ee.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function ZS(e,t,r){var n=Ee.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function QS(e,t,r){var n=$S.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function JS(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function eE(e,t,r){var n=Ee.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function kv(e,t){return Y(e.getDate(),t,2)}function tE(e,t){return Y(e.getHours(),t,2)}function rE(e,t){return Y(e.getHours()%12||12,t,2)}function nE(e,t){return Y(1+zn.count(Tt(e),e),t,3)}function Ay(e,t){return Y(e.getMilliseconds(),t,3)}function iE(e,t){return Ay(e,t)+"000"}function aE(e,t){return Y(e.getMonth()+1,t,2)}function oE(e,t){return Y(e.getMinutes(),t,2)}function uE(e,t){return Y(e.getSeconds(),t,2)}function lE(e){var t=e.getDay();return t===0?7:t}function cE(e,t){return Y(Da.count(Tt(e)-1,e),t,2)}function Sy(e){var t=e.getDay();return t>=4||t===0?Lr(e):Lr.ceil(e)}function sE(e,t){return e=Sy(e),Y(Lr.count(Tt(e),e)+(Tt(e).getDay()===4),t,2)}function fE(e){return e.getDay()}function dE(e,t){return Y(Vi.count(Tt(e)-1,e),t,2)}function vE(e,t){return Y(e.getFullYear()%100,t,2)}function hE(e,t){return e=Sy(e),Y(e.getFullYear()%100,t,2)}function pE(e,t){return Y(e.getFullYear()%1e4,t,4)}function mE(e,t){var r=e.getDay();return e=r>=4||r===0?Lr(e):Lr.ceil(e),Y(e.getFullYear()%1e4,t,4)}function yE(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Y(t/60|0,"0",2)+Y(t%60,"0",2)}function jv(e,t){return Y(e.getUTCDate(),t,2)}function gE(e,t){return Y(e.getUTCHours(),t,2)}function bE(e,t){return Y(e.getUTCHours()%12||12,t,2)}function wE(e,t){return Y(1+Ta.count(Dt(e),e),t,3)}function Ey(e,t){return Y(e.getUTCMilliseconds(),t,3)}function xE(e,t){return Ey(e,t)+"000"}function PE(e,t){return Y(e.getUTCMonth()+1,t,2)}function OE(e,t){return Y(e.getUTCMinutes(),t,2)}function AE(e,t){return Y(e.getUTCSeconds(),t,2)}function SE(e){var t=e.getUTCDay();return t===0?7:t}function EE(e,t){return Y(Na.count(Dt(e)-1,e),t,2)}function _y(e){var t=e.getUTCDay();return t>=4||t===0?zr(e):zr.ceil(e)}function _E(e,t){return e=_y(e),Y(zr.count(Dt(e),e)+(Dt(e).getUTCDay()===4),t,2)}function kE(e){return e.getUTCDay()}function jE(e,t){return Y(Xi.count(Dt(e)-1,e),t,2)}function CE(e,t){return Y(e.getUTCFullYear()%100,t,2)}function IE(e,t){return e=_y(e),Y(e.getUTCFullYear()%100,t,2)}function ME(e,t){return Y(e.getUTCFullYear()%1e4,t,4)}function TE(e,t){var r=e.getUTCDay();return e=r>=4||r===0?zr(e):zr.ceil(e),Y(e.getUTCFullYear()%1e4,t,4)}function DE(){return"+0000"}function Cv(){return"%"}function Iv(e){return+e}function Mv(e){return Math.floor(+e/1e3)}var Or,ky,jy;NE({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function NE(e){return Or=NS(e),ky=Or.format,Or.parse,jy=Or.utcFormat,Or.utcParse,Or}function $E(e){return new Date(e)}function RE(e){return e instanceof Date?+e:+new Date(+e)}function jc(e,t,r,n,i,a,o,u,l,s){var c=pc(),f=c.invert,d=c.domain,v=s(".%L"),p=s(":%S"),y=s("%I:%M"),m=s("%I %p"),g=s("%a %d"),x=s("%b %d"),w=s("%B"),P=s("%Y");function b(O){return(l(O)t(i/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>wA(e,a/n))},r.copy=function(){return Ty(t).domain(e)},zt.apply(r,arguments)}function Ra(){var e=0,t=.5,r=1,n=1,i,a,o,u,l,s=Ne,c,f=!1,d;function v(y){return isNaN(y=+y)?d:(y=.5+((y=+c(y))-a)*(n*ye.chartData,Mc=A([rr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),La=(e,t,r,n)=>n?Mc(e):rr(e);function Yt(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(se(t)&&se(r))return!0}return!1}function Tv(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function Ry(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,i,a;if(se(r))i=r;else if(typeof r=="function")return;if(se(n))a=n;else if(typeof n=="function")return;var o=[i,a];if(Yt(o))return o}}function KE(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Yt(n))return Tv(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[i,a]=e,o,u;if(i==="auto")t!=null&&(o=Math.min(...t));else if(N(i))o=i;else if(typeof i=="function")try{t!=null&&(o=i(t?.[0]))}catch{}else if(typeof i=="string"&&ad.test(i)){var l=ad.exec(i);if(l==null||t==null)o=void 0;else{var s=+l[1];o=t[0]-s}}else o=t?.[0];if(a==="auto")t!=null&&(u=Math.max(...t));else if(N(a))u=a;else if(typeof a=="function")try{t!=null&&(u=a(t?.[1]))}catch{}else if(typeof a=="string"&&od.test(a)){var c=od.exec(a);if(c==null||t==null)u=void 0;else{var f=+c[1];u=t[1]+f}}else u=t?.[1];var d=[o,u];if(Yt(d))return t==null?d:Tv(d,t,r)}}}var Kr=1e9,qE={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Dc,ie=!0,ot="[DecimalError] ",vr=ot+"Invalid argument: ",Tc=ot+"Exponent out of range: ",qr=Math.floor,ur=Math.pow,WE=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ge,Oe=1e7,te=7,Ly=9007199254740991,Zi=qr(Ly/te),D={};D.absoluteValue=D.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};D.comparedTo=D.cmp=function(e){var t,r,n,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,i=e.d.length,t=0,r=ne.d[t]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};D.decimalPlaces=D.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*te;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};D.dividedBy=D.div=function(e){return kt(this,new this.constructor(e))};D.dividedToIntegerBy=D.idiv=function(e){var t=this,r=t.constructor;return Z(kt(t,new r(e),0,1),r.precision)};D.equals=D.eq=function(e){return!this.cmp(e)};D.exponent=function(){return he(this)};D.greaterThan=D.gt=function(e){return this.cmp(e)>0};D.greaterThanOrEqualTo=D.gte=function(e){return this.cmp(e)>=0};D.isInteger=D.isint=function(){return this.e>this.d.length-2};D.isNegative=D.isneg=function(){return this.s<0};D.isPositive=D.ispos=function(){return this.s>0};D.isZero=function(){return this.s===0};D.lessThan=D.lt=function(e){return this.cmp(e)<0};D.lessThanOrEqualTo=D.lte=function(e){return this.cmp(e)<1};D.logarithm=D.log=function(e){var t,r=this,n=r.constructor,i=n.precision,a=i+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Ge))throw Error(ot+"NaN");if(r.s<1)throw Error(ot+(r.s?"NaN":"-Infinity"));return r.eq(Ge)?new n(0):(ie=!1,t=kt(xn(r,a),xn(e,a),a),ie=!0,Z(t,i))};D.minus=D.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Fy(t,e):zy(t,(e.s=-e.s,e))};D.modulo=D.mod=function(e){var t,r=this,n=r.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(ot+"NaN");return r.s?(ie=!1,t=kt(r,e,0,1).times(e),ie=!0,r.minus(t)):Z(new n(r),i)};D.naturalExponential=D.exp=function(){return By(this)};D.naturalLogarithm=D.ln=function(){return xn(this)};D.negated=D.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};D.plus=D.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?zy(t,e):Fy(t,(e.s=-e.s,e))};D.precision=D.sd=function(e){var t,r,n,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vr+e);if(t=he(i)+1,n=i.d.length-1,r=n*te+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};D.squareRoot=D.sqrt=function(){var e,t,r,n,i,a,o,u=this,l=u.constructor;if(u.s<1){if(!u.s)return new l(0);throw Error(ot+"NaN")}for(e=he(u),ie=!1,i=Math.sqrt(+u),i==0||i==1/0?(t=yt(u.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=qr((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new l(t)):n=new l(i.toString()),r=l.precision,i=o=r+3;;)if(a=n,n=a.plus(kt(u,a,o+2)).times(.5),yt(a.d).slice(0,o)===(t=yt(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Z(a,r+1,0),a.times(a).eq(u)){n=a;break}}else if(t!="9999")break;o+=4}return ie=!0,Z(n,r)};D.times=D.mul=function(e){var t,r,n,i,a,o,u,l,s,c=this,f=c.constructor,d=c.d,v=(e=new f(e)).d;if(!c.s||!e.s)return new f(0);for(e.s*=c.s,r=c.e+e.e,l=d.length,s=v.length,l=0;){for(t=0,i=l+n;i>n;)u=a[i]+v[n]*d[i-n-1]+t,a[i--]=u%Oe|0,t=u/Oe|0;a[i]=(a[i]+t)%Oe|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,ie?Z(e,f.precision):e};D.toDecimalPlaces=D.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(xt(e,0,Kr),t===void 0?t=n.rounding:xt(t,0,8),Z(r,e+he(r)+1,t))};D.toExponential=function(e,t){var r,n=this,i=n.constructor;return e===void 0?r=gr(n,!0):(xt(e,0,Kr),t===void 0?t=i.rounding:xt(t,0,8),n=Z(new i(n),e+1,t),r=gr(n,!0,e+1)),r};D.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?gr(i):(xt(e,0,Kr),t===void 0?t=a.rounding:xt(t,0,8),n=Z(new a(i),e+he(i)+1,t),r=gr(n.abs(),!1,e+he(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};D.toInteger=D.toint=function(){var e=this,t=e.constructor;return Z(new t(e),he(e)+1,t.rounding)};D.toNumber=function(){return+this};D.toPower=D.pow=function(e){var t,r,n,i,a,o,u=this,l=u.constructor,s=12,c=+(e=new l(e));if(!e.s)return new l(Ge);if(u=new l(u),!u.s){if(e.s<1)throw Error(ot+"Infinity");return u}if(u.eq(Ge))return u;if(n=l.precision,e.eq(Ge))return Z(u,n);if(t=e.e,r=e.d.length-1,o=t>=r,a=u.s,o){if((r=c<0?-c:c)<=Ly){for(i=new l(Ge),t=Math.ceil(n/te+4),ie=!1;r%2&&(i=i.times(u),Nv(i.d,t)),r=qr(r/2),r!==0;)u=u.times(u),Nv(u.d,t);return ie=!0,e.s<0?new l(Ge).div(i):Z(i,n)}}else if(a<0)throw Error(ot+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,u.s=1,ie=!1,i=e.times(xn(u,n+s)),ie=!0,i=By(i),i.s=a,i};D.toPrecision=function(e,t){var r,n,i=this,a=i.constructor;return e===void 0?(r=he(i),n=gr(i,r<=a.toExpNeg||r>=a.toExpPos)):(xt(e,1,Kr),t===void 0?t=a.rounding:xt(t,0,8),i=Z(new a(i),e,t),r=he(i),n=gr(i,e<=r||r<=a.toExpNeg,e)),n};D.toSignificantDigits=D.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(xt(e,1,Kr),t===void 0?t=n.rounding:xt(t,0,8)),Z(new n(r),e,t)};D.toString=D.valueOf=D.val=D.toJSON=D[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=he(e),r=e.constructor;return gr(e,t<=r.toExpNeg||t>=r.toExpPos)};function zy(e,t){var r,n,i,a,o,u,l,s,c=e.constructor,f=c.precision;if(!e.s||!t.s)return t.s||(t=new c(e)),ie?Z(t,f):t;if(l=e.d,s=t.d,o=e.e,i=t.e,l=l.slice(),a=o-i,a){for(a<0?(n=l,a=-a,u=s.length):(n=s,i=o,u=l.length),o=Math.ceil(f/te),u=o>u?o+1:u+1,a>u&&(a=u,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(u=l.length,a=s.length,u-a<0&&(a=u,n=s,s=l,l=n),r=0;a;)r=(l[--a]=l[a]+s[a]+r)/Oe|0,l[a]%=Oe;for(r&&(l.unshift(r),++i),u=l.length;l[--u]==0;)l.pop();return t.d=l,t.e=i,ie?Z(t,f):t}function xt(e,t,r){if(e!==~~e||er)throw Error(vr+e)}function yt(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(u=l=0;ui[u]?1:-1;break}return l}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]1;)n.shift()}return function(n,i,a,o){var u,l,s,c,f,d,v,p,y,m,g,x,w,P,b,O,S,_,I=n.constructor,M=n.s==i.s?1:-1,E=n.d,j=i.d;if(!n.s)return new I(n);if(!i.s)throw Error(ot+"Division by zero");for(l=n.e-i.e,S=j.length,b=E.length,v=new I(M),p=v.d=[],s=0;j[s]==(E[s]||0);)++s;if(j[s]>(E[s]||0)&&--l,a==null?x=a=I.precision:o?x=a+(he(n)-he(i))+1:x=a,x<0)return new I(0);if(x=x/te+2|0,s=0,S==1)for(c=0,j=j[0],x++;(s1&&(j=e(j,c),E=e(E,c),S=j.length,b=E.length),P=S,y=E.slice(0,S),m=y.length;m=Oe/2&&++O;do c=0,u=t(j,y,S,m),u<0?(g=y[0],S!=m&&(g=g*Oe+(y[1]||0)),c=g/O|0,c>1?(c>=Oe&&(c=Oe-1),f=e(j,c),d=f.length,m=y.length,u=t(f,y,d,m),u==1&&(c--,r(f,S16)throw Error(Tc+he(e));if(!e.s)return new c(Ge);for(ie=!1,u=f,o=new c(.03125);e.abs().gte(.1);)e=e.times(o),s+=5;for(n=Math.log(ur(2,s))/Math.LN10*2+5|0,u+=n,r=i=a=new c(Ge),c.precision=u;;){if(i=Z(i.times(e),u),r=r.times(++l),o=a.plus(kt(i,r,u)),yt(o.d).slice(0,u)===yt(a.d).slice(0,u)){for(;s--;)a=Z(a.times(a),u);return c.precision=f,t==null?(ie=!0,Z(a,f)):a}a=o}}function he(e){for(var t=e.e*te,r=e.d[0];r>=10;r/=10)t++;return t}function mu(e,t,r){if(t>e.LN10.sd())throw ie=!0,r&&(e.precision=r),Error(ot+"LN10 precision limit exceeded");return Z(new e(e.LN10),t)}function qt(e){for(var t="";e--;)t+="0";return t}function xn(e,t){var r,n,i,a,o,u,l,s,c,f=1,d=10,v=e,p=v.d,y=v.constructor,m=y.precision;if(v.s<1)throw Error(ot+(v.s?"NaN":"-Infinity"));if(v.eq(Ge))return new y(0);if(t==null?(ie=!1,s=m):s=t,v.eq(10))return t==null&&(ie=!0),mu(y,s);if(s+=d,y.precision=s,r=yt(p),n=r.charAt(0),a=he(v),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(e),r=yt(v.d),n=r.charAt(0),f++;a=he(v),n>1?(v=new y("0."+r),a++):v=new y(n+"."+r.slice(1))}else return l=mu(y,s+2,m).times(a+""),v=xn(new y(n+"."+r.slice(1)),s-d).plus(l),y.precision=m,t==null?(ie=!0,Z(v,m)):v;for(u=o=v=kt(v.minus(Ge),v.plus(Ge),s),c=Z(v.times(v),s),i=3;;){if(o=Z(o.times(c),s),l=u.plus(kt(o,new y(i),s)),yt(l.d).slice(0,s)===yt(u.d).slice(0,s))return u=u.times(2),a!==0&&(u=u.plus(mu(y,s+2,m).times(a+""))),u=kt(u,new y(f),s),y.precision=m,t==null?(ie=!0,Z(u,m)):u;u=l,i+=2}}function Dv(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(n,i),t){if(i-=n,r=r-n-1,e.e=qr(r/te),e.d=[],n=(r+1)%te,r<0&&(n+=te),nZi||e.e<-Zi))throw Error(Tc+r)}else e.s=0,e.e=0,e.d=[0];return e}function Z(e,t,r){var n,i,a,o,u,l,s,c,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(n=t-o,n<0)n+=te,i=t,s=f[c=0];else{if(c=Math.ceil((n+1)/te),a=f.length,c>=a)return e;for(s=a=f[c],o=1;a>=10;a/=10)o++;n%=te,i=n-te+o}if(r!==void 0&&(a=ur(10,o-i-1),u=s/a%10|0,l=t<0||f[c+1]!==void 0||s%a,l=r<4?(u||l)&&(r==0||r==(e.s<0?3:2)):u>5||u==5&&(r==4||l||r==6&&(n>0?i>0?s/ur(10,o-i):0:f[c-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return l?(a=he(e),f.length=1,t=t-a-1,f[0]=ur(10,(te-t%te)%te),e.e=qr(-t/te)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=c,a=1,c--):(f.length=c+1,a=ur(10,te-n),f[c]=i>0?(s/ur(10,o-i)%ur(10,i)|0)*a:0),l)for(;;)if(c==0){(f[0]+=a)==Oe&&(f[0]=1,++e.e);break}else{if(f[c]+=a,f[c]!=Oe)break;f[c--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(ie&&(e.e>Zi||e.e<-Zi))throw Error(Tc+he(e));return e}function Fy(e,t){var r,n,i,a,o,u,l,s,c,f,d=e.constructor,v=d.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new d(e),ie?Z(t,v):t;if(l=e.d,f=t.d,n=t.e,s=e.e,l=l.slice(),o=s-n,o){for(c=o<0,c?(r=l,o=-o,u=f.length):(r=f,n=s,u=l.length),i=Math.max(Math.ceil(v/te),u)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=l.length,u=f.length,c=i0;--i)l[u++]=0;for(i=f.length;i>o;){if(l[--i]0?a=a.charAt(0)+"."+a.slice(1)+qt(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+qt(-i-1)+a,r&&(n=r-o)>0&&(a+=qt(n))):i>=o?(a+=qt(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+qt(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=qt(n))),e.s<0?"-"+a:a}function Nv(e,t){if(e.length>t)return e.length=t,!0}function Ky(e){var t,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(vr+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return Dv(o,a.toString())}else if(typeof a!="string")throw Error(vr+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,WE.test(a))Dv(o,a);else throw Error(vr+a)}if(i.prototype=D,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=Ky,i.config=i.set=UE,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&n<=i[t+2])this[r]=n;else throw Error(vr+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(vr+r+": "+n);return this}var Dc=Ky(qE);Ge=new Dc(1);const V=Dc;var HE=e=>e,qy={},Wy=e=>e===qy,$v=e=>function t(){return arguments.length===0||arguments.length===1&&Wy(arguments.length<=0?void 0:arguments[0])?t:e(...arguments)},Uy=(e,t)=>e===1?t:$v(function(){for(var r=arguments.length,n=new Array(r),i=0;io!==qy).length;return a>=e?t(...n):Uy(e-a,$v(function(){for(var o=arguments.length,u=new Array(o),l=0;lWy(c)?u.shift():c);return t(...s,...u)}))}),YE=e=>Uy(e.length,e),gl=(e,t)=>{for(var r=[],n=e;nArray.isArray(t)?t.map(e):Object.keys(t).map(r=>t[r]).map(e)),VE=function(){for(var t=arguments.length,r=new Array(t),n=0;nl(u),a(...arguments))}},bl=e=>Array.isArray(e)?e.reverse():e.split("").reverse().join("");function Hy(e){var t;return e===0?t=1:t=Math.floor(new V(e).abs().log(10).toNumber())+1,t}function Yy(e,t,r){for(var n=new V(e),i=0,a=[];n.lt(t)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var Gy=e=>{var[t,r]=e,[n,i]=[t,r];return t>r&&([n,i]=[r,t]),[n,i]},Vy=(e,t,r)=>{if(e.lte(0))return new V(0);var n=Hy(e.toNumber()),i=new V(10).pow(n),a=e.div(i),o=n!==1?.05:.1,u=new V(Math.ceil(a.div(o).toNumber())).add(r).mul(o),l=u.mul(i);return t?new V(l.toNumber()):new V(Math.ceil(l.toNumber()))},XE=(e,t,r)=>{var n=new V(1),i=new V(e);if(!i.isint()&&r){var a=Math.abs(e);a<1?(n=new V(10).pow(Hy(e)-1),i=new V(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new V(Math.floor(e)))}else e===0?i=new V(Math.floor((t-1)/2)):r||(i=new V(Math.floor(e)));var o=Math.floor((t-1)/2),u=VE(GE(l=>i.add(new V(l-o).mul(n)).toNumber()),gl);return u(0,t)},Xy=function(t,r,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((r-t)/(n-1)))return{step:new V(0),tickMin:new V(0),tickMax:new V(0)};var o=Vy(new V(r).sub(t).div(n-1),i,a),u;t<=0&&r>=0?u=new V(0):(u=new V(t).add(r).div(2),u=u.sub(new V(u).mod(o)));var l=Math.ceil(u.sub(t).div(o).toNumber()),s=Math.ceil(new V(r).sub(u).div(o).toNumber()),c=l+s+1;return c>n?Xy(t,r,n,i,a+1):(c0?s+(n-c):s,l=r>0?l:l+(n-c)),{step:o,tickMin:u.sub(new V(l).mul(o)),tickMax:u.add(new V(s).mul(o))})},ZE=function(t){var[r,n]=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),[u,l]=Gy([r,n]);if(u===-1/0||l===1/0){var s=l===1/0?[u,...gl(0,i-1).map(()=>1/0)]:[...gl(0,i-1).map(()=>-1/0),l];return r>n?bl(s):s}if(u===l)return XE(u,i,a);var{step:c,tickMin:f,tickMax:d}=Xy(u,l,o,a,0),v=Yy(f,d.add(new V(.1).mul(c)),c);return r>n?bl(v):v},QE=function(t,r){var[n,i]=t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,u]=Gy([n,i]);if(o===-1/0||u===1/0)return[n,i];if(o===u)return[o];var l=Math.max(r,2),s=Vy(new V(u).sub(o).div(l-1),a,0),c=[...Yy(new V(o),new V(u),s),u];return a===!1&&(c=c.map(f=>Math.round(f))),n>i?bl(c):c},Zy=e=>e.rootProps.maxBarSize,JE=e=>e.rootProps.barGap,Qy=e=>e.rootProps.barCategoryGap,e_=e=>e.rootProps.barSize,Bn=e=>e.rootProps.stackOffset,Jy=e=>e.rootProps.reverseStackOrder,Nc=e=>e.options.chartName,$c=e=>e.rootProps.syncId,eg=e=>e.rootProps.syncMethod,Rc=e=>e.options.eventEmitter,ve={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},At={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},Ye={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},za=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t},t_={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:At.angleAxisId,includeHidden:!1,name:void 0,reversed:At.reversed,scale:At.scale,tick:At.tick,tickCount:void 0,ticks:void 0,type:At.type,unit:void 0},r_={allowDataOverflow:Ye.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ye.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ye.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ye.scale,tick:Ye.tick,tickCount:Ye.tickCount,ticks:void 0,type:Ye.type,unit:void 0},n_={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:At.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:At.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:At.scale,tick:At.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},i_={allowDataOverflow:Ye.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ye.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ye.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ye.scale,tick:Ye.tick,tickCount:Ye.tickCount,ticks:void 0,type:"category",unit:void 0},Lc=(e,t)=>e.polarAxis.angleAxis[t]!=null?e.polarAxis.angleAxis[t]:e.layout.layoutType==="radial"?n_:t_,zc=(e,t)=>e.polarAxis.radiusAxis[t]!=null?e.polarAxis.radiusAxis[t]:e.layout.layoutType==="radial"?i_:r_,Ba=e=>e.polarOptions,Bc=A([Rt,Lt,ye],Xm),tg=A([Ba,Bc],(e,t)=>{if(e!=null)return Ie(e.innerRadius,t,0)}),rg=A([Ba,Bc],(e,t)=>{if(e!=null)return Ie(e.outerRadius,t,t*.8)}),a_=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},ng=A([Ba],a_);A([Lc,ng],za);var ig=A([Bc,tg,rg],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});A([zc,ig],za);var ag=A([q,Ba,tg,rg,Rt,Lt],(e,t,r,n,i,a)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:u,startAngle:l,endAngle:s}=t;return{cx:Ie(o,i,i/2),cy:Ie(u,a,a/2),innerRadius:r,outerRadius:n,startAngle:l,endAngle:s,clockWise:!1}}}),oe=(e,t)=>t,Fn=(e,t,r)=>r;function Fc(e){return e?.id}function og(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=r,o=new Map;return e.forEach(u=>{var l,s=(l=u.data)!==null&&l!==void 0?l:n;if(!(s==null||s.length===0)){var c=Fc(u);s.forEach((f,d)=>{var v=a==null||i?d:String(X(f,a,null)),p=X(f,u.dataKey,0),y;o.has(v)?y=o.get(v):y={},Object.assign(y,{[c]:p}),o.set(v,y)})}}),Array.from(o.values())}function Fa(e){return e.stackId!=null&&e.dataKey!=null}var Ka=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function qa(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function o_(e,t){if(e.length===t.length){for(var r=0;r{var t=q(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Wr=e=>e.tooltip.settings.axisId;function Rv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Qi(e){for(var t=1;te.cartesianAxis.xAxis[t],Bt=(e,t)=>{var r=ug(e,t);return r??xe},Pe={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:wl,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Cn},lg=(e,t)=>e.cartesianAxis.yAxis[t],Ft=(e,t)=>{var r=lg(e,t);return r??Pe},s_={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Kc=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??s_},ue=(e,t,r)=>{switch(t){case"xAxis":return Bt(e,r);case"yAxis":return Ft(e,r);case"zAxis":return Kc(e,r);case"angleAxis":return Lc(e,r);case"radiusAxis":return zc(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},f_=(e,t,r)=>{switch(t){case"xAxis":return Bt(e,r);case"yAxis":return Ft(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},Kn=(e,t,r)=>{switch(t){case"xAxis":return Bt(e,r);case"yAxis":return Ft(e,r);case"angleAxis":return Lc(e,r);case"radiusAxis":return zc(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},cg=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function qc(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var Wa=e=>e.graphicalItems.cartesianItems,d_=A([oe,Fn],qc),Wc=(e,t,r)=>e.filter(r).filter(n=>t?.includeHidden===!0?!0:!n.hide),qn=A([Wa,ue,d_],Wc,{memoizeOptions:{resultEqualityCheck:qa}}),sg=A([qn],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(Fa)),fg=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),v_=A([qn],fg),Uc=e=>e.map(t=>t.data).filter(Boolean).flat(1),h_=A([qn],Uc,{memoizeOptions:{resultEqualityCheck:qa}}),Hc=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:i}=t;return e.length>0?e:r.slice(n,i+1)},Yc=A([h_,La],Hc),Gc=(e,t,r)=>t?.dataKey!=null?e.map(n=>({value:X(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(i=>({value:X(i,n)}))):e.map(n=>({value:n})),Ua=A([Yc,ue,qn],Gc);function dg(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function gi(e){if(bt(e)||e instanceof Date){var t=Number(e);if(se(t))return t}}function Lv(e){if(Array.isArray(e)){var t=[gi(e[0]),gi(e[1])];return Yt(t)?t:void 0}var r=gi(e);if(r!=null)return[r,r]}function Nt(e){return e.map(gi).filter(lw)}function p_(e,t,r){return!r||typeof t!="number"||dt(t)?[]:r.length?Nt(r.flatMap(n=>{var i=X(e,n.dataKey),a,o;if(Array.isArray(i)?[a,o]=i:a=o=i,!(!se(a)||!se(o)))return[t-a,t+o]})):[]}var we=e=>{var t=be(e),r=Wr(e);return Kn(e,t,r)},Wn=A([we],e=>e?.dataKey),m_=A([sg,La,we],og),vg=(e,t,r,n)=>{var i={},a=t.reduce((o,u)=>(u.stackId==null||(o[u.stackId]==null&&(o[u.stackId]=[]),o[u.stackId].push(u)),o),i);return Object.fromEntries(Object.entries(a).map(o=>{var[u,l]=o,s=n?[...l].reverse():l,c=s.map(Fc);return[u,{stackedData:CP(e,c,r),graphicalItems:s}]}))},xl=A([m_,sg,Bn,Jy],vg),hg=(e,t,r,n)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(n==null&&r!=="zAxis"){var o=NP(e,i,a);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},y_=A([ue],e=>e.allowDataOverflow),Vc=e=>{var t;if(e==null||!("domain"in e))return wl;if(e.domain!=null)return e.domain;if(e.ticks!=null){if(e.type==="number"){var r=Nt(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e?.domain)!==null&&t!==void 0?t:wl},Xc=A([ue],Vc),Zc=A([Xc,y_],Ry),g_=A([xl,rr,oe,Zc],hg,{memoizeOptions:{resultEqualityCheck:Ka}}),Ha=e=>e.errorBars,b_=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>dg(r,n)),Ji=function(){for(var t=arguments.length,r=new Array(t),n=0;n{var a,o;if(r.length>0&&e.forEach(u=>{r.forEach(l=>{var s,c,f=(s=n[l.id])===null||s===void 0?void 0:s.filter(g=>dg(i,g)),d=X(u,(c=t.dataKey)!==null&&c!==void 0?c:l.dataKey),v=p_(u,d,f);if(v.length>=2){var p=Math.min(...v),y=Math.max(...v);(a==null||po)&&(o=y)}var m=Lv(d);m!=null&&(a=a==null?m[0]:Math.min(a,m[0]),o=o==null?m[1]:Math.max(o,m[1]))})}),t?.dataKey!=null&&e.forEach(u=>{var l=Lv(X(u,t.dataKey));l!=null&&(a=a==null?l[0]:Math.min(a,l[0]),o=o==null?l[1]:Math.max(o,l[1]))}),se(a)&&se(o))return[a,o]},w_=A([Yc,ue,v_,Ha,oe],Qc,{memoizeOptions:{resultEqualityCheck:Ka}});function x_(e){var{value:t}=e;if(bt(t)||t instanceof Date)return t}var P_=(e,t,r)=>{var n=e.map(x_).filter(i=>i!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&jp(n))?ey(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},pg=e=>e.referenceElements.dots,Ur=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),O_=A([pg,oe,Fn],Ur),mg=e=>e.referenceElements.areas,A_=A([mg,oe,Fn],Ur),yg=e=>e.referenceElements.lines,S_=A([yg,oe,Fn],Ur),gg=(e,t)=>{var r=Nt(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},E_=A(O_,oe,gg),bg=(e,t)=>{var r=Nt(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},__=A([A_,oe],bg);function k_(e){var t;if(e.x!=null)return Nt([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Nt(r)}function j_(e){var t;if(e.y!=null)return Nt([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Nt(r)}var wg=(e,t)=>{var r=e.flatMap(n=>t==="xAxis"?k_(n):j_(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]},C_=A([S_,oe],wg),I_=A(E_,C_,__,(e,t,r)=>Ji(e,r,t)),Jc=(e,t,r,n,i,a,o,u)=>{if(r!=null)return r;var l=o==="vertical"&&u==="xAxis"||o==="horizontal"&&u==="yAxis",s=l?Ji(n,a,i):Ji(a,i);return KE(t,s,e.allowDataOverflow)},M_=A([ue,Xc,Zc,g_,w_,I_,q,oe],Jc,{memoizeOptions:{resultEqualityCheck:Ka}}),T_=[0,1],es=(e,t,r,n,i,a,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:u,type:l}=e,s=Jt(t,a);if(s&&u==null){var c;return ey(0,(c=r?.length)!==null&&c!==void 0?c:0)}return l==="category"?P_(n,e,s):i==="expand"?T_:o}},ts=A([ue,q,Yc,Ua,Bn,oe,M_],es),xg=(e,t,r,n,i)=>{if(e!=null){var{scale:a,type:o}=e;if(a==="auto")return t==="radial"&&i==="radiusAxis"?"band":t==="radial"&&i==="angleAxis"?"linear":o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?"point":o==="category"?"band":"linear";if(typeof a=="string"){var u="scale".concat(An(a));return u in un?u:"point"}}},Hr=A([ue,q,cg,Nc,oe],xg);function D_(e){if(e!=null){if(e in un)return un[e]();var t="scale".concat(An(e));if(t in un)return un[t]()}}function rs(e,t,r,n){if(!(r==null||n==null)){if(typeof e.scale=="function")return e.scale.copy().domain(r).range(n);var i=D_(t);if(i!=null){var a=i.domain(r).range(n);return SP(a),a}}}var ns=(e,t,r)=>{var n=Vc(t);if(!(r!=="auto"&&r!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(n)&&(n[0]==="auto"||n[1]==="auto")&&Yt(e))return ZE(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Yt(e))return QE(e,t.tickCount,t.allowDecimals)}},is=A([ts,Kn,Hr],ns),as=(e,t,r,n)=>{if(n!=="angleAxis"&&e?.type==="number"&&Yt(t)&&Array.isArray(r)&&r.length>0){var i=t[0],a=r[0],o=t[1],u=r[r.length-1];return[Math.min(i,a),Math.max(o,u)]}return t},N_=A([ue,ts,is,oe],as),$_=A(Ua,ue,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Nt(e.map(u=>u.value))).sort((u,l)=>u-l);if(n.length<2)return 1/0;var i=n[n.length-1]-n[0];if(i===0)return 1/0;for(var a=0;an,(e,t,r,n,i)=>{if(!se(e))return 0;var a=t==="vertical"?n.height:n.width;if(i==="gap")return e*a/2;if(i==="no-gap"){var o=Ie(r,e*a),u=e*a/2;return u-o-(u-o)/a*o}return 0}),R_=(e,t)=>{var r=Bt(e,t);return r==null||typeof r.padding!="string"?0:Pg(e,"xAxis",t,r.padding)},L_=(e,t)=>{var r=Ft(e,t);return r==null||typeof r.padding!="string"?0:Pg(e,"yAxis",t,r.padding)},z_=A(Bt,R_,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:i}=e;return typeof i=="string"?{left:t,right:t}:{left:((r=i.left)!==null&&r!==void 0?r:0)+t,right:((n=i.right)!==null&&n!==void 0?n:0)+t}}),B_=A(Ft,L_,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:i}=e;return typeof i=="string"?{top:t,bottom:t}:{top:((r=i.top)!==null&&r!==void 0?r:0)+t,bottom:((n=i.bottom)!==null&&n!==void 0?n:0)+t}}),F_=A([ye,z_,Ea,Sa,(e,t,r)=>r],(e,t,r,n,i)=>{var{padding:a}=n;return i?[a.left,r.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),K_=A([ye,q,B_,Ea,Sa,(e,t,r)=>r],(e,t,r,n,i,a)=>{var{padding:o}=i;return a?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),Un=(e,t,r,n)=>{var i;switch(t){case"xAxis":return F_(e,r,n);case"yAxis":return K_(e,r,n);case"zAxis":return(i=Kc(e,r))===null||i===void 0?void 0:i.range;case"angleAxis":return ng(e);case"radiusAxis":return ig(e,r);default:return}},Og=A([ue,Un],za),Yr=A([ue,Hr,N_,Og],rs);A([qn,Ha,oe],b_);function Ag(e,t){return e.idt.id?1:0}var Ya=(e,t)=>t,Ga=(e,t,r)=>r,q_=A(Oa,Ya,Ga,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Ag)),W_=A(Aa,Ya,Ga,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(Ag)),Sg=(e,t)=>({width:e.width,height:t.height}),U_=(e,t)=>{var r=typeof t.width=="number"?t.width:Cn;return{width:r,height:e.height}},Eg=A(ye,Bt,Sg),H_=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},Y_=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},G_=A(Lt,ye,q_,Ya,Ga,(e,t,r,n,i)=>{var a={},o;return r.forEach(u=>{var l=Sg(t,u);o==null&&(o=H_(t,n,e));var s=n==="top"&&!i||n==="bottom"&&i;a[u.id]=o-Number(s)*l.height,o+=(s?-1:1)*l.height}),a}),V_=A(Rt,ye,W_,Ya,Ga,(e,t,r,n,i)=>{var a={},o;return r.forEach(u=>{var l=U_(t,u);o==null&&(o=Y_(t,n,e));var s=n==="left"&&!i||n==="right"&&i;a[u.id]=o-Number(s)*l.width,o+=(s?-1:1)*l.width}),a}),X_=(e,t)=>{var r=Bt(e,t);if(r!=null)return G_(e,r.orientation,r.mirror)},Z_=A([ye,Bt,X_,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r?.[n];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Q_=(e,t)=>{var r=Ft(e,t);if(r!=null)return V_(e,r.orientation,r.mirror)},J_=A([ye,Ft,Q_,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var i=r?.[n];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),_g=A(ye,Ft,(e,t)=>{var r=typeof t.width=="number"?t.width:Cn;return{width:r,height:e.height}}),zv=(e,t,r)=>{switch(t){case"xAxis":return Eg(e,r).width;case"yAxis":return _g(e,r).height;default:return}},kg=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:i,type:a,dataKey:o}=r,u=Jt(e,n),l=t.map(s=>s.value);if(o&&u&&a==="category"&&i&&jp(l))return l}},os=A([q,Ua,ue,oe],kg),jg=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:i,scale:a}=r,o=Jt(e,n);if(o&&(i==="number"||a!=="auto"))return t.map(u=>u.value)}},us=A([q,Ua,Kn,oe],jg),Bv=A([q,f_,Hr,Yr,os,us,Un,is,oe],(e,t,r,n,i,a,o,u,l)=>{if(t!=null){var s=Jt(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:s,niceTicks:u,range:o,realScaleType:r,scale:n}}}),ek=(e,t,r,n,i,a,o,u,l)=>{if(!(t==null||n==null)){var s=Jt(e,l),{type:c,ticks:f,tickCount:d}=t,v=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,p=c==="category"&&n.bandwidth?n.bandwidth()/v:0;p=l==="angleAxis"&&a!=null&&a.length>=2?Ae(a[0]-a[1])*2*p:p;var y=f||i;if(y){var m=y.map((g,x)=>{var w=o?o.indexOf(g):g;return{index:x,coordinate:n(w)+p,value:g,offset:p}});return m.filter(g=>se(g.coordinate))}return s&&u?u.map((g,x)=>({coordinate:n(g)+p,value:g,index:x,offset:p})).filter(g=>se(g.coordinate)):n.ticks?n.ticks(d).map(g=>({coordinate:n(g)+p,value:g,offset:p})):n.domain().map((g,x)=>({coordinate:n(g)+p,value:o?o[g]:g,index:x,offset:p}))}},Cg=A([q,Kn,Hr,Yr,is,Un,os,us,oe],ek),tk=(e,t,r,n,i,a,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var u=Jt(e,o),{tickCount:l}=t,s=0;return s=o==="angleAxis"&&n?.length>=2?Ae(n[0]-n[1])*2*s:s,u&&a?a.map((c,f)=>({coordinate:r(c)+s,value:c,index:f,offset:s})):r.ticks?r.ticks(l).map(c=>({coordinate:r(c)+s,value:c,offset:s})):r.domain().map((c,f)=>({coordinate:r(c)+s,value:i?i[c]:c,index:f,offset:s}))}},Gt=A([q,Kn,Yr,Un,os,us,oe],tk),Vt=A(ue,Yr,(e,t)=>{if(!(e==null||t==null))return Qi(Qi({},e),{},{scale:t})}),rk=A([ue,Hr,ts,Og],rs);A((e,t,r)=>Kc(e,r),rk,(e,t)=>{if(!(e==null||t==null))return Qi(Qi({},e),{},{scale:t})});var nk=A([q,Oa,Aa],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Ig=e=>e.options.defaultTooltipEventType,Mg=e=>e.options.validateTooltipEventTypes;function Tg(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function ls(e,t){var r=Ig(e),n=Mg(e);return Tg(t,r,n)}function ik(e){return T(t=>ls(t,e))}var Dg=(e,t)=>{var r,n=Number(t);if(!(dt(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},ak=e=>e.tooltip.settings,Ut={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},ok={itemInteraction:{click:Ut,hover:Ut},axisInteraction:{click:Ut,hover:Ut},keyboardInteraction:Ut,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},Ng=qe({name:"tooltip",initialState:ok,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:re()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,i=ft(e).tooltipItemPayloads.indexOf(r);i>-1&&(e.tooltipItemPayloads[i]=n)},prepare:re()},removeTooltipEntrySettings:{reducer(e,t){var r=ft(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:re()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate,e.keyboardInteraction.dataKey=t.payload.activeDataKey}}}),{addTooltipEntrySettings:uk,replaceTooltipEntrySettings:lk,removeTooltipEntrySettings:ck,setTooltipSettingsState:sk,setActiveMouseOverItemIndex:$g,mouseLeaveItem:fk,mouseLeaveChart:Rg,setActiveClickItemIndex:dk,setMouseOverAxisIndex:Lg,setMouseClickAxisIndex:vk,setSyncInteraction:Pl,setKeyboardInteraction:Ol}=Ng.actions,hk=Ng.reducer;function Fv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fi(e){for(var t=1;t{if(t==null)return Ut;var i=gk(e,t,r);if(i==null)return Ut;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(bk(i)){if(a)return fi(fi({},i),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return fi(fi({},Ut),{},{coordinate:i.coordinate})};function wk(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function xk(e,t){var r=wk(e),n=t[0],i=t[1];if(r===void 0)return!1;var a=Math.min(n,i),o=Math.max(n,i);return r>=a&&r<=o}function Pk(e,t,r){if(r==null||t==null)return!0;var n=X(e,t);return n==null||!Yt(r)?!0:xk(n,r)}var cs=(e,t,r,n)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!se(a))return i;var o=0,u=1/0;t.length>0&&(u=t.length-1);var l=Math.max(o,Math.min(a,u)),s=t[l];return s==null||Pk(s,r,n)?String(l):null},Bg=(e,t,r,n,i,a,o,u)=>{if(!(a==null||u==null)){var l=o[0],s=l==null?void 0:u(l.positions,a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(r){case"horizontal":return{x:c.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:c.coordinate}}}},Fg=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i;return r==="hover"?i=e.itemInteraction.hover.dataKey:i=e.itemInteraction.click.dataKey,i==null&&n!=null?[e.tooltipItemPayloads[0]]:e.tooltipItemPayloads.filter(a=>{var o;return((o=a.settings)===null||o===void 0?void 0:o.dataKey)===i})},Hn=e=>e.options.tooltipPayloadSearcher,Gr=e=>e.tooltip;function Kv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qv(e){for(var t=1;t{if(!(t==null||a==null)){var{chartData:u,computedData:l,dataStartIndex:s,dataEndIndex:c}=r,f=[];return e.reduce((d,v)=>{var p,{dataDefinedOnItem:y,settings:m}=v,g=Ek(y,u),x=Array.isArray(g)?Om(g,s,c):g,w=(p=m?.dataKey)!==null&&p!==void 0?p:n,P=m?.nameKey,b;if(n&&Array.isArray(x)&&!Array.isArray(x[0])&&o==="axis"?b=Cp(x,n,i):b=a(x,t,l,P),Array.isArray(b))b.forEach(S=>{var _=qv(qv({},m),{},{name:S.name,unit:S.unit,color:void 0,fill:void 0});d.push(ud({tooltipEntrySettings:_,dataKey:S.dataKey,payload:S.payload,value:X(S.payload,S.dataKey),name:S.name}))});else{var O;d.push(ud({tooltipEntrySettings:m,dataKey:w,payload:b,value:X(b,w),name:(O=X(b,P))!==null&&O!==void 0?O:m?.name}))}return d},f)}},ss=A([we,q,cg,Nc,be],xg),_k=A([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),kk=A([be,Wr],qc),Yn=A([_k,we,kk],Wc,{memoizeOptions:{resultEqualityCheck:qa}}),jk=A([Yn],e=>e.filter(Fa)),Ck=A([Yn],Uc,{memoizeOptions:{resultEqualityCheck:qa}}),Vr=A([Ck,rr],Hc),Ik=A([jk,rr,we],og),fs=A([Vr,we,Yn],Gc),qg=A([we],Vc),Mk=A([we],e=>e.allowDataOverflow),Wg=A([qg,Mk],Ry),Tk=A([Yn],e=>e.filter(Fa)),Dk=A([Ik,Tk,Bn,Jy],vg),Nk=A([Dk,rr,be,Wg],hg),$k=A([Yn],fg),Rk=A([Vr,we,$k,Ha,be],Qc,{memoizeOptions:{resultEqualityCheck:Ka}}),Lk=A([pg,be,Wr],Ur),zk=A([Lk,be],gg),Bk=A([mg,be,Wr],Ur),Fk=A([Bk,be],bg),Kk=A([yg,be,Wr],Ur),qk=A([Kk,be],wg),Wk=A([zk,qk,Fk],Ji),Uk=A([we,qg,Wg,Nk,Rk,Wk,q,be],Jc),Gn=A([we,q,Vr,fs,Bn,be,Uk],es),Hk=A([Gn,we,ss],ns),Yk=A([we,Gn,Hk,be],as),Ug=e=>{var t=be(e),r=Wr(e),n=!1;return Un(e,t,r,n)},Hg=A([we,Ug],za),Yg=A([we,ss,Yk,Hg],rs),Gk=A([q,fs,we,be],kg),Vk=A([q,fs,we,be],jg),Xk=(e,t,r,n,i,a,o,u)=>{if(t){var{type:l}=t,s=Jt(e,u);if(n){var c=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=l==="category"&&n.bandwidth?n.bandwidth()/c:0;return f=u==="angleAxis"&&i!=null&&i?.length>=2?Ae(i[0]-i[1])*2*f:f,s&&o?o.map((d,v)=>({coordinate:n(d)+f,value:d,index:v,offset:f})):n.domain().map((d,v)=>({coordinate:n(d)+f,value:a?a[d]:d,index:v,offset:f}))}}},Kt=A([q,we,ss,Yg,Ug,Gk,Vk,be],Xk),ds=A([Ig,Mg,ak],(e,t,r)=>Tg(r.shared,e,t)),Gg=e=>e.tooltip.settings.trigger,vs=e=>e.tooltip.settings.defaultIndex,Vn=A([Gr,ds,Gg,vs],zg),Xt=A([Vn,Vr,Wn,Gn],cs),Vg=A([Kt,Xt],Dg),hs=A([Vn],e=>{if(e)return e.dataKey}),Zk=A([Vn],e=>{if(e)return e.graphicalItemId}),Xg=A([Gr,ds,Gg,vs],Fg),Qk=A([Rt,Lt,q,ye,Kt,vs,Xg,Hn],Bg),Jk=A([Vn,Qk],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),ej=A([Vn],e=>e.active),tj=A([Xg,Xt,rr,Wn,Vg,Hn,ds],Kg),rj=A([tj],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function Wv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Uv(e){for(var t=1;tT(we),uj=()=>{var e=oj(),t=T(Kt),r=T(Yg);return Dr(!e||!r?void 0:Uv(Uv({},e),{},{scale:r}),t)};function Hv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ar(e){for(var t=1;t{var i=t.find(a=>a&&a.index===r);if(i){if(e==="horizontal")return{x:i.coordinate,y:n.chartY};if(e==="vertical")return{x:n.chartX,y:i.coordinate}}return{x:0,y:0}},dj=(e,t,r,n)=>{var i=t.find(s=>s&&s.index===r);if(i){if(e==="centric"){var a=i.coordinate,{radius:o}=n;return Ar(Ar(Ar({},n),de(n.cx,n.cy,o,a)),{},{angle:a,radius:o})}var u=i.coordinate,{angle:l}=n;return Ar(Ar(Ar({},n),de(n.cx,n.cy,u,l)),{},{angle:l,radius:u})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function vj(e,t){var{chartX:r,chartY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var Zg=(e,t,r,n,i)=>{var a,o=-1,u=(a=t?.length)!==null&&a!==void 0?a:0;if(u<=1||e==null)return 0;if(n==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var l=0;l0?r[l-1].coordinate:r[u-1].coordinate,c=r[l].coordinate,f=l>=u-1?r[0].coordinate:r[l+1].coordinate,d=void 0;if(Ae(c-s)!==Ae(f-c)){var v=[];if(Ae(f-c)===Ae(i[1]-i[0])){d=f;var p=c+i[1]-i[0];v[0]=Math.min(p,(p+s)/2),v[1]=Math.max(p,(p+s)/2)}else{d=s;var y=f+i[1]-i[0];v[0]=Math.min(c,(y+c)/2),v[1]=Math.max(c,(y+c)/2)}var m=[Math.min(c,(d+c)/2),Math.max(c,(d+c)/2)];if(e>m[0]&&e<=m[1]||e>=v[0]&&e<=v[1]){({index:o}=r[l]);break}}else{var g=Math.min(s,f),x=Math.max(s,f);if(e>(g+c)/2&&e<=(x+c)/2){({index:o}=r[l]);break}}}else if(t){for(var w=0;w0&&w(t[w].coordinate+t[w-1].coordinate)/2&&e<=(t[w].coordinate+t[w+1].coordinate)/2||w===u-1&&e>(t[w].coordinate+t[w-1].coordinate)/2){({index:o}=t[w]);break}}return o},hj=()=>T(Nc),ps=(e,t)=>t,Qg=(e,t,r)=>r,ms=(e,t,r,n)=>n,pj=A(Kt,e=>ha(e,t=>t.coordinate)),ys=A([Gr,ps,Qg,ms],zg),gs=A([ys,Vr,Wn,Gn],cs),mj=(e,t,r)=>{if(t!=null){var n=Gr(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},Jg=A([Gr,ps,Qg,ms],Fg),ea=A([Rt,Lt,q,ye,Kt,ms,Jg,Hn],Bg),yj=A([ys,ea],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),e0=A([Kt,gs],Dg),gj=A([Jg,gs,rr,Wn,e0,Hn,ps],Kg),bj=A([ys,gs],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),wj=(e,t,r,n,i,a,o)=>{if(!(!e||!r||!n||!i)&&vj(e,o)){var u=$P(e,t),l=Zg(u,a,i,r,n),s=fj(t,i,l,e);return{activeIndex:String(l),activeCoordinate:s}}},xj=(e,t,r,n,i,a,o)=>{if(!(!e||!n||!i||!a||!r)){var u=J1(e,r);if(u){var l=RP(u,t),s=Zg(l,o,a,n,i),c=dj(t,a,s,u);return{activeIndex:String(s),activeCoordinate:c}}}},Pj=(e,t,r,n,i,a,o,u)=>{if(!(!e||!t||!n||!i||!a))return t==="horizontal"||t==="vertical"?wj(e,t,n,i,a,o,u):xj(e,t,r,n,i,a,o)},Oj=A(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElementId:n.elementId}}),Aj=A(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(ve)),r=Array.from(new Set(t));return r.sort((n,i)=>n-i)},{memoizeOptions:{resultEqualityCheck:o_}});function Yv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Gv(e){for(var t=1;tGv(Gv({},e),{},{[t]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),kj)},Cj=new Set(Object.values(ve));function Ij(e){return Cj.has(e)}var t0=qe({name:"zIndex",initialState:jj,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:re()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!Ij(r)&&delete e.zIndexMap[r])},prepare:re()},registerZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r,elementId:n,isPanorama:i}=t.payload;e.zIndexMap[r]?i?e.zIndexMap[r].panoramaElementId=n:e.zIndexMap[r].elementId=n:e.zIndexMap[r]={consumers:0,elementId:i?void 0:n,panoramaElementId:i?n:void 0}},prepare:re()},unregisterZIndexPortalId:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElementId=void 0:e.zIndexMap[r].elementId=void 0)},prepare:re()}}}),{registerZIndexPortal:Mj,unregisterZIndexPortal:Tj,registerZIndexPortalId:Dj,unregisterZIndexPortalId:Nj}=t0.actions,$j=t0.reducer;function We(e){var{zIndex:t,children:r}=e,n=hO(),i=n&&t!==void 0&&t!==0,a=Me(),o=ee();h.useLayoutEffect(()=>i?(o(Mj({zIndex:t})),()=>{o(Tj({zIndex:t}))}):Sn,[o,t,i]);var u=T(s=>Oj(s,t,a));if(!i)return r;if(!u)return null;var l=document.getElementById(u);return l?Nl.createPortal(r,l):null}function Al(){return Al=Object.assign?Object.assign.bind():function(e){for(var t=1;th.useContext(r0),yu={exports:{}},Xv;function Wj(){return Xv||(Xv=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,s,c){this.fn=l,this.context=s,this.once=c||!1}function a(l,s,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,f||l,d),p=r?r+s:s;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],v]:l._events[p].push(v):(l._events[p]=v,l._eventsCount++),l}function o(l,s){--l._eventsCount===0?l._events=new n:delete l._events[s]}function u(){this._events=new n,this._eventsCount=0}u.prototype.eventNames=function(){var s=[],c,f;if(this._eventsCount===0)return s;for(f in c=this._events)t.call(c,f)&&s.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(c)):s},u.prototype.listeners=function(s){var c=r?r+s:s,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,v=f.length,p=new Array(v);d{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Gj=n0.reducer,{createEventEmitter:Vj}=n0.actions;function Xj(e){return e.tooltip.syncInteraction}var Zj={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},i0=qe({name:"chartData",initialState:Zj,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:Qv,setDataStartEndIndexes:Qj,setComputedData:N$}=i0.actions,Jj=i0.reducer,eC=["x","y"];function Jv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Sr(e){for(var t=1;tl.rootProps.className);h.useEffect(()=>{if(e==null)return Sn;var l=(s,c,f)=>{if(t!==f&&e===s){if(n==="index"){var d;if(o&&c!==null&&c!==void 0&&(d=c.payload)!==null&&d!==void 0&&d.coordinate&&c.payload.sourceViewBox){var v=c.payload.coordinate,{x:p,y}=v,m=iC(v,eC),{x:g,y:x,width:w,height:P}=c.payload.sourceViewBox,b=Sr(Sr({},m),{},{x:o.x+(w?(p-g)/w:0)*o.width,y:o.y+(P?(y-x)/P:0)*o.height});r(Sr(Sr({},c),{},{payload:Sr(Sr({},c.payload),{},{coordinate:b})}))}else r(c);return}if(i!=null){var O;if(typeof n=="function"){var S={activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate},_=n(i,S);O=i[_]}else n==="value"&&(O=i.find(K=>String(K.value)===c.payload.label));var{coordinate:I}=c.payload;if(O==null||c.payload.active===!1||I==null||o==null){r(Pl({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:M,y:E}=I,j=Math.min(M,o.x+o.width),$=Math.min(E,o.y+o.height),L={x:a==="horizontal"?O.coordinate:j,y:a==="horizontal"?$:O.coordinate},z=Pl({active:c.payload.active,coordinate:L,dataKey:c.payload.dataKey,index:String(O.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId});r(z)}}};return Pn.on(Sl,l),()=>{Pn.off(Sl,l)}},[u,r,t,e,n,i,a,o])}function uC(){var e=T($c),t=T(Rc),r=ee();h.useEffect(()=>{if(e==null)return Sn;var n=(i,a,o)=>{t!==o&&e===i&&r(Qj(a))};return Pn.on(Zv,n),()=>{Pn.off(Zv,n)}},[r,t,e])}function lC(){var e=ee();h.useEffect(()=>{e(Vj())},[e]),oC(),uC()}function cC(e,t,r,n,i,a){var o=T(v=>mj(v,e,t)),u=T(Rc),l=T($c),s=T(eg),c=T(Xj),f=c?.active,d=_a();h.useEffect(()=>{if(!f&&l!=null&&u!=null){var v=Pl({active:a,coordinate:r,dataKey:o,index:i,label:typeof n=="number"?String(n):n,sourceViewBox:d,graphicalItemId:void 0});Pn.emit(Sl,l,v,u)}},[f,r,o,i,n,u,l,s,a,d])}function eh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function th(e){for(var t=1;t{S(sk({shared:x,trigger:w,axisId:O,active:i,defaultIndex:_}))},[S,x,w,O,i,_]);var I=_a(),M=Wm(),E=ik(x),{activeIndex:j,isActive:$}=(t=T(ze=>bj(ze,E,w,_)))!==null&&t!==void 0?t:{},L=T(ze=>gj(ze,E,w,_)),z=T(ze=>e0(ze,E,w,_)),K=T(ze=>yj(ze,E,w,_)),B=L,W=qj(),R=(r=i??$)!==null&&r!==void 0?r:!1,[ke,Te]=Yp([B,R]),Le=E==="axis"?z:void 0;cC(E,w,K,Le,j,R);var Pt=b??W;if(Pt==null||I==null||E==null)return null;var Je=B??rh;R||(Je=rh),s&&Je.length&&(Je=Kp(Je.filter(ze=>ze.value!=null&&(ze.hide!==!0||n.includeHidden)),d,vC));var nr=Je.length>0,Xr=h.createElement(e1,{allowEscapeViewBox:a,animationDuration:o,animationEasing:u,isAnimationActive:c,active:R,coordinate:K,hasPayload:nr,offset:f,position:v,reverseDirection:p,useTranslate3d:y,viewBox:I,wrapperStyle:m,lastBoundingBox:ke,innerRef:Te,hasPortalFromProps:!!b},hC(l,th(th({},n),{},{payload:Je,label:Le,active:R,activeIndex:j,coordinate:K,accessibilityLayer:M})));return h.createElement(h.Fragment,null,Nl.createPortal(Xr,Pt),R&&h.createElement(Kj,{cursor:g,tooltipEventType:E,coordinate:K,payload:Je,index:j}))}var Va=e=>null;Va.displayName="Cell";function mC(e,t,r){return(t=yC(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yC(e){var t=gC(e,"string");return typeof t=="symbol"?t:t+""}function gC(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class bC{constructor(t){mC(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function nh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wC(e){for(var t=1;t{try{var r=document.getElementById(ah);r||(r=document.createElement("span"),r.setAttribute("id",ah),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,SC,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},ln=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Tn.isSsr)return{width:0,height:0};if(!a0.enableCache)return oh(t,r);var n=EC(t,r),i=ih.get(n);if(i)return i;var a=oh(t,r);return ih.set(n,a),a},uh=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,lh=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,_C=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,kC=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,o0={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},jC=Object.keys(o0),kr="NaN";function CC(e,t){return e*o0[t]}class Fe{static parse(t){var r,[,n,i]=(r=kC.exec(t))!==null&&r!==void 0?r:[];return new Fe(parseFloat(n),i??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,dt(t)&&(this.unit=""),r!==""&&!_C.test(r)&&(this.num=NaN,this.unit=""),jC.includes(r)&&(this.num=CC(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new Fe(NaN,""):new Fe(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return dt(this.num)}}function u0(e){if(e.includes(kr))return kr;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,i,a]=(r=uh.exec(t))!==null&&r!==void 0?r:[],o=Fe.parse(n??""),u=Fe.parse(a??""),l=i==="*"?o.multiply(u):o.divide(u);if(l.isNaN())return kr;t=t.replace(uh,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var s,[,c,f,d]=(s=lh.exec(t))!==null&&s!==void 0?s:[],v=Fe.parse(c??""),p=Fe.parse(d??""),y=f==="+"?v.add(p):v.subtract(p);if(y.isNaN())return kr;t=t.replace(lh,y.toString())}return t}var ch=/\(([^()]*)\)/;function IC(e){for(var t=e,r;(r=ch.exec(t))!=null;){var[,n]=r;t=t.replace(ch,u0(n))}return t}function MC(e){var t=e.replace(/\s+/g,"");return t=IC(t),t=u0(t),t}function TC(e){try{return MC(e)}catch{return kr}}function gu(e){var t=TC(e.slice(5,-1));return t===kr?"":t}var DC=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],NC=["dx","dy","angle","className","breakAll"];function El(){return El=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{children:t,breakAll:r,style:n}=e;try{var i=[];ae(t)||(r?i=t.toString().split(""):i=t.toString().split(l0));var a=i.map(u=>({word:u,width:ln(u,n).width})),o=r?0:ln(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch{return null}};function RC(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var s0=(e,t,r,n)=>e.reduce((i,a)=>{var{word:o,width:u}=a,l=i[i.length-1];if(l&&u!=null&&(t==null||n||l.width+u+re.reduce((t,r)=>t.width>r.width?t:r),LC="…",fh=(e,t,r,n,i,a,o,u)=>{var l=e.slice(0,t),s=c0({breakAll:r,style:n,children:l+LC});if(!s)return[!1,[]];var c=s0(s.wordsWithComputedWidth,a,o,u),f=c.length>i||f0(c).width>Number(a);return[f,c]},zC=(e,t,r,n,i)=>{var{maxLines:a,children:o,style:u,breakAll:l}=e,s=N(a),c=String(o),f=s0(t,n,r,i);if(!s||i)return f;var d=f.length>a||f0(f).width>Number(n);if(!d)return f;for(var v=0,p=c.length-1,y=0,m;v<=p&&y<=c.length-1;){var g=Math.floor((v+p)/2),x=g-1,[w,P]=fh(c,x,l,u,a,n,r,i),[b]=fh(c,g,l,u,a,n,r,i);if(!w&&!b&&(v=g+1),w&&b&&(p=g-1),!w&&b){m=P;break}y++}return m||f},dh=e=>{var t=ae(e)?[]:e.toString().split(l0);return[{words:t,width:void 0}]},BC=e=>{var{width:t,scaleToFit:r,children:n,style:i,breakAll:a,maxLines:o}=e;if((t||r)&&!Tn.isSsr){var u,l,s=c0({breakAll:a,children:n,style:i});if(s){var{wordsWithComputedWidth:c,spaceWidth:f}=s;u=c,l=f}else return dh(n);return zC({breakAll:a,children:n,maxLines:o,style:i},u,l,t,!!r)}return dh(n)},d0="#808080",FC={angle:0,breakAll:!1,capHeight:"0.71em",fill:d0,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Xa=h.forwardRef((e,t)=>{var r=pe(e,FC),{x:n,y:i,lineHeight:a,capHeight:o,fill:u,scaleToFit:l,textAnchor:s,verticalAnchor:c}=r,f=sh(r,DC),d=h.useMemo(()=>BC({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),{dx:v,dy:p,angle:y,className:m,breakAll:g}=f,x=sh(f,NC);if(!bt(n)||!bt(i)||d.length===0)return null;var w=Number(n)+(N(v)?v:0),P=Number(i)+(N(p)?p:0);if(!se(w)||!se(P))return null;var b;switch(c){case"start":b=gu("calc(".concat(o,")"));break;case"middle":b=gu("calc(".concat((d.length-1)/2," * -").concat(a," + (").concat(o," / 2))"));break;default:b=gu("calc(".concat(d.length-1," * -").concat(a,")"));break}var O=[];if(l){var S=d[0].width,{width:_}=f;O.push("scale(".concat(N(_)&&N(S)?_/S:1,")"))}return y&&O.push("rotate(".concat(y,", ").concat(w,", ").concat(P,")")),O.length&&(x.transform=O.join(" ")),h.createElement("text",El({},$e(x),{ref:t,x:w,y:P,className:H("recharts-text",m),textAnchor:s,fill:u.includes("url")?d0:u}),d.map((I,M)=>{var E=I.words.join(g?"":" ");return h.createElement("tspan",{x:w,dy:M===0?b:a,key:"".concat(E,"-").concat(M)},E)}))});Xa.displayName="Text";var KC=["labelRef"];function qC(e,t){if(e==null)return{};var r,n,i=WC(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:o,children:u}=e,l=h.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:i,width:a,height:o}),[t,r,n,i,a,o]);return h.createElement(v0.Provider,{value:l},u)},h0=()=>{var e=h.useContext(v0),t=_a();return e||Mm(t)},VC=h.createContext(null),XC=()=>{var e=h.useContext(VC),t=T(ag);return e||t},ZC=e=>{var{value:t,formatter:r}=e,n=ae(e.children)?t:e.children;return typeof r=="function"?r(n):n},ws=e=>e!=null&&typeof e=="function",QC=(e,t)=>{var r=Ae(t-e),n=Math.min(Math.abs(t-e),360);return r*n},JC=(e,t,r,n,i)=>{var{offset:a,className:o}=e,{cx:u,cy:l,innerRadius:s,outerRadius:c,startAngle:f,endAngle:d,clockWise:v}=i,p=(s+c)/2,y=QC(f,d),m=y>=0?1:-1,g,x;switch(t){case"insideStart":g=f+m*a,x=v;break;case"insideEnd":g=d-m*a,x=!v;break;case"end":g=d+m*a,x=v;break;default:throw new Error("Unsupported position ".concat(t))}x=y<=0?x:!x;var w=de(u,l,p,g),P=de(u,l,p,g+(x?1:-1)*359),b="M".concat(w.x,",").concat(w.y,` - A`).concat(p,",").concat(p,",0,1,").concat(x?0:1,`, - `).concat(P.x,",").concat(P.y),O=ae(e.id)?cn("recharts-radial-line-"):e.id;return h.createElement("text",St({},n,{dominantBaseline:"central",className:H("recharts-radial-bar-label",o)}),h.createElement("defs",null,h.createElement("path",{id:O,d:b})),h.createElement("textPath",{xlinkHref:"#".concat(O)},r))},eI=(e,t,r)=>{var{cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:l}=e,s=(u+l)/2;if(r==="outside"){var{x:c,y:f}=de(n,i,o+t,s);return{x:c,y:f,textAnchor:c>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:i,textAnchor:"middle",verticalAnchor:"end"};var d=(a+o)/2,{x:v,y:p}=de(n,i,d,s);return{x:v,y:p,textAnchor:"middle",verticalAnchor:"middle"}},_l=e=>"cx"in e&&N(e.cx),tI=(e,t)=>{var{parentViewBox:r,offset:n,position:i}=e,a;r!=null&&!_l(r)&&(a=r);var{x:o,y:u,upperWidth:l,lowerWidth:s,height:c}=t,f=o,d=o+(l-s)/2,v=(f+d)/2,p=(l+s)/2,y=f+l/2,m=c>=0?1:-1,g=m*n,x=m>0?"end":"start",w=m>0?"start":"end",P=l>=0?1:-1,b=P*n,O=P>0?"end":"start",S=P>0?"start":"end";if(i==="top"){var _={x:f+l/2,y:u-g,textAnchor:"middle",verticalAnchor:x};return ce(ce({},_),a?{height:Math.max(u-a.y,0),width:l}:{})}if(i==="bottom"){var I={x:d+s/2,y:u+c+g,textAnchor:"middle",verticalAnchor:w};return ce(ce({},I),a?{height:Math.max(a.y+a.height-(u+c),0),width:s}:{})}if(i==="left"){var M={x:v-b,y:u+c/2,textAnchor:O,verticalAnchor:"middle"};return ce(ce({},M),a?{width:Math.max(M.x-a.x,0),height:c}:{})}if(i==="right"){var E={x:v+p+b,y:u+c/2,textAnchor:S,verticalAnchor:"middle"};return ce(ce({},E),a?{width:Math.max(a.x+a.width-E.x,0),height:c}:{})}var j=a?{width:p,height:c}:{};return i==="insideLeft"?ce({x:v+b,y:u+c/2,textAnchor:S,verticalAnchor:"middle"},j):i==="insideRight"?ce({x:v+p-b,y:u+c/2,textAnchor:O,verticalAnchor:"middle"},j):i==="insideTop"?ce({x:f+l/2,y:u+g,textAnchor:"middle",verticalAnchor:w},j):i==="insideBottom"?ce({x:d+s/2,y:u+c-g,textAnchor:"middle",verticalAnchor:x},j):i==="insideTopLeft"?ce({x:f+b,y:u+g,textAnchor:S,verticalAnchor:w},j):i==="insideTopRight"?ce({x:f+l-b,y:u+g,textAnchor:O,verticalAnchor:w},j):i==="insideBottomLeft"?ce({x:d+b,y:u+c-g,textAnchor:S,verticalAnchor:x},j):i==="insideBottomRight"?ce({x:d+s-b,y:u+c-g,textAnchor:O,verticalAnchor:x},j):i&&typeof i=="object"&&(N(i.x)||Ct(i.x))&&(N(i.y)||Ct(i.y))?ce({x:o+Ie(i.x,p),y:u+Ie(i.y,c),textAnchor:"end",verticalAnchor:"end"},j):ce({x:y,y:u+c/2,textAnchor:"middle",verticalAnchor:"middle"},j)},rI={angle:0,offset:5,zIndex:ve.label,position:"middle",textBreakAll:!1};function Wt(e){var t=pe(e,rI),{viewBox:r,position:n,value:i,children:a,content:o,className:u="",textBreakAll:l,labelRef:s}=t,c=XC(),f=h0(),d=n==="center"?f:c??f,v,p,y;if(r==null?v=d:_l(r)?v=r:v=Mm(r),!v||ae(i)&&ae(a)&&!h.isValidElement(o)&&typeof o!="function")return null;var m=ce(ce({},t),{},{viewBox:v});if(h.isValidElement(o)){var{labelRef:g}=m,x=qC(m,KC);return h.cloneElement(o,x)}if(typeof o=="function"){if(p=h.createElement(o,m),h.isValidElement(p))return p}else p=ZC(t);var w=$e(t);if(_l(v)){if(n==="insideStart"||n==="insideEnd"||n==="end")return JC(t,n,p,w,v);y=eI(v,t.offset,t.position)}else y=tI(t,v);return h.createElement(We,{zIndex:t.zIndex},h.createElement(Xa,St({ref:s,className:H("recharts-label",u)},w,y,{textAnchor:RC(w.textAnchor)?w.textAnchor:y.textAnchor,breakAll:l}),p))}Wt.displayName="Label";var nI=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?h.createElement(Wt,St({key:"label-implicit"},n)):bt(e)?h.createElement(Wt,St({key:"label-implicit",value:e},n)):h.isValidElement(e)?e.type===Wt?h.cloneElement(e,ce({key:"label-implicit"},n)):h.createElement(Wt,St({key:"label-implicit",content:e},n)):ws(e)?h.createElement(Wt,St({key:"label-implicit",content:e},n)):e&&typeof e=="object"?h.createElement(Wt,St({},e,{key:"label-implicit"},n)):null};function iI(e){var{label:t,labelRef:r}=e,n=h0();return nI(t,n,r)||null}var bu={},wu={},hh;function aI(){return hh||(hh=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r[r.length-1]}e.last=t})(wu)),wu}var xu={},ph;function oI(){return ph||(ph=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Array.isArray(r)?r:Array.from(r)}e.toArray=t})(xu)),xu}var mh;function uI(){return mh||(mh=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=aI(),r=oI(),n=Hl();function i(a){if(n.isArrayLike(a))return t.last(r.toArray(a))}e.last=i})(bu)),bu}var Pu,yh;function lI(){return yh||(yh=1,Pu=uI().last),Pu}var cI=lI();const sI=Qt(cI);var fI=["valueAccessor"],dI=["dataKey","clockWise","id","textBreakAll","zIndex"];function ta(){return ta=Object.assign?Object.assign.bind():function(e){for(var t=1;tArray.isArray(e.value)?sI(e.value):e.value,p0=h.createContext(void 0),m0=p0.Provider,y0=h.createContext(void 0),pI=y0.Provider;function mI(){return h.useContext(p0)}function yI(){return h.useContext(y0)}function bi(e){var{valueAccessor:t=hI}=e,r=gh(e,fI),{dataKey:n,clockWise:i,id:a,textBreakAll:o,zIndex:u}=r,l=gh(r,dI),s=mI(),c=yI(),f=s||c;return!f||!f.length?null:h.createElement(We,{zIndex:u??ve.label},h.createElement(Se,{className:"recharts-label-list"},f.map((d,v)=>{var p,y=ae(n)?t(d,v):X(d&&d.payload,n),m=ae(a)?{}:{id:"".concat(a,"-").concat(v)};return h.createElement(Wt,ta({key:"label-".concat(v)},$e(d),l,m,{fill:(p=r.fill)!==null&&p!==void 0?p:d.fill,parentViewBox:d.parentViewBox,value:y,textBreakAll:o,viewBox:d.viewBox,index:v,zIndex:0}))})))}bi.displayName="LabelList";function xs(e){var{label:t}=e;return t?t===!0?h.createElement(bi,{key:"labelList-implicit"}):h.isValidElement(t)||ws(t)?h.createElement(bi,{key:"labelList-implicit",content:t}):typeof t=="object"?h.createElement(bi,ta({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function kl(){return kl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{cx:t,cy:r,r:n,className:i}=e,a=H("recharts-dot",i);return N(t)&&N(r)&&N(n)?h.createElement("circle",kl({},Ze(e),Ul(e),{className:a,cx:t,cy:r,r:n})):null},b0=e=>e.graphicalItems.polarItems,gI=A([oe,Fn],qc),Za=A([b0,ue,gI],Wc),bI=A([Za],Uc),Qa=A([bI,Mc],Hc),wI=A([Qa,ue,Za],Gc);A([Qa,ue,Za],(e,t,r)=>r.length>0?e.flatMap(n=>r.flatMap(i=>{var a,o=X(n,(a=t.dataKey)!==null&&a!==void 0?a:i.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):t?.dataKey!=null?e.map(n=>({value:X(n,t.dataKey),errorDomain:[]})):e.map(n=>({value:n,errorDomain:[]})));var bh=()=>{},xI=A([Qa,ue,Za,Ha,oe],Qc),PI=A([ue,Xc,Zc,bh,xI,bh,q,oe],Jc),w0=A([ue,q,Qa,wI,Bn,oe,PI],es),OI=A([w0,ue,Hr],ns);A([ue,w0,OI,oe],as);var AI={radiusAxis:{},angleAxis:{}},x0=qe({name:"polarAxis",initialState:AI,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:R$,removeRadiusAxis:L$,addAngleAxis:z$,removeAngleAxis:B$}=x0.actions,SI=x0.reducer;function wh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xh(e){for(var t=1;tt,Ps=A([b0,jI],(e,t)=>e.filter(r=>r.type==="pie").find(r=>r.id===t)),CI=[],Os=(e,t,r)=>r?.length===0?CI:r,P0=A([Mc,Ps,Os],(e,t,r)=>{var{chartData:n}=e;if(t!=null){var i;if(t?.data!=null&&t.data.length>0?i=t.data:i=n,(!i||!i.length)&&r!=null&&(i=r.map(a=>xh(xh({},t.presentationProps),a.props))),i!=null)return i}}),II=A([P0,Ps,Os],(e,t,r)=>{if(!(e==null||t==null))return e.map((n,i)=>{var a,o=X(n,t.nameKey,t.name),u;return r!=null&&(a=r[i])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?u=r[i].props.fill:typeof n=="object"&&n!=null&&"fill"in n?u=n.fill:u=t.fill,{value:Br(o,t.dataKey),color:u,payload:n,type:t.legendType}})}),MI=A([P0,Ps,Os,ye],(e,t,r,n)=>{if(!(t==null||e==null))return TM({offset:n,pieSettings:t,displayedData:e,cells:r})}),Ou={exports:{}},G={};var Ph;function TI(){if(Ph)return G;Ph=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,o=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function w(b){if(typeof b=="object"&&b!==null){var O=b.$$typeof;switch(O){case t:switch(b=b.type,b){case l:case s:case n:case a:case i:case f:return b;default:switch(b=b&&b.$$typeof,b){case u:case c:case p:case v:case o:return b;default:return O}}case r:return O}}}function P(b){return w(b)===s}return G.AsyncMode=l,G.ConcurrentMode=s,G.ContextConsumer=u,G.ContextProvider=o,G.Element=t,G.ForwardRef=c,G.Fragment=n,G.Lazy=p,G.Memo=v,G.Portal=r,G.Profiler=a,G.StrictMode=i,G.Suspense=f,G.isAsyncMode=function(b){return P(b)||w(b)===l},G.isConcurrentMode=P,G.isContextConsumer=function(b){return w(b)===u},G.isContextProvider=function(b){return w(b)===o},G.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===t},G.isForwardRef=function(b){return w(b)===c},G.isFragment=function(b){return w(b)===n},G.isLazy=function(b){return w(b)===p},G.isMemo=function(b){return w(b)===v},G.isPortal=function(b){return w(b)===r},G.isProfiler=function(b){return w(b)===a},G.isStrictMode=function(b){return w(b)===i},G.isSuspense=function(b){return w(b)===f},G.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===n||b===s||b===a||b===i||b===f||b===d||typeof b=="object"&&b!==null&&(b.$$typeof===p||b.$$typeof===v||b.$$typeof===o||b.$$typeof===u||b.$$typeof===c||b.$$typeof===m||b.$$typeof===g||b.$$typeof===x||b.$$typeof===y)},G.typeOf=w,G}var Oh;function DI(){return Oh||(Oh=1,Ou.exports=TI()),Ou.exports}var NI=DI(),Ah=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",Sh=null,Au=null,O0=e=>{if(e===Sh&&Array.isArray(Au))return Au;var t=[];return h.Children.forEach(e,r=>{ae(r)||(NI.isFragment(r)?t=t.concat(O0(r.props.children)):t.push(r))}),Au=t,Sh=e,t};function As(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(i=>Ah(i)):n=[Ah(t)],O0(e).forEach(i=>{var a=pr(i,"type.displayName")||pr(i,"type.name");a&&n.indexOf(a)!==-1&&r.push(i)}),r}var A0=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,Su={},Eh;function $I(){return Eh||(Eh=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const i=r[Symbol.toStringTag];return i==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${i}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(Su)),Su}var Eu,_h;function RI(){return _h||(_h=1,Eu=$I().isPlainObject),Eu}var LI=RI();const zI=Qt(LI);function kh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function jh(e){for(var t=1;t{var a=r-n,o;return o="M ".concat(e,",").concat(t),o+="L ".concat(e+r,",").concat(t),o+="L ".concat(e+r-a/2,",").concat(t+i),o+="L ".concat(e+r-a/2-n,",").concat(t+i),o+="L ".concat(e,",").concat(t," Z"),o},qI={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},WI=e=>{var t=pe(e,qI),{x:r,y:n,upperWidth:i,lowerWidth:a,height:o,className:u}=t,{animationEasing:l,animationDuration:s,animationBegin:c,isUpdateAnimationActive:f}=t,d=h.useRef(null),[v,p]=h.useState(-1),y=h.useRef(i),m=h.useRef(a),g=h.useRef(o),x=h.useRef(r),w=h.useRef(n),P=Nn(e,"trapezoid-");if(h.useEffect(()=>{if(d.current&&d.current.getTotalLength)try{var L=d.current.getTotalLength();L&&p(L)}catch{}},[]),r!==+r||n!==+n||i!==+i||a!==+a||o!==+o||i===0&&a===0||o===0)return null;var b=H("recharts-trapezoid",u);if(!f)return h.createElement("g",null,h.createElement("path",ra({},$e(t),{className:b,d:Ch(r,n,i,a,o)})));var O=y.current,S=m.current,_=g.current,I=x.current,M=w.current,E="0px ".concat(v===-1?1:v,"px"),j="".concat(v,"px 0px"),$=Um(["strokeDasharray"],s,l);return h.createElement(Dn,{animationId:P,key:P,canBegin:v>0,duration:s,easing:l,isActive:f,begin:c},L=>{var z=ne(O,i,L),K=ne(S,a,L),B=ne(_,o,L),W=ne(I,r,L),R=ne(M,n,L);d.current&&(y.current=z,m.current=K,g.current=B,x.current=W,w.current=R);var ke=L>0?{transition:$,strokeDasharray:j}:{strokeDasharray:E};return h.createElement("path",ra({},$e(t),{className:b,d:Ch(W,R,z,K,B),ref:d,style:jh(jh({},ke),t.style)}))})},UI=["option","shapeType","propTransformer","activeClassName"];function HI(e,t){if(e==null)return{};var r,n,i=YI(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var n=ee();return(i,a)=>o=>{e?.(i,a,o),n($g({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}},_s=e=>{var t=ee();return(r,n)=>i=>{e?.(r,n,i),t(fk())}},ks=(e,t,r)=>{var n=ee();return(i,a)=>o=>{e?.(i,a,o),n(dk({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:r}))}};function js(e){var{tooltipEntrySettings:t}=e,r=ee(),n=Me(),i=h.useRef(null);return h.useLayoutEffect(()=>{n||(i.current===null?r(uk(t)):i.current!==t&&r(lk({prev:i.current,next:t})),i.current=t)},[t,r,n]),h.useLayoutEffect(()=>()=>{i.current&&(r(ck(i.current)),i.current=null)},[r]),null}function S0(e){var{legendPayload:t}=e,r=ee(),n=Me(),i=h.useRef(null);return h.useLayoutEffect(()=>{n||(i.current===null?r(Fm(t)):i.current!==t&&r(Km({prev:i.current,next:t})),i.current=t)},[r,n,t]),h.useLayoutEffect(()=>()=>{i.current&&(r(qm(i.current)),i.current=null)},[r]),null}function eM(e){var{legendPayload:t}=e,r=ee(),n=T(q),i=h.useRef(null);return h.useLayoutEffect(()=>{n!=="centric"&&n!=="radial"||(i.current===null?r(Fm(t)):i.current!==t&&r(Km({prev:i.current,next:t})),i.current=t)},[r,n,t]),h.useLayoutEffect(()=>()=>{i.current&&(r(qm(i.current)),i.current=null)},[r]),null}var _u,tM=()=>{var[e]=h.useState(()=>cn("uid-"));return e},rM=(_u=sb.useId)!==null&&_u!==void 0?_u:tM;function E0(e,t){var r=rM();return t||(e?"".concat(e,"-").concat(r):r)}var nM=h.createContext(void 0),Cs=e=>{var{id:t,type:r,children:n}=e,i=E0("recharts-".concat(r),t);return h.createElement(nM.Provider,{value:i},n(i))},iM={cartesianItems:[],polarItems:[]},_0=qe({name:"graphicalItems",initialState:iM,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:re()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,i=ft(e).cartesianItems.indexOf(r);i>-1&&(e.cartesianItems[i]=n)},prepare:re()},removeCartesianGraphicalItem:{reducer(e,t){var r=ft(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:re()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:re()},removePolarGraphicalItem:{reducer(e,t){var r=ft(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:re()}}}),{addCartesianGraphicalItem:aM,replaceCartesianGraphicalItem:oM,removeCartesianGraphicalItem:uM,addPolarGraphicalItem:lM,removePolarGraphicalItem:cM}=_0.actions,sM=_0.reducer,fM=e=>{var t=ee(),r=h.useRef(null);return h.useLayoutEffect(()=>{r.current===null?t(aM(e)):r.current!==e&&t(oM({prev:r.current,next:e})),r.current=e},[t,e]),h.useLayoutEffect(()=>()=>{r.current&&(t(uM(r.current)),r.current=null)},[t]),null},k0=h.memo(fM);function dM(e){var t=ee();return h.useLayoutEffect(()=>(t(lM(e)),()=>{t(cM(e))}),[t,e]),null}var vM=["key"],hM=["onMouseEnter","onClick","onMouseLeave"],pM=["id"],mM=["id"];function Th(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;tAs(e.children,Va),[e.children]),r=T(n=>II(n,e.id,t));return r==null?null:h.createElement(eM,{legendPayload:r})}var PM=h.memo(e=>{var{dataKey:t,nameKey:r,sectors:n,stroke:i,strokeWidth:a,fill:o,name:u,hide:l,tooltipType:s}=e,c={dataDefinedOnItem:n.map(f=>f.tooltipPayload),positions:n.map(f=>f.tooltipPosition),settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:r,name:Br(u,t),hide:l,type:s,color:o,unit:""}};return h.createElement(js,{tooltipEntrySettings:c})}),OM=(e,t)=>e>t?"start":eIe(typeof t=="function"?t(e):t,r,r*.8),SM=(e,t,r)=>{var{top:n,left:i,width:a,height:o}=t,u=Xm(a,o),l=i+Ie(e.cx,a,a/2),s=n+Ie(e.cy,o,o/2),c=Ie(e.innerRadius,u,0),f=AM(r,e.outerRadius,u),d=e.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:l,cy:s,innerRadius:c,outerRadius:f,maxRadius:d}},EM=(e,t)=>{var r=Ae(t-e),n=Math.min(Math.abs(t-e),360);return r*n};function _M(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var kM=(e,t)=>{if(h.isValidElement(e))return h.cloneElement(e,t);if(typeof e=="function")return e(t);var r=H("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:n}=t,i=Ja(t,vM);return h.createElement(lc,Zt({},i,{type:"linear",className:r}))},jM=(e,t,r)=>{if(h.isValidElement(e))return h.cloneElement(e,t);var n=r;if(typeof e=="function"&&(n=e(t),h.isValidElement(n)))return n;var i=H("recharts-pie-label-text",_M(e));return h.createElement(Xa,Zt({},t,{alignmentBaseline:"middle",className:i}),n)};function CM(e){var{sectors:t,props:r,showLabels:n}=e,{label:i,labelLine:a,dataKey:o}=r;if(!n||!i||!t)return null;var u=Ze(r),l=hr(i),s=hr(a),c=typeof i=="object"&&"offsetRadius"in i&&typeof i.offsetRadius=="number"&&i.offsetRadius||20,f=t.map((d,v)=>{var p=(d.startAngle+d.endAngle)/2,y=de(d.cx,d.cy,d.outerRadius+c,p),m=le(le(le(le({},u),d),{},{stroke:"none"},l),{},{index:v,textAnchor:OM(y.x,d.cx)},y),g=le(le(le(le({},u),d),{},{fill:"none",stroke:d.fill},s),{},{index:v,points:[de(d.cx,d.cy,d.outerRadius,p),y],key:"line"});return h.createElement(We,{zIndex:ve.label,key:"label-".concat(d.startAngle,"-").concat(d.endAngle,"-").concat(d.midAngle,"-").concat(v)},h.createElement(Se,null,a&&kM(a,g),jM(i,m,X(d,o))))});return h.createElement(Se,{className:"recharts-pie-labels"},f)}function IM(e){var{sectors:t,props:r,showLabels:n}=e,{label:i}=r;return typeof i=="object"&&i!=null&&"position"in i?h.createElement(xs,{label:i}):h.createElement(CM,{sectors:t,props:r,showLabels:n})}function MM(e){var{sectors:t,activeShape:r,inactiveShape:n,allOtherPieProps:i,shape:a,id:o}=e,u=T(Xt),l=T(hs),s=T(Zk),{onMouseEnter:c,onClick:f,onMouseLeave:d}=i,v=Ja(i,hM),p=Es(c,i.dataKey,o),y=_s(d),m=ks(f,i.dataKey,o);return t==null||t.length===0?null:h.createElement(h.Fragment,null,t.map((g,x)=>{if(g?.startAngle===0&&g?.endAngle===0&&t.length!==1)return null;var w=s==null||s===o,P=String(x)===u&&(l==null||i.dataKey===l)&&w,b=u?n:null,O=r&&P?r:b,S=le(le({},g),{},{stroke:g.stroke,tabIndex:-1,[_m]:x,[km]:i.dataKey});return h.createElement(Se,Zt({key:"sector-".concat(g?.startAngle,"-").concat(g?.endAngle,"-").concat(g.midAngle,"-").concat(x),tabIndex:-1,className:"recharts-pie-sector"},En(v,g,x),{onMouseEnter:p(g,x),onMouseLeave:y(g,x),onClick:m(g,x)}),h.createElement(Ss,Zt({option:a??O,index:x,shapeType:"sector",isActive:P},S)))}))}function TM(e){var t,{pieSettings:r,displayedData:n,cells:i,offset:a}=e,{cornerRadius:o,startAngle:u,endAngle:l,dataKey:s,nameKey:c,tooltipType:f}=r,d=Math.abs(r.minAngle),v=EM(u,l),p=Math.abs(v),y=n.length<=1?0:(t=r.paddingAngle)!==null&&t!==void 0?t:0,m=n.filter(O=>X(O,s,0)!==0).length,g=(p>=360?m:m-1)*y,x=p-m*d-g,w=n.reduce((O,S)=>{var _=X(S,s,0);return O+(N(_)?_:0)},0),P;if(w>0){var b;P=n.map((O,S)=>{var _=X(O,s,0),I=X(O,c,S),M=SM(r,a,O),E=(N(_)?_:0)/w,j,$=le(le({},O),i&&i[S]&&i[S].props);S?j=b.endAngle+Ae(v)*y*(_!==0?1:0):j=u;var L=j+Ae(v)*((_!==0?d:0)+E*x),z=(j+L)/2,K=(M.innerRadius+M.outerRadius)/2,B=[{name:I,value:_,payload:$,dataKey:s,type:f}],W=de(M.cx,M.cy,K,z);return b=le(le(le(le({},r.presentationProps),{},{percent:E,cornerRadius:typeof o=="string"?parseFloat(o):o,name:I,tooltipPayload:B,midAngle:z,middleRadius:K,tooltipPosition:W},$),M),{},{value:_,dataKey:s,startAngle:j,endAngle:L,payload:$,paddingAngle:Ae(v)*y}),b})}return P}function DM(e){var{showLabels:t,sectors:r,children:n}=e,i=h.useMemo(()=>!t||!r?[]:r.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[r,t]);return h.createElement(pI,{value:t?i:void 0},n)}function NM(e){var{props:t,previousSectorsRef:r,id:n}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:u,animationEasing:l,activeShape:s,inactiveShape:c,onAnimationStart:f,onAnimationEnd:d}=t,v=Nn(t,"recharts-pie-"),p=r.current,[y,m]=h.useState(!1),g=h.useCallback(()=>{typeof d=="function"&&d(),m(!1)},[d]),x=h.useCallback(()=>{typeof f=="function"&&f(),m(!0)},[f]);return h.createElement(DM,{showLabels:!y,sectors:i},h.createElement(Dn,{animationId:v,begin:o,duration:u,isActive:a,easing:l,onAnimationStart:x,onAnimationEnd:g,key:v},w=>{var P=[],b=i&&i[0],O=b?.startAngle;return i?.forEach((S,_)=>{var I=p&&p[_],M=_>0?pr(S,"paddingAngle",0):0;if(I){var E=ne(I.endAngle-I.startAngle,S.endAngle-S.startAngle,w),j=le(le({},S),{},{startAngle:O+M,endAngle:O+E+M});P.push(j),O=j.endAngle}else{var{endAngle:$,startAngle:L}=S,z=ne(0,$-L,w),K=le(le({},S),{},{startAngle:O+M,endAngle:O+z+M});P.push(K),O=K.endAngle}}),r.current=P,h.createElement(Se,null,h.createElement(MM,{sectors:P,activeShape:s,inactiveShape:c,allOtherPieProps:t,shape:t.shape,id:n}))}),h.createElement(IM,{showLabels:!y,sectors:i,props:t}),t.children)}var $M={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:ve.area};function RM(e){var{id:t}=e,r=Ja(e,pM),{hide:n,className:i,rootTabIndex:a}=e,o=h.useMemo(()=>As(e.children,Va),[e.children]),u=T(c=>MI(c,t,o)),l=h.useRef(null),s=H("recharts-pie",i);return n||u==null?(l.current=null,h.createElement(Se,{tabIndex:a,className:s})):h.createElement(We,{zIndex:e.zIndex},h.createElement(PM,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:u,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType}),h.createElement(Se,{tabIndex:a,className:s},h.createElement(NM,{props:le(le({},r),{},{sectors:u}),previousSectorsRef:l,id:t})))}function LM(e){var t=pe(e,$M),{id:r}=t,n=Ja(t,mM),i=Ze(n);return h.createElement(Cs,{id:r,type:"pie"},a=>h.createElement(h.Fragment,null,h.createElement(dM,{type:"pie",id:a,data:n.data,dataKey:n.dataKey,hide:n.hide,angleAxisId:0,radiusAxisId:0,name:n.name,nameKey:n.nameKey,tooltipType:n.tooltipType,legendType:n.legendType,fill:n.fill,cx:n.cx,cy:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,paddingAngle:n.paddingAngle,minAngle:n.minAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,cornerRadius:n.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),h.createElement(xM,Zt({},n,{id:a})),h.createElement(RM,Zt({},n,{id:a}))))}LM.displayName="Pie";var zM=["points"];function Dh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ku(e){for(var t=1;t{var m,g,x=ku(ku(ku({r:3},o),f),{},{index:y,cx:(m=p.x)!==null&&m!==void 0?m:void 0,cy:(g=p.y)!==null&&g!==void 0?g:void 0,dataKey:a,value:p.value,payload:p.payload,points:t});return h.createElement(UM,{key:"dot-".concat(y),option:r,dotProps:x,className:i})}),v={};return u&&l!=null&&(v.clipPath="url(#clipPath-".concat(c?"":"dots-").concat(l,")")),h.createElement(We,{zIndex:s},h.createElement(Se,ia({className:n},v),d))}function Nh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $h(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),uT=A([oT,Rt,Lt],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),Is=()=>T(uT),lT=()=>T(rj);function Rh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ju(e){for(var t=1;t{var{point:t,childIndex:r,mainColor:n,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var u={index:r,dataKey:a,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=ju(ju(ju({},u),hr(i)),Ul(i)),s;return h.isValidElement(i)?s=h.cloneElement(i,l):typeof i=="function"?s=i(l):s=h.createElement(g0,l),h.createElement(Se,{className:"recharts-active-dot",clipPath:o},s)};function vT(e){var{points:t,mainColor:r,activeDot:n,itemDataKey:i,clipPath:a,zIndex:o=ve.activeDot}=e,u=T(Xt),l=lT();if(t==null||l==null)return null;var s=t.find(c=>l.includes(c.payload));return ae(s)?null:h.createElement(We,{zIndex:o},h.createElement(dT,{point:s,childIndex:Number(u),mainColor:r,dataKey:i,activeDot:n,clipPath:a}))}var hT=["x","y"];function jl(){return jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:0;return(n,i)=>{if(N(t))return t;var a=N(n)||ae(n);return a?t(n,i):(a||fb(!1),r)}},PT={},C0=qe({name:"errorBars",initialState:PT,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:i}=t.payload;e[r]&&(e[r]=e[r].map(a=>a.dataKey===n.dataKey&&a.direction===n.direction?i:a))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(i=>i.dataKey!==n.dataKey||i.direction!==n.direction))}}}),{addErrorBar:W$,replaceErrorBar:U$,removeErrorBar:H$}=C0.actions,OT=C0.reducer,AT=["children"];function ST(e,t){if(e==null)return{};var r,n,i=ET(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n({x:0,y:0,value:0}),errorBarOffset:0},kT=h.createContext(_T);function I0(e){var{children:t}=e,r=ST(e,AT);return h.createElement(kT.Provider,{value:r},t)}function Ms(e,t){var r,n,i=T(s=>Bt(s,e)),a=T(s=>Ft(s,t)),o=(r=i?.allowDataOverflow)!==null&&r!==void 0?r:xe.allowDataOverflow,u=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Pe.allowDataOverflow,l=o||u;return{needClip:l,needClipX:o,needClipY:u}}function M0(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,i=Is(),{needClipX:a,needClipY:o,needClip:u}=Ms(t,r);if(!u||!i)return null;var{x:l,y:s,width:c,height:f}=i;return h.createElement("clipPath",{id:"clipPath-".concat(n)},h.createElement("rect",{x:a?l:l-c/2,y:o?s:s-f/2,width:a?c:c*2,height:o?f:f*2}))}function jT(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&se(e.zIndex)?e.zIndex:t}var Cu={exports:{}},Iu={};var zh;function CT(){if(zh)return Iu;zh=1;var e=db();function t(l,s){return l===s&&(l!==0||1/l===1/s)||l!==l&&s!==s}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,u=e.useDebugValue;return Iu.useSyncExternalStoreWithSelector=function(l,s,c,f,d){var v=i(null);if(v.current===null){var p={hasValue:!1,value:null};v.current=p}else p=v.current;v=o(function(){function m(b){if(!g){if(g=!0,x=b,b=f(b),d!==void 0&&p.hasValue){var O=p.value;if(d(O,b))return w=O}return w=b}if(O=w,r(x,b))return O;var S=f(b);return d!==void 0&&d(O,S)?(x=b,O):(x=b,w=S)}var g=!1,x,w,P=c===void 0?null:c;return[function(){return m(s())},P===null?void 0:function(){return m(P())}]},[s,c,f,d]);var y=n(l,v[0],v[1]);return a(function(){p.hasValue=!0,p.value=y},[y]),u(y),y},Iu}var Bh;function IT(){return Bh||(Bh=1,Cu.exports=CT()),Cu.exports}IT();function MT(e){e()}function TT(){let e=null,t=null;return{clear(){e=null,t=null},notify(){MT(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Fh={notify(){},get:()=>[]};function DT(e,t){let r,n=Fh,i=0,a=!1;function o(y){c();const m=n.subscribe(y);let g=!1;return()=>{g||(g=!0,m(),f())}}function u(){n.notify()}function l(){p.onStateChange&&p.onStateChange()}function s(){return a}function c(){i++,r||(r=e.subscribe(l),n=TT())}function f(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=Fh)}function d(){a||(a=!0,c())}function v(){a&&(a=!1,f())}const p={addNestedSub:o,notifyNestedSubs:u,handleChangeWrapper:l,isSubscribed:s,trySubscribe:d,tryUnsubscribe:v,getListeners:()=>n};return p}var NT=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$T=NT(),RT=()=>typeof navigator<"u"&&navigator.product==="ReactNative",LT=RT(),zT=()=>$T||LT?h.useLayoutEffect:h.useEffect,BT=zT();function Kh(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function FT(e,t){if(Kh(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i{const l=DT(i);return{store:i,subscription:l,getServerState:n?()=>n:void 0}},[i,n]),o=h.useMemo(()=>i.getState(),[i]);BT(()=>{const{subscription:l}=a;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[a,o]);const u=r||UT;return h.createElement(u.Provider,{value:a},t)}var YT=HT,GT=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function VT(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function eo(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(GT.has(n)){if(e[n]==null&&t[n]==null)continue;if(!FT(e[n],t[n]))return!1}else if(!VT(e[n],t[n]))return!1;return!0}var XT=["onMouseEnter","onMouseLeave","onClick"],ZT=["value","background","tooltipPosition"],QT=["id"],JT=["onMouseEnter","onClick","onMouseLeave"];function $t(){return $t=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,fill:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:Br(r,t),payload:e}]},aD=h.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:a,hide:o,unit:u,tooltipType:l}=e,s={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:Br(a,t),hide:o,type:l,color:i,unit:u}};return h.createElement(js,{tooltipEntrySettings:s})});function oD(e){var t=T(Xt),{data:r,dataKey:n,background:i,allOtherBarProps:a}=e,{onMouseEnter:o,onMouseLeave:u,onClick:l}=a,s=oa(a,XT),c=Es(o,n),f=_s(u),d=ks(l,n);if(!i||r==null)return null;var v=hr(i);return h.createElement(We,{zIndex:jT(i,ve.barBackground)},r.map((p,y)=>{var{value:m,background:g,tooltipPosition:x}=p,w=oa(p,ZT);if(!g)return null;var P=c(p,y),b=f(p,y),O=d(p,y),S=De(De(De(De(De({option:i,isActive:String(y)===t},w),{},{fill:"#eee"},g),v),En(s,p,y)),{},{onMouseEnter:P,onMouseLeave:b,onClick:O,dataKey:n,index:y,className:"recharts-bar-background-rectangle"});return h.createElement(aa,$t({key:"background-bar-".concat(y)},S))}))}function uD(e){var{showLabels:t,children:r,rects:n}=e,i=n?.map(a=>{var o={x:a.x,y:a.y,width:a.width,lowerWidth:a.width,upperWidth:a.width,height:a.height};return De(De({},o),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:o,fill:a.fill})});return h.createElement(m0,{value:t?i:void 0},r)}function lD(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:a,dataKey:o}=e,u=T(Xt),l=T(hs),s=r&&String(a)===u&&(l==null||o===l),c=s?r:t;return s?h.createElement(We,{zIndex:ve.activeBar},h.createElement(aa,$t({},n,{name:String(n.name)},i,{isActive:s,option:c,index:a,dataKey:o}))):h.createElement(aa,$t({},n,{name:String(n.name)},i,{isActive:s,option:c,index:a,dataKey:o}))}function cD(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:a}=e;return h.createElement(aa,$t({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:a}))}function sD(e){var t,{data:r,props:n}=e,i=(t=Ze(n))!==null&&t!==void 0?t:{},{id:a}=i,o=oa(i,QT),{shape:u,dataKey:l,activeBar:s}=n,{onMouseEnter:c,onClick:f,onMouseLeave:d}=n,v=oa(n,JT),p=Es(c,l),y=_s(d),m=ks(f,l);return r?h.createElement(h.Fragment,null,r.map((g,x)=>h.createElement(Se,$t({key:"rectangle-".concat(g?.x,"-").concat(g?.y,"-").concat(g?.value,"-").concat(x),className:"recharts-bar-rectangle"},En(v,g,x),{onMouseEnter:p(g,x),onMouseLeave:y(g,x),onClick:m(g,x)}),s?h.createElement(lD,{shape:u,activeBar:s,baseProps:o,entry:g,index:x,dataKey:l}):h.createElement(cD,{shape:u,baseProps:o,entry:g,index:x,dataKey:l})))):null}function fD(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:u,animationEasing:l,onAnimationEnd:s,onAnimationStart:c}=t,f=r.current,d=Nn(t,"recharts-bar-"),[v,p]=h.useState(!1),y=!v,m=h.useCallback(()=>{typeof s=="function"&&s(),p(!1)},[s]),g=h.useCallback(()=>{typeof c=="function"&&c(),p(!0)},[c]);return h.createElement(uD,{showLabels:y,rects:n},h.createElement(Dn,{animationId:d,begin:o,duration:u,isActive:a,easing:l,onAnimationEnd:m,onAnimationStart:g,key:d},x=>{var w=x===1?n:n?.map((P,b)=>{var O=f&&f[b];if(O)return De(De({},P),{},{x:ne(O.x,P.x,x),y:ne(O.y,P.y,x),width:ne(O.width,P.width,x),height:ne(O.height,P.height,x)});if(i==="horizontal"){var S=ne(0,P.height,x),_=ne(P.stackedBarStart,P.y,x);return De(De({},P),{},{y:_,height:S})}var I=ne(0,P.width,x),M=ne(P.stackedBarStart,P.x,x);return De(De({},P),{},{width:I,x:M})});return x>0&&(r.current=w??null),w==null?null:h.createElement(Se,null,h.createElement(sD,{props:t,data:w}))}),h.createElement(xs,{label:t.label}),t.children)}function dD(e){var t=h.useRef(null);return h.createElement(fD,{previousRectanglesRef:t,props:e})}var T0=0,vD=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:X(e,t)}};class hD extends h.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:a,yAxisId:o,needClip:u,background:l,id:s}=this.props;if(t||r==null)return null;var c=H("recharts-bar",i),f=s;return h.createElement(Se,{className:c,id:s},u&&h.createElement("defs",null,h.createElement(M0,{clipPathId:f,xAxisId:a,yAxisId:o})),h.createElement(Se,{className:"recharts-bar-rectangles",clipPath:u?"url(#clipPath-".concat(f,")"):void 0},h.createElement(oD,{data:r,dataKey:n,background:l,allOtherBarProps:this.props}),h.createElement(dD,this.props)))}}var pD={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:T0,xAxisId:0,yAxisId:0,zIndex:ve.bar};function mD(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:a,activeBar:o,animationBegin:u,animationDuration:l,animationEasing:s,isAnimationActive:c}=e,{needClip:f}=Ms(t,r),d=In(),v=Me(),p=As(e.children,Va),y=T(x=>UD(x,t,r,v,e.id,p));if(d!=="vertical"&&d!=="horizontal")return null;var m,g=y?.[0];return g==null||g.height==null||g.width==null?m=0:m=d==="vertical"?g.height/2:g.width/2,h.createElement(I0,{xAxisId:t,yAxisId:r,data:y,dataPointFormatter:vD,errorBarOffset:m},h.createElement(hD,$t({},e,{layout:d,needClip:f,data:y,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:a,activeBar:o,animationBegin:u,animationDuration:l,animationEasing:s,isAnimationActive:c})))}function yD(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:i,bandSize:a,xAxis:o,yAxis:u,xAxisTicks:l,yAxisTicks:s,stackedData:c,displayedData:f,offset:d,cells:v,parentViewBox:p,dataStartIndex:y}=e,m=t==="horizontal"?u:o,g=c?m.scale.domain():null,x=MP({numericAxis:m}),w=m.scale(x);return f.map((P,b)=>{var O,S,_,I,M,E;c?O=EP(c[b+y],g):(O=X(P,r),Array.isArray(O)||(O=[x,O]));var j=xT(n,T0)(O[1],b);if(t==="horizontal"){var $,[L,z]=[u.scale(O[0]),u.scale(O[1])];S=id({axis:o,ticks:l,bandSize:a,offset:i.offset,entry:P,index:b}),_=($=z??L)!==null&&$!==void 0?$:void 0,I=i.size;var K=L-z;if(M=dt(K)?0:K,E={x:S,y:d.top,width:I,height:d.height},Math.abs(j)>0&&Math.abs(M)0&&Math.abs(I)h.createElement(h.Fragment,null,h.createElement(S0,{legendPayload:iD(t)}),h.createElement(aD,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),h.createElement(k0,{type:"bar",id:n,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:IP(t.stackId),hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r}),h.createElement(We,{zIndex:t.zIndex},h.createElement(mD,$t({},t,{id:n})))))}var bD=h.memo(gD,eo);bD.displayName="Bar";function Wh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vi(e){for(var t=1;tt,AD=(e,t,r)=>r,SD=(e,t,r,n)=>n,ED=(e,t,r,n,i)=>i,Xn=A([Wa,ED],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),_D=A([Xn],e=>e?.maxBarSize),kD=(e,t,r,n,i,a)=>a,Uh=(e,t,r)=>{var n=r??e;if(!ae(n))return Ie(n,t,0)},jD=A([q,Wa,OD,AD,SD],(e,t,r,n,i)=>t.filter(a=>e==="horizontal"?a.xAxisId===r:a.yAxisId===n).filter(a=>a.isPanorama===i).filter(a=>a.hide===!1).filter(a=>a.type==="bar")),CD=(e,t,r,n)=>{var i=q(e);return i==="horizontal"?xl(e,"yAxis",r,n):xl(e,"xAxis",t,n)},ID=(e,t,r)=>{var n=q(e);return n==="horizontal"?zv(e,"xAxis",t):zv(e,"yAxis",r)},MD=(e,t,r)=>{var n={},i=e.filter(Fa),a=e.filter(s=>s.stackId==null),o=i.reduce((s,c)=>(s[c.stackId]||(s[c.stackId]=[]),s[c.stackId].push(c),s),n),u=Object.entries(o).map(s=>{var[c,f]=s,d=f.map(p=>p.dataKey),v=Uh(t,r,f[0].barSize);return{stackId:c,dataKeys:d,barSize:v}}),l=a.map(s=>{var c=[s.dataKey].filter(d=>d!=null),f=Uh(t,r,s.barSize);return{stackId:void 0,dataKeys:c,barSize:f}});return[...u,...l]},TD=A([jD,e_,ID],MD),DD=(e,t,r,n,i)=>{var a,o,u=Xn(e,t,r,n,i);if(u!=null){var l=q(e),s=Zy(e),{maxBarSize:c}=u,f=ae(c)?s:c,d,v;return l==="horizontal"?(d=Vt(e,"xAxis",t,n),v=Gt(e,"xAxis",t,n)):(d=Vt(e,"yAxis",r,n),v=Gt(e,"yAxis",r,n)),(a=(o=Dr(d,v,!0))!==null&&o!==void 0?o:f)!==null&&a!==void 0?a:0}},D0=(e,t,r,n)=>{var i=q(e),a,o;return i==="horizontal"?(a=Vt(e,"xAxis",t,n),o=Gt(e,"xAxis",t,n)):(a=Vt(e,"yAxis",r,n),o=Gt(e,"yAxis",r,n)),Dr(a,o)};function ND(e,t,r,n,i){var a=n.length;if(!(a<1)){var o=Ie(e,r,0,!0),u,l=[];if(se(n[0].barSize)){var s=!1,c=r/a,f=n.reduce((g,x)=>g+(x.barSize||0),0);f+=(a-1)*o,f>=r&&(f-=(a-1)*o,o=0),f>=r&&c>0&&(s=!0,c*=.9,f=a*c);var d=(r-f)/2>>0,v={offset:d-o,size:0};u=n.reduce((g,x)=>{var w,P={stackId:x.stackId,dataKeys:x.dataKeys,position:{offset:v.offset+v.size+o,size:s?c:(w=x.barSize)!==null&&w!==void 0?w:0}},b=[...g,P];return v=b[b.length-1].position,b},l)}else{var p=Ie(t,r,0,!0);r-2*p-(a-1)*o<=0&&(o=0);var y=(r-2*p-(a-1)*o)/a;y>1&&(y>>=0);var m=se(i)?Math.min(y,i):y;u=n.reduce((g,x,w)=>[...g,{stackId:x.stackId,dataKeys:x.dataKeys,position:{offset:p+(y+o)*w+(y-m)/2,size:m}}],l)}return u}}var $D=(e,t,r,n,i,a,o)=>{var u=ae(o)?t:o,l=ND(r,n,i!==a?i:a,e,u);return i!==a&&l!=null&&(l=l.map(s=>vi(vi({},s),{},{position:vi(vi({},s.position),{},{offset:s.position.offset-i/2})}))),l},RD=A([TD,Zy,JE,Qy,DD,D0,_D],$D),LD=(e,t,r,n)=>Vt(e,"xAxis",t,n),zD=(e,t,r,n)=>Vt(e,"yAxis",r,n),BD=(e,t,r,n)=>Gt(e,"xAxis",t,n),FD=(e,t,r,n)=>Gt(e,"yAxis",r,n),KD=A([RD,Xn],(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}}),qD=(e,t)=>{var r=Fc(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:a}=i;if(a)return a.find(o=>o.key===r)}}}},WD=A([CD,Xn],qD),UD=A([ye,rc,LD,zD,BD,FD,KD,q,La,D0,WD,Xn,kD],(e,t,r,n,i,a,o,u,l,s,c,f,d)=>{var{chartData:v,dataStartIndex:p,dataEndIndex:y}=l;if(!(f==null||o==null||t==null||u!=="horizontal"&&u!=="vertical"||r==null||n==null||i==null||a==null||s==null)){var{data:m}=f,g;if(m!=null&&m.length>0?g=m:g=v?.slice(p,y+1),g!=null)return yD({layout:u,barSettings:f,pos:o,parentViewBox:t,bandSize:s,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,stackedData:c,displayedData:g,offset:e,cells:d,dataStartIndex:p})}}),N0=e=>{var{chartData:t}=e,r=ee(),n=Me();return h.useEffect(()=>n?()=>{}:(r(Qv(t)),()=>{r(Qv(void 0))}),[t,r,n]),null},Hh={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},$0=qe({name:"brush",initialState:Hh,reducers:{setBrushSettings(e,t){return t.payload==null?Hh:t.payload}}}),{setBrushSettings:Y$}=$0.actions,HD=$0.reducer;function YD(e,t,r){return(t=GD(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function GD(e){var t=VD(e,"string");return typeof t=="symbol"?t:t+""}function VD(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class Ts{static create(t){return new Ts(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:r,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(n)switch(n){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(t)+a}default:return this.scale(t)}if(r){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o}return this.scale(t)}}isInRange(t){var r=this.range(),n=r[0],i=r[r.length-1];return n<=i?t>=n&&t<=i:t>=i&&t<=n}}YD(Ts,"EPS",1e-4);function XD(e){return(e%180+180)%180}var ZD=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=XD(i),o=a*Math.PI/180,u=Math.atan(n/r),l=o>u&&o{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=ft(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=ft(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=ft(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:G$,removeDot:V$,addArea:X$,removeArea:Z$,addLine:Q$,removeLine:J$}=R0.actions,JD=R0.reducer,eN=h.createContext(void 0),tN=e=>{var{children:t}=e,[r]=h.useState("".concat(cn("recharts"),"-clip")),n=Is();if(n==null)return null;var{x:i,y:a,width:o,height:u}=n;return h.createElement(eN.Provider,{value:r},h.createElement("defs",null,h.createElement("clipPath",{id:r},h.createElement("rect",{x:i,y:a,height:u,width:o}))),t)};function L0(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;ne*i)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-i)<=0}function iN(e,t){return L0(e,t+1)}function aN(e,t,r,n,i){for(var a=(n||[]).slice(),{start:o,end:u}=t,l=0,s=1,c=o,f=function(){var p=n?.[l];if(p===void 0)return{v:L0(n,s)};var y=l,m,g=()=>(m===void 0&&(m=r(p,y)),m),x=p.coordinate,w=l===0||ua(e,x,g,c,u);w||(l=0,c=o,s+=1),w&&(c=x+e*(g()/2+i),l+=s)},d;s<=a.length;)if(d=f(),d)return d.v;return[]}function Yh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function je(e){for(var t=1;t(p===void 0&&(p=r(v,d)),p);if(d===o-1){var m=e*(v.coordinate+e*y()/2-l);a[d]=v=je(je({},v),{},{tickCoord:m>0?v.coordinate-m*e:v.coordinate})}else a[d]=v=je(je({},v),{},{tickCoord:v.coordinate});if(v.tickCoord!=null){var g=ua(e,v.tickCoord,y,u,l);g&&(l=v.tickCoord-e*(y()/2+i),a[d]=je(je({},v),{},{isShow:!0}))}},c=o-1;c>=0;c--)s(c);return a}function sN(e,t,r,n,i,a){var o=(n||[]).slice(),u=o.length,{start:l,end:s}=t;if(a){var c=n[u-1],f=r(c,u-1),d=e*(c.coordinate+e*f/2-s);if(o[u-1]=c=je(je({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate}),c.tickCoord!=null){var v=ua(e,c.tickCoord,()=>f,l,s);v&&(s=c.tickCoord-e*(f/2+i),o[u-1]=je(je({},c),{},{isShow:!0}))}}for(var p=a?u-1:u,y=function(x){var w=o[x],P,b=()=>(P===void 0&&(P=r(w,x)),P);if(x===0){var O=e*(w.coordinate-e*b()/2-l);o[x]=w=je(je({},w),{},{tickCoord:O<0?w.coordinate-O*e:w.coordinate})}else o[x]=w=je(je({},w),{},{tickCoord:w.coordinate});if(w.tickCoord!=null){var S=ua(e,w.tickCoord,b,l,s);S&&(l=w.tickCoord+e*(b()/2+i),o[x]=je(je({},w),{},{isShow:!0}))}},m=0;m{var b=typeof s=="function"?s(w.value,P):w.value;return p==="width"?rN(ln(b,{fontSize:t,letterSpacing:r}),y,f):ln(b,{fontSize:t,letterSpacing:r})[p]},g=i.length>=2?Ae(i[1].coordinate-i[0].coordinate):1,x=nN(a,g,p);return l==="equidistantPreserveStart"?aN(g,x,m,i,o):(l==="preserveStart"||l==="preserveStartEnd"?v=sN(g,x,m,i,o,l==="preserveStartEnd"):v=cN(g,x,m,i,o),v.filter(w=>w.isShow))}var fN=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(c=>{if(c){var f=c.getBoundingClientRect();f.width>o&&(o=f.width)}});var u=r?r.getBoundingClientRect().width:0,l=i+a,s=o+l+u+(r?n:0);return Math.round(s)}return 0},dN=["axisLine","width","height","className","hide","ticks","axisType"];function vN(e,t){if(e==null)return{};var r,n,i=hN(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{ticks:r=[],tick:n,tickLine:i,stroke:a,tickFormatter:o,unit:u,padding:l,tickTextProps:s,orientation:c,mirror:f,x:d,y:v,width:p,height:y,tickSize:m,tickMargin:g,fontSize:x,letterSpacing:w,getTicksConfig:P,events:b,axisType:O}=e,S=Ds(fe(fe({},P),{},{ticks:r}),x,w),_=wN(c,f),I=xN(c,f),M=Ze(P),E=hr(n),j={};typeof i=="object"&&(j=i);var $=fe(fe({},M),{},{fill:"none"},j),L=S.map(B=>fe({entry:B},bN(B,d,v,p,y,c,m,f,g))),z=L.map(B=>{var{entry:W,line:R}=B;return h.createElement(Se,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(W.value,"-").concat(W.coordinate,"-").concat(W.tickCoord)},i&&h.createElement("line",br({},$,R,{className:H("recharts-cartesian-axis-tick-line",pr(i,"className"))})))}),K=L.map((B,W)=>{var{entry:R,tick:ke}=B,Te=fe(fe(fe(fe({textAnchor:_,verticalAnchor:I},M),{},{stroke:"none",fill:a},E),ke),{},{index:W,payload:R,visibleTicksCount:S.length,tickFormatter:o,padding:l},s);return h.createElement(Se,br({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(R.value,"-").concat(R.coordinate,"-").concat(R.tickCoord)},En(b,R,W)),n&&h.createElement(PN,{option:n,tickProps:Te,value:"".concat(typeof o=="function"?o(R.value,W):R.value).concat(u||"")}))});return h.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(O,"-ticks")},K.length>0&&h.createElement(We,{zIndex:ve.label},h.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(O,"-tick-labels"),ref:t},K)),z.length>0&&h.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(O,"-tick-lines")},z))}),AN=h.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:a,hide:o,ticks:u,axisType:l}=e,s=vN(e,dN),[c,f]=h.useState(""),[d,v]=h.useState(""),p=h.useRef(null);h.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var m;return fN({ticks:p.current,label:(m=e.labelRef)===null||m===void 0?void 0:m.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var y=h.useCallback(m=>{if(m){var g=m.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=g;var x=g[0];if(x){var w=window.getComputedStyle(x),P=w.fontSize,b=w.letterSpacing;(P!==c||b!==d)&&(f(P),v(b))}}},[c,d]);return o||n!=null&&n<=0||i!=null&&i<=0?null:h.createElement(We,{zIndex:e.zIndex},h.createElement(Se,{className:H("recharts-cartesian-axis",a)},h.createElement(gN,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Ze(e)}),h.createElement(ON,{ref:y,axisType:l,events:s,fontSize:c,getTicksConfig:e,height:e.height,letterSpacing:d,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:u,unit:e.unit,width:e.width,x:e.x,y:e.y}),h.createElement(GC,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},h.createElement(iI,{label:e.label,labelRef:e.labelRef}),e.children)))}),Ns=h.forwardRef((e,t)=>{var r=pe(e,jt);return h.createElement(AN,br({},r,{ref:t}))});Ns.displayName="CartesianAxis";var SN=["x1","y1","x2","y2","key"],EN=["offset"],_N=["xAxisId","yAxisId"],kN=["xAxisId","yAxisId"];function Vh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:a,height:o,ry:u}=e;return h.createElement("rect",{x:n,y:i,ry:u,width:a,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function z0(e){var{option:t,lineItemProps:r}=e,n;if(h.isValidElement(t))n=h.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:a,y1:o,x2:u,y2:l,key:s}=r,c=la(r,SN),f=(i=Ze(c))!==null&&i!==void 0?i:{},{offset:d}=f,v=la(f,EN);n=h.createElement("line",sr({},v,{x1:a,y1:o,x2:u,y2:l,fill:"none",key:s}))}return n}function DN(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,u=la(e,_N),l=i.map((s,c)=>{var f=Ce(Ce({},u),{},{x1:t,y1:s,x2:t+r,y2:s,key:"line-".concat(c),index:c});return h.createElement(z0,{key:"line-".concat(c),option:n,lineItemProps:f})});return h.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function NN(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,u=la(e,kN),l=i.map((s,c)=>{var f=Ce(Ce({},u),{},{x1:s,y1:t,x2:s,y2:t+r,key:"line-".concat(c),index:c});return h.createElement(z0,{option:n,lineItemProps:f,key:"line-".concat(c)})});return h.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function $N(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:a,height:o,horizontalPoints:u,horizontal:l=!0}=e;if(!l||!t||!t.length||u==null)return null;var s=u.map(f=>Math.round(f+i-i)).sort((f,d)=>f-d);i!==s[0]&&s.unshift(0);var c=s.map((f,d)=>{var v=!s[d+1],p=v?i+o-f:s[d+1]-f;if(p<=0)return null;var y=d%t.length;return h.createElement("rect",{key:"react-".concat(d),y:f,x:n,height:p,width:a,stroke:"none",fill:t[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function RN(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:a,width:o,height:u,verticalPoints:l}=e;if(!t||!r||!r.length)return null;var s=l.map(f=>Math.round(f+i-i)).sort((f,d)=>f-d);i!==s[0]&&s.unshift(0);var c=s.map((f,d)=>{var v=!s[d+1],p=v?i+o-f:s[d+1]-f;if(p<=0)return null;var y=d%r.length;return h.createElement("rect",{key:"react-".concat(d),x:f,y:a,width:p,height:u,stroke:"none",fill:r[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var LN=(e,t)=>{var{xAxis:r,width:n,height:i,offset:a}=e;return Am(Ds(Ce(Ce(Ce({},jt),r),{},{ticks:Sm(r),viewBox:{x:0,y:0,width:n,height:i}})),a.left,a.left+a.width,t)},zN=(e,t)=>{var{yAxis:r,width:n,height:i,offset:a}=e;return Am(Ds(Ce(Ce(Ce({},jt),r),{},{ticks:Sm(r),viewBox:{x:0,y:0,width:n,height:i}})),a.top,a.top+a.height,t)},BN={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:ve.grid};function FN(e){var t=ic(),r=ac(),n=Tm(),i=Ce(Ce({},pe(e,BN)),{},{x:N(e.x)?e.x:n.left,y:N(e.y)?e.y:n.top,width:N(e.width)?e.width:n.width,height:N(e.height)?e.height:n.height}),{xAxisId:a,yAxisId:o,x:u,y:l,width:s,height:c,syncWithTicks:f,horizontalValues:d,verticalValues:v}=i,p=Me(),y=T(I=>Bv(I,"xAxis",a,p)),m=T(I=>Bv(I,"yAxis",o,p));if(!wt(s)||!wt(c)||!N(u)||!N(l))return null;var g=i.verticalCoordinatesGenerator||LN,x=i.horizontalCoordinatesGenerator||zN,{horizontalPoints:w,verticalPoints:P}=i;if((!w||!w.length)&&typeof x=="function"){var b=d&&d.length,O=x({yAxis:m?Ce(Ce({},m),{},{ticks:b?d:m.ticks}):void 0,width:t??s,height:r??c,offset:n},b?!0:f);Di(Array.isArray(O),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof O,"]")),Array.isArray(O)&&(w=O)}if((!P||!P.length)&&typeof g=="function"){var S=v&&v.length,_=g({xAxis:y?Ce(Ce({},y),{},{ticks:S?v:y.ticks}):void 0,width:t??s,height:r??c,offset:n},S?!0:f);Di(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(P=_)}return h.createElement(We,{zIndex:i.zIndex},h.createElement("g",{className:"recharts-cartesian-grid"},h.createElement(TN,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),h.createElement($N,sr({},i,{horizontalPoints:w})),h.createElement(RN,sr({},i,{verticalPoints:P})),h.createElement(DN,sr({},i,{offset:n,horizontalPoints:w,xAxis:y,yAxis:m})),h.createElement(NN,sr({},i,{offset:n,verticalPoints:P,xAxis:y,yAxis:m}))))}FN.displayName="CartesianGrid";var B0=(e,t,r,n)=>Vt(e,"xAxis",t,n),F0=(e,t,r,n)=>Gt(e,"xAxis",t,n),K0=(e,t,r,n)=>Vt(e,"yAxis",r,n),q0=(e,t,r,n)=>Gt(e,"yAxis",r,n),KN=A([q,B0,K0,F0,q0],(e,t,r,n,i)=>Jt(e,"xAxis")?Dr(t,n,!1):Dr(r,i,!1)),qN=(e,t,r,n,i)=>i;function WN(e){return e.type==="line"}var UN=A([Wa,qN],(e,t)=>e.filter(WN).find(r=>r.id===t)),HN=A([q,B0,K0,F0,q0,UN,KN,La],(e,t,r,n,i,a,o,u)=>{var{chartData:l,dataStartIndex:s,dataEndIndex:c}=u;if(!(a==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||o==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:f,data:d}=a,v;if(d!=null&&d.length>0?v=d:v=l?.slice(s,c+1),v!=null)return v2({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:f,bandSize:o,displayedData:v})}});function YN(e){var t=hr(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),u=Number(a);return(Number.isNaN(o)||o<0)&&(o=r),(Number.isNaN(u)||u<0)&&(u=n),{r:o,strokeWidth:u}}return{r,strokeWidth:n}}var GN=["id"],VN=["type","layout","connectNulls","needClip","shape"],XN=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var{dataKey:t,name:r,stroke:n,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:n,value:Br(r,t),payload:e}]},r2=h.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:a,name:o,hide:u,unit:l,tooltipType:s}=e,c={dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Br(o,t),hide:u,type:s,color:n,unit:l}};return h.createElement(js,{tooltipEntrySettings:c})}),W0=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function n2(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i{var n=r.reduce((f,d)=>f+d);if(!n)return W0(t,e);for(var i=Math.floor(e/n),a=e%n,o=t-e,u=[],l=0,s=0;la){u=[...r.slice(0,l),a-s];break}var c=u.length%2===0?[0,o]:[o];return[...n2(r,i),...u,...c].map(f=>"".concat(f,"px")).join(", ")};function a2(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:a,needClip:o}=n,{id:u}=n,l=$s(n,GN),s=Ze(l);return h.createElement(YM,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:s,needClip:o,clipPathId:t})}function o2(e){var{showLabels:t,children:r,points:n}=e,i=h.useMemo(()=>n?.map(a=>{var o,u,l={x:(o=a.x)!==null&&o!==void 0?o:0,y:(u=a.y)!==null&&u!==void 0?u:0,width:0,lowerWidth:0,upperWidth:0,height:0};return mt(mt({},l),{},{value:a.value,payload:a.payload,viewBox:l,parentViewBox:void 0,fill:void 0})}),[n]);return h.createElement(m0,{value:t?i:void 0},r)}function Zh(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:a}=e,{type:o,layout:u,connectNulls:l,needClip:s,shape:c}=a,f=$s(a,VN),d=mt(mt({},$e(f)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(t,")"):void 0,points:n,type:o,layout:u,connectNulls:l,strokeDasharray:i??a.strokeDasharray});return h.createElement(h.Fragment,null,n?.length>1&&h.createElement(Ss,On({shapeType:"curve",option:c},d,{pathRef:r})),h.createElement(a2,{points:n,clipPathId:t,props:a}))}function u2(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function l2(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:u,isAnimationActive:l,animationBegin:s,animationDuration:c,animationEasing:f,animateNewValues:d,width:v,height:p,onAnimationEnd:y,onAnimationStart:m}=r,g=i.current,x=Nn(o,"recharts-line-"),w=h.useRef(x),[P,b]=h.useState(!1),O=!P,S=h.useCallback(()=>{typeof y=="function"&&y(),b(!1)},[y]),_=h.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]),I=u2(n.current),M=h.useRef(0);w.current!==x&&(M.current=a.current,w.current=x);var E=M.current;return h.createElement(o2,{points:o,showLabels:O},r.children,h.createElement(Dn,{animationId:x,begin:s,duration:c,isActive:l,easing:f,onAnimationEnd:S,onAnimationStart:_,key:x},j=>{var $=ne(E,I+E,j),L=Math.min($,I),z;if(l)if(u){var K="".concat(u).split(/[,\s]+/gim).map(R=>parseFloat(R));z=i2(L,I,K)}else z=W0(I,L);else z=u==null?void 0:String(u);if(j>0&&I>0&&(i.current=o,a.current=Math.max(a.current,L)),g){var B=g.length/o.length,W=j===1?o:o.map((R,ke)=>{var Te=Math.floor(ke*B);if(g[Te]){var Le=g[Te];return mt(mt({},R),{},{x:ne(Le.x,R.x,j),y:ne(Le.y,R.y,j)})}return d?mt(mt({},R),{},{x:ne(v*2,R.x,j),y:ne(p/2,R.y,j)}):mt(mt({},R),{},{x:R.x,y:R.y})});return i.current=W,h.createElement(Zh,{props:r,points:W,clipPathId:t,pathRef:n,strokeDasharray:z})}return h.createElement(Zh,{props:r,points:o,clipPathId:t,pathRef:n,strokeDasharray:z})}),h.createElement(xs,{label:r.label}))}function c2(e){var{clipPathId:t,props:r}=e,n=h.useRef(null),i=h.useRef(0),a=h.useRef(null);return h.createElement(l2,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:a})}var s2=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:X(e.payload,t)}};class f2 extends h.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:a,yAxisId:o,top:u,left:l,width:s,height:c,id:f,needClip:d,zIndex:v}=this.props;if(t)return null;var p=H("recharts-line",i),y=f,{r:m,strokeWidth:g}=YN(r),x=A0(r),w=m*2+g,P=d?"url(#clipPath-".concat(x?"":"dots-").concat(y,")"):void 0;return h.createElement(We,{zIndex:v},h.createElement(Se,{className:p},d&&h.createElement("defs",null,h.createElement(M0,{clipPathId:y,xAxisId:a,yAxisId:o}),!x&&h.createElement("clipPath",{id:"clipPath-dots-".concat(y)},h.createElement("rect",{x:l-w/2,y:u-w/2,width:s+w,height:c+w}))),h.createElement(I0,{xAxisId:a,yAxisId:o,data:n,dataPointFormatter:s2,errorBarOffset:0},h.createElement(c2,{props:this.props,clipPathId:y}))),h.createElement(vT,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:P}))}}var U0={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:ve.line,type:"linear"};function d2(e){var t=pe(e,U0),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:u,dot:l,hide:s,isAnimationActive:c,label:f,legendType:d,xAxisId:v,yAxisId:p,id:y}=t,m=$s(t,XN),{needClip:g}=Ms(v,p),x=Is(),w=In(),P=Me(),b=T(M=>HN(M,v,p,P,y));if(w!=="horizontal"&&w!=="vertical"||b==null||x==null)return null;var{height:O,width:S,x:_,y:I}=x;return h.createElement(f2,On({},m,{id:y,connectNulls:u,dot:l,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:c,hide:s,label:f,legendType:d,xAxisId:v,yAxisId:p,points:b,layout:w,height:O,width:S,left:_,top:I,needClip:g}))}function v2(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:u,displayedData:l}=e;return l.map((s,c)=>{var f=X(s,o);if(t==="horizontal"){var d=nd({axis:r,ticks:i,bandSize:u,entry:s,index:c}),v=ae(f)?null:n.scale(f);return{x:d,y:v,value:f,payload:s}}var p=ae(f)?null:r.scale(f),y=nd({axis:n,ticks:a,bandSize:u,entry:s,index:c});return p==null||y==null?null:{x:p,y,value:f,payload:s}}).filter(Boolean)}function h2(e){var t=pe(e,U0),r=Me();return h.createElement(Cs,{id:t.id,type:"line"},n=>h.createElement(h.Fragment,null,h.createElement(S0,{legendPayload:t2(t)}),h.createElement(r2,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),h.createElement(k0,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),h.createElement(d2,On({},t,{id:n}))))}var p2=h.memo(h2,eo);p2.displayName="Line";var m2=["domain","range"],y2=["domain","range"];function Qh(e,t){if(e==null)return{};var r,n,i=g2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{r.current===null?t(QM(e)):r.current!==e&&t(JM({prev:r.current,next:e})),r.current=e},[e,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(eT(r.current)),r.current=null)},[t]),null}var O2=e=>{var{xAxisId:t,className:r}=e,n=T(rc),i=Me(),a="xAxis",o=T(m=>Yr(m,a,t,i)),u=T(m=>Cg(m,a,t,i)),l=T(m=>Eg(m,t)),s=T(m=>Z_(m,t)),c=T(m=>ug(m,t));if(l==null||s==null||c==null)return null;var{dangerouslySetInnerHTML:f,ticks:d}=e,v=ep(e,b2),{id:p}=c,y=ep(c,w2);return h.createElement(Ns,Cl({},v,y,{scale:o,x:s.x,y:s.y,width:l.width,height:l.height,className:H("recharts-".concat(a," ").concat(a),r),viewBox:n,ticks:u,axisType:a}))},A2={allowDataOverflow:xe.allowDataOverflow,allowDecimals:xe.allowDecimals,allowDuplicatedCategory:xe.allowDuplicatedCategory,angle:xe.angle,axisLine:jt.axisLine,height:xe.height,hide:!1,includeHidden:xe.includeHidden,interval:xe.interval,minTickGap:xe.minTickGap,mirror:xe.mirror,orientation:xe.orientation,padding:xe.padding,reversed:xe.reversed,scale:xe.scale,tick:xe.tick,tickCount:xe.tickCount,tickLine:jt.tickLine,tickSize:jt.tickSize,type:xe.type,xAxisId:0},S2=e=>{var t=pe(e,A2);return h.createElement(h.Fragment,null,h.createElement(P2,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),h.createElement(O2,t))},E2=h.memo(S2,H0);E2.displayName="XAxis";var _2=["dangerouslySetInnerHTML","ticks"],k2=["id"];function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t{r.current===null?t(tT(e)):r.current!==e&&t(rT({prev:r.current,next:e})),r.current=e},[e,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(nT(r.current)),r.current=null)},[t]),null}var I2=e=>{var{yAxisId:t,className:r,width:n,label:i}=e,a=h.useRef(null),o=h.useRef(null),u=T(rc),l=Me(),s=ee(),c="yAxis",f=T(b=>Yr(b,c,t,l)),d=T(b=>_g(b,t)),v=T(b=>J_(b,t)),p=T(b=>Cg(b,c,t,l)),y=T(b=>lg(b,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!d||ws(i)||h.isValidElement(i)||y==null)){var b=a.current;if(b){var O=b.getCalculatedWidth();Math.round(d.width)!==Math.round(O)&&s(iT({id:t,width:O}))}}},[p,d,s,i,t,n,y]),d==null||v==null||y==null)return null;var{dangerouslySetInnerHTML:m,ticks:g}=e,x=tp(e,_2),{id:w}=y,P=tp(y,k2);return h.createElement(Ns,Il({},x,P,{ref:a,labelRef:o,scale:f,x:v.x,y:v.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:d.width,height:d.height,className:H("recharts-".concat(c," ").concat(c),r),viewBox:u,ticks:p,axisType:c}))},M2={allowDataOverflow:Pe.allowDataOverflow,allowDecimals:Pe.allowDecimals,allowDuplicatedCategory:Pe.allowDuplicatedCategory,angle:Pe.angle,axisLine:jt.axisLine,hide:!1,includeHidden:Pe.includeHidden,interval:Pe.interval,minTickGap:Pe.minTickGap,mirror:Pe.mirror,orientation:Pe.orientation,padding:Pe.padding,reversed:Pe.reversed,scale:Pe.scale,tick:Pe.tick,tickCount:Pe.tickCount,tickLine:jt.tickLine,tickSize:jt.tickSize,type:Pe.type,width:Pe.width,yAxisId:0},T2=e=>{var t=pe(e,M2);return h.createElement(h.Fragment,null,h.createElement(C2,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),h.createElement(I2,t))},D2=h.memo(T2,H0);D2.displayName="YAxis";var N2=(e,t)=>t,Rs=A([N2,q,ag,be,Hg,Kt,pj,ye],Pj),Ls=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},Y0=at("mouseClick"),G0=jn();G0.startListening({actionCreator:Y0,effect:(e,t)=>{var r=e.payload,n=Rs(t.getState(),Ls(r));n?.activeIndex!=null&&t.dispatch(vk({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Ml=at("mouseMove"),V0=jn(),hi=null;V0.startListening({actionCreator:Ml,effect:(e,t)=>{var r=e.payload;hi!==null&&cancelAnimationFrame(hi);var n=Ls(r);hi=requestAnimationFrame(()=>{var i=t.getState(),a=ls(i,i.tooltip.settings.shared);if(a==="axis"){var o=Rs(i,n);o?.activeIndex!=null?t.dispatch(Lg({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(Rg())}hi=null})}});var rp={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},X0=qe({name:"rootProps",initialState:rp,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:rp.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),$2=X0.reducer,{updateOptions:R2}=X0.actions,Z0=qe({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:L2}=Z0.actions,z2=Z0.reducer,Q0=at("keyDown"),J0=at("focus"),zs=jn();zs.startListening({actionCreator:Q0,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip,a=e.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var o=cs(i,Vr(r),Wn(r),Gn(r)),u=o==null?-1:Number(o);if(!(!Number.isFinite(u)||u<0)){var l=Kt(r);if(a==="Enter"){var s=ea(r,"axis","hover",String(i.index));t.dispatch(Ol({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:s}));return}var c=nk(r),f=c==="left-to-right"?1:-1,d=a==="ArrowRight"?1:-1,v=u+d*f;if(!(l==null||v>=l.length||v<0)){var p=ea(r,"axis","hover",String(v));t.dispatch(Ol({active:!0,activeIndex:v.toString(),activeDataKey:void 0,activeCoordinate:p}))}}}}}});zs.startListening({actionCreator:J0,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var a="0",o=ea(r,"axis","hover",String(a));t.dispatch(Ol({activeDataKey:void 0,active:!0,activeIndex:a,activeCoordinate:o}))}}}});var rt=at("externalEvent"),eb=jn(),Mu=new Map;eb.startListening({actionCreator:rt,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var i=n.type,a=Mu.get(i);a!==void 0&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var u=t.getState(),l={activeCoordinate:Jk(u),activeDataKey:hs(u),activeIndex:Xt(u),activeLabel:Vg(u),activeTooltipIndex:Xt(u),isTooltipActive:ej(u)};r(l,n)}finally{Mu.delete(i)}});Mu.set(i,o)}}});var B2=A([Gr],e=>e.tooltipItemPayloads),F2=A([B2,Hn,(e,t,r)=>t,(e,t,r)=>r],(e,t,r,n)=>{var i=e.find(u=>u.settings.dataKey===n);if(i!=null){var{positions:a}=i;if(a!=null){var o=t(a,r);return o}}}),tb=at("touchMove"),rb=jn();rb.startListening({actionCreator:tb,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),i=ls(n,n.tooltip.settings.shared);if(i==="axis"){var a=Rs(n,Ls({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY,currentTarget:r.currentTarget}));a?.activeIndex!=null&&t.dispatch(Lg({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if(i==="item"){var o,u=r.touches[0];if(document.elementFromPoint==null)return;var l=document.elementFromPoint(u.clientX,u.clientY);if(!l||!l.getAttribute)return;var s=l.getAttribute(_m),c=(o=l.getAttribute(km))!==null&&o!==void 0?o:void 0,f=F2(t.getState(),s,c);t.dispatch($g({activeDataKey:c,activeIndex:s,activeCoordinate:f}))}}}});var K2=Vp({brush:HD,cartesianAxis:aT,chartData:Jj,errorBars:OT,graphicalItems:sM,layout:wP,legend:kO,options:Gj,polarAxis:SI,polarOptions:z2,referenceElements:JD,rootProps:$2,tooltip:hk,zIndex:$j}),q2=function(t){return Ux({reducer:K2,preloadedState:t,middleware:r=>{var n;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((n="es6")!==null&&n!==void 0?n:"")}).concat([G0.middleware,V0.middleware,zs.middleware,eb.middleware,rb.middleware])},enhancers:r=>{var n=r;return typeof r=="function"&&(n=r()),n.concat(sm({type:"raf"}))},devTools:Tn.devToolsEnabled})};function nb(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=Me(),a=h.useRef(null);if(i)return r;a.current==null&&(a.current=q2(t));var o=Yl;return h.createElement(YT,{context:o,store:a.current},r)}function W2(e){var{layout:t,margin:r}=e,n=ee(),i=Me();return h.useEffect(()=>{i||(n(yP(t)),n(mP(r)))},[n,i,t,r]),null}var ib=h.memo(W2,eo);function ab(e){var t=ee();return h.useEffect(()=>{t(R2(e))},[t,e]),null}function np(e){var{zIndex:t,isPanorama:r}=e,n=r?"recharts-zindex-panorama-":"recharts-zindex-",i=E0("".concat(n).concat(t)),a=ee();return h.useLayoutEffect(()=>(a(Dj({zIndex:t,elementId:i,isPanorama:r})),()=>{a(Nj({zIndex:t,isPanorama:r}))}),[a,t,i,r]),h.createElement("g",{tabIndex:-1,id:i})}function ip(e){var{children:t,isPanorama:r}=e,n=T(Aj);if(!n||n.length===0)return t;var i=n.filter(o=>o<0),a=n.filter(o=>o>0);return h.createElement(h.Fragment,null,i.map(o=>h.createElement(np,{key:o,zIndex:o,isPanorama:r})),t,a.map(o=>h.createElement(np,{key:o,zIndex:o,isPanorama:r})))}var U2=["children"];function H2(e,t){if(e==null)return{};var r,n,i=Y2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var r=ic(),n=ac(),i=Wm();if(!wt(r)||!wt(n))return null;var{children:a,otherAttributes:o,title:u,desc:l}=e,s,c;return o!=null&&(typeof o.tabIndex=="number"?s=o.tabIndex:s=i?0:void 0,typeof o.role=="string"?c=o.role:c=i?"application":void 0),h.createElement(Rl,ca({},o,{title:u,desc:l,role:c,tabIndex:s,width:r,height:n,style:G2,ref:t}),a)}),X2=e=>{var{children:t}=e,r=T(Ea);if(!r)return null;var{width:n,height:i,y:a,x:o}=r;return h.createElement(Rl,{width:n,height:i,x:o,y:a},t)},ap=h.forwardRef((e,t)=>{var{children:r}=e,n=H2(e,U2),i=Me();return i?h.createElement(X2,null,h.createElement(ip,{isPanorama:!0},r)):h.createElement(V2,ca({ref:t},n),h.createElement(ip,{isPanorama:!1},r))});function Z2(){var e=ee(),[t,r]=h.useState(null),n=T(LP);return h.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),a=i.width/t.offsetWidth;se(a)&&a!==n&&e(bP(a))}},[t,e,n]),r}function op(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Q2(e){for(var t=1;t(lC(),null);function sa(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var n$=h.forwardRef((e,t)=>{var r,n,i=h.useRef(null),[a,o]=h.useState({containerWidth:sa((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:sa((n=e.style)===null||n===void 0?void 0:n.height)}),u=h.useCallback((s,c)=>{o(f=>{var d=Math.round(s),v=Math.round(c);return f.containerWidth===d&&f.containerHeight===v?f:{containerWidth:d,containerHeight:v}})},[]),l=h.useCallback(s=>{if(typeof t=="function"&&t(s),s!=null&&typeof ResizeObserver<"u"){var{width:c,height:f}=s.getBoundingClientRect();u(c,f);var d=p=>{var{width:y,height:m}=p[0].contentRect;u(y,m)},v=new ResizeObserver(d);v.observe(s),i.current=v}},[t,u]);return h.useEffect(()=>()=>{var s=i.current;s?.disconnect()},[u]),h.createElement(h.Fragment,null,h.createElement(ka,{width:a.containerWidth,height:a.containerHeight}),h.createElement("div",wr({ref:l},e)))}),i$=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,a]=h.useState({containerWidth:sa(r),containerHeight:sa(n)}),o=h.useCallback((l,s)=>{a(c=>{var f=Math.round(l),d=Math.round(s);return c.containerWidth===f&&c.containerHeight===d?c:{containerWidth:f,containerHeight:d}})},[]),u=h.useCallback(l=>{if(typeof t=="function"&&t(l),l!=null){var{width:s,height:c}=l.getBoundingClientRect();o(s,c)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(ka,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",wr({ref:u},e)))}),a$=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(ka,{width:r,height:n}),h.createElement("div",wr({ref:t},e)))}),o$=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return Ct(r)||Ct(n)?h.createElement(i$,wr({},e,{ref:t})):h.createElement(a$,wr({},e,{ref:t}))});function u$(e){return e===!0?n$:o$}var l$=h.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:a,onContextMenu:o,onDoubleClick:u,onMouseDown:l,onMouseEnter:s,onMouseLeave:c,onMouseMove:f,onMouseUp:d,onTouchEnd:v,onTouchMove:p,onTouchStart:y,style:m,width:g,responsive:x,dispatchTouchEvents:w=!0}=e,P=h.useRef(null),b=ee(),[O,S]=h.useState(null),[_,I]=h.useState(null),M=Z2(),E=nc(),j=E?.width>0?E.width:g,$=E?.height>0?E.height:i,L=h.useCallback(k=>{M(k),typeof t=="function"&&t(k),S(k),I(k),k!=null&&(P.current=k)},[M,t,S,I]),z=h.useCallback(k=>{b(Y0(k)),b(rt({handler:a,reactEvent:k}))},[b,a]),K=h.useCallback(k=>{b(Ml(k)),b(rt({handler:s,reactEvent:k}))},[b,s]),B=h.useCallback(k=>{b(Rg()),b(rt({handler:c,reactEvent:k}))},[b,c]),W=h.useCallback(k=>{b(Ml(k)),b(rt({handler:f,reactEvent:k}))},[b,f]),R=h.useCallback(()=>{b(J0())},[b]),ke=h.useCallback(k=>{b(Q0(k.key))},[b]),Te=h.useCallback(k=>{b(rt({handler:o,reactEvent:k}))},[b,o]),Le=h.useCallback(k=>{b(rt({handler:u,reactEvent:k}))},[b,u]),Pt=h.useCallback(k=>{b(rt({handler:l,reactEvent:k}))},[b,l]),Je=h.useCallback(k=>{b(rt({handler:d,reactEvent:k}))},[b,d]),nr=h.useCallback(k=>{b(rt({handler:y,reactEvent:k}))},[b,y]),Xr=h.useCallback(k=>{w&&b(tb(k)),b(rt({handler:p,reactEvent:k}))},[b,w,p]),ze=h.useCallback(k=>{b(rt({handler:v,reactEvent:k}))},[b,v]),to=u$(x);return h.createElement(r0.Provider,{value:O},h.createElement(fp.Provider,{value:_},h.createElement(to,{width:j??m?.width,height:$??m?.height,className:H("recharts-wrapper",n),style:Q2({position:"relative",cursor:"default",width:j,height:$},m),onClick:z,onContextMenu:Te,onDoubleClick:Le,onFocus:R,onKeyDown:ke,onMouseDown:Pt,onMouseEnter:K,onMouseLeave:B,onMouseMove:W,onMouseUp:Je,onTouchEnd:ze,onTouchMove:Xr,onTouchStart:nr,ref:L},h.createElement(r$,null),r)))}),c$=["width","height","responsive","children","className","style","compact","title","desc"];function s$(e,t){if(e==null)return{};var r,n,i=f$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n{var{width:r,height:n,responsive:i,children:a,className:o,style:u,compact:l,title:s,desc:c}=e,f=s$(e,c$),d=Ze(f);return l?h.createElement(h.Fragment,null,h.createElement(ka,{width:r,height:n}),h.createElement(ap,{otherAttributes:d,title:s,desc:c},a)):h.createElement(l$,{className:o,style:u,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(ap,{otherAttributes:d,title:s,desc:c,ref:t},h.createElement(tN,null,a)))});function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;th.createElement(ub,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:h$,tooltipPayloadSearcher:bs,categoricalChartProps:e,ref:t})),p$=["axis","item"],tR=h.forwardRef((e,t)=>h.createElement(ub,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:p$,tooltipPayloadSearcher:bs,categoricalChartProps:e,ref:t}));function m$(e){var t=ee();return h.useEffect(()=>{t(L2(e))},[t,e]),null}var y$=["layout"];function Dl(){return Dl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=pe(e,E$);return h.createElement(x$,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:S$,tooltipPayloadSearcher:bs,categoricalChartProps:r,ref:t})});export{tR as B,FN as C,KO as L,rR as P,I$ as R,$$ as T,E2 as X,D2 as Y,ov as a,HA as b,bn as c,T$ as d,M$ as e,D$ as f,eR as g,p2 as h,pt as i,bD as j,LM as k,Va as l}; diff --git a/webui/dist/assets/codemirror-TZqPU532.js b/webui/dist/assets/codemirror-TZqPU532.js deleted file mode 100644 index cfe8cb2f..00000000 --- a/webui/dist/assets/codemirror-TZqPU532.js +++ /dev/null @@ -1,16 +0,0 @@ -import{r as Se,j as zu}from"./router-9vIXuQkh.js";function xr(){return xr=Object.assign?Object.assign.bind():function(n){for(var e=1;e{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=bh[i])e=i+1;else return!0;if(e==t)return!1}}function hl(n){return n>=127462&&n<=127487}const cl=8205;function Nu(n,e,t=!0,i=!0){return(t?Sh:Xu)(n,e,i)}function Sh(n,e,t){if(e==n.length)return e;e&&xh(n.charCodeAt(e))&&kh(n.charCodeAt(e-1))&&e--;let i=zs(n,e);for(e+=fl(i);e=0&&hl(zs(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Xu(n,e,t){for(;e>0;){let i=Sh(n,e-2,t);if(i=56320&&n<57344}function kh(n){return n>=55296&&n<56320}function fl(n){return n<65536?1:2}class V{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),Ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new Ai(this),r=new Ai(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new Ai(this,e)}iterRange(e,t=this.length){return new wh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new vh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new K(e):Ze.from(K.split(e,[]))}}class K extends V{constructor(e,t=Fu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new _u(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new K(ul(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Xn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new K(l,o.length+r.length));else{let a=l.length>>1;i.push(new K(l.slice(0,a)),new K(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof K))return super.replace(e,t,i);[e,t]=li(this,e,t);let s=Xn(this.text,Xn(i.text,ul(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new K(s,r):Ze.from(K.split(s,[]),r)}sliceString(e,t=this.length,i=` -`){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new K(i,s)),i=[],s=-1);return s>-1&&t.push(new K(i,s)),t}}class Ze extends V{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Ze(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){[e,t]=li(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ze))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new K(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ze)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof K&&a&&(p=c[c.length-1])instanceof K&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new K(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ze.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ze(l,t)}}V.empty=new K([""],0);function Fu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Xn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof K?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof K?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof K){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof K?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class wh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ai(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class vh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},Ai.prototype[Symbol.iterator]=wh.prototype[Symbol.iterator]=vh.prototype[Symbol.iterator]=function(){return this});class _u{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function pe(n,e,t=!0,i=!0){return Nu(n,e,t,i)}function Uu(n){return n>=56320&&n<57344}function Hu(n){return n>=55296&&n<56320}function Te(n,e){let t=n.charCodeAt(e);if(!Hu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Uu(i)?(t-55296<<10)+(i-56320)+65536:t}function So(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ye(n){return n<65536?1:2}const wr=/\r\n?|\n/;var de=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(de||(de={}));class it{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=de.Simple&&h>=e&&(i==de.TrackDel&&se||i==de.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new it(e)}static create(e){return new it(e)}}class se extends it{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return vr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Tr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&&kt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?V.of(d.split(i||wr)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&Oe(s,f-o,-1),Oe(s,u-f,m),kt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new se(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function kt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function Tr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Bi(n),l=new Bi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Oe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Bi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Wt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Wt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new Wt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Wt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Ch(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let xo=0;class A{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=xo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new A(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:ko),!!e.static,e.enables)}of(e){return new Fn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function ko(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Fn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=xo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Cr(f,c)){let d=i(f);if(l?!dl(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=ns(u,p);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===f.facet(g):g instanceof he?u.field(g,!1)==f.field(g,!1):!0)||(l?dl(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function dl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(On).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(On),o=s.facet(On),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,On.of({field:this,create:e})]}get extension(){return this}}const $t={lowest:4,low:3,default:2,high:1,highest:0};function Si(n){return e=>new Ph(e,n)}const Mt={highest:Si($t.highest),high:Si($t.high),default:Si($t.default),low:Si($t.low),lowest:Si($t.lowest)};class Ph{constructor(e,t){this.inner=e,this.prec=t}}class vs{of(e){return new Pr(this,e)}reconfigure(e){return vs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Pr{constructor(e,t){this.compartment=e,this.inner=t}}class is{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Gu(e,t,o))u instanceof he?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,ko(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>ju(g,p,d))}}let f=h.map(u=>u(l));return new is(e,o,f,l,a,r)}}function Gu(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Pr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Pr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ph)r(o.inner,o.prec);else if(o instanceof he)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Fn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,$t.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,$t.default),i.reduce((o,l)=>o.concat(l))}function Mi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function ns(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Qh=A.define(),Qr=A.define({combine:n=>n.some(e=>e),static:!0}),Ah=A.define({combine:n=>n.length?n[0]:void 0,static:!0}),Mh=A.define(),Rh=A.define(),Dh=A.define(),Eh=A.define({combine:n=>n.length?n[0]:!1});class st{constructor(e,t){this.type=e,this.value=t}static define(){return new Zu}}class Zu{of(e){return new st(this,e)}}class Yu{constructor(e){this.map=e}of(e){return new q(this,e)}}class q{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new q(this.type,t)}is(e){return this.type==e}static define(e={}){return new Yu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}q.reconfigure=q.define();q.appendConfig=q.define();class ie{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Ch(i,t.newLength),r.some(l=>l.type==ie.time)||(this.annotations=r.concat(ie.time.of(Date.now())))}static create(e,t,i,s,r,o){return new ie(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=st.define();ie.userEvent=st.define();ie.addToHistory=st.define();ie.remote=st.define();function Ku(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof ie?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof ie?n=r[0]:n=$h(e,ti(r),!1)}return n}function ed(n){let e=n.startState,t=e.facet(Dh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=qh(i,Ar(e,r,n.changes.newLength),!0))}return i==n?n:ie.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const td=[];function ti(n){return n==null?td:Array.isArray(n)?n:[n]}var Y=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Y||(Y={}));const id=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Mr;try{Mr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function nd(n){if(Mr)return Mr.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||id.test(t)))return!0}return!1}function sd(n){return e=>{if(!/\S/.test(e))return Y.Space;if(nd(e))return Y.Word;for(let t=0;t-1)return Y.Word;return Y.Other}}class I{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(q.reconfigure)?(t=null,i=l.value):l.is(q.appendConfig)&&(t=null,i=ti(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=is.resolve(i,s,this),r=new I(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Qr)?e.newSelection:e.newSelection.asSingle();new I(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=ti(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return I.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=is.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(I.lineSeparator)||wr)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Ch(s,i.length),t.staticFacet(Qr)||(s=s.asSingle()),new I(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(I.tabSize)}get lineBreak(){return this.facet(I.lineSeparator)||` -`}get readOnly(){return this.facet(Eh)}phrase(e,...t){for(let i of this.facet(I.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Qh))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return sd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=pe(t,o,!1);if(r(t.slice(a,o))!=Y.Word)break;o=a}for(;ln.length?n[0]:4});I.lineSeparator=Ah;I.readOnly=Eh;I.phrases=A.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});I.languageData=Qh;I.changeFilter=Mh;I.transactionFilter=Rh;I.transactionExtender=Dh;vs.reconfigure=q.define();function rt(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class Nt{eq(e){return this==e}range(e,t=e){return Rr.create(e,t,this)}}Nt.prototype.startSide=Nt.prototype.endSide=0;Nt.prototype.point=!1;Nt.prototype.mapMode=de.TrackDel;let Rr=class Bh{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Bh(e,t,i)}};function Dr(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class wo{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new wo(s,r,i,l):null,pos:o}}}class N{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new N(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Dr)),this.isEmpty)return t.length?N.of(t):this;let l=new Wh(this,null,-1).goto(0),a=0,h=[],c=new gt;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Wi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Wi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=pl(o,l,i),h=new xi(o,a,r),c=new xi(l,a,r);i.iterGaps((f,u,d)=>ml(h,f,c,u,d,s)),i.empty&&i.length==0&&ml(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=pl(r,o),a=new xi(r,l,0).goto(i),h=new xi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Er(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new xi(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new gt;for(let s of e instanceof Rr?[e]:t?rd(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return N.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=N.empty;s=s.nextLayer)t=new N(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}N.empty=new N([],[],null,-1);function rd(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Dr);e=i}return n}N.empty.nextLayer=N.empty;class gt{finishChunk(e){this.chunks.push(new wo(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new gt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(N.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=N.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function pl(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new Wh(o,t,i,r));return s.length==1?s[0]:new Wi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Is(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Is(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Is(this.heap,0)}}}function Is(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class xi{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Wi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){yn(this.active,e),yn(this.activeTo,e),yn(this.activeRank,e),this.minActive=gl(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t0;)t++;bn(this.active,t,i),bn(this.activeTo,t,s),bn(this.activeRank,t,r),e&&bn(e,t,this.cursor.from),this.minActive=gl(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&yn(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function ml(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e;for(;;){let h=n.to+a-t.to,c=h||n.endSide-t.endSide,f=c<0?n.to+a:t.to,u=Math.min(f,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&Er(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,u,n.point,t.point):u>l&&!Er(n.active,t.active)&&r.compareRange(l,u,n.active,t.active),f>o)break;(h||n.openEnd!=t.openEnd)&&r.boundChange&&r.boundChange(f),l=f,c<=0&&n.next(),c>=0&&t.next()}}function Er(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function gl(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=pe(n,s)}return i===!0?-1:n.length}const $r="ͼ",Ol=typeof Symbol>"u"?"__"+$r:Symbol.for($r),Br=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),yl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Tt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=yl[Ol]||1;return yl[Ol]=e+1,$r+e.toString(36)}static mount(e,t,i){let s=e[Br],r=i&&i.nonce;s?r&&s.setNonce(r):s=new od(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let bl=new Map;class od{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=bl.get(i);if(r)return e[Br]=r;this.sheet=new s.CSSStyleSheet,bl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Br]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ld=typeof navigator<"u"&&/Mac/.test(navigator.platform),ad=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ue=0;ue<10;ue++)Ct[48+ue]=Ct[96+ue]=String(ue);for(var ue=1;ue<=24;ue++)Ct[ue+111]="F"+ue;for(var ue=65;ue<=90;ue++)Ct[ue]=String.fromCharCode(ue+32),Li[ue]=String.fromCharCode(ue);for(var Vs in Ct)Li.hasOwnProperty(Vs)||(Li[Vs]=Ct[Vs]);function hd(n){var e=ld&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ad&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Li:Ct)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function U(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e2);var Q={mac:xl||/Mac/.test(xe.platform),windows:/Win/.test(xe.platform),linux:/Linux|X11/.test(xe.platform),ie:Ts,ie_version:zh?Wr.documentMode||6:zr?+zr[1]:Lr?+Lr[1]:0,gecko:Sl,gecko_version:Sl?+(/Firefox\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,chrome:!!Ns,chrome_version:Ns?+Ns[1]:0,ios:xl,android:/Android\b/.test(xe.userAgent),webkit_version:cd?+(/\bAppleWebKit\/(\d+)/.exec(xe.userAgent)||[0,0])[1]:0,safari:Ir,safari_version:Ir?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xe.userAgent)||[0,0])[1]:0,tabSize:Wr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function zi(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Vr(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function _n(n,e){if(!e.anchorNode)return!1;try{return Vr(n,e.anchorNode)}catch{return!1}}function ai(n){return n.nodeType==3?Ft(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ri(n,e,t,i){return t?kl(n,e,t,i,-1)||kl(n,e,t,i,1):!1}function Xt(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function ss(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function kl(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:nt(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Xt(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?nt(n):0}else return!1}}function nt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function sn(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function fd(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Ih(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function ud(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=fd(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let S=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Ih(c,S)),u={left:S.left,right:S.left+c.clientWidth*p,top:S.top,bottom:S.top+c.clientHeight*m}}let g=0,y=0;if(s=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+r)):e.right>u.right&&(g=e.right-u.right+r,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function dd(n){let e=n.ownerDocument,t,i;for(let s=n.parentNode;s&&!(s==e.body||t&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:t,y:i}}class pd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?nt(t):0),i,Math.min(e.focusOffset,i?nt(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let qt=null;Q.safari&&Q.safari_version>=26&&(qt=!1);function Vh(n){if(n.setActive)return n.setActive();if(qt)return n.focus(qt);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(qt==null?{get preventScroll(){return qt={preventScroll:!0},!0}}:void 0),!qt){qt=!1;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}function Fh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=nt(t)}else if(t.parentNode&&!ss(t))i=Xt(t),t=t.parentNode;else return null}}function _h(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&it)return f.domBoundsAround(e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==this.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=vo){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Hh(n,e,t,i,s,r,o,l,a){let{children:h}=n,c=h.length?h[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,a))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(tOd||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ve(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return yd(this.dom,e,t)}}class Ot extends _{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(Nh(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,s,r,o){return i&&(!(i instanceof Ot&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=a,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ot(this.mark,t,o)}domAtPos(e){return Gh(this,e)}coordsAt(e,t){return Yh(this,e,t)}}function yd(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?Q.chrome||Q.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?sn(a,o<0):a||null}class pt extends _{static create(e,t,i){return new pt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=pt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof pt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?s.length-1:0;r=s[l],!(e>0?l==0:l==s.length-1||r.top0?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}}Ve.prototype.children=pt.prototype.children=hi.prototype.children=vo;function Gh(n,e){let t=n.dom,{children:i}=n,s=0;for(let r=0;sr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof Ot&&s.length&&(i=s[s.length-1])instanceof Ot&&i.mark.eq(e.mark)?Zh(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function Yh(n,e,t){let i=null,s=-1,r=null,o=-1;function l(h,c){for(let f=0,u=0;f=c&&(d.children.length?l(d,c-u):(!r||r.isHidden&&(t>0||Sd(r,d)))&&(p>c||u==p&&d.getSide()>0)?(r=d,o=c-u):(u-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Xr(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function xd(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Pt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Kh(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Pt(e,i,s,t,e.widget||null,!0)}static line(e){return new on(e)}static set(e,t=!1){return N.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}R.none=N.empty;class rn extends R{constructor(e){let{start:t,end:i}=Kh(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof rn&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&rs(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}rn.prototype.point=!1;class on extends R{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof on&&this.spec.class==e.spec.class&&rs(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}on.prototype.mapMode=de.TrackBefore;on.prototype.point=!0;class Pt extends R{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?de.TrackBefore:de.TrackAfter:de.TrackDel}get type(){return this.startSide!=this.endSide?ke.WidgetRange:this.startSide<=0?ke.WidgetBefore:ke.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Pt&&kd(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Pt.prototype.point=!0;function Kh(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function kd(n,e){return n==e||!!(n&&e&&n.compare(e))}function Un(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class te extends _{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof te))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),jh(this,e,t,i?i.children.slice():[],r,o),!0}split(e){let t=new te;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){rs(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Zh(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Nr(t,this.attrs||{})),i&&(this.attrs=Nr({class:i},this.attrs||{}))}domAtPos(e){return Gh(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Nh(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Xr(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&_.get(s)instanceof Ot;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=_.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!Q.ios||!this.children.some(r=>r instanceof Ve))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ve)||/[^ -~]/.test(i.text))return null;let s=ai(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Yh(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof te)return r;if(o>t)break}s=o+r.breakAfter}return null}}class mt extends _{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0}}class Fr extends ot{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Di{constructor(e,t,i,s){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof mt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new te),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Sn(new hi(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof mt)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:l,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(l){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),r=Math.min(s,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Sn(new Ve(this.text.slice(this.textOff,this.textOff+r)),t),i),this.atCursorPos=!0,this.textOff+=r,e-=r,i=s<=r?0:t.length}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Pt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof Pt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new mt(i.widget||ci.block,l,i));else{let a=pt.create(i.widget||ci.inline,l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=s.length&&(e0),c=!a.isEditable&&(es.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(f.append(Sn(new hi(1),s),r),r=s.length+Math.max(0,r-s.length)),f.append(Sn(a,s),r),this.atCursorPos=c,this.pendingBuffer=c?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,s,r){let o=new Di(e,t,i,r);return o.openEnd=N.spans(s,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Sn(n,e){for(let t of e)n=new Ot(t,[n],n.length);return n}class ci extends ot{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ci.inline=new ci("span");ci.block=new ci("div");var Z=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(Z||(Z={}));const _t=Z.LTR,To=Z.RTL;function Jh(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function tc(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ue[m+1]==-d){let g=Ue[m+2],y=g&2?s:g&4?g&1?r:s:0;y&&(H[f]=H[Ue[m]]=y),l=m;break}}else{if(Ue.length==189)break;Ue[l++]=f,Ue[l++]=u,Ue[l++]=a}else if((p=H[f])==2||p==1){let m=p==s;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=Ue[g+2];if(y&2)break;if(m)Ue[g+2]|=2;else{if(y&4)break;Ue[g+2]|=4}}}}}function Qd(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),H[--p]=d;a=c}else r=h,a++}}}function Ur(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;aa&&o.push(new wt(a,m.from,d));let g=m.direction==_t!=!(d%2);Hr(n,g?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?H[p]!=l:H[p]==l))break;p++}u?Ur(n,a,p,i+1,s,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=H[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(H[g-1]==l)break e;break}}if(u)u.push(m);else{m.toH.length;)H[H.length]=256;let i=[],s=e==_t?0:1;return Hr(n,s,s,t,0,n.length,i),i}function ic(n){return[new wt(0,n,0)]}let nc="";function Md(n,e,t,i,s){var r;let o=i.head-n.from,l=wt.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=pe(n.text,o,a.forward(s,t));(ca.to)&&(c=h),nc=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(e=>e)}),fc=A.define({combine:n=>n.some(e=>e)}),uc=A.define();class ni{constructor(e,t="nearest",i="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new ni(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ni(b.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xn=q.define({map:(n,e)=>n.map(e)}),dc=q.define();function Pe(n,e,t){let i=n.facet(lc);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const dt=A.define({combine:n=>n.length?n[0]:!0});let Dd=0;const Kt=A.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(Ii.of(h=>{let c=h.plugin(l);return c?o(c):R.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return J.define((i,s)=>new e(i,s),t)}}class Xs{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Pe(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Pe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Pe(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const pc=A.define(),Qo=A.define(),Ii=A.define(),mc=A.define(),ln=A.define(),gc=A.define();function Cl(n,e){let t=n.state.facet(gc);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return N.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Rd(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}const Oc=A.define();function Ao(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(Oc)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const Ti=A.define();class Le{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Le(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!a)return i;new Le(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class os{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=se.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new Le(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new os(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Pl extends _{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=R.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new te],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Le(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!zd(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?qd(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Le(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Q.ie||Q.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=Wd(o,l,e.changes);return i=Le.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Q.chrome||Q.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,u,d,p,m;if(i&&i.range.fromBc){let w=Di.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),k=Di.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);d=w.breakAtStart,p=w.openStart,m=k.openEnd;let v=this.compositionView(i);k.breakAtStart?v.breakAfter=1:k.content.length&&v.merge(v.length,v.length,k.content[0],!1,k.openStart,0)&&(v.breakAfter=k.content[0].breakAfter,k.content.shift()),w.content.length&&v.merge(0,0,w.content[w.content.length-1],!0,0,w.openEnd)&&w.content.pop(),u=w.content.concat(v).concat(k.content)}else({content:u,breakAtStart:d,openStart:p,openEnd:m}=Di.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:y}=r.findPos(h,1),{i:S,off:x}=r.findPos(a,-1);Hh(this,S,x,g,y,u,d,p,m)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(dc)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ve(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new Ot(s,[t],t.length);let i=new te;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=_.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&!(this.view.state.facet(dt)||this.dom.tabIndex>-1)&&_n(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&Ed(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new ye(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!Ri(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Ri(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(c.focusNode)&&Ld(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=zi(this.view.root);if(f)if(l.empty){if(Q.gecko){let u=$d(a.node,a.offset);if(u&&u!=3){let d=(u==1?Fh:_h)(a.node,a.offset);d&&(a=new ye(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ye(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ye(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ri(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=zi(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=te.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let s=e.offset;!i&&s=0;s--){let r=_.get(t.childNodes[s]);r instanceof te&&(i=r.domAtPos(r.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=_.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof te&&!(i instanceof te&&t>=0)))i=l,s=h;else if(i&&h==e&&a==e&&l instanceof mt&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(i=null)}r=h}return i?i.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof te))return null;for(;s.children.length;){let{i:l,off:a}=s.childPos(i,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}i=a}if(!(s instanceof Ve))return null;let r=pe(s.text,i);if(r==i)return null;let o=Ft(s.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Z.LTR;for(let h=0,c=0;cs)break;if(h>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?ai(p):[];if(m.length){let g=m[m.length-1],y=a?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Z.RTL:Z.LTR}measureTextSize(){for(let r of this.children)if(r instanceof te){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=ai(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Uh(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(R.replace({widget:new Fr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return R.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ii).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(mc).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(N.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];et.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=Ao(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;ud(this.view.scrollDOM,o,t.heads instanceof pt||s.children.some(i);return i(this.children[t])}}function Ed(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function yc(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=Fh(t.focusNode,t.focusOffset),s=_h(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=_.get(s.node);if(!l||l instanceof Ve&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=_.get(i.node);!a||a instanceof Ve&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function qd(n,e,t){let i=yc(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc,h=new Le(a.mapPos(r),a.mapPos(o),r,o),c=[];for(let f=s.parentNode;;f=f.parentNode){let u=_.get(f);if(u instanceof Ot)c.push({node:f,deco:u.mark});else{if(u instanceof te||f.nodeName=="DIV"&&f.parentNode==n.contentDOM)return{range:h,text:s,marks:c,line:f};if(f!=n.contentDOM)c.push({node:f,deco:new rn({inclusive:!0,attributes:xd(f),tagName:f.tagName.toLowerCase()})});else return null}}}function $d(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}function Id(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return b.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=pe(s.text,r,!1):l=pe(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=pe(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln?e.left-n:Math.max(0,n-e.right)}function Nd(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function Fs(n,e){return n.tope.top+1}function Ql(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function Gr(n,e,t){let i,s,r,o,l=!1,a,h,c,f;for(let p=n.firstChild;p;p=p.nextSibling){let m=ai(p);for(let g=0;gx||o==x&&r>S)&&(i=p,s=y,r=S,o=x,l=S?e0:gy.bottom&&(!c||c.bottomy.top)&&(h=p,f=y):c&&Fs(c,y)?c=Al(c,y.bottom):f&&Fs(f,y)&&(f=Ql(f,y.top))}}if(c&&c.bottom>=t?(i=a,s=c):f&&f.top<=t&&(i=h,s=f),!i)return{node:n,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return Ml(i,u,t);if(l&&i.contentEditable!="false")return Gr(i,u,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function Ml(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if(Q.chrome||Q.gecko){let p=Ft(n,l).getBoundingClientRect();Math.abs(p.left-c.right)<.1&&(d=!u)}if(f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function bc(n,e,t,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:h}=n.viewState,{x:c,y:f}=e,u=f-l;if(u<0)return 0;if(u>h)return n.state.doc.length;for(let w=n.viewState.heightOracle.textHeight/2,k=!1;a=n.elementAtHeight(u),a.type!=ke.Text;)for(;u=i>0?a.bottom+w:a.top-w,!(u>=0&&u<=h);){if(k)return t?null:0;k=!0,i=-i}f=l+u;let d=a.from;if(dn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:Rl(n,o,a,c,f);let p=n.dom.ownerDocument,m=n.root.elementFromPoint?n.root:p,g=m.elementFromPoint(c,f);g&&!n.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=m.elementFromPoint(c,f),g&&!n.contentDOM.contains(g)&&(g=null));let y,S=-1;if(g&&((s=n.docView.nearest(g))===null||s===void 0?void 0:s.isEditable)!=!1){if(p.caretPositionFromPoint){let w=p.caretPositionFromPoint(c,f);w&&({offsetNode:y,offset:S}=w)}else if(p.caretRangeFromPoint){let w=p.caretRangeFromPoint(c,f);w&&({startContainer:y,startOffset:S}=w)}y&&(!n.contentDOM.contains(y)||Q.safari&&Xd(y,S,c)||Q.chrome&&Fd(y,S,c))&&(y=void 0),y&&(S=Math.min(nt(y),S))}if(!y||!n.docView.dom.contains(y)){let w=te.find(n.docView,d);if(!w)return u>a.top+a.height/2?a.to:a.from;({node:y,offset:S}=Gr(w.dom,c,f))}let x=n.docView.nearest(y);if(!x)return null;if(x.isWidget&&((r=x.dom)===null||r===void 0?void 0:r.nodeType)==1){let w=x.dom.getBoundingClientRect();return e.yn.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+qr(o,r,n.state.tabSize)}function Sc(n,e,t){let i,s=n;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(;;){let r=s.nextSibling;if(r){if(r.nodeName=="BR")break;return!1}else{let o=s.parentNode;if(!o||o.nodeName=="DIV")break;s=o}}return Ft(n,i-1,i).getBoundingClientRect().right>t}function Xd(n,e,t){return Sc(n,e,t)}function Fd(n,e,t){if(e!=0)return Sc(n,e,t);for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():Ft(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Zr(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;(!s||r.type==ke.Text&&(s.type!=r.type||(t<0?r.frome)))&&(s=r)}}return s||i}return i}function _d(n,e,t,i){let s=Zr(n,e.head,e.assoc||-1),r=!i||s.type!=ke.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==Z.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return b.cursor(a,t?-1:1)}return b.cursor(t?s.to:s.from,t?-1:1)}function Dl(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=Md(s,r,o,l,t),c=nc;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` -`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function Ud(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==Y.Space&&(s=o),s==o}}function Hd(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return b.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,e.assoc||-1),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=bc(n,{x:f,y:p},!1,r);if(pa.bottom||(r<0?ms)){let g=n.docView.coordsForChar(m),y=!g||p{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:b.cursor(i,ir)&&!Zd(o,t)&&this.lineBreak(),s=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=_.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Gd(e,i.node,i.offset)?t:0))}}function Gd(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:Jd(e),a=new jd(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ep(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Vr(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Vr(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((Q.ios||Q.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(b.range(h,a)):this.newSel=b.single(h,a)}}}function kc(n,e){let t,{newSel:i}=e,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=s.from,h=null;(r===8||Q.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:n.state.doc.lineAt(s.from).toDate.now()-50?t={from:s.from,to:s.to,insert:n.state.toText(n.inputState.insertingText)}:Q.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` - `&&n.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:V.of([" "])}),t)return Mo(n,t,i,r);if(i&&!i.main.eq(s)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin,l=="select.pointer"&&(i=xc(n.state.facet(ln).map(a=>a(n)),i))),n.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Mo(n,e,t,i=-1){if(Q.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(Q.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ii(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&ii(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&ii(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Kd(n,e,t));return n.state.facet(ac).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Kd(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:b.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&yc(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,g=m-c.length;if(n.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:p};let y=s.changes({from:g,to:m,insert:e.insert}),S=p.to-r.to;return{changes:y,range:h?b.range(Math.max(0,h.anchor+S),Math.max(0,h.head+S)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function wc(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Jd(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new El(t,i)),(s!=t||r!=i)&&e.push(new El(s,r))),e}function ep(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}class tp{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Q.safari&&e.contentDOM.addEventListener("input",()=>null),Q.gecko&&Op(e.contentDOM.ownerDocument)}handleEvent(e){!hp(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=ip(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Tc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Q.android&&Q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=vc.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||np.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ql(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Pe(t.state,s)}}}function ip(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(ql(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(ql(i.value,a))}}for(let i in Ne)t(i).handlers.push(Ne[i]);for(let i in ze)t(i).observers.push(ze[i]);return e}const vc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],np="dthko",Tc=[16,17,18,20,91,92,224,225],kn=6;function wn(n){return Math.max(0,n)*.7+8}function sp(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class rp{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=dd(e.contentDOM),this.atoms=e.state.facet(ln).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(I.allowMultipleSelections)&&op(e,t),this.dragging=ap(e,t)&&Qc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&sp(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Ao(this.view);e.clientX-a.left<=s+kn?t=-wn(s-e.clientX):e.clientX+a.right>=o-kn&&(t=wn(e.clientX-o)),e.clientY-a.top<=r+kn?i=-wn(r-e.clientY):e.clientY+a.bottom>=l-kn&&(i=wn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=xc(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function op(n,e){let t=n.state.facet(sc);return t.length?t[0](e):Q.mac?e.metaKey:e.ctrlKey}function lp(n,e){let t=n.state.facet(rc);return t.length?t[0](e):Q.mac?!e.altKey:!e.ctrlKey}function ap(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=zi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function hp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=_.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ne=Object.create(null),ze=Object.create(null),Cc=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function cp(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Pc(n,t.value)},50)}function Cs(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Pc(n,e){e=Cs(n.state,Co,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Yr!=null&&t.selection.ranges.every(a=>a.empty)&&Yr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ze.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};Ne.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ze.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};ze.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Ne.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(oc))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=dp(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new rp(n,e,t,i)),i&&n.observer.ignore(()=>{Vh(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function $l(n,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return Id(n.state,e,t);{let s=te.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return le>=t.top&&e<=t.bottom&&n>=t.left&&n<=t.right;function fp(n,e,t,i){let s=te.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Bl(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Bl(t,i,l)?1:o&&o.bottom>=i?-1:1}function Wl(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:fp(n,t,e.clientX,e.clientY)}}const up=Q.ie&&Q.ie_version<=11;let Ll=null,zl=0,Il=0;function Qc(n){if(!up)return n.detail;let e=Ll,t=Il;return Ll=n,Il=Date.now(),zl=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(zl+1)%3:1}function dp(n,e){let t=Wl(n,e),i=Qc(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=Wl(n,r),h,c=$l(n,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=$l(n,t.pos,t.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=pp(s,a.pos))?h:l?s.addRange(c):b.create([c])}}}function pp(n,e){for(let t=0;t=e)return b.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Ne.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=b.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Cs(n.state,Po,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ne.dragend=n=>(n.inputState.draggedContent=null,!1);function Vl(n,e,t,i){if(t=Cs(n.state,Co,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&lp(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ne.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&Vl(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Vl(n,e,i,!0),!0}return!1};Ne.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Cc?null:e.clipboardData;return t?(Pc(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(cp(n),!1)};function mp(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function gp(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:Cs(n,Po,e.join(n.lineBreak)),ranges:t,linewise:i}}let Yr=null;Ne.copy=Ne.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=gp(n.state);if(!t&&!s)return!1;Yr=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Cc?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(mp(n,t),!1)};const Ac=st.define();function Mc(n,e){let t=[];for(let i of n.facet(hc)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:Ac.of(!0)}):null}function Rc(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Mc(n.state,e);t?n.dispatch(t):n.update([])}},10)}ze.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Rc(n)};ze.blur=n=>{n.observer.clearSelectionRange(),Rc(n)};ze.compositionstart=ze.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};ze.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Q.chrome&&Q.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ze.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ne.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Mo(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(Q.chrome&&Q.android&&(s=vc.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Q.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Q.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ze.compositionend(n,e),20),!1};const Nl=new Set;function Op(n){Nl.has(n)||(Nl.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Xl=["pre-wrap","normal","pre-line","break-spaces"];let fi=!1;function Fl(){fi=!1}class yp{constructor(e){this.lineWrapping=e,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Xl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Hn&&(fi=!0),this.height=e)}replace(e,t,i){return we.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,G.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,G.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class De extends Dc{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new Ke(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof De||s instanceof fe&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof fe?s=new De(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):we.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(s.heights[s.index++]):(i||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class fe extends we{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof fe?i[i.length-1]=new fe(r.length+s):i.push(null,new fe(s-1))}if(e>0){let r=i[0];r instanceof fe?i[0]=new fe(e+r.length):i.unshift(new fe(e-1),null)}return we.of(i)}decomposeLeft(e,t){t.push(new fe(e-1),null)}decomposeRight(e,t){t.push(null,new fe(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new fe(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++];a==-1?a=f:Math.abs(f-a)>=Hn&&(a=-2);let u=new De(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new fe(r-l).updateHeight(e,l));let h=we.of(o);return(a<0||Math.abs(h.height-this.height)>=Hn||Math.abs(a-this.heightMetrics(e,t).perLine)>=Hn)&&(fi=!0),ls(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Sp extends we{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==G.ByPosNoHeight?G.ByPosNoHeight:G.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,G.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&_l(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?we.of(this.break?[e,null,t]:[e,t]):(this.left=ls(this.left,e),this.right=ls(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function _l(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof fe&&(i=n[e+1])instanceof fe&&n.splice(e-1,3,new fe(t.length+1+i.length))}const xp=5;class Ro{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof De?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new De(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=xp)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new De(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new fe(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof De)return e;let t=new De(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof De)&&!this.isCovered?this.nodes.push(new De(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Tp(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Cp(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Us{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new yp(t),this.stateDeco=e.facet(Ii).filter(i=>typeof i!="function"),this.heightMap=we.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(e.doc),[new Le(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new vn(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Hl:new Do(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Pi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ii).filter(c=>typeof c!="function");let s=e.changedRanges,r=Le.extendWithRanges(s,kp(i,this.stateDeco,e?e.changes:se.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Fl(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||fi)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Z.RTL:Z.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:w,scaleY:k}=Ih(t,l);(w>.005&&Math.abs(this.scaleX-w)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=w,this.scaleY=k,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Xh(e.scrollDOM);let p=(this.printing?Cp:vp)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget&&!Tp(e.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let w=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(w)&&(o=!0),o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:k,charWidth:v,textHeight:T}=e.docView.measureTextSize();o=k>0&&s.refresh(r,k,v,T,Math.max(5,S/v),w),o&&(e.docView.minWidth=0,h|=16)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),Fl();for(let k of this.viewports){let v=k.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?we.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new Le(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new bp(k.from,v))}fi&&(h|=2)}let x=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return x&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new vn(s.lineAt(o-i*1e3,G.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,G.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,G.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=Z.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromS));if(!g){if(fx.from<=f&&x.to>=f)){let x=t.moveToLineBoundary(b.cursor(f),!1,!0).head;x>c&&(f=x)}let y=this.gapSize(u,c,f,d),S=i||y<2e6?y:2e6;g=new Us(c,f,y,S)}l.push(g)},h=c=>{if(c.length2e6)for(let v of e)v.from>=c.from&&v.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];N.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Pi(this.heightMap.lineAt(e,G.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Pi(this.heightMap.lineAt(this.scaler.fromDOM(e),G.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Pi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class vn{constructor(e,t){this.from=e,this.to=t}}function Qp(n,e,t){let i=[],s=n,r=0;return N.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Cn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Ap(n,e){for(let t of n)if(e(t))return t}const Hl={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Do{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,G.ByPos,e,0,0).top,c=t.lineAt(a,G.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Pi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ke(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>Pi(s,e)):n._content)}const Pn=A.define({combine:n=>n.join(" ")}),Kr=A.define({combine:n=>n.indexOf(!0)>-1}),Jr=Tt.newName(),Ec=Tt.newName(),qc=Tt.newName(),$c={"&light":"."+Ec,"&dark":"."+qc};function eo(n,e,t){return new Tt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Mp=eo("."+Jr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},$c),Rp={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Hs=Q.ie&&Q.ie_version<=11;class Dp{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new pd,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Q.ie&&Q.ie_version<=11||Q.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Q.chrome&&Q.chrome_version<126)&&(this.editContext=new qp(e),e.state.facet(dt)&&(e.contentDOM.editContext=this.editContext.editContext)),Hs&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(dt)?i.root.activeElement!=this.dom:!_n(this.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Ri(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=zi(e.root);if(!t)return!1;let i=Q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Ep(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=_n(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ii(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&_n(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Yd(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=kc(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=jl(t,e.previousSibling||e.target.previousSibling,-1),s=jl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dt)!=e.state.facet(dt)&&(e.view.contentDOM.editContext=e.state.facet(dt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function jl(n,e,t){for(;e;){let i=_.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function Gl(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return Ri(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Ep(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Gl(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?Gl(n,t):null}class qp{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=wc(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=b.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));u.main.eq(s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:V.of(i.text.slice(c.from,c.toB).split(` -`))};if((Q.mac||Q.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:V.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Mo(e,f,b.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=zi(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class P{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||md(e.parent)||document,this.viewState=new Ul(e.state||I.create(e)),e.scrollTo&&e.scrollTo.is(xn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(s=>new Xs(s));for(let s of this.plugins)s.update(this);this.observer=new Dp(this),this.inputState=new tp(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Pl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof ie?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Ac))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Mc(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(I.phrases)!=this.state.facet(I.phrases))return this.setState(r);s=os.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new ni(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(xn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=as.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Ti)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Pn)!=s.state.facet(Pn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(jr))try{u(s)}catch(d){Pe(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!kc(this,c)&&h.force&&ii(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Ul(e),this.plugins=e.facet(Kt).map(i=>new Xs(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Pl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Kt),i=e.state.facet(Kt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Xs(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Xh(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Pe(this.state,p),Zl}}),f=os.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1){s=s+p,i.scrollTop=s/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(jr))l(t)}get themeClasses(){return Jr+" "+(this.state.facet(Kr)?qc:Ec)+" "+this.state.facet(Pn)}updateAttrs(){let e=Yl(this,pc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(dt)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Yl(this,Qo,t);let i=this.observer.ignore(()=>{let s=Xr(this.contentDOM,this.contentAttrs,t),r=Xr(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(P.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ti);let e=this.state.facet(P.cspNonce);Tt.mount(this.root,this.styleModules.concat(Mp).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return _s(this,e,Dl(this,e,t,i))}moveByGroup(e,t){return _s(this,e,Dl(this,e,t,i=>Ud(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return b.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return _d(this,e,t,i)}moveVertically(e,t,i){return _s(this,e,Hd(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),bc(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[wt.find(r,e-s.from,-1,t)];return sn(i,o.dir==Z.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(cc)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$p)return ic(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||tc(r.isolates,i=Cl(this,e))))return r.order;i||(i=Cl(this,e));let s=Ad(e.text,t,i);return this.bidiCache.push(new as(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vh(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return xn.of(new ni(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return xn.of(new ni(b.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return J.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return J.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Tt.newName(),s=[Pn.of(i),Ti.of(eo(`.${i}`,e))];return t&&t.dark&&s.push(Kr.of(!0)),s}static baseTheme(e){return Mt.lowest(Ti.of(eo("."+Jr,e,$c)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&_.get(i)||_.get(e);return((t=s?.rootView)===null||t===void 0?void 0:t.view)||null}}P.styleModule=Ti;P.inputHandler=ac;P.clipboardInputFilter=Co;P.clipboardOutputFilter=Po;P.scrollHandler=uc;P.focusChangeEffect=hc;P.perLineTextDirection=cc;P.exceptionSink=lc;P.updateListener=jr;P.editable=dt;P.mouseSelectionStyle=oc;P.dragMovesSelection=rc;P.clickAddsSelectionRange=sc;P.decorations=Ii;P.outerDecorations=mc;P.atomicRanges=ln;P.bidiIsolatedRanges=gc;P.scrollMargins=Oc;P.darkTheme=Kr;P.cspNonce=A.define({combine:n=>n.length?n[0]:""});P.contentAttributes=Qo;P.editorAttributes=pc;P.lineWrapping=P.contentAttributes.of({class:"cm-lineWrapping"});P.announce=q.define();const $p=4096,Zl={};class as{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:Z.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Nr(o,t)}return t}const Bp=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function Wp(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function zp(n,e,t){return Wc(Bc(n.state),e,n,t)}let xt=null;const Ip=4e3;function Vp(n,e=Bp){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Wp(y,e));for(let y=1;y{let w=xt={view:x,prefix:S,scope:o};return setTimeout(()=>{xt==w&&(xt=null)},Ip),!0}]})}let m=p.join(" ");s(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,to))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let to=null;function Wc(n,e,t,i){to=e;let s=hd(e),r=Te(s,0),o=Ye(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;xt&&xt.view==t&&xt.scope==i&&(l=xt.prefix+" ",Tc.indexOf(e.keyCode)<0&&(h=!0,xt=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+Qn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&!(Q.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Ct[e.keyCode])&&p!=s?(u(d[l+Qn(p,e,!0)])||e.shiftKey&&(m=Li[e.keyCode])!=s&&m!=p&&u(d[l+Qn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Qn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),to=null,a}class hn{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Lc(e);return[new hn(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Np(e,t,i)}}function Lc(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Z.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Jl(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function Np(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==Z.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Lc(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Zr(n,i,1),p=Zr(n,s,-1),m=d.type==ke.Text?d:null,g=p.type==ke.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=Jl(n,i,1,m)),g&&(n.lineWrapping||p.widgetLineBreaks)&&(g=Jl(n,s,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return S(x(t.from,t.to,m));{let k=m?x(t.from,null,m):w(d,!1),v=g?x(null,t.to,g):w(p,!0),T=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2D&&W.from=ne)break;ee>X&&$(Math.max(F,X),k==null&&F<=D,Math.min(ee,ne),v==null&&ee>=B,me.dir)}if(X=oe.to+1,X>=ne)break}return z.length==0&&$(D,k==null,B,v==null,n.textDirection),{top:E,bottom:M,horizontal:z}}function w(k,v){let T=l.top+(v?k.top:k.bottom);return{top:T,bottom:T,horizontal:[]}}}function Xp(n,e){return n.constructor==e.constructor&&n.eq(e)}class Fp{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(jn)!=e.state.facet(jn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(jn);for(;t!Xp(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,Q.safari&&Q.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const jn=A.define();function zc(n){return[J.define(e=>new Fp(e,n)),jn.of(n)]}const Vi=A.define({combine(n){return rt(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function _p(n={}){return[Vi.of(n),Up,Hp,jp,fc.of(!0)]}function Ic(n){return n.startState.facet(Vi)!=n.state.facet(Vi)}const Up=zc({above:!0,markers(n){let{state:e}=n,t=e.facet(Vi),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:b.cursor(s.head,s.head>s.anchor?-1:1);for(let a of hn.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ic(n);return t&&ea(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){ea(e.state,n)},class:"cm-cursorLayer"});function ea(n,e){e.style.animationDuration=n.facet(Vi).cursorBlinkRate+"ms"}const Hp=zc({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:hn.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||Ic(n)},class:"cm-selectionLayer"}),jp=Mt.highest(P.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Vc=q.define({map(n,e){return n==null?null:e.mapPos(n)}}),Qi=he.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(Vc)?i.value:t,n)}}),Gp=J.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Qi);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Qi)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Qi),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Qi)!=n&&this.view.dispatch({effects:Vc.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Zp(){return[Qi,Gp]}function ta(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Yp(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Kp{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new gt,i=t.add.bind(t);for(let{from:s,to:r}of Yp(e,this.maxLength))ta(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const io=/x/.unicode!=null?"gu":"g",Jp=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,io),em={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let js=null;function tm(){var n;if(js==null&&typeof document<"u"&&document.body){let e=document.body.style;js=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return js||!1}const Gn=A.define({combine(n){let e=rt(n,{render:null,specialChars:Jp,addSpecialChars:null});return(e.replaceTabs=!tm())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,io)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,io)),e}});function im(n={}){return[Gn.of(n),nm()]}let ia=null;function nm(){return ia||(ia=J.fromClass(class{constructor(n){this.view=n,this.decorations=R.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Gn)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Kp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=Te(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=gi(o.text,l,i-o.from);return R.replace({widget:new lm((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=R.replace({widget:new om(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Gn);n.startState.facet(Gn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const sm="•";function rm(n){return n>=32?sm:n==10?"␤":String.fromCharCode(9216+n)}class om extends ot{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=rm(this.code),i=e.state.phrase("Control character")+" "+(em[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class lm extends ot{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function am(){return cm}const hm=R.line({class:"cm-activeLine"}),cm=J.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(hm.range(s.from)),e=s.from)}return R.set(t)}},{decorations:n=>n.decorations});class fm extends ot{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?ai(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=sn(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function um(n){let e=J.fromClass(class{constructor(t){this.view=t,this.placeholder=n?R.set([R.widget({widget:new fm(n),side:1}).range(0)]):R.none}get decorations(){return this.view.state.doc.length?R.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,P.contentAttributes.of({"aria-placeholder":n})]:e}const no=2e3;function dm(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>no||t.off>no||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=qr(h.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=qr(h.text,l,n.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function pm(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function na(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>no?-1:s==i.length?pm(n,e.clientX):gi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function mm(n,e){let t=na(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=na(n,s);if(!l)return i;let a=dm(n.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function gm(n){let e=(t=>t.altKey&&t.button==0);return P.mouseSelectionStyle.of((t,i)=>e(i)?mm(t,i):null)}const Om={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},ym={style:"cursor: crosshair"};function bm(n={}){let[e,t]=Om[n.key||"Alt"],i=J.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,P.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?ym:null})]}const An="-10000px";class Nc{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Sm(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Gs=A.define({combine:n=>{var e,t,i;return{position:Q.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Sm}}}),sa=new WeakMap,Eo=J.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Gs);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Nc(n,qo,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Gs);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=An,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Q.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=Ao(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Gs).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=An;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=sa.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||km,S=this.view.textDirection==Z.LTR,x=u.width>i.right-i.left?S?i.left:i.right-u.width:S?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),w=this.above[l];!a.strictSide&&(w?f.top-g-p-y.yi.bottom)&&w==i.bottom-f.bottom>f.top-i.top&&(w=this.above[l]=!w);let k=(w?f.top-i.top:i.bottom-f.bottom)-p;if(kx&&E.topv&&(v=w?E.top-g-2-p:E.bottom+p+2);if(this.position=="absolute"?(c.style.top=(v-n.parent.top)/r+"px",ra(c,(x-n.parent.left)/s)):(c.style.top=v/r+"px",ra(c,x/s)),d){let E=f.left+(S?y.x:-y.x)-(x+14-7);d.style.left=E/s+"px"}h.overlap!==!0&&o.push({left:x,top:v,right:T,bottom:v+g}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=An}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ra(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const xm=P.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),km={x:0,y:0},qo=A.define({enables:[Eo,xm]}),hs=A.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Ps{static create(e){return new Ps(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Nc(e,hs,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const wm=qo.compute([hs],n=>{let e=n.facet(hs);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Ps.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class vm{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==Z.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Pe(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Eo),t=e?e.manager.tooltips.findIndex(i=>i.create==Ps.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!Tm(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Cm(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Mn=4;function Tm(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-Mn&&e.clientX<=i+Mn&&e.clientY>=s-Mn&&e.clientY<=r+Mn}function Cm(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Pm(n,e={}){let t=q.define(),i=he.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,de.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Qm)&&(s=[]);return s},provide:s=>hs.from(s)});return{active:i,extension:[i,J.define(s=>new vm(s,n,i,t,e.hoverTime||300)),wm]}}function Xc(n,e){let t=n.plugin(Eo);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Qm=q.define(),oa=A.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Ni(n,e){let t=n.plugin(Fc),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Fc=J.fromClass(class{constructor(n){this.input=n.state.facet(Xi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(oa);this.top=new Rn(n,!0,e.topContainer),this.bottom=new Rn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(oa);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Rn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Rn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Xi);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Rn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=la(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=la(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function la(n){let e=n.nextSibling;return n.remove(),e}const Xi=A.define({enables:Fc});class yt extends Nt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}yt.prototype.elementClass="";yt.prototype.toDOM=void 0;yt.prototype.mapMode=de.TrackBefore;yt.prototype.startSide=yt.prototype.endSide=-1;yt.prototype.point=!0;const Zn=A.define(),Am=A.define(),Mm={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>N.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},qi=A.define();function Rm(n){return[_c(),qi.of({...Mm,...n})]}const aa=A.define({combine:n=>n.some(e=>e)});function _c(n){return[Dm]}const Dm=J.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(qi).map(e=>new ca(n,e)),this.fixed=!n.state.facet(aa);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(aa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=N.iter(this.view.state.facet(Zn),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Em(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ke.Text&&o){so(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ke.Text){so(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(qi),t=n.state.facet(qi),i=n.docChanged||n.heightChanged||n.viewportChanged||!N.eq(n.startState.facet(Zn),n.state.facet(Zn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new ca(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Z.LTR?{left:i,right:s}:{right:i,left:s}})});function ha(n){return Array.isArray(n)?n:[n]}function so(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Em{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=N.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new Uc(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];so(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Am)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ca{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=ha(t.markers(e)),t.initialSpacer&&(this.spacer=new Uc(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=ha(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!N.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Uc{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),qm(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Zs extends yt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ys(n,e){return n.state.facet(Jt).formatNumber(e,n.state)}const Wm=qi.compute([Jt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($m)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Zs(Ys(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Bm)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Jt)!=e.state.facet(Jt),initialSpacer(e){return new Zs(Ys(e,fa(e.state.doc.lines)))},updateSpacer(e,t){let i=Ys(t.view,fa(t.view.state.doc.lines));return i==e.number?e:new Zs(i)},domEventHandlers:n.facet(Jt).domEventHandlers,side:"before"}));function Lm(n={}){return[Jt.of(n),_c(),Wm]}function fa(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(zm.range(s)))}return N.of(e)});function Vm(){return Im}const Hc=1024;let Nm=0;class Ks{constructor(e,t){this.from=e,this.to=t}}class L{constructor(e={}){this.id=Nm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ve.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}L.closedBy=new L({deserialize:n=>n.split(" ")});L.openedBy=new L({deserialize:n=>n.split(" ")});L.group=new L({deserialize:n=>n.split(" ")});L.isolate=new L({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});L.contextHash=new L({perNode:!0});L.lookAhead=new L({perNode:!0});L.mounted=new L({perNode:!0});class cs{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[L.mounted.id]}}const Xm=Object.create(null);class ve{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Xm,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ve(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(L.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(L.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}ve.none=new ve("",Object.create(null),0,8);class Qs{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|re.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Wo(ve.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new j(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new j(ve.none,t,i,s)))}static build(e){return Hm(e)}}j.empty=new j(ve.none,[],[],0);class $o{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new $o(this.buffer,this.index)}}class Qt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ve.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Fi(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from;if(jc(s,i,f,f+c.length)){if(c instanceof Qt){if(r&re.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new Je(new Fm(o,c,e,f),null,u)}else if(r&re.IncludeAnonymous||!c.type.isAnonymous||Bo(c)){let u;if(!(r&re.IgnoreMounts)&&(u=cs.get(c))&&!u.overlay)return new Ae(u.tree,f,e,o);let d=new Ae(c,f,e,o);return r&re.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&re.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&re.IgnoreOverlays)&&(s=cs.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new Ae(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function da(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function ro(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Fm{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class Je extends Gc{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Je(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&re.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Je(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Je(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Je(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new j(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Zc(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new Ae(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Fi(l,e,t,!1))}}return s?Zc(s):i}class oo{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ae)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Ae?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&re.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&re.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&re.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&re.IncludeAnonymous||l instanceof Qt||!l.type.isAnonymous||Bo(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return ro(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Bo(n){return n.children.some(e=>e instanceof Qt||!e.type.isAnonymous||Bo(e))}function Hm(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Hc,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new $o(t,t.length):t,a=i.types,h=0,c=0;function f(k,v,T,E,M,z){let{id:$,start:D,end:B,size:W}=l,X=c,ne=h;if(W<0)if(l.next(),W==-1){let ce=r[$];T.push(ce),E.push(D-k);return}else if(W==-3){h=$;return}else if(W==-4){c=$;return}else throw new RangeError(`Unrecognized record size: ${W}`);let oe=a[$],me,F,ee=D-k;if(B-D<=s&&(F=g(l.pos-v,M))){let ce=new Uint16Array(F.size-F.skip),ge=l.pos-F.size,_e=ce.length;for(;l.pos>ge;)_e=y(F.start,ce,_e);me=new Qt(ce,B-F.start,i),ee=F.start-k}else{let ce=l.pos-W;l.next();let ge=[],_e=[],Dt=$>=o?$:-1,Gt=0,gn=B;for(;l.pos>ce;)Dt>=0&&l.id==Dt&&l.size>=0?(l.end<=gn-s&&(p(ge,_e,D,Gt,l.end,gn,Dt,X,ne),Gt=ge.length,gn=l.end),l.next()):z>2500?u(D,ce,ge,_e):f(D,ce,ge,_e,Dt,z+1);if(Dt>=0&&Gt>0&&Gt-1&&Gt>0){let al=d(oe,ne);me=Wo(oe,ge,_e,0,ge.length,0,B-D,al,al)}else me=m(oe,ge,_e,B-D,X-B,ne)}T.push(me),E.push(ee)}function u(k,v,T,E){let M=[],z=0,$=-1;for(;l.pos>v;){let{id:D,start:B,end:W,size:X}=l;if(X>4)l.next();else{if($>-1&&B<$)break;$<0&&($=W-s),M.push(D,B,W),z++,l.next()}}if(z){let D=new Uint16Array(z*4),B=M[M.length-2];for(let W=M.length-3,X=0;W>=0;W-=3)D[X++]=M[W],D[X++]=M[W+1]-B,D[X++]=M[W+2]-B,D[X++]=X;T.push(new Qt(D,M[2]-B,i)),E.push(B-k)}}function d(k,v){return(T,E,M)=>{let z=0,$=T.length-1,D,B;if($>=0&&(D=T[$])instanceof j){if(!$&&D.type==k&&D.length==M)return D;(B=D.prop(L.lookAhead))&&(z=E[$]+D.length+B)}return m(k,T,E,M,z,v)}}function p(k,v,T,E,M,z,$,D,B){let W=[],X=[];for(;k.length>E;)W.push(k.pop()),X.push(v.pop()+T-M);k.push(m(i.types[$],W,X,z-M,D-z,B)),v.push(M-T)}function m(k,v,T,E,M,z,$){if(z){let D=[L.contextHash,z];$=$?[D].concat($):[D]}if(M>25){let D=[L.lookAhead,M];$=$?[D].concat($):[D]}return new j(k,v,T,E,$)}function g(k,v){let T=l.fork(),E=0,M=0,z=0,$=T.end-s,D={size:0,start:0,skip:0};e:for(let B=T.pos-k;T.pos>B;){let W=T.size;if(T.id==v&&W>=0){D.size=E,D.start=M,D.skip=z,z+=4,E+=4,T.next();continue}let X=T.pos-W;if(W<0||X=o?4:0,oe=T.start;for(T.next();T.pos>X;){if(T.size<0)if(T.size==-3)ne+=4;else break e;else T.id>=o&&(ne+=4);T.next()}M=oe,E+=W,z+=ne}return(v<0||E==k)&&(D.size=E,D.start=M,D.skip=z),D.size>4?D:void 0}function y(k,v,T){let{id:E,start:M,end:z,size:$}=l;if(l.next(),$>=0&&E4){let B=l.pos-($-4);for(;l.pos>B;)T=y(k,v,T)}v[--T]=D,v[--T]=z-k,v[--T]=M-k,v[--T]=E}else $==-3?h=E:$==-4&&(c=E);return T}let S=[],x=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,S,x,-1,0);let w=(e=n.length)!==null&&e!==void 0?e:S.length?x[0]+S[0].length:0;return new j(a[n.topID],S.reverse(),x.reverse(),w)}const pa=new WeakMap;function Yn(n,e){if(!n.isAnonymous||e instanceof Qt||e.type!=n)return 1;let t=pa.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof j)){t=1;break}t+=Yn(n,i)}pa.set(e,t)}return t}function Wo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;v+=T}if(x==w+1){if(v>c){let T=p[w];d(T.children,T.positions,0,T.children.length,m[w]+S);continue}f.push(p[w])}else{let T=m[x-1]+p[x-1].length-k;f.push(Wo(n,p,m,w,x,k,T,null,a))}u.push(k+S-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class jm{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Je?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ae&&this.map.set(e.tree,t)}get(e){return e instanceof Je?this.getBuffer(e.context.buffer,e.index):e instanceof Ae?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class It{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new It(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new It(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Ks(s.from,s.to)):[new Ks(0,0)]:[new Ks(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Gm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new L({perNode:!0});let Zm=0;class qe{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Zm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof qe&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new qe(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new fs(e);return i=>i.modified.indexOf(t)>-1?i:fs.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}}let Ym=0;class fs{constructor(e){this.name=e,this.instances=[],this.id=Ym++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Km(t,l.modified));if(i)return i;let s=[],r=new qe(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=Jm(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(fs.get(l,a));return r}}function Km(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Jm(n){let e=[[]];for(let t=0;ti.length-t.length)}function zo(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new _i(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Yc.add(e)}const Yc=new L({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new _i(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class _i{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function eg(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function tg(n,e,t,i=0,s=n.length){let r=new ig(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class ig{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=ng(e)||_i.empty,f=eg(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(L.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let S=g=x||!e.nextSibling())););if(!S||x>i)break;y=S.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,S.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function ng(n){let e=n.type.prop(Yc);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const C=qe.define,En=C(),bt=C(),ma=C(bt),ga=C(bt),St=C(),qn=C(St),Js=C(St),Ge=C(),Et=C(Ge),He=C(),je=C(),lo=C(),ki=C(lo),$n=C(),O={comment:En,lineComment:C(En),blockComment:C(En),docComment:C(En),name:bt,variableName:C(bt),typeName:ma,tagName:C(ma),propertyName:ga,attributeName:C(ga),className:C(bt),labelName:C(bt),namespace:C(bt),macroName:C(bt),literal:St,string:qn,docString:C(qn),character:C(qn),attributeValue:C(qn),number:Js,integer:C(Js),float:C(Js),bool:C(St),regexp:C(St),escape:C(St),color:C(St),url:C(St),keyword:He,self:C(He),null:C(He),atom:C(He),unit:C(He),modifier:C(He),operatorKeyword:C(He),controlKeyword:C(He),definitionKeyword:C(He),moduleKeyword:C(He),operator:je,derefOperator:C(je),arithmeticOperator:C(je),logicOperator:C(je),bitwiseOperator:C(je),compareOperator:C(je),updateOperator:C(je),definitionOperator:C(je),typeOperator:C(je),controlOperator:C(je),punctuation:lo,separator:C(lo),bracket:ki,angleBracket:C(ki),squareBracket:C(ki),paren:C(ki),brace:C(ki),content:Ge,heading:Et,heading1:C(Et),heading2:C(Et),heading3:C(Et),heading4:C(Et),heading5:C(Et),heading6:C(Et),contentSeparator:C(Ge),list:C(Ge),quote:C(Ge),emphasis:C(Ge),strong:C(Ge),link:C(Ge),monospace:C(Ge),strikethrough:C(Ge),inserted:C(),deleted:C(),changed:C(),invalid:C(),meta:$n,documentMeta:C($n),annotation:C($n),processingInstruction:C($n),definition:qe.defineModifier("definition"),constant:qe.defineModifier("constant"),function:qe.defineModifier("function"),standard:qe.defineModifier("standard"),local:qe.defineModifier("local"),special:qe.defineModifier("special")};for(let n in O){let e=O[n];e instanceof qe&&(e.name=n)}Kc([{tag:O.link,class:"tok-link"},{tag:O.heading,class:"tok-heading"},{tag:O.emphasis,class:"tok-emphasis"},{tag:O.strong,class:"tok-strong"},{tag:O.keyword,class:"tok-keyword"},{tag:O.atom,class:"tok-atom"},{tag:O.bool,class:"tok-bool"},{tag:O.url,class:"tok-url"},{tag:O.labelName,class:"tok-labelName"},{tag:O.inserted,class:"tok-inserted"},{tag:O.deleted,class:"tok-deleted"},{tag:O.literal,class:"tok-literal"},{tag:O.string,class:"tok-string"},{tag:O.number,class:"tok-number"},{tag:[O.regexp,O.escape,O.special(O.string)],class:"tok-string2"},{tag:O.variableName,class:"tok-variableName"},{tag:O.local(O.variableName),class:"tok-variableName tok-local"},{tag:O.definition(O.variableName),class:"tok-variableName tok-definition"},{tag:O.special(O.variableName),class:"tok-variableName2"},{tag:O.definition(O.propertyName),class:"tok-propertyName tok-definition"},{tag:O.typeName,class:"tok-typeName"},{tag:O.namespace,class:"tok-namespace"},{tag:O.className,class:"tok-className"},{tag:O.macroName,class:"tok-macroName"},{tag:O.propertyName,class:"tok-propertyName"},{tag:O.operator,class:"tok-operator"},{tag:O.comment,class:"tok-comment"},{tag:O.meta,class:"tok-meta"},{tag:O.invalid,class:"tok-invalid"},{tag:O.punctuation,class:"tok-punctuation"}]);var er;const Lt=new L;function Jc(n){return A.define({combine:n?e=>e.concat(n):void 0})}const sg=new L;class $e{constructor(e,t,i=[],s=""){this.data=e,this.name=s,I.prototype.hasOwnProperty("tree")||Object.defineProperty(I.prototype,"tree",{get(){return ae(this)}}),this.parser=t,this.extension=[At.of(this),I.languageData.of((r,o,l)=>{let a=Oa(r,o,l),h=a.type.prop(Lt);if(!h)return[];let c=r.facet(h),f=a.type.prop(sg);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Oa(e,t,i).type.prop(Lt)==this.data}findRegions(e){let t=e.facet(At);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Lt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(L.mounted);if(l){if(l.tree.prop(Lt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Ui(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ae(n){let e=n.field($e.state,!1);return e?e.tree:j.empty}class rg{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let wi=null;class ui{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new ui(e,t,[],j.empty,0,i,[],null)}startParse(){return this.parser.startParse(new rg(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=j.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(It.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=wi;wi=this;try{return e()}finally{wi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ya(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=It.applyChanges(i,a),s=j.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=ya(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Lo{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=wi;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new j(ve.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return wi}}function ya(n,e,t){return It.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class di{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new di(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=ui.create(e.facet(At).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new di(i)}}$e.state=he.define({create:di.init,update(n,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(At)!=e.state.facet(At)?di.init(e.state):n.apply(e)}});let ef=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ef=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const tr=typeof navigator<"u"&&(!((er=navigator.scheduling)===null||er===void 0)&&er.isInputPending)?()=>navigator.scheduling.isInputPending():null,og=J.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ef(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>tr&&tr()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new di(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Pe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),At=A.define({combine(n){return n.length?n[0]:null},enables:n=>[$e.state,og,P.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class tf{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const lg=A.define(),cn=A.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ut(n){let e=n.facet(cn);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Hi(n,e){let t="",i=n.tabSize,s=n.facet(cn)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?ag(n,t,e):null}class As{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ut(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return gi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ms=new L;function ag(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return nf(i,n,t)}function nf(n,e,t){for(let i=n;i;i=i.next){let s=cg(i.node);if(s)return s(Vo.create(e,t,i))}return 0}function hg(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function cg(n){let e=n.type.prop(Ms);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(L.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>sf(o,!0,1,void 0,r&&!hg(o)?s.from:void 0)}return n.parent==null?fg:null}function fg(){return 0}class Vo extends As{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Vo(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(ug(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return nf(this.context.next,this.base,this.pos)}}function ug(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function dg(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function ir({closing:n,align:e=!0,units:t=1}){return i=>sf(i,e,t,n)}function sf(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?dg(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}function ba({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const pg=200;function mg(){return I.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+pg)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=Io(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=Hi(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const gg=A.define(),No=new L;function rf(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function yg(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function us(n,e,t){for(let i of n.facet(gg)){let s=i(n,e,t);if(s)return s}return Og(n,e,t)}function of(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Rs=q.define({map:of}),fn=q.define({map:of});function lf(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Ht=he.define({create(){return R.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=Sa(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Rs)&&!bg(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(cf),s=i?R.replace({widget:new Cg(i(e.state,t.value))}):xa;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(fn)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=Sa(n,e.selection.main.head)),n},provide:n=>P.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{se&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function ds(n,e,t){var i;let s=null;return(i=n.field(Ht,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function bg(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function af(n,e){return n.field(Ht,!1)?e:e.concat(q.appendConfig.of(ff()))}const Sg=n=>{for(let e of lf(n)){let t=us(n.state,e.from,e.to);if(t)return n.dispatch({effects:af(n.state,[Rs.of(t),hf(n,t)])}),!0}return!1},xg=n=>{if(!n.state.field(Ht,!1))return!1;let e=[];for(let t of lf(n)){let i=ds(n.state,t.from,t.to);i&&e.push(fn.of(i),hf(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function hf(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return P.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const kg=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(Ht,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(fn.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},vg=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Sg},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xg},{key:"Ctrl-Alt-[",run:kg},{key:"Ctrl-Alt-]",run:wg}],Tg={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},cf=A.define({combine(n){return rt(n,Tg)}});function ff(n){return[Ht,Ag]}function uf(n,e){let{state:t}=n,i=t.facet(cf),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=ds(n.state,l.from,l.to);a&&n.dispatch({effects:fn.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const xa=R.replace({widget:new class extends ot{toDOM(n){return uf(n,null)}}});class Cg extends ot{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return uf(e,this.value)}}const Pg={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class nr extends yt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Qg(n={}){let e={...Pg,...n},t=new nr(e,!0),i=new nr(e,!1),s=J.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(At)!=o.state.facet(At)||o.startState.field(Ht,!1)!=o.state.field(Ht,!1)||ae(o.startState)!=ae(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new gt;for(let a of o.viewportLineBlocks){let h=ds(o.state,a.from,a.to)?i:us(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Rm({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||N.empty},initialSpacer(){return new nr(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=ds(o.state,l.from,l.to);if(h)return o.dispatch({effects:fn.of(h)}),!0;let c=us(o.state,l.from,l.to);return c?(o.dispatch({effects:Rs.of(c)}),!0):!1}}}),ff()]}const Ag=P.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class un{constructor(e,t){this.specs=e;let i;function s(l){let a=Tt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof $e?l=>l.prop(Lt)==o.data:o?l=>l==o:void 0,this.style=Kc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Tt(i):null,this.themeType=t.themeType}static define(e,t){return new un(e,t||{})}}const ao=A.define(),df=A.define({combine(n){return n.length?[n[0]]:null}});function sr(n){let e=n.facet(ao);return e.length?e:n.facet(df)}function pf(n,e){let t=[Rg],i;return n instanceof un&&(n.module&&t.push(P.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(df.of(n)):i?t.push(ao.computeN([P.darkTheme],s=>s.facet(P.darkTheme)==(i=="dark")?[n]:[])):t.push(ao.of(n)),t}class Mg{constructor(e){this.markCache=Object.create(null),this.tree=ae(e.state),this.decorations=this.buildDeco(e,sr(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=ae(e.state),i=sr(e.state),s=i!=sr(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return R.none;let i=new gt;for(let{from:s,to:r}of e.visibleRanges)tg(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},s,r);return i.finish()}}const Rg=Mt.high(J.fromClass(Mg,{decorations:n=>n.decorations})),Dg=un.define([{tag:O.meta,color:"#404740"},{tag:O.link,textDecoration:"underline"},{tag:O.heading,textDecoration:"underline",fontWeight:"bold"},{tag:O.emphasis,fontStyle:"italic"},{tag:O.strong,fontWeight:"bold"},{tag:O.strikethrough,textDecoration:"line-through"},{tag:O.keyword,color:"#708"},{tag:[O.atom,O.bool,O.url,O.contentSeparator,O.labelName],color:"#219"},{tag:[O.literal,O.inserted],color:"#164"},{tag:[O.string,O.deleted],color:"#a11"},{tag:[O.regexp,O.escape,O.special(O.string)],color:"#e40"},{tag:O.definition(O.variableName),color:"#00f"},{tag:O.local(O.variableName),color:"#30a"},{tag:[O.typeName,O.namespace],color:"#085"},{tag:O.className,color:"#167"},{tag:[O.special(O.variableName),O.macroName],color:"#256"},{tag:O.definition(O.propertyName),color:"#00c"},{tag:O.comment,color:"#940"},{tag:O.invalid,color:"#f00"}]),Eg=P.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),mf=1e4,gf="()[]{}",Of=A.define({combine(n){return rt(n,{afterCursor:!0,brackets:gf,maxScanDistance:mf,renderMatch:Bg})}}),qg=R.mark({class:"cm-matchingBracket"}),$g=R.mark({class:"cm-nonmatchingBracket"});function Bg(n){let e=[],t=n.matched?qg:$g;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Wg=he.define({create(){return R.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(Of);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=et(e.state,s.head,-1,i)||s.head>0&&et(e.state,s.head-1,1,i)||i.afterCursor&&(et(e.state,s.head,1,i)||s.headP.decorations.from(n)}),Lg=[Wg,Eg];function zg(n={}){return[Of.of(n),Lg]}const Ig=new L;function ho(n,e,t){let i=n.prop(e<0?L.openedBy:L.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function co(n){let e=n.type.prop(Ig);return e?e(n.node):n}function et(n,e,t,i={}){let s=i.maxScanDistance||mf,r=i.brackets||gf,o=ae(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=ho(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return Vg(n,e,t,a,c,h,r)}}return Ng(n,e,t,o,l.type,s,r)}function Vg(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function ka(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Xg(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Fg,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||Fo,mergeTokens:n.mergeTokens!==!1}}function Fg(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const wa=new WeakMap;class bf extends $e{constructor(e){let t=Jc(e.languageData),i=Xg(e),s,r=new class extends Lo{createParse(o,l,a){return new Ug(s,o,l,a)}};super(t,r,[],e.name),this.topNode=Gg(t,this),s=this,this.streamParser=i,this.stateAfter=new L({perNode:!0}),this.tokenTable=e.tokenTable?new wf(i.tokenTable):jg}static define(e){return new bf(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=wa.get(e.state),t!=null&&t1e4)return null;for(;r=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof j&&a=e.length)return e;!s&&t==0&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&Xo(n,r.tree,0-r.offset,t,l),h;if(a&&a.pos<=i&&(h=Sf(n,r.tree,t+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(s?Ut(s):4),tree:j.empty}}let Ug=class{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=ui.get(),o=s[0].from,{state:l,tree:a}=_g(e,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Ut(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=ui.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` -`&&(t="");else{let i=t.indexOf(` -`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(t,s,1),t+=s;let l=this.chunk.length;s=this.skipGapsTo(i,s,-1),i+=s,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,r),s}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new yf(t,e?e.state.tabSize:4,e?Ut(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=xf(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const Fo=Object.create(null),ji=[ve.none],Hg=new Qs(ji),va=[],Ta=Object.create(null),kf=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])kf[n]=vf(Fo,e);class wf{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kf)}resolve(e){return e?this.table[e]||(this.table[e]=vf(this.extra,e)):0}}const jg=new wf(Fo);function rr(n,e){va.indexOf(n)>-1||(va.push(n),console.warn(e))}function vf(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):rr(h,`Modifier ${h} used at start of tag`):a.length?rr(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:rr(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Ta[s];if(r)return r.id;let o=Ta[s]=ve.define({id:ji.length,name:i,props:[zo({[i]:t})]});return ji.push(o),o.id}function Gg(n,e){let t=ve.define({id:ji.length,name:"Document",props:[Lt.add(()=>n),Ms.add(()=>i=>e.getIndent(i))],top:!0});return ji.push(t),t}Z.RTL,Z.LTR;const Zg=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Uo(n.state,t.from);return i.line?Yg(n):i.block?Jg(n):!1};function _o(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Yg=_o(iO,0),Kg=_o(Tf,0),Jg=_o((n,e)=>Tf(n,e,tO(e)),0);function Uo(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const vi=50;function eO(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-vi,i),o=n.sliceDoc(s,s+vi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*vi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+vi),f=n.sliceDoc(s-vi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function tO(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function Tf(n,e,t=e.selection.ranges){let i=t.map(r=>Uo(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>eO(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const fo=st.define(),nO=st.define(),sO=A.define(),Cf=A.define({combine(n){return rt(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),Pf=he.define({create(){return tt.empty},update(n,e){let t=e.state.facet(Cf),i=e.annotation(fo);if(i){let a=Qe.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=ps(c,c.length,t.minDepth,a):c=Mf(c,e.startState.selection),new tt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(nO);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(ie.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Qe.fromTransaction(e),o=e.annotation(ie.time),l=e.annotation(ie.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new tt(n.done.map(Qe.fromJSON),n.undone.map(Qe.fromJSON))}});function rO(n={}){return[Pf,Cf.of(n),P.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Qf:e.inputType=="historyRedo"?uo:null;return i?(e.preventDefault(),i(t)):!1}})]}function Ds(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Pf,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Qf=Ds(0,!1),uo=Ds(1,!1),oO=Ds(0,!0),lO=Ds(1,!0);class Qe{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new Qe(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Qe(e.changes&&se.fromJSON(e.changes),[],e.mapped&&it.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Be;for(let s of e.startState.facet(sO)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new Qe(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Be)}static selection(e){return new Qe(void 0,Be,void 0,void 0,e)}}function ps(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function aO(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function hO(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Af(n,e){return n.length?e.length?n.concat(e):n:e}const Be=[],cO=200;function Mf(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-cO));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),ps(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Qe.selection([e])]}function fO(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function or(n,e){if(!n.length)return n;let t=n.length,i=Be;for(;t;){let s=uO(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[Qe.selection(i)]:Be}function uO(n,e,t){let i=Af(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Be,t);if(!n.changes)return Qe.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Qe(s,q.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const dO=/^(input\.type|delete)($|\.)/;class tt{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new tt(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||dO.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Es(t,e))}function be(n){return n.textDirectionAt(n.state.selection.main.head)==Z.LTR}const Df=n=>Rf(n,!be(n)),Ef=n=>Rf(n,be(n));function qf(n,e){return Fe(n,t=>t.empty?n.moveByGroup(t,e):Es(t,e))}const mO=n=>qf(n,!be(n)),gO=n=>qf(n,be(n));function OO(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function qs(n,e,t){let i=ae(n).resolveInner(e.head),s=t?L.closedBy:L.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;OO(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?et(n,i.from,1):et(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,b.cursor(l,t?-1:1)}const yO=n=>Fe(n,e=>qs(n.state,e,!be(n))),bO=n=>Fe(n,e=>qs(n.state,e,be(n)));function $f(n,e){return Fe(n,t=>{if(!t.empty)return Es(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Bf=n=>$f(n,!1),Wf=n=>$f(n,!0);function Lf(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Es(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomzf(n,!1),po=n=>zf(n,!0);function Rt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=b.cursor(i.from+r))}return s}const SO=n=>Fe(n,e=>Rt(n,e,!0)),xO=n=>Fe(n,e=>Rt(n,e,!1)),kO=n=>Fe(n,e=>Rt(n,e,!be(n))),wO=n=>Fe(n,e=>Rt(n,e,be(n))),vO=n=>Fe(n,e=>b.cursor(n.lineBlockAt(e.head).from,1)),TO=n=>Fe(n,e=>b.cursor(n.lineBlockAt(e.head).to,-1));function CO(n,e,t){let i=!1,s=Oi(n.selection,r=>{let o=et(n,r.head,-1)||et(n,r.head,1)||r.head>0&&et(n,r.head-1,1)||r.headCO(n,e);function Ie(n,e){let t=Oi(n.state.selection,i=>{let s=e(i);return b.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Xe(n.state,t)),!0)}function If(n,e){return Ie(n,t=>n.moveByChar(t,e))}const Vf=n=>If(n,!be(n)),Nf=n=>If(n,be(n));function Xf(n,e){return Ie(n,t=>n.moveByGroup(t,e))}const QO=n=>Xf(n,!be(n)),AO=n=>Xf(n,be(n)),MO=n=>Ie(n,e=>qs(n.state,e,!be(n))),RO=n=>Ie(n,e=>qs(n.state,e,be(n)));function Ff(n,e){return Ie(n,t=>n.moveVertically(t,e))}const _f=n=>Ff(n,!1),Uf=n=>Ff(n,!0);function Hf(n,e){return Ie(n,t=>n.moveVertically(t,e,Lf(n).height))}const Pa=n=>Hf(n,!1),Qa=n=>Hf(n,!0),DO=n=>Ie(n,e=>Rt(n,e,!0)),EO=n=>Ie(n,e=>Rt(n,e,!1)),qO=n=>Ie(n,e=>Rt(n,e,!be(n))),$O=n=>Ie(n,e=>Rt(n,e,be(n))),BO=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).from)),WO=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).to)),Aa=({state:n,dispatch:e})=>(e(Xe(n,{anchor:0})),!0),Ma=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.doc.length})),!0),Ra=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.selection.main.anchor,head:0})),!0),Da=({state:n,dispatch:e})=>(e(Xe(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),LO=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),zO=({state:n,dispatch:e})=>{let t=$s(n).map(({from:i,to:s})=>b.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:b.create(t),userEvent:"select"})),!0},IO=({state:n,dispatch:e})=>{let t=Oi(n.selection,i=>{let s=ae(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return b.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Xe(n,t)),!0)};function jf(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(Xe(t,b.create(s,s.length-1))),!0)}const VO=n=>jf(n,!1),NO=n=>jf(n,!0),XO=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=b.create([t.main]):t.main.empty||(i=b.create([b.cursor(t.main.head)])),i?(e(Xe(n,i)),!0):!1};function dn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Bn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Bn(n,o,!1),l=Bn(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Gf=(n,e,t)=>dn(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sGf(n,!1,!0),Zf=n=>Gf(n,!0,!1),Yf=(n,e)=>dn(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=pe(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Kf=n=>Yf(n,!1),FO=n=>Yf(n,!0),_O=n=>dn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headdn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),HO=n=>dn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:V.of(["",""])},range:b.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},GO=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:pe(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:pe(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:b.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function $s(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Jf(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of $s(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(b.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(b.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:b.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZO=({state:n,dispatch:e})=>Jf(n,e,!1),YO=({state:n,dispatch:e})=>Jf(n,e,!0);function eu(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of $s(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const KO=({state:n,dispatch:e})=>eu(n,e,!1),JO=({state:n,dispatch:e})=>eu(n,e,!0),e0=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes($s(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function t0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ae(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(L.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const Ea=tu(!1),i0=tu(!0);function tu(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&t0(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new As(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=Io(h,r);for(c==null&&(c=gi(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const n0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new As(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Ho(n,(r,o,l)=>{let a=Io(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=Hi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(Ho(n,(t,i)=>{i.push({from:t.from,insert:n.facet(cn)})}),{userEvent:"input.indent"})),!0),nu=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Ho(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=gi(s,n.tabSize),o=0,l=Hi(n,Math.max(0,r-Ut(n)));for(;o(n.setTabFocusMode(),!0),r0=[{key:"Ctrl-b",run:Df,shift:Vf,preventDefault:!0},{key:"Ctrl-f",run:Ef,shift:Nf},{key:"Ctrl-p",run:Bf,shift:_f},{key:"Ctrl-n",run:Wf,shift:Uf},{key:"Ctrl-a",run:vO,shift:BO},{key:"Ctrl-e",run:TO,shift:WO},{key:"Ctrl-d",run:Zf},{key:"Ctrl-h",run:mo},{key:"Ctrl-k",run:_O},{key:"Ctrl-Alt-h",run:Kf},{key:"Ctrl-o",run:jO},{key:"Ctrl-t",run:GO},{key:"Ctrl-v",run:po}],o0=[{key:"ArrowLeft",run:Df,shift:Vf,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:mO,shift:QO,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:kO,shift:qO,preventDefault:!0},{key:"ArrowRight",run:Ef,shift:Nf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:gO,shift:AO,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wO,shift:$O,preventDefault:!0},{key:"ArrowUp",run:Bf,shift:_f,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Aa,shift:Ra},{mac:"Ctrl-ArrowUp",run:Ca,shift:Pa},{key:"ArrowDown",run:Wf,shift:Uf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Ma,shift:Da},{mac:"Ctrl-ArrowDown",run:po,shift:Qa},{key:"PageUp",run:Ca,shift:Pa},{key:"PageDown",run:po,shift:Qa},{key:"Home",run:xO,shift:EO,preventDefault:!0},{key:"Mod-Home",run:Aa,shift:Ra},{key:"End",run:SO,shift:DO,preventDefault:!0},{key:"Mod-End",run:Ma,shift:Da},{key:"Enter",run:Ea,shift:Ea},{key:"Mod-a",run:LO},{key:"Backspace",run:mo,shift:mo,preventDefault:!0},{key:"Delete",run:Zf,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kf,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:FO,preventDefault:!0},{mac:"Mod-Backspace",run:UO,preventDefault:!0},{mac:"Mod-Delete",run:HO,preventDefault:!0}].concat(r0.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),l0=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:yO,shift:MO},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:bO,shift:RO},{key:"Alt-ArrowUp",run:ZO},{key:"Shift-Alt-ArrowUp",run:KO},{key:"Alt-ArrowDown",run:YO},{key:"Shift-Alt-ArrowDown",run:JO},{key:"Mod-Alt-ArrowUp",run:VO},{key:"Mod-Alt-ArrowDown",run:NO},{key:"Escape",run:XO},{key:"Mod-Enter",run:i0},{key:"Alt-l",mac:"Ctrl-l",run:zO},{key:"Mod-i",run:IO,preventDefault:!0},{key:"Mod-[",run:nu},{key:"Mod-]",run:iu},{key:"Mod-Alt-\\",run:n0},{key:"Shift-Mod-k",run:e0},{key:"Shift-Mod-\\",run:PO},{key:"Mod-/",run:Zg},{key:"Alt-A",run:Kg},{key:"Ctrl-m",mac:"Shift-Alt-m",run:s0}].concat(o0),a0={key:"Tab",run:iu,shift:nu},qa=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class pi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(qa(l)):qa,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=So(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Ye(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=ms(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new si(t,e.sliceString(t,i));return lr.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=ms(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=si.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ru.prototype[Symbol.iterator]=ou.prototype[Symbol.iterator]=function(){return this});function h0(n){try{return new RegExp(n,jo),!0}catch{return!1}}function ms(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function go(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=U("input",{class:"cm-textfield",name:"line",value:e}),i=U("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),n.dispatch({effects:$i.of(!1)}),n.focus()):r.keyCode==13&&(r.preventDefault(),s())},onsubmit:r=>{r.preventDefault(),s()}},U("label",n.state.phrase("Go to line"),": ",t)," ",U("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),U("button",{name:"close",onclick:()=>{n.dispatch({effects:$i.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head),[,a,h,c,f]=r,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=b.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[$i.of(!1),P.scrollIntoView(m.from,{y:"center"})],selection:m}),n.focus()}return{dom:i}}const $i=q.define(),$a=he.define({create(){return!0},update(n,e){for(let t of e.effects)t.is($i)&&(n=t.value);return n},provide:n=>Xi.from(n,e=>e?go:null)}),c0=n=>{let e=Ni(n,go);if(!e){let t=[$i.of(!0)];n.state.field($a,!1)==null&&t.push(q.appendConfig.of([$a,f0])),n.dispatch({effects:t}),e=Ni(n,go)}return e&&e.dom.querySelector("input").select(),!0},f0=P.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),u0={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},d0=A.define({combine(n){return rt(n,u0,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function p0(n){return[b0,y0]}const m0=R.mark({class:"cm-selectionMatch"}),g0=R.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ba(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Y.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Y.Word)}function O0(n,e,t,i){return n(e.sliceDoc(t,t+1))==Y.Word&&n(e.sliceDoc(i-1,i))==Y.Word}const y0=J.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(d0),{state:t}=n,i=t.selection;if(i.ranges.length>1)return R.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return R.none;let a=t.wordAt(s.head);if(!a)return R.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return R.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Ba(o,t,s.from,s.to)&&O0(o,t,s.from,s.to)))return R.none}else if(r=t.sliceDoc(s.from,s.to),!r)return R.none}let l=[];for(let a of n.visibleRanges){let h=new pi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||Ba(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(g0.range(c,f)):(c>=s.to||f<=s.from)&&l.push(m0.range(c,f)),l.length>e.maxMatches))return R.none}}return R.set(l)}},{decorations:n=>n.decorations}),b0=P.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S0=({state:n,dispatch:e})=>{let{selection:t}=n,i=b.create(t.ranges.map(s=>n.wordAt(s.head)||b.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function x0(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new pi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new pi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const k0=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return S0({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=x0(n,i);return s?(e(n.update({selection:n.selection.addRange(b.range(s.from,s.to),!1),effects:P.scrollIntoView(s.to)})),!0):!1},yi=A.define({combine(n){return rt(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new q0(e),scrollToMatch:e=>P.scrollIntoView(e)})}});class lu{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||h0(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new C0(this):new v0(this)}getCursor(e,t=0,i){let s=e.doc?e:I.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Yt(this,s,t,i):Zt(this,s,t,i)}}class au{constructor(e){this.spec=e}}function Zt(n,e,t,i){return new pi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?w0(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function w0(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Zt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Yt(n,e,t,i){return new ru(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?T0(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function gs(n,e){return n.slice(pe(n,e,!1),e)}function Os(n,e){return n.slice(e,pe(n,e))}function T0(n){return(e,t,i)=>!i[0].length||(n(gs(i.input,i.index))!=Y.Word||n(Os(i.input,i.index))!=Y.Word)&&(n(Os(i.input,i.index+i[0].length))!=Y.Word||n(gs(i.input,i.index+i[0].length))!=Y.Word)}class C0 extends au{nextMatch(e,t,i){let s=Yt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Yt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Yt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Yt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Gi=q.define(),Go=q.define(),vt=he.define({create(n){return new ar(Oo(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Gi)?n=new ar(t.value.create(),n.panel):t.is(Go)&&(n=new ar(n.query,t.value?Zo:null));return n},provide:n=>Xi.from(n,e=>e.panel)});class ar{constructor(e,t){this.query=e,this.panel=t}}const P0=R.mark({class:"cm-searchMatch"}),Q0=R.mark({class:"cm-searchMatch cm-searchMatch-selected"}),A0=J.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(vt))}update(n){let e=n.state.field(vt);(e!=n.startState.field(vt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return R.none;let{view:t}=this,i=new gt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Q0:P0)})}return i.finish()}},{decorations:n=>n.decorations});function pn(n){return e=>{let t=e.state.field(vt,!1);return t&&t.query.spec.valid?n(e,t):fu(e)}}const ys=pn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=b.single(i.from,i.to),r=n.state.facet(yi);return n.dispatch({selection:s,effects:[Yo(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),cu(n),!0}),bs=pn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=b.single(s.from,s.to),o=n.state.facet(yi);return n.dispatch({selection:r,effects:[Yo(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),cu(n),!0}),M0=pn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),R0=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new pi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(b.range(l.value.from,l.value.to))}return e(n.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},Wa=pn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(P.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let f=n.state.changes(l);return o&&(a=b.single(o.from,o.to).map(f),c.push(Yo(n,o)),c.push(t.facet(yi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),D0=pn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:P.announce.of(i),userEvent:"input.replace.all"}),!0});function Zo(n){return n.state.facet(yi).createPanel(n)}function Oo(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(yi);return new lu({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function hu(n){let e=Ni(n,Zo);return e&&e.dom.querySelector("[main-field]")}function cu(n){let e=hu(n);e&&e==n.root.activeElement&&e.select()}const fu=n=>{let e=n.state.field(vt,!1);if(e&&e.panel){let t=hu(n);if(t&&t!=n.root.activeElement){let i=Oo(n.state,e.query.spec);i.valid&&n.dispatch({effects:Gi.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Go.of(!0),e?Gi.of(Oo(n.state,e.query.spec)):q.appendConfig.of(B0)]});return!0},uu=n=>{let e=n.state.field(vt,!1);if(!e||!e.panel)return!1;let t=Ni(n,Zo);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Go.of(!1)}),!0},E0=[{key:"Mod-f",run:fu,scope:"editor search-panel"},{key:"F3",run:ys,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ys,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:uu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:R0},{key:"Mod-Alt-g",run:c0},{key:"Mod-d",run:k0,preventDefault:!0}];class q0{constructor(e){this.view=e;let t=this.query=e.state.field(vt).query.spec;this.commit=this.commit.bind(this),this.searchField=U("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=U("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=U("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=U("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=U("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return U("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=U("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ys(e),[Me(e,"next")]),i("prev",()=>bs(e),[Me(e,"previous")]),i("select",()=>M0(e),[Me(e,"all")]),U("label",null,[this.caseField,Me(e,"match case")]),U("label",null,[this.reField,Me(e,"regexp")]),U("label",null,[this.wordField,Me(e,"by word")]),...e.state.readOnly?[]:[U("br"),this.replaceField,i("replace",()=>Wa(e),[Me(e,"replace")]),i("replaceAll",()=>D0(e),[Me(e,"replace all")])],U("button",{name:"close",onclick:()=>uu(e),"aria-label":Me(e,"close"),type:"button"},["×"])])}commit(){let e=new lu({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Gi.of(e)}))}keydown(e){zp(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?bs:ys)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wa(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Gi)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(yi).top}}function Me(n,e){return n.state.phrase(e)}const Wn=30,Ln=/[\s\.,:;?!]/;function Yo(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Wn),o=Math.min(s,t+Wn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Wn;a--)if(!Ln.test(l[a-1])&&Ln.test(l[a])){l=l.slice(0,a);break}}return P.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const $0=P.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),B0=[vt,Mt.low(A0),$0];class du{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ae(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(mu(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function La(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function W0(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:W0(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function L0(n,e){return t=>{for(let i=ae(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class za{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Vt(n){return n.selection.main.from}function mu(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Ko=st.define();function z0(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:b.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Ia=new WeakMap;function I0(n){if(!Array.isArray(n))return n;let e=Ia.get(n);return e||Ia.set(n,e=pu(n)),e}const Ss=q.define(),Zi=q.define();class V0{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(v=So(k))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!S||T==1&&g||w==0&&T!=0)&&(t[f]==k||i[f]==k&&(u=!0)?o[f++]=S:o.length&&(y=!1)),w=T,S+=Ye(k)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?Ye(Te(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class N0{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:X0,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Va(e(i),t(i)),optionClass:(e,t)=>i=>Va(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Va(n,e){return n?e?n+" "+e:n:e}function X0(n,e,t,i,s,r){let o=n.textDirection==Z.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||S>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function F0(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function hr(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class _0{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(le);this.optionContent=F0(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=hr(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(le).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Zi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=hr(r.length,o,e.state.facet(le).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=hr(t.options.length,t.selected,this.view.state.facet(le).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Pe(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&H0(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew _0(t,n,e)}function H0(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function Na(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function j0(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(le);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new za(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new N0(u):new V0(u);for(let m of c.result.options)if(d=p.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new za(m,c.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:S}=m.section;s||(s=Object.create(null)),s[S]=Math.max(y,s[S]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):Na(c.completion)>Na(a)&&(l[l.length-1]=c),a=c.completion}return l}class ei{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ei(this.options,Xa(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=j0(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(le).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:ey,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new ei(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ei(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class xs{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new xs(K0,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(le),r=(i.override||t.languageDataAt("autocomplete",Vt(t)).map(I0)).map(a=>(this.active.find(c=>c.source==a)||new We(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(Jo));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!G0(r,this.active)||l?o=ei.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new We(a.source,0):a));for(let a of e.effects)a.is(Ou)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new xs(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Z0:Y0}}function G0(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const K0=[];function gu(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Ko);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class We{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=gu(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new We(s.source,0)),i&4&&s.state==0&&(s=new We(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(Ss))s=new We(s.source,1,r.value);else if(r.is(Zi))s=new We(s.source,0);else if(r.is(Jo))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Vt(e.state))}}class ri extends We{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Vt(e.state);if(l>o||!s||t&2&&(Vt(e.startState)==this.from||lt.map(e))}}),Ou=q.define(),Ce=he.define({create(){return xs.start()},update(n,e){return n.update(e)},provide:n=>[qo.from(n,e=>e.tooltip),P.contentAttributes.from(n,e=>e.attrs)]});function el(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Ce).active.find(s=>s.source==e.source);return i instanceof ri?(typeof t=="string"?n.dispatch({...z0(n.state,t,i.from,i.to),annotations:Ko.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const ey=U0(Ce,el);function zn(n,e="option"){return t=>{let i=t.state.field(Ce,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:Ou.of(l)}),!0}}const ty=n=>{let e=n.state.field(Ce,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Ce,!1)?(n.dispatch({effects:Ss.of(!0)}),!0):!1,iy=n=>{let e=n.state.field(Ce,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Zi.of(null)}),!0)};class ny{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const sy=50,ry=1e3,oy=J.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Ce).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Ce),t=n.state.facet(le);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ce)==e)return;let i=n.transactions.some(r=>{let o=gu(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rsy&&Date.now()-o.time>ry){for(let l of o.context.abortListeners)try{l()}catch(a){Pe(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(Ss)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Ce);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Vt(e),i=new du(e,t,n.explicit,this.view),s=new ny(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Zi.of(null)}),Pe(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(le),i=this.view.state.field(Ce);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new We(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Jo.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Ce,!1);if(e&&e.tooltip&&this.view.state.facet(le).closeOnBlur){let t=e.open&&Xc(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Zi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ss.of(!1)}),20),this.composing=0}}}),ly=typeof navigator=="object"&&/Win/.test(navigator.platform),ay=Mt.highest(P.domEventHandlers({keydown(n,e){let t=e.state.field(Ce,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(ly&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&el(e,i),!1}})),yu=P.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class hy{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class tl{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,de.TrackDel),i=e.mapPos(this.to,1,de.TrackDel);return t==null||i==null?null:new tl(this.field,t,i)}}class il{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew tl(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of s)if(f.line==i.length&&f.from>r.index){let u=r[2]?3+(r[1]||"").length:2;f.from-=u,f.to-=u}s.push(new hy(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new il(i,s)}}let cy=R.widget({widget:new class extends ot{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),fy=R.mark({class:"cm-snippetField"});class bi{constructor(e,t){this.ranges=e,this.active=t,this.deco=R.set(e.map(i=>(i.from==i.to?cy:fy).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new bi(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const mn=q.define({map(n,e){return n&&n.map(e)}}),uy=q.define(),Yi=he.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(mn))return t.value;if(t.is(uy)&&n)return new bi(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>P.decorations.from(n,e=>e?e.deco:R.none)});function nl(n,e){return b.create(n.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function dy(n){let e=il.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),{main:a}=t.state.selection,h={changes:{from:s,to:r==a.from?a.to:r,insert:V.of(o)},scrollIntoView:!0,annotations:i?[Ko.of(i),ie.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=nl(l,0)),l.some(c=>c.field>0)){let c=new bi(l,0),f=h.effects=[mn.of(c)];t.state.field(Yi,!1)===void 0&&f.push(q.appendConfig.of([Yi,yy,by,yu]))}t.dispatch(t.state.update(h))}}function bu(n){return({state:e,dispatch:t})=>{let i=e.field(Yi,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:nl(i.ranges,s),effects:mn.of(r?null:new bi(i.ranges,s)),scrollIntoView:!0})),!0}}const py=({state:n,dispatch:e})=>n.field(Yi,!1)?(e(n.update({effects:mn.of(null)})),!0):!1,my=bu(1),gy=bu(-1),Oy=[{key:"Tab",run:my,shift:gy},{key:"Escape",run:py}],Fa=A.define({combine(n){return n.length?n[0]:Oy}}),yy=Mt.highest(an.compute([Fa],n=>n.facet(Fa)));function lt(n,e){return{...e,apply:dy(n)}}const by=P.domEventHandlers({mousedown(n,e){let t=e.state.field(Yi,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:nl(t.ranges,s.field),effects:mn.of(t.ranges.some(r=>r.field>s.field)?new bi(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),Ki={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},zt=q.define({map(n,e){let t=e.mapPos(n,-1,de.TrackAfter);return t??void 0}}),sl=new class extends Nt{};sl.startSide=1;sl.endSide=-1;const Su=he.define({create(){return N.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(zt)&&(n=n.update({add:[sl.range(t.value,t.value+1)]}));return n}});function Sy(){return[ky,Su]}const fr="()[]{}<>«»»«[]{}";function xu(n){for(let e=0;e{if((xy?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Ye(Te(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Ty(n.state,i);return r?(n.dispatch(r),!0):!1}),wy=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ku(n,n.selection.main.head).brackets||Ki.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Cy(n.doc,o.head);for(let a of i)if(a==l&&Bs(n.doc,o.head)==xu(Te(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},vy=[{key:"Backspace",run:wy}];function Ty(n,e){let t=ku(n,n.selection.main.head),i=t.brackets||Ki.brackets;for(let s of i){let r=xu(Te(s,0));if(e==s)return r==s?Ay(n,s,i.indexOf(s+s+s)>-1,t):Py(n,s,r,t.before||Ki.before);if(e==r&&wu(n,n.selection.main.from))return Qy(n,s,r)}return null}function wu(n,e){let t=!1;return n.field(Su).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Bs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Ye(Te(t,0)))}function Cy(n,e){let t=n.sliceString(e-2,e);return Ye(Te(t,0))==t.length?t:t.slice(1)}function Py(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:zt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Bs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:zt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Qy(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Bs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ay(n,e,t,i){let s=i.stringPrefixes||Ki.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:zt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Bs(n.doc,a),c;if(h==e){if(_a(n,a))return{changes:{insert:e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)};if(wu(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=Ua(n,a-2*e.length,s))>-1&&_a(n,c))return{changes:{insert:e+e+e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=Y.Word&&Ua(n,a,s)>-1&&!My(n,a,e,s))return{changes:{insert:e+e,from:a},effects:zt.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _a(n,e){let t=ae(n).resolveInner(e+1);return t.parent&&t.from==e}function My(n,e,t,i){let s=ae(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Ua(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Y.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=Y.Word)return r}return-1}function Ry(n={}){return[ay,Ce,le.of(n),oy,Dy,yu]}const vu=[{key:"Ctrl-Space",run:cr},{mac:"Alt-`",run:cr},{mac:"Alt-i",run:cr},{key:"Escape",run:iy},{key:"ArrowDown",run:zn(!0)},{key:"ArrowUp",run:zn(!1)},{key:"PageDown",run:zn(!0,"page")},{key:"PageUp",run:zn(!1,"page")},{key:"Enter",run:ty}],Dy=Mt.highest(an.computeN([le],n=>n.facet(le).defaultKeymap?[vu]:[]));class Ha{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Bt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(Ji).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new gt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((x,w)=>Math.min(x,w.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;g=p.to,l.push(p),d++}for(;dx.from||x.to==m))l.push(x),d++,g=Math.min(x.to,g);else{g=Math.min(x.from,g);break}}g=Math.min(g,f);let y=!1;if(l.some(x=>x.from==m&&(x.to==g||g==f))&&(y=m==g,!y&&g-m<10)){let x=m-(c+h.value.length);x>0&&(h.next(x),c=m);for(let w=m;;){if(w>=g){y=!0;break}if(!h.lineBreak&&c+h.value.length>w)break;w=c+h.value.length,c+=h.value.length,h.next()}}let S=_y(l);if(y)o.add(m,m,R.widget({widget:new Vy(S),diagnostics:l.slice()}));else{let x=l.reduce((w,k)=>k.markClass?w+" "+k.markClass:w,"");o.add(m,g,R.mark({class:"cm-lintRange cm-lintRange-"+S+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>g)}))}if(a=g,a==f)break;for(let x=0;x{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Ha(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Ha(i.from,r,i.diagnostic)}}),i}function Ey(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(Ji).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Tu))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function qy(n,e){return n.field(Ee,!1)?e:e.concat(q.appendConfig.of(Uy))}const Tu=q.define(),rl=q.define(),Cu=q.define(),Ee=he.define({create(){return new Bt(R.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=mi(t,n.selected.diagnostic,r)||mi(t,null,r)}!t.size&&s&&e.state.facet(Ji).autoPanel&&(s=null),n=new Bt(t,s,i)}for(let t of e.effects)if(t.is(Tu)){let i=e.state.facet(Ji).autoPanel?t.value.length?en.open:null:n.panel;n=Bt.init(t.value,i,e.state)}else t.is(rl)?n=new Bt(n.diagnostics,t.value?en.open:null,n.selected):t.is(Cu)&&(n=new Bt(n.diagnostics,n.panel,t.value));return n},provide:n=>[Xi.from(n,e=>e.panel),P.decorations.from(n,e=>e.diagnostics)]}),$y=R.mark({class:"cm-lintRange cm-lintRange-active"});function By(n,e,t){let{diagnostics:i}=n.state.field(Ee),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(eQu(n,t,!1)))}const Ly=n=>{let e=n.state.field(Ee,!1);(!e||!e.panel)&&n.dispatch({effects:qy(n.state,[rl.of(!0)])});let t=Ni(n,en.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},ja=n=>{let e=n.state.field(Ee,!1);return!e||!e.panel?!1:(n.dispatch({effects:rl.of(!1)}),!0)},zy=n=>{let e=n.state.field(Ee,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},Iy=[{key:"Mod-Shift-m",run:Ly,preventDefault:!0},{key:"F8",run:zy}],Ji=A.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...rt(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ga,tooltipFilter:Ga,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function Ga(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function Pu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Qu(n,e,t){var i;let s=t?Pu(e.actions):[];return U("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},U("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=mi(n.state.field(Ee).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),U("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return U("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&U("div",{class:"cm-diagnosticSource"},e.source))}class Vy extends ot{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return U("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Za{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Qu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class en{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)ja(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Pu(r.actions);for(let l=0;l{for(let r=0;rja(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ee).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ee),i=mi(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Cu.of(i)})}static open(e){return new en(e)}}function Ny(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function In(n){return Ny(``,'width="6" height="3"')}const Xy=P.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:In("#d11")},".cm-lintRange-warning":{backgroundImage:In("orange")},".cm-lintRange-info":{backgroundImage:In("#999")},".cm-lintRange-hint":{backgroundImage:In("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Fy(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function _y(n){let e="hint",t=1;for(let i of n){let s=Fy(i.severity);s>t&&(t=s,e=i.severity)}return e}const Uy=[Ee,P.decorations.compute([Ee],n=>{let{selected:e,panel:t}=n.field(Ee);return!e||!t||e.from==e.to?R.none:R.set([$y.range(e.from,e.to)])}),Pm(By,{hideOn:Ey}),Xy];var Ya=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(vy)),e.defaultKeymap!==!1&&(i=i.concat(l0)),e.searchKeymap!==!1&&(i=i.concat(E0)),e.historyKeymap!==!1&&(i=i.concat(pO)),e.foldKeymap!==!1&&(i=i.concat(vg)),e.completionKeymap!==!1&&(i=i.concat(vu)),e.lintKeymap!==!1&&(i=i.concat(Iy));var s=[];return e.lineNumbers!==!1&&s.push(Lm()),e.highlightActiveLineGutter!==!1&&s.push(Vm()),e.highlightSpecialChars!==!1&&s.push(im()),e.history!==!1&&s.push(rO()),e.foldGutter!==!1&&s.push(Qg()),e.drawSelection!==!1&&s.push(_p()),e.dropCursor!==!1&&s.push(Zp()),e.allowMultipleSelections!==!1&&s.push(I.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(mg()),e.syntaxHighlighting!==!1&&s.push(pf(Dg,{fallback:!0})),e.bracketMatching!==!1&&s.push(zg()),e.closeBrackets!==!1&&s.push(Sy()),e.autocompletion!==!1&&s.push(Ry()),e.rectangularSelection!==!1&&s.push(gm()),t!==!1&&s.push(bm()),e.highlightActiveLine!==!1&&s.push(am()),e.highlightSelectionMatches!==!1&&s.push(p0()),e.tabSize&&typeof e.tabSize=="number"&&s.push(cn.of(" ".repeat(e.tabSize))),s.concat([an.of(i.flat())]).filter(Boolean)};const Hy="#e5c07b",Ka="#e06c75",jy="#56b6c2",Gy="#ffffff",Kn="#abb2bf",yo="#7d8799",Zy="#61afef",Yy="#98c379",Ja="#d19a66",Ky="#c678dd",Jy="#21252b",eh="#2c313a",th="#282c34",ur="#353a42",e1="#3E4451",ih="#528bff",t1=P.theme({"&":{color:Kn,backgroundColor:th},".cm-content":{caretColor:ih},".cm-cursor, .cm-dropCursor":{borderLeftColor:ih},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:e1},".cm-panels":{backgroundColor:Jy,color:Kn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:th,color:yo,border:"none"},".cm-activeLineGutter":{backgroundColor:eh},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ur},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ur,borderBottomColor:ur},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:eh,color:Kn}}},{dark:!0}),i1=un.define([{tag:O.keyword,color:Ky},{tag:[O.name,O.deleted,O.character,O.propertyName,O.macroName],color:Ka},{tag:[O.function(O.variableName),O.labelName],color:Zy},{tag:[O.color,O.constant(O.name),O.standard(O.name)],color:Ja},{tag:[O.definition(O.name),O.separator],color:Kn},{tag:[O.typeName,O.className,O.number,O.changed,O.annotation,O.modifier,O.self,O.namespace],color:Hy},{tag:[O.operator,O.operatorKeyword,O.url,O.escape,O.regexp,O.link,O.special(O.string)],color:jy},{tag:[O.meta,O.comment],color:yo},{tag:O.strong,fontWeight:"bold"},{tag:O.emphasis,fontStyle:"italic"},{tag:O.strikethrough,textDecoration:"line-through"},{tag:O.link,color:yo,textDecoration:"underline"},{tag:O.heading,fontWeight:"bold",color:Ka},{tag:[O.atom,O.bool,O.special(O.variableName)],color:Ja},{tag:[O.processingInstruction,O.string,O.inserted],color:Yy},{tag:O.invalid,color:Gy}]),n1=[t1,pf(i1)];var s1=P.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),r1=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:i=!0,readOnly:s=!1,theme:r="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(t&&a.unshift(an.of([a0])),l&&(typeof l=="boolean"?a.unshift(Ya()):a.unshift(Ya(l))),o&&a.unshift(um(o)),r){case"light":a.push(s1);break;case"dark":a.push(n1);break;case"none":break;default:a.push(r);break}return i===!1&&a.push(P.editable.of(!1)),s&&a.push(I.readOnly.of(!0)),[...a]},o1=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class l1{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class nh{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var dr=null,a1=()=>typeof window>"u"?new nh:(dr||(dr=new nh),dr),sh=st.define(),h1=200,c1=[];function f1(n){var{value:e,selection:t,onChange:i,onStatistics:s,onCreateEditor:r,onUpdate:o,extensions:l=c1,autoFocus:a,theme:h="light",height:c=null,minHeight:f=null,maxHeight:u=null,width:d=null,minWidth:p=null,maxWidth:m=null,placeholder:g="",editable:y=!0,readOnly:S=!1,indentWithTab:x=!0,basicSetup:w=!0,root:k,initialState:v}=n,[T,E]=Se.useState(),[M,z]=Se.useState(),[$,D]=Se.useState(),B=Se.useState(()=>({current:null}))[0],W=Se.useState(()=>({current:null}))[0],X=P.theme({"&":{height:c,minHeight:f,maxHeight:u,width:d,minWidth:p,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),ne=P.updateListener.of(F=>{if(F.docChanged&&typeof i=="function"&&!F.transactions.some(ge=>ge.annotation(sh))){B.current?B.current.reset():(B.current=new l1(()=>{if(W.current){var ge=W.current;W.current=null,ge()}B.current=null},h1),a1().add(B.current));var ee=F.state.doc,ce=ee.toString();i(ce,F)}s&&s(o1(F))}),oe=r1({theme:h,editable:y,readOnly:S,placeholder:g,indentWithTab:x,basicSetup:w}),me=[ne,X,...oe];return o&&typeof o=="function"&&me.push(P.updateListener.of(o)),me=me.concat(l),Se.useLayoutEffect(()=>{if(T&&!$){var F={doc:e,selection:t,extensions:me},ee=v?I.fromJSON(v.json,F,v.fields):I.create(F);if(D(ee),!M){var ce=new P({state:ee,parent:T,root:k});z(ce),r&&r(ce,ee)}}return()=>{M&&(D(void 0),z(void 0))}},[T,$]),Se.useEffect(()=>{n.container&&E(n.container)},[n.container]),Se.useEffect(()=>()=>{M&&(M.destroy(),z(void 0)),B.current&&(B.current.cancel(),B.current=null)},[M]),Se.useEffect(()=>{a&&M&&M.focus()},[a,M]),Se.useEffect(()=>{M&&M.dispatch({effects:q.reconfigure.of(me)})},[h,l,c,f,u,d,p,m,g,y,S,x,w,i,o]),Se.useEffect(()=>{if(e!==void 0){var F=M?M.state.doc.toString():"";if(M&&e!==F){var ee=B.current&&!B.current.isDone,ce=()=>{M&&e!==M.state.doc.toString()&&M.dispatch({changes:{from:0,to:M.state.doc.toString().length,insert:e||""},annotations:[sh.of(!0)]})};ee?W.current=ce:ce()}}},[e,M]),{state:$,setState:D,view:M,setView:z,container:T,setContainer:E}}var u1=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],d1=Se.forwardRef((n,e)=>{var{className:t,value:i="",selection:s,extensions:r=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,autoFocus:c,theme:f="light",height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:S,placeholder:x,indentWithTab:w,editable:k,readOnly:v,root:T,initialState:E}=n,M=Iu(n,u1),z=Se.useRef(null),{state:$,view:D,container:B,setContainer:W}=f1({root:T,value:i,autoFocus:c,theme:f,height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:S,placeholder:x,indentWithTab:w,editable:k,readOnly:v,selection:s,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,extensions:r,initialState:E});Se.useImperativeHandle(e,()=>({editor:z.current,state:$,view:D}),[z,B,$,D]);var X=Se.useCallback(oe=>{z.current=oe,W(oe)},[W]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var ne=typeof f=="string"?"cm-theme-"+f:"cm-theme";return zu.jsx("div",xr({ref:X,className:""+ne+(t?" "+t:"")},M))});d1.displayName="CodeMirror";var rh={};class ks{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new ks(e,[],t,i,i,0,[],0,s?new oh(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;(s>this.pos||t<=o.maxNode)&&(this.pos=s,o.stateFlag(r,1)||(this.reducePos=s)),this.pushState(r,i),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,s,4)}else this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4)}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new ks(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new p1(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class oh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class p1{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class ws{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ws(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ws(this.stack,this.pos,this.index)}}function Vn(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class Jn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const lh=new Jn;class m1{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=lh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=lh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class oi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;g1(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}oi.prototype.contextual=oi.prototype.fallback=oi.prototype.extend=!1;oi.prototype.fallback=oi.prototype.extend=!1;class Ws{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function g1(n,e,t,i,s,r){let o=0,l=1<0){let p=n[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||O1(p,e.token.value,s,r))){e.acceptToken(p);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1,p=h+d+(d<<1),m=n[p],g=n[p+1]||65536;if(c=g)f=d+1;else{o=n[p+2],e.advance();continue e}}break}}function ah(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function O1(n,e,t,i){let s=ah(t,i,e);return s<0||ah(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class y1{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?hh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof j){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class b1{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Jn)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Jn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Jn,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new y1(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&w1(s);if(o)return Re&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Re&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return Re&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(L.contextHash)||0)==c))return e.useNode(f,u),Re&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof j)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof j&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),Re&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hs?t.push(p):i.push(p)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return ch(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),Re&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(Re&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)Re&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))Re&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Re&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),ch(l,i)):(!s||s.scoren;class k1{constructor(e){this.start=e.start,this.shift=e.shift||mr,this.reduce=e.reduce||mr,this.reuse=e.reuse||mr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class tn extends Lo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new Qs(t.map((l,a)=>ve.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Hc;let o=Vn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new oi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new S1(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ut(this.data,r+2);else break;s=t(ut(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ut(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(tn.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=fh(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const v1=1,Au=194,Mu=195,T1=196,uh=197,C1=198,P1=199,Q1=200,A1=2,Ru=3,dh=201,M1=24,R1=25,D1=49,E1=50,q1=55,$1=56,B1=57,W1=59,L1=60,z1=61,I1=62,V1=63,N1=65,X1=238,F1=71,_1=241,U1=242,H1=243,j1=244,G1=245,Z1=246,Y1=247,K1=248,Du=72,J1=249,eb=250,tb=251,ib=252,nb=253,sb=254,rb=255,ob=256,lb=73,ab=77,hb=263,cb=112,fb=130,ub=151,db=152,pb=155,jt=10,nn=13,ol=32,Ls=9,ll=35,mb=40,gb=46,bo=123,ph=125,Eu=39,qu=34,mh=92,Ob=111,yb=120,bb=78,Sb=117,xb=85,kb=new Set([R1,D1,E1,hb,N1,fb,$1,B1,X1,I1,V1,Du,lb,ab,L1,z1,ub,db,pb,cb]);function gr(n){return n==jt||n==nn}function Or(n){return n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102}const wb=new Ws((n,e)=>{let t;if(n.next<0)n.acceptToken(P1);else if(e.context.flags&es)gr(n.next)&&n.acceptToken(C1,1);else if(((t=n.peek(-1))<0||gr(t))&&e.canShift(uh)){let i=0;for(;n.next==ol||n.next==Ls;)n.advance(),i++;(n.next==jt||n.next==nn||n.next==ll)&&n.acceptToken(uh,-i)}else gr(n.next)&&n.acceptToken(T1,1)},{contextual:!0}),vb=new Ws((n,e)=>{let t=e.context;if(t.flags)return;let i=n.peek(-1);if(i==jt||i==nn){let s=0,r=0;for(;;){if(n.next==ol)s++;else if(n.next==Ls)s+=8-s%8;else break;n.advance(),r++}s!=t.indent&&n.next!=jt&&n.next!=nn&&n.next!=ll&&(s[n,e|$u])),Pb=new k1({start:Tb,reduce(n,e,t,i){return n.flags&es&&kb.has(e)||(e==F1||e==Du)&&n.flags&$u?n.parent:n},shift(n,e,t,i){return e==Au?new ts(n,Cb(i.read(i.pos,t.pos)),0):e==Mu?n.parent:e==M1||e==q1||e==W1||e==Ru?new ts(n,0,es):gh.has(e)?new ts(n,0,gh.get(e)|n.flags&es):n},hash(n){return n.hash}}),Qb=new Ws(n=>{for(let e=0;e<5;e++){if(n.next!="print".charCodeAt(e))return;n.advance()}if(!/\w/.test(String.fromCharCode(n.next)))for(let e=0;;e++){let t=n.peek(e);if(!(t==ol||t==Ls)){t!=mb&&t!=gb&&t!=jt&&t!=nn&&t!=ll&&n.acceptToken(v1);return}}}),Ab=new Ws((n,e)=>{let{flags:t}=e.context,i=t&at?qu:Eu,s=(t&ht)>0,r=!(t&ct),o=(t&ft)>0,l=n.pos;for(;!(n.next<0);)if(o&&n.next==bo)if(n.peek(1)==bo)n.advance(2);else{if(n.pos==l){n.acceptToken(Ru,1);return}break}else if(r&&n.next==mh){if(n.pos==l){n.advance();let a=n.next;a>=0&&(n.advance(),Mb(n,a)),n.acceptToken(A1);return}break}else if(n.next==mh&&!r&&n.peek(1)>-1)n.advance(2);else if(n.next==i&&(!s||n.peek(1)==i&&n.peek(2)==i)){if(n.pos==l){n.acceptToken(dh,s?3:1);return}break}else if(n.next==jt){if(s)n.advance();else if(n.pos==l){n.acceptToken(dh);return}break}else n.advance();n.pos>l&&n.acceptToken(Q1)});function Mb(n,e){if(e==Ob)for(let t=0;t<2&&n.next>=48&&n.next<=55;t++)n.advance();else if(e==yb)for(let t=0;t<2&&Or(n.next);t++)n.advance();else if(e==Sb)for(let t=0;t<4&&Or(n.next);t++)n.advance();else if(e==xb)for(let t=0;t<8&&Or(n.next);t++)n.advance();else if(e==bb&&n.next==bo){for(n.advance();n.next>=0&&n.next!=ph&&n.next!=Eu&&n.next!=qu&&n.next!=jt;)n.advance();n.next==ph&&n.advance()}}const Rb=zo({'async "*" "**" FormatConversion FormatSpec':O.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":O.controlKeyword,"in not and or is del":O.operatorKeyword,"from def class global nonlocal lambda":O.definitionKeyword,import:O.moduleKeyword,"with as print":O.keyword,Boolean:O.bool,None:O.null,VariableName:O.variableName,"CallExpression/VariableName":O.function(O.variableName),"FunctionDefinition/VariableName":O.function(O.definition(O.variableName)),"ClassDefinition/VariableName":O.definition(O.className),PropertyName:O.propertyName,"CallExpression/MemberExpression/PropertyName":O.function(O.propertyName),Comment:O.lineComment,Number:O.number,String:O.string,FormatString:O.special(O.string),Escape:O.escape,UpdateOp:O.updateOperator,"ArithOp!":O.arithmeticOperator,BitOp:O.bitwiseOperator,CompareOp:O.compareOperator,AssignOp:O.definitionOperator,Ellipsis:O.punctuation,At:O.meta,"( )":O.paren,"[ ]":O.squareBracket,"{ }":O.brace,".":O.derefOperator,", ;":O.separator}),Db={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Eb=tn.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Qb,vb,wb,Ab,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:n=>Db[n]||-1}],tokenPrec:7668}),Oh=new jm,Bu=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Nn(n){return(e,t,i)=>{if(i)return!1;let s=e.node.getChild("VariableName");return s&&t(s,n),!0}}const qb={FunctionDefinition:Nn("function"),ClassDefinition:Nn("class"),ForStatement(n,e,t){if(t){for(let i=n.node.firstChild;i;i=i.nextSibling)if(i.name=="VariableName")e(i,"variable");else if(i.name=="in")break}},ImportStatement(n,e){var t,i;let{node:s}=n,r=((t=s.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=s.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((i=o.nextSibling)===null||i===void 0?void 0:i.name)!="as"&&e(o,r?"variable":"namespace")},AssignStatement(n,e){for(let t=n.node.firstChild;t;t=t.nextSibling)if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break},ParamList(n,e){for(let t=null,i=n.node.firstChild;i;i=i.nextSibling)i.name=="VariableName"&&(!t||!/\*|AssignOp/.test(t.name))&&e(i,"variable"),t=i},CapturePattern:Nn("variable"),AsPattern:Nn("variable"),__proto__:null};function Wu(n,e){let t=Oh.get(e);if(t)return t;let i=[],s=!0;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(re.IncludeAnonymous).iterate(o=>{if(o.name){let l=qb[o.name];if(l&&l(o,r,s)||!s&&Bu.has(o.name))return!1;s=!1}else if(o.to-o.from>8192){for(let l of Wu(n,o.node))i.push(l);return!1}}),Oh.set(e,i),i}const yh=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Lu=["String","FormatString","Comment","PropertyName"];function $b(n){let e=ae(n.state).resolveInner(n.pos,-1);if(Lu.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&yh.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)Bu.has(s.name)&&(i=i.concat(Wu(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:yh}}const Bb=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(n=>({label:n,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(n=>({label:n,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(n=>({label:n,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(n=>({label:n,type:"function"}))),Wb=[lt("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),lt("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),lt("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),lt("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),lt(`if \${}: - -`,{label:"if",detail:"block",type:"keyword"}),lt("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),lt("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),lt("import ${module}",{label:"import",detail:"statement",type:"keyword"}),lt("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Lb=L0(Lu,pu(Bb.concat(Wb)));function yr(n){let{node:e,pos:t}=n,i=n.lineIndent(t,-1),s=null;for(;;){let r=e.childBefore(t);if(r)if(r.name=="Comment")t=r.from;else if(r.name=="Body"||r.name=="MatchBody")n.baseIndentFor(r)+n.unit<=i&&(s=r),e=r;else if(r.name=="MatchClause")e=r;else if(r.type.is("Statement"))e=r;else break;else break}return s}function br(n,e){let t=n.baseIndentFor(e),i=n.lineAt(n.pos,-1),s=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&n.node.tot?null:t+n.unit}const Sr=Ui.define({name:"python",parser:Eb.configure({props:[Ms.add({Body:n=>{var e;let t=/^\s*(#|$)/.test(n.textAfter)&&yr(n)||n.node;return(e=br(n,t))!==null&&e!==void 0?e:n.continue()},MatchBody:n=>{var e;let t=yr(n);return(e=br(n,t||n.node))!==null&&e!==void 0?e:n.continue()},IfStatement:n=>/^\s*(else:|elif )/.test(n.textAfter)?n.baseIndent:n.continue(),"ForStatement WhileStatement":n=>/^\s*else:/.test(n.textAfter)?n.baseIndent:n.continue(),TryStatement:n=>/^\s*(except[ :]|finally:|else:)/.test(n.textAfter)?n.baseIndent:n.continue(),MatchStatement:n=>/^\s*case /.test(n.textAfter)?n.baseIndent+n.unit:n.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ir({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ir({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":ir({closing:"]"}),MemberExpression:n=>n.baseIndent+n.unit,"String FormatString":()=>null,Script:n=>{var e;let t=yr(n);return(e=t&&br(n,t))!==null&&e!==void 0?e:n.continue()}}),No.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":rf,Body:(n,e)=>({from:n.from+1,to:n.to-(n.to==e.doc.length?0:1)}),"String FormatString":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Hb(){return new tf(Sr,[Sr.data.of({autocomplete:$b}),Sr.data.of({autocomplete:Lb})])}const zb=zo({String:O.string,Number:O.number,"True False":O.bool,PropertyName:O.propertyName,Null:O.null,", :":O.separator,"[ ]":O.squareBracket,"{ }":O.brace}),Ib=tn.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[zb],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),jb=()=>n=>{try{JSON.parse(n.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=Vb(e,n.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function Vb(n,e){let t;return(t=n.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=n.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const Nb=Ui.define({name:"json",parser:Ib.configure({props:[Ms.add({Object:ba({except:/^\s*\}/}),Array:ba({except:/^\s*\]/})}),No.add({"Object Array":rf})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Gb(){return new tf(Nb)}export{P as E,d1 as R,bf as S,jb as a,Gb as j,n1 as o,Hb as p}; diff --git a/webui/dist/assets/dnd-BiPfFtVp.js b/webui/dist/assets/dnd-BiPfFtVp.js deleted file mode 100644 index 2cb9ef46..00000000 --- a/webui/dist/assets/dnd-BiPfFtVp.js +++ /dev/null @@ -1,5 +0,0 @@ -import{r as c,R as P,b as Oe}from"./router-9vIXuQkh.js";function Sn(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function bt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:bt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Wt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:bt(e)?wt(e)?e:Be(e)||Wt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function mt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Je(e){const t=mt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ft(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function Ht(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Ht(1),ze=Ht(-1);function In(e){return"clientX"in e&&"clientY"in e}function yt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ht(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return In(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Tt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function An(e){return e.matches(Tt)?e:e.querySelector(Tt)}const On={display:"none"};function Tn(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:On},n)}function Nn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Ln(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Kt=c.createContext(null);function kn(e){const t=c.useContext(Kt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function zn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Pn={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},Bn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Fn(e){let{announcements:t=Bn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Pn}=e;const{announce:i,announcement:s}=Ln(),a=$e("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),kn(c.useMemo(()=>({onDragStart(d){let{active:g}=d;i(t.onDragStart({active:g}))},onDragMove(d){let{active:g,over:h}=d;t.onDragMove&&i(t.onDragMove({active:g,over:h}))},onDragOver(d){let{active:g,over:h}=d;i(t.onDragOver({active:g,over:h}))},onDragEnd(d){let{active:g,over:h}=d;i(t.onDragEnd({active:g,over:h}))},onDragCancel(d){let{active:g,over:h}=d;i(t.onDragCancel({active:g,over:h}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement(Tn,{id:r,value:o.draggable}),P.createElement(Nn,{id:a,announcement:s}));return n?Oe.createPortal(f,n):f}var O;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(O||(O={}));function Qe(){}function ao(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function co(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const V=Object.freeze({x:0,y:0});function Vt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $n(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Nt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Gt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Lt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const lo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Lt(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Vt(Lt(l),o);i.push({id:a,data:{droppableContainer:s,value:u}})}}return i.sort(qt)},Xn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Nt(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Nt(l),f=o.reduce((g,h,C)=>g+Vt(u[C],h),0),d=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(qt)};function Yn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=Yn(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort($n)};function Un(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Jt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:V}function Wn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Hn=Wn(1);function Kn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Vn(e,t,n){const r=Kn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const qn={ignoreTransform:!1};function xe(e,t){t===void 0&&(t=qn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=Vn(n,u,f))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function kt(e){return xe(e,{ignoreTransform:!0})}function Gn(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Jn(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function _n(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(wt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Wt(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&_n(o,i)&&n.push(o),Jn(o,i)?n:r(o.parentNode)}return e?r(e):n}function _t(e){const[t]=nt(e,1);return t??null}function lt(e){return!tt||!e?null:me(e)?e:bt(e)?wt(e)||e===ye(e).scrollingElement?window:Be(e)?e:null:null}function Qt(e){return me(e)?e.scrollX:e.scrollLeft}function Zt(e){return me(e)?e.scrollY:e.scrollTop}function gt(e){return{x:Qt(e),y:Zt(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function en(e){return!tt||!e?!1:e===document.scrollingElement}function tn(e){const t={x:0,y:0},n=en(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const Qn={x:.2,y:.2};function Zn(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Qn);const{isTop:u,isBottom:f,isLeft:d,isRight:g}=tn(e),h={x:0,y:0},C={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(h.y=N.Backward,C.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(h.y=N.Forward,C.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!g&&a>=t.right-v.width?(h.x=N.Forward,C.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=N.Backward,C.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:C}}function er(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function nn(e){return e.reduce((t,n)=>we(t,gt(n)),V)}function tr(e){return e.reduce((t,n)=>t+Qt(n),0)}function nr(e){return e.reduce((t,n)=>t+Zt(n),0)}function rr(e,t){if(t===void 0&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);_t(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const or=[["x",["left","right"],tr],["y",["top","bottom"],nr]];class xt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=nn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of or)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ir(e){const{EventTarget:t}=B(e);return e instanceof t?e:ye(e)}function ut(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function zt(e){e.preventDefault()}function sr(e){e.stopPropagation()}var w;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(w||(w={}));const rn={start:[w.Space,w.Enter],cancel:[w.Esc],end:[w.Space,w.Enter,w.Tab]},ar=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case w.Right:return{...n,x:n.x+25};case w.Left:return{...n,x:n.x-25};case w.Down:return{...n,y:n.y+25};case w.Up:return{...n,y:n.y-25}}};class on{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(ye(n)),this.windowListeners=new Te(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&rr(r),n(V)}handleKeyDown(t){if(yt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=rn,coordinateGetter:s=ar,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:V;this.referenceCoordinates||(this.referenceCoordinates=f);const d=s(t,{active:n,context:r.current,currentCoordinates:f});if(d){const g=ze(d,f),h={x:0,y:0},{scrollableAncestors:C}=r.current;for(const v of C){const p=t.code,{isTop:m,isRight:y,isLeft:b,isBottom:R,maxScroll:S,minScroll:E}=tn(v),x=er(v),D={x:Math.min(p===w.Right?x.right-x.width/2:x.right,Math.max(p===w.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(p===w.Down?x.bottom-x.height/2:x.bottom,Math.max(p===w.Down?x.top:x.top+x.height/2,d.y))},A=p===w.Right&&!y||p===w.Left&&!b,T=p===w.Down&&!R||p===w.Up&&!m;if(A&&D.x!==d.x){const M=v.scrollLeft+g.x,H=p===w.Right&&M<=S.x||p===w.Left&&M>=E.x;if(H&&!g.y){v.scrollTo({left:M,behavior:a});return}H?h.x=v.scrollLeft-M:h.x=p===w.Right?v.scrollLeft-S.x:v.scrollLeft-E.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(T&&D.y!==d.y){const M=v.scrollTop+g.y,H=p===w.Down&&M<=S.y||p===w.Up&&M>=E.y;if(H&&!g.x){v.scrollTo({top:M,behavior:a});return}H?h.y=v.scrollTop-M:h.y=p===w.Down?v.scrollTop-S.y:v.scrollTop-E.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,we(ze(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}on.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=rn,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Pt(e){return!!(e&&"distance"in e)}function Bt(e){return!!(e&&"delay"in e)}class Dt{constructor(t,n,r){var o;r===void 0&&(r=ir(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=ye(s),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(B(s)),this.initialCoordinates=(o=ht(i))!=null?o:V,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,zt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,zt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Bt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Pt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,sr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=ht(t))!=null?n:V,u=ze(o,l);if(!r&&a){if(Pt(a)){if(a.tolerance!=null&&ut(u,a.tolerance))return this.handleCancel();if(ut(u,a.distance))return this.handleStart()}if(Bt(a)&&ut(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===w.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const cr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sn extends Dt{constructor(t){const{event:n}=t,r=ye(n.target);super(t,cr,r)}}sn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const lr={move:{name:"mousemove"},end:{name:"mouseup"}};var vt;(function(e){e[e.RightClick=2]="RightClick"})(vt||(vt={}));class ur extends Dt{constructor(t){super(t,lr,ye(t.event.target))}}ur.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===vt.RightClick?!1:(r?.({event:n}),!0)}}];const dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dr extends Dt{constructor(t){super(t,dt)}static setup(){return window.addEventListener(dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(dt.move.name,t)};function t(){}}}dr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ne;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ne||(Ne={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function fr(e){let{acceleration:t,activator:n=Ne.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Ze.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:g}=e;const h=gr({delta:d,disabled:!i}),[C,v]=En(),p=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),y=c.useMemo(()=>{switch(n){case Ne.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ne.DraggableRect:return o}},[n,o,l]),b=c.useRef(null),R=c.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),S=c.useMemo(()=>a===Ze.TreeOrder?[...u].reverse():u,[a,u]);c.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of S){if(r?.(E)===!1)continue;const x=u.indexOf(E),D=f[x];if(!D)continue;const{direction:A,speed:T}=Zn(E,D,y,t,g);for(const M of["x","y"])h[M][A[M]]||(T[M]=0,A[M]=0);if(T.x>0||T.y>0){v(),b.current=E,C(R,s),p.current=T,m.current=A;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,R,r,v,i,s,JSON.stringify(y),JSON.stringify(h),C,u,S,f,JSON.stringify(g)])}const hr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function gr(e){let{delta:t,disabled:n}=e;const r=ft(t);return Fe(o=>{if(n||!r||!o)return hr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||i.x===-1,[N.Forward]:o.x[N.Forward]||i.x===1},y:{[N.Backward]:o.y[N.Backward]||i.y===-1,[N.Forward]:o.y[N.Forward]||i.y===1}}},[n,t,r])}function vr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function pr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Pe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pe||(Pe={}));var pt;(function(e){e.Optimized="optimized"})(pt||(pt={}));const Ft=new Map;function br(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=c.useState(null),{frequency:a,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),g=ke(d),h=c.useCallback(function(m){m===void 0&&(m=[]),!g.current&&s(y=>y===null?m:y.concat(m.filter(b=>!y.includes(b))))},[g]),C=c.useRef(null),v=Fe(m=>{if(d&&!n)return Ft;if(!m||m===Ft||f.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const R=b.node.current,S=R?new xt(l(R),R):null;b.rect.current=S,S&&y.set(b.id,S)}return y}return m},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||h()},[n,d]),c.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof a!="number"||C.current!==null||(C.current=setTimeout(()=>{h(),C.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function p(){switch(u){case Pe.Always:return!1;case Pe.BeforeDragging:return n;default:return!n}}}function an(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function wr(e,t){return an(e,t)}function mr(e){let{callback:t,disabled:n}=e;const r=mt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=mt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function yr(e){return new xt(xe(e),e)}function $t(e,t,n){t===void 0&&(t=yr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const s=mr({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=rt({callback:i});return Q(()=>{i(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function xr(e){const t=an(e);return Jt(e,t)}const Xt=[];function Dr(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==Xt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Xt,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Cr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const s=lt(i.target);s&&n(a=>a?(a.set(s,gt(s)),new Map(a)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const u=lt(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,gt(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const u=lt(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>we(i,s),V):nn(e):V,[e,t])}function Yt(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==V;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):V}function Rr(e){c.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Sr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function cn(e){return c.useMemo(()=>e?Gn(e):null,[e])}const jt=[];function Er(e,t){t===void 0&&(t=xe);const[n]=e,r=cn(n?B(n):null),[o,i]=c.useState(jt);function s(){i(()=>e.length?e.map(l=>en(l)?r:new xt(t(l),l)):jt)}const a=rt({callback:s});return Q(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),o}function Ir(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Mr(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Be(f)){r(d=>{const g=t(f);return d?{...d,width:g.width,height:g.height}:g});break}},[t]),i=rt({callback:o}),s=c.useCallback(u=>{const f=Ir(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,l]=Je(s);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Ar=[{sensor:sn,options:{}},{sensor:on,options:{}}],Or={current:{}},Ge={draggable:{measure:kt},droppable:{measure:kt,strategy:Pe.WhileDragging,frequency:pt.Optimized},dragOverlay:{measure:xe}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Tr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ge,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},Nr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=c.createContext(Nr),ln=c.createContext(Tr);function Lr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function kr(e,t){switch(t.type){case O.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case O.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case O.DragEnd:case O.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case O.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Le(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case O.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function zr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(ot),i=ft(r),s=ft(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!yt(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=An(f);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function Pr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Br(e){return c.useMemo(()=>({draggable:{...Ge.draggable,...e?.draggable},droppable:{...Ge.droppable,...e?.droppable},dragOverlay:{...Ge.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;Q(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Jt(f,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const g=_t(u);g&&g.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const un=c.createContext({...V,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const uo=c.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:f=Ar,collisionDetection:d=jn,measuring:g,modifiers:h,...C}=t;const v=c.useReducer(kr,void 0,Lr),[p,m]=v,[y,b]=zn(),[R,S]=c.useState(ue.Uninitialized),E=R===ue.Initialized,{draggable:{active:x,nodes:D,translate:A},droppable:{containers:T}}=p,M=x!=null?D.get(x):null,H=c.useRef({initial:null,translated:null}),K=c.useMemo(()=>{var k;return x!=null?{id:x,data:(k=M?.data)!=null?k:Or,rect:H}:null},[x,M]),q=c.useRef(null),[De,Xe]=c.useState(null),[F,Ye]=c.useState(null),Z=ke(C,Object.values(C)),Ce=$e("DndDescribedBy",s),je=c.useMemo(()=>T.getEnabled(),[T]),z=Br(g),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Re}=br(je,{dragging:E,dependencies:[A.x,A.y],config:z.droppable}),j=vr(D,x),Ue=c.useMemo(()=>F?ht(F):null,[F]),oe=Rn(),te=wr(j,z.draggable.measure);Fr({activeNode:x!=null?D.get(x):null,config:oe.layoutShiftCompensation,initialRect:te,measure:z.draggable.measure});const I=$t(j,z.draggable.measure,te),Se=$t(j?j.parentElement:null),G=c.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=T.getNodeFor((n=G.current.over)==null?void 0:n.id),ne=Mr({measure:z.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:j,ge=E?(o=ne.rect)!=null?o:I:null,Ct=!!(ne.nodeRef.current&&ne.rect),Rt=xr(Ct?null:I),it=cn(he?B(he):null),ie=Dr(E?fe??j:null),We=Er(ie),He=Pr(h,{transform:{x:A.x-Rt.x,y:A.y-Rt.y,scaleX:1,scaleY:1},activatorEvent:F,active:K,activeNodeRect:I,containerNodeRect:Se,draggingNodeRect:ge,over:G.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:We,windowRect:it}),St=Ue?we(Ue,A):null,Et=Cr(ie),bn=Yt(Et),wn=Yt(Et,[I]),ve=we(He,bn),pe=ge?Hn(ge,He):null,Ee=K&&pe?d({active:K,collisionRect:pe,droppableRects:ee,droppableContainers:je,pointerCoordinates:St}):null,It=Gt(Ee,"id"),[se,Mt]=c.useState(null),mn=Ct?He:we(He,wn),yn=Un(mn,(i=se?.rect)!=null?i:null,I),st=c.useRef(null),At=c.useCallback((k,$)=>{let{sensor:X,options:ae}=$;if(q.current==null)return;const U=D.get(q.current);if(!U)return;const Y=k.nativeEvent,J=new X({active:q.current,activeNode:U,event:Y,options:ae,context:G,onAbort(L){if(!D.get(L))return;const{onDragAbort:_}=Z.current,re={id:L};_?.(re),y({type:"onDragAbort",event:re})},onPending(L,ce,_,re){if(!D.get(L))return;const{onDragPending:Me}=Z.current,le={id:L,constraint:ce,initialCoordinates:_,offset:re};Me?.(le),y({type:"onDragPending",event:le})},onStart(L){const ce=q.current;if(ce==null)return;const _=D.get(ce);if(!_)return;const{onDragStart:re}=Z.current,Ie={activatorEvent:Y,active:{id:ce,data:_.data,rect:H}};Oe.unstable_batchedUpdates(()=>{re?.(Ie),S(ue.Initializing),m({type:O.DragStart,initialCoordinates:L,active:ce}),y({type:"onDragStart",event:Ie}),Xe(st.current),Ye(Y)})},onMove(L){m({type:O.DragMove,coordinates:L})},onEnd:be(O.DragEnd),onCancel:be(O.DragCancel)});st.current=J;function be(L){return async function(){const{active:_,collisions:re,over:Ie,scrollAdjustedTranslate:Me}=G.current;let le=null;if(_&&Me){const{cancelDrop:Ae}=Z.current;le={activatorEvent:Y,active:_,collisions:re,delta:Me,over:Ie},L===O.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(le))&&(L=O.DragCancel)}q.current=null,Oe.unstable_batchedUpdates(()=>{m({type:L}),S(ue.Uninitialized),Mt(null),Xe(null),Ye(null),st.current=null;const Ae=L===O.DragEnd?"onDragEnd":"onDragCancel";if(le){const at=Z.current[Ae];at?.(le),y({type:Ae,event:le})}})}}},[D]),xn=c.useCallback((k,$)=>(X,ae)=>{const U=X.nativeEvent,Y=D.get(ae);if(q.current!==null||!Y||U.dndKit||U.defaultPrevented)return;const J={active:Y};k(X,$.options,J)===!0&&(U.dndKit={capturedBy:$.sensor},q.current=ae,At(X,$))},[D,At]),Ot=pr(f,xn);Rr(f),Q(()=>{I&&R===ue.Initializing&&S(ue.Initialized)},[I,R]),c.useEffect(()=>{const{onDragMove:k}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:U}=G.current;if(!$||!X)return;const Y={active:$,activatorEvent:X,collisions:ae,delta:{x:ve.x,y:ve.y},over:U};Oe.unstable_batchedUpdates(()=>{k?.(Y),y({type:"onDragMove",event:Y})})},[ve.x,ve.y]),c.useEffect(()=>{const{active:k,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:U}=G.current;if(!k||q.current==null||!$||!U)return;const{onDragOver:Y}=Z.current,J=ae.get(It),be=J&&J.rect.current?{id:J.id,rect:J.rect.current,data:J.data,disabled:J.disabled}:null,L={active:k,activatorEvent:$,collisions:X,delta:{x:U.x,y:U.y},over:be};Oe.unstable_batchedUpdates(()=>{Mt(be),Y?.(L),y({type:"onDragOver",event:L})})},[It]),Q(()=>{G.current={activatorEvent:F,active:K,activeNode:j,collisionRect:pe,collisions:Ee,droppableRects:ee,draggableNodes:D,draggingNode:he,draggingNodeRect:ge,droppableContainers:T,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:ve},H.current={initial:ge,translated:pe}},[K,j,Ee,pe,D,he,ge,ee,T,se,ie,ve]),fr({...oe,delta:A,draggingRect:pe,pointerCoordinates:St,scrollableAncestors:ie,scrollableAncestorRects:We});const Dn=c.useMemo(()=>({active:K,activeNode:j,activeNodeRect:I,activatorEvent:F,collisions:Ee,containerNodeRect:Se,dragOverlay:ne,draggableNodes:D,droppableContainers:T,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:We,measuringConfiguration:z,measuringScheduled:Re,windowRect:it}),[K,j,I,F,Ee,Se,ne,D,T,ee,se,de,ie,We,z,Re,it]),Cn=c.useMemo(()=>({activatorEvent:F,activators:Ot,active:K,activeNodeRect:I,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:se,measureDroppableContainers:de}),[F,Ot,K,I,m,Ce,D,se,de]);return P.createElement(Kt.Provider,{value:b},P.createElement(ot.Provider,{value:Cn},P.createElement(ln.Provider,{value:Dn},P.createElement(un.Provider,{value:yn},u)),P.createElement(zr,{disabled:a?.restoreFocus===!1})),P.createElement(Fn,{...a,hiddenTextDescribedById:Ce}));function Rn(){const k=De?.autoScrollEnabled===!1,$=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!k&&!$;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),$r=c.createContext(null),Ut="button",Xr="Draggable";function Yr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(Xr),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:g}=c.useContext(ot),{role:h=Ut,roleDescription:C="draggable",tabIndex:v=0}=o??{},p=l?.id===t,m=c.useContext(p?un:$r),[y,b]=Je(),[R,S]=Je(),E=Sr(s,t),x=ke(n);Q(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:R,data:x}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const D=c.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&h===Ut?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,h,v,p,C,f.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:D,isDragging:p,listeners:r?void 0:E,node:y,over:g,setNodeRef:b,setActivatorNodeRef:S,transform:m}}function jr(){return c.useContext(ln)}const Ur="Droppable",Wr={timeout:25};function Hr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Ur),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=c.useContext(ot),f=c.useRef({disabled:n}),d=c.useRef(!1),g=c.useRef(null),h=c.useRef(null),{disabled:C,updateMeasurementsFor:v,timeout:p}={...Wr,...o},m=ke(v??r),y=c.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),h.current=null},p)},[p]),b=rt({callback:y,disabled:C||!s}),R=c.useCallback((D,A)=>{b&&(A&&(b.unobserve(A),d.current=!1),D&&b.observe(D))},[b]),[S,E]=Je(R),x=ke(t);return c.useEffect(()=>{!b||!S.current||(b.disconnect(),d.current=!1,b.observe(S.current))},[S,b]),c.useEffect(()=>(a({type:O.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:g,data:x}}),()=>a({type:O.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(a({type:O.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:s,rect:g,isOver:l?.id===r,node:S,over:l,setNodeRef:E}}function dn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Kr(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ke(e){return e!==null&&e>=0}function Vr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:s}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const l=Gr(n,s,o);if(s===o){const u=n[i];return u?{x:oo&&s<=i?{x:-a.width-l,y:0,...Ve}:s=i?{x:a.width+l,y:0,...Ve}:{x:0,y:0,...Ve}};function Gr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=dn(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},qe={scaleX:1,scaleY:1},ho=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const u=i[s];return u?{x:0,y:nn&&o<=s?{x:0,y:-a.height-l,...qe}:o=s?{x:0,y:a.height+l,...qe}:{x:0,y:0,...qe}};function Jr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?nr.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),C=s!=null,v=s?h.indexOf(s.id):-1,p=u?h.indexOf(u.id):-1,m=c.useRef(h),y=!Vr(h,m.current),b=p!==-1&&v===-1||y,R=qr(i);Q(()=>{y&&C&&f(h)},[y,h,C,f]),c.useEffect(()=>{m.current=h},[h]);const S=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:R,disableTransforms:b,items:h,overIndex:p,useDragOverlay:g,sortedRects:Kr(h,l),strategy:o}),[v,d,R.draggable,R.droppable,b,h,p,l,g,o]);return P.createElement(gn.Provider,{value:S},t)}const _r=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return dn(n,r,o).indexOf(t)},Qr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},Zr={duration:200,easing:"ease"},vn="transform",eo=_e.Transition.toString({property:vn,duration:0,easing:"linear"}),to={roleDescription:"sortable"};function no(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=c.useState(null),a=c.useRef(n);return Q(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const u=xe(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&s(f)}}n!==a.current&&(a.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&s(null)},[i]),i}function vo(e){let{animateLayoutChanges:t=Qr,attributes:n,disabled:r,data:o,getNewIndex:i=_r,id:s,strategy:a,resizeObserverConfig:l,transition:u=Zr}=e;const{items:f,containerId:d,activeIndex:g,disabled:h,disableTransforms:C,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:y}=c.useContext(gn),b=ro(r,h),R=f.indexOf(s),S=c.useMemo(()=>({sortable:{containerId:d,index:R,items:f},...o}),[d,o,R,f]),E=c.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:x,node:D,isOver:A,setNodeRef:T}=Hr({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:M,activatorEvent:H,activeNodeRect:K,attributes:q,setNodeRef:De,listeners:Xe,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Ce}=Yr({id:s,data:S,attributes:{...to,...n},disabled:b.draggable}),je=Sn(T,De),z=!!M,ee=z&&!C&&Ke(g)&&Ke(p),de=!m&&F,Re=de&&ee?Ce:null,Ue=ee?Re??(a??y)({rects:v,activeNodeRect:K,activeIndex:g,overIndex:p,index:R}):null,oe=Ke(g)&&Ke(p)?i({id:s,items:f,activeIndex:g,overIndex:p}):R,te=M?.id,I=c.useRef({activeId:te,items:f,newIndex:oe,containerId:d}),Se=f!==I.current.items,G=t({active:M,containerId:d,isDragging:F,isSorting:z,id:s,index:R,items:f,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:u,wasDragging:I.current.activeId!=null}),fe=no({disabled:!G,index:R,node:D,rect:x});return c.useEffect(()=>{z&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),f!==I.current.items&&(I.current.items=f)},[z,oe,d,f]),c.useEffect(()=>{if(te===I.current.activeId)return;if(te!=null&&I.current.activeId==null){I.current.activeId=te;return}const he=setTimeout(()=>{I.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:M,activeIndex:g,attributes:q,data:S,rect:x,index:R,newIndex:oe,items:f,isOver:A,isSorting:z,isDragging:F,listeners:Xe,node:D,overIndex:p,over:Ye,setNodeRef:je,setActivatorNodeRef:Z,setDroppableNodeRef:T,setDraggableNodeRef:De,transform:fe??Ue,transition:ne()};function ne(){if(fe||Se&&I.current.newIndex===R)return eo;if(!(de&&!yt(H)||!u)&&(z||G))return _e.Transition.toString({...u,property:vn})}}function ro(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const oo=[w.Down,w.Right,w.Up,w.Left],po=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(oo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const g=o.get(d.id);if(g)switch(e.code){case w.Down:r.topg.top&&l.push(d);break;case w.Left:r.left>g.left&&l.push(d);break;case w.Right:r.left1&&(f=u[1].id),f!=null){const d=i.get(n.id),g=i.get(f),h=g?o.get(g.id):null,C=g?.node.current;if(C&&h&&d&&g){const p=nt(C).some((E,x)=>a[x]!==E),m=pn(d,g),y=io(d,g),b=p||!m?{x:0,y:0}:{x:y?r.width-h.width:0,y:y?r.height-h.height:0},R={x:h.left,y:h.top};return b.x&&b.y?R:ze(R,b)}}}};function pn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function io(e,t){return!et(e)||!et(t)||!pn(e,t)?!1:e.data.current.sortable.indext.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=_(t);return a.charAt(0).toUpperCase()+a.slice(1)},k=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var m={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"};const v=h.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:n="",children:y,iconNode:r,...s},p)=>h.createElement("svg",{ref:p,...m,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:k("lucide",n),...!y&&!x(s)&&{"aria-hidden":"true"},...s},[...r.map(([i,l])=>h.createElement(i,l)),...Array.isArray(y)?y:[y]]));const e=(t,a)=>{const c=h.forwardRef(({className:o,...n},y)=>h.createElement(v,{ref:y,iconNode:a,className:k(`lucide-${M(d(t))}`,`lucide-${t}`,o),...n}));return c.displayName=d(t),c};const g=[["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"}]],V2=e("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],L2=e("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],H2=e("arrow-right",f);const w=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],S2=e("arrow-up-down",w);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],P2=e("arrow-up",N);const $=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],U2=e("at-sign",$);const z=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],T2=e("ban",z);const q=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],B2=e("book-open",q);const b=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],R2=e("bot",b);const C=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],D2=e("boxes",C);const j=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],E2=e("brain",j);const A=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],Z2=e("bug",A);const V=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],O2=e("calendar",V);const L=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],F2=e("chart-column",L);const H=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],G2=e("chart-pie",H);const S=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],I2=e("check",S);const P=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],W2=e("chevron-down",P);const U=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],K2=e("chevron-left",U);const T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Q2=e("chevron-right",T);const B=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],X2=e("chevron-up",B);const R=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],J2=e("chevrons-left",R);const D=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Y2=e("chevrons-right",D);const E=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],e0=e("chevrons-up-down",E);const Z=[["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"}]],a0=e("circle-alert",Z);const O=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],t0=e("circle-check-big",O);const F=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],c0=e("circle-check",F);const G=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],o0=e("circle-question-mark",G);const I=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],y0=e("circle-user-round",I);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],h0=e("circle-user",W);const K=[["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"}]],n0=e("circle-x",K);const Q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],s0=e("circle",Q);const X=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],d0=e("clipboard-check",X);const J=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],k0=e("clipboard-list",J);const Y=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],r0=e("clock",Y);const e1=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],p0=e("code-xml",e1);const a1=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],i0=e("container",a1);const t1=[["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"}]],l0=e("copy",t1);const c1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],M0=e("cpu",c1);const o1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],_0=e("database",o1);const y1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],x0=e("dollar-sign",y1);const h1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],m0=e("download",h1);const n1=[["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"}]],v0=e("ellipsis",n1);const s1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],g0=e("external-link",s1);const d1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],u0=e("eye-off",d1);const k1=[["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"}]],f0=e("eye",k1);const r1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]],w0=e("file-question-mark",r1);const p1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],N0=e("file-search",p1);const i1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],$0=e("file-text",i1);const l1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],z0=e("folder-open",l1);const M1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],q0=e("funnel",M1);const _1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],b0=e("git-branch",_1);const x1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],C0=e("globe",x1);const m1=[["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"}]],j0=e("graduation-cap",m1);const v1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],A0=e("grip-vertical",v1);const g1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],V0=e("hard-drive",g1);const u1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],L0=e("hash",u1);const f1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],H0=e("heart",f1);const w1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],S0=e("house",w1);const N1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],P0=e("image",N1);const $1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],U0=e("info",$1);const z1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],T0=e("key",z1);const q1=[["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"}]],B0=e("layers",q1);const b1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],R0=e("layout-grid",b1);const C1=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],D0=e("list-checks",C1);const j1=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],E0=e("list",j1);const A1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Z0=e("loader-circle",A1);const V1=[["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"}]],O0=e("lock-open",V1);const L1=[["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"}]],F0=e("lock",L1);const H1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],G0=e("log-out",H1);const S1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],I0=e("menu",S1);const P1=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],W0=e("message-circle",P1);const U1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],K0=e("message-square-text",U1);const T1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Q0=e("message-square",T1);const B1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],X0=e("moon",B1);const R1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],J0=e("network",R1);const D1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Y0=e("package",D1);const E1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ee=e("palette",E1);const Z1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],ae=e("panels-top-left",Z1);const O1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],te=e("pause",O1);const F1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ce=e("pen",F1);const G1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],oe=e("pencil",G1);const I1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ye=e("play",I1);const W1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],he=e("plus",W1);const K1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ne=e("power",K1);const Q1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],se=e("puzzle",Q1);const X1=[["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"}]],de=e("refresh-cw",X1);const J1=[["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"}]],ke=e("rotate-ccw",J1);const Y1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],re=e("rotate-cw",Y1);const e2=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],pe=e("save",e2);const a2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ie=e("search",a2);const t2=[["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"}]],le=e("send",t2);const c2=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Me=e("server",c2);const o2=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],_e=e("settings-2",o2);const y2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xe=e("settings",y2);const h2=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],me=e("share-2",h2);const n2=[["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"}]],ve=e("shield",n2);const s2=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],ge=e("skip-forward",s2);const d2=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ue=e("sliders-vertical",d2);const k2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],fe=e("smile",k2);const r2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],we=e("sparkles",r2);const p2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ne=e("square-pen",p2);const i2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$e=e("star",i2);const l2=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ze=e("sun",l2);const M2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],qe=e("tag",M2);const _2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],be=e("terminal",_2);const x2=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],Ce=e("thumbs-down",x2);const m2=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],je=e("thumbs-up",m2);const v2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ae=e("trash-2",v2);const g2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Ve=e("trending-up",g2);const u2=[["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"}]],Le=e("triangle-alert",u2);const f2=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],He=e("trophy",f2);const w2=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Se=e("type",w2);const N2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Pe=e("upload",N2);const $2=[["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"}]],Ue=e("user",$2);const z2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Te=e("users",z2);const q2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Be=e("wifi-off",q2);const b2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Re=e("wifi",b2);const C2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],De=e("x",C2);const j2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ee=e("zap",j2);export{S0 as $,V2 as A,T2 as B,a0 as C,x0 as D,v0 as E,$0 as F,X0 as G,V0 as H,U0 as I,F0 as J,T0 as K,Z0 as L,Q0 as M,o0 as N,be as O,ne as P,g0 as Q,de as R,ie as S,Ve as T,Ue as U,we as V,fe as W,De as X,ge as Y,Ee as Z,H2 as _,ke as a,G0 as a$,L2 as a0,he as a1,p0 as a2,N0 as a3,A0 as a4,pe as a5,ae as a6,oe as a7,J2 as a8,Y2 as a9,M0 as aA,K0 as aB,re as aC,_e as aD,$e as aE,R0 as aF,je as aG,Ce as aH,b0 as aI,y0 as aJ,Re as aK,Be as aL,ce as aM,le as aN,w0 as aO,U2 as aP,H0 as aQ,He as aR,S2 as aS,D2 as aT,h0 as aU,F2 as aV,P2 as aW,ue as aX,I0 as aY,G2 as aZ,B2 as a_,e0 as aa,me as ab,Y0 as ac,Me as ad,B0 as ae,D0 as af,qe as ag,j0 as ah,O0 as ai,i0 as aj,z0 as ak,P0 as al,q0 as am,Ne as an,L0 as ao,s0 as ap,W0 as aq,C0 as ar,Te as as,J0 as at,te as au,ye as av,O2 as aw,Se as ax,E2 as ay,t0 as az,c0 as b,Z2 as b0,I2 as c,W2 as d,X2 as e,K2 as f,Q2 as g,E0 as h,r0 as i,n0 as j,R2 as k,d0 as l,se as m,xe as n,k0 as o,_0 as p,ee as q,ve as r,Le as s,l0 as t,u0 as u,f0 as v,Ae as w,m0 as x,Pe as y,ze as z}; diff --git a/webui/dist/assets/index-DD4VGX3W.js b/webui/dist/assets/index-DD4VGX3W.js deleted file mode 100644 index d54d300c..00000000 --- a/webui/dist/assets/index-DD4VGX3W.js +++ /dev/null @@ -1,94 +0,0 @@ -import{r as u,j as e,L as Kn,e as ha,R as Bs,b as tw,f as aw,g as lw,h as nw,k as rw,l as lt,m as iw,n as cw,O as xj,o as ow}from"./router-9vIXuQkh.js";import{a as dw,b as uw,g as mw}from"./react-vendor-BmxF9s7Q.js";import{N as xw,c as hw,O as ti,P as fw,g as Em}from"./utils-BqoaXoQ1.js";import{L as hj,T as fj,C as pj,R as pw,a as gj,V as gw,b as jw,S as jj,c as vw,d as vj,I as Nw,e as Nj,f as bw,g as bj,h as yw,i as ww,j as _w,O as yj,P as Sw,k as wj,l as _j,D as Sj,A as kj,m as Cj,n as kw,o as Cw,p as Tj,q as Tw,r as Ej,s as Ew,t as Mw,u as Mj,v as Aw,w as zw,x as Aj,y as zj,F as Rj,z as Dj,B as Rw,E as Dw,G as Oj,H as Ow,J as Lw,K as Uw,M as $w,N as Bw,Q as Iw,U as Pw,W as Fw,X as Hw,Y as qw,Z as Vw,_ as Gw,$ as Kw,a0 as Qw,a1 as Yw,a2 as Lj,a3 as Jw,a4 as Xw}from"./radix-extra-DmmnfeQE.js";import{R as Uj,T as $j,L as Zw,g as Ww,C as Ji,X as Xi,Y as Gr,h as e1,B as Bo,j as Zi,P as s1,k as t1,l as a1}from"./charts-simvewUa.js";import{S as l1,O as Bj,o as n1,C as Ij,p as r1,T as Pj,D as Fj,R as i1,q as c1,H as Hj,I as o1,J as qj,K as d1,L as Vj,M as Gj,N as u1,Q as Kj,V as m1,U as Qj,X as Yj,Y as x1,Z as h1,_ as Jj,$ as f1,a0 as p1,a1 as Xj,a2 as g1,a3 as Zj,a4 as j1,a5 as v1,a6 as N1,e as Wj,f as ad,c as ld,P as ar,d as nd,b as _n,h as b1,l as y1,m as w1,u as Ym,r as _1,a as S1,a7 as ev,a8 as sv,a9 as tv,aa as av,ab as lv,ac as nv,ad as k1}from"./radix-core-DyJi0yyw.js";import{R as dt,a as rc,C as Ut,b as st,L as Fs,X as Sa,c as Ot,d as Ba,e as Xr,f as Pa,g as ra,E as C1,h as rv,Z as sl,i as da,j as ta,S as $t,B as iv,U as Fl,k as Yn,P as pc,l as cv,F as Ua,m as T1,n as Sn,o as E1,M as Ia,A as nx,D as M1,p as Zr,T as rx,q as A1,r as ov,I as Yt,s as Lt,t as qo,u as ic,v as ua,H as z1,w as os,x as na,y as cc,z as ix,G as tc,J as Jm,K as cx,N as ox,O as R1,Q as Io,V as D1,W as rd,Y as O1,_ as L1,$ as id,a0 as $a,a1 as Xs,a2 as dx,a3 as ux,a4 as dv,a5 as gc,a6 as uv,a7 as Zn,a8 as kn,a9 as Cn,aa as mx,ab as mv,ac as xa,ad as Hl,ae as Wn,af as er,ag as cd,ah as U1,ai as $1,aj as B1,ak as I1,al as xx,am as Po,an as sr,ao as Wr,ap as Vo,aq as P1,ar as Go,as as oc,at as xv,au as F1,av as H1,aw as Ko,ax as q1,ay as hx,az as Mg,aA as V1,aB as G1,aC as hv,aD as K1,aE as vn,aF as fv,aG as Mm,aH as Ag,aI as Q1,aJ as Am,aK as Y1,aL as J1,aM as X1,aN as Z1,aO as pv,aP as W1,aQ as ei,aR as e_,aS as s_,aT as gv,aU as jv,aV as t_,aW as a_,aX as zg,aY as l_,aZ as n_,a_ as r_,a$ as i_,b0 as c_}from"./icons-8bdCaZgy.js";import{S as o_,p as d_,j as u_,a as m_,E as zm,R as x_,o as h_}from"./codemirror-TZqPU532.js";import{u as vv,a as Qo,s as Nv,K as bv,P as yv,b as wv,D as _v,c as Sv,S as kv,v as f_,d as Cv,C as Tv,h as p_}from"./dnd-BiPfFtVp.js";import{_ as ka,c as g_,g as Ev,D as j_,z as Oo}from"./misc-CJqnlRwD.js";import{D as v_,U as N_}from"./uppy-DFP_VzYR.js";import{M as b_,r as y_,a as w_,b as __}from"./markdown-CKA5gBQ9.js";import{c as S_,H as Yo,P as Jo,u as k_,d as C_,R as T_,B as E_,e as M_,C as A_,M as z_,f as R_}from"./reactflow-DtsZHOR4.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(d){if(d.ep)return;d.ep=!0;const m=r(d);fetch(d.href,m)}})();var Rm={exports:{}},Ki={},Dm={exports:{}},Om={};var Rg;function D_(){return Rg||(Rg=1,(function(a){function l(D,Q){var B=D.length;D.push(Q);e:for(;0>>1,Y=D[ue];if(0>>1;ued(Ee,B))Gd($,Ee)?(D[ue]=$,D[G]=B,ue=G):(D[ue]=Ee,D[fe]=B,ue=fe);else if(Gd($,B))D[ue]=$,D[G]=B,ue=G;else break e}}return Q}function d(D,Q){var B=D.sortIndex-Q.sortIndex;return B!==0?B:D.id-Q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var h=Date,f=h.now();a.unstable_now=function(){return h.now()-f}}var p=[],g=[],N=1,j=null,b=3,y=!1,w=!1,z=!1,M=!1,S=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(D){for(var Q=r(g);Q!==null;){if(Q.callback===null)c(g);else if(Q.startTime<=D)c(g),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=r(g)}}function R(D){if(z=!1,C(D),!w)if(r(p)!==null)w=!0,H||(H=!0,je());else{var Q=r(g);Q!==null&&pe(R,Q.startTime-D)}}var H=!1,O=-1,X=5,L=-1;function me(){return M?!0:!(a.unstable_now()-LD&&me());){var ue=j.callback;if(typeof ue=="function"){j.callback=null,b=j.priorityLevel;var Y=ue(j.expirationTime<=D);if(D=a.unstable_now(),typeof Y=="function"){j.callback=Y,C(D),Q=!0;break s}j===r(p)&&c(p),C(D)}else c(p);j=r(p)}if(j!==null)Q=!0;else{var we=r(g);we!==null&&pe(R,we.startTime-D),Q=!1}}break e}finally{j=null,b=B,y=!1}Q=void 0}}finally{Q?je():H=!1}}}var je;if(typeof E=="function")je=function(){E(Ne)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ge=ce.port2;ce.port1.onmessage=Ne,je=function(){ge.postMessage(null)}}else je=function(){S(Ne,0)};function pe(D,Q){O=S(function(){D(a.unstable_now())},Q)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(D){D.callback=null},a.unstable_forceFrameRate=function(D){0>D||125ue?(D.sortIndex=B,l(g,D),r(p)===null&&D===r(g)&&(z?(F(O),O=-1):z=!0,pe(R,B-ue))):(D.sortIndex=Y,l(p,D),w||y||(w=!0,H||(H=!0,je()))),D},a.unstable_shouldYield=me,a.unstable_wrapCallback=function(D){var Q=b;return function(){var B=b;b=Q;try{return D.apply(this,arguments)}finally{b=B}}}})(Om)),Om}var Dg;function O_(){return Dg||(Dg=1,Dm.exports=D_()),Dm.exports}var Og;function L_(){if(Og)return Ki;Og=1;var a=O_(),l=dw(),r=uw();function c(s){var t="https://react.dev/errors/"+s;if(1Y||(s.current=ue[Y],ue[Y]=null,Y--)}function Ee(s,t){Y++,ue[Y]=s.current,s.current=t}var G=we(null),$=we(null),A=we(null),K=we(null);function Re(s,t){switch(Ee(A,t),Ee($,s),Ee(G,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Wp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Wp(t),s=eg(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}fe(G),Ee(G,s)}function se(){fe(G),fe($),fe(A)}function $e(s){s.memoizedState!==null&&Ee(K,s);var t=G.current,n=eg(t,s.type);t!==n&&(Ee($,s),Ee(G,n))}function cs(s){$.current===s&&(fe(G),fe($)),K.current===s&&(fe(K),Hi._currentValue=B)}var J,Z;function Le(s){if(J===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",Z=-1)":-1o||I[i]!==ie[o]){var ve=` -`+I[i].replace(" at new "," at ");return s.displayName&&ve.includes("")&&(ve=ve.replace("",s.displayName)),ve}while(1<=i&&0<=o);break}}}finally{le=!1,Error.prepareStackTrace=n}return(n=s?s.displayName||s.name:"")?Le(n):""}function xe(s,t){switch(s.tag){case 26:case 27:case 5:return Le(s.type);case 16:return Le("Lazy");case 13:return s.child!==t&&t!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return De(s.type,!1);case 11:return De(s.type.render,!1);case 1:return De(s.type,!0);case 31:return Le("Activity");default:return""}}function Me(s){try{var t="",n=null;do t+=xe(s,n),n=s,s=s.return;while(s);return t}catch(i){return` -Error generating stack: `+i.message+` -`+i.stack}}var ds=Object.prototype.hasOwnProperty,Ts=a.unstable_scheduleCallback,Ct=a.unstable_cancelCallback,ia=a.unstable_shouldYield,ut=a.unstable_requestPaint,Is=a.unstable_now,V=a.unstable_getCurrentPriorityLevel,Ke=a.unstable_ImmediatePriority,He=a.unstable_UserBlockingPriority,Je=a.unstable_NormalPriority,Es=a.unstable_LowPriority,ms=a.unstable_IdlePriority,Ms=a.log,We=a.unstable_setDisableYieldValue,Cs=null,rs=null;function is(s){if(typeof Ms=="function"&&We(s),rs&&typeof rs.setStrictMode=="function")try{rs.setStrictMode(Cs,s)}catch{}}var ys=Math.clz32?Math.clz32:Ae,rt=Math.log,jt=Math.LN2;function Ae(s){return s>>>=0,s===0?32:31-(rt(s)/jt|0)|0}var Qe=256,As=262144,mt=4194304;function Ht(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ca(s,t,n){var i=s.pendingLanes;if(i===0)return 0;var o=0,x=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var k=i&134217727;return k!==0?(i=k&~x,i!==0?o=Ht(i):(v&=k,v!==0?o=Ht(v):n||(n=k&~s,n!==0&&(o=Ht(n))))):(k=i&~x,k!==0?o=Ht(k):v!==0?o=Ht(v):n||(n=i&~s,n!==0&&(o=Ht(n)))),o===0?0:t!==0&&t!==o&&(t&x)===0&&(x=o&-o,n=t&-t,x>=n||x===32&&(n&4194048)!==0)?t:o}function Fa(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Xt(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function te(){var s=mt;return mt<<=1,(mt&62914560)===0&&(mt=4194304),s}function _e(s){for(var t=[],n=0;31>n;n++)t.push(s);return t}function U(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Se(s,t,n,i,o,x){var v=s.pendingLanes;s.pendingLanes=n,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=n,s.entangledLanes&=n,s.errorRecoveryDisabledLanes&=n,s.shellSuspendCounter=0;var k=s.entanglements,I=s.expirationTimes,ie=s.hiddenUpdates;for(n=v&~n;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Jb=/[\n"\\]/g;function qa(s){return s.replace(Jb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wd(s,t,n,i,o,x,v,k){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),t!=null?v==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+Ha(t)):s.value!==""+Ha(t)&&(s.value=""+Ha(t)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),t!=null?_d(s,v,Ha(t)):n!=null?_d(s,v,Ha(n)):i!=null&&s.removeAttribute("value"),o==null&&x!=null&&(s.defaultChecked=!!x),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+Ha(k):s.removeAttribute("name")}function Gx(s,t,n,i,o,x,v,k){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),t!=null||n!=null){if(!(x!=="submit"&&x!=="reset"||t!=null)){yd(s);return}n=n!=null?""+Ha(n):"",t=t!=null?""+Ha(t):n,k||t===s.value||(s.value=t),s.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,s.checked=k?s.checked:!!i,s.defaultChecked=!!i,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),yd(s)}function _d(s,t,n){t==="number"&&_c(s.ownerDocument)===s||s.defaultValue===""+n||(s.defaultValue=""+n)}function dr(s,t,n,i){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(bl)try{var ii={};Object.defineProperty(ii,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",ii,ii),window.removeEventListener("test",ii,ii)}catch{Ed=!1}var Yl=null,Md=null,kc=null;function Wx(){if(kc)return kc;var s,t=Md,n=t.length,i,o="value"in Yl?Yl.value:Yl.textContent,x=o.length;for(s=0;s=di),nh=" ",rh=!1;function ih(s,t){switch(s){case"keyup":return _y.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ch(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var hr=!1;function ky(s,t){switch(s){case"compositionend":return ch(t);case"keypress":return t.which!==32?null:(rh=!0,nh);case"textInput":return s=t.data,s===nh&&rh?null:s;default:return null}}function Cy(s,t){if(hr)return s==="compositionend"||!Od&&ih(s,t)?(s=Wx(),kc=Md=Yl=null,hr=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-s};s=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ph(n)}}function jh(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?jh(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function vh(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=_c(s.document);t instanceof s.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)s=t.contentWindow;else break;t=_c(s.document)}return t}function $d(s){var t=s&&s.nodeName&&s.nodeName.toLowerCase();return t&&(t==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||t==="textarea"||s.contentEditable==="true")}var Oy=bl&&"documentMode"in document&&11>=document.documentMode,fr=null,Bd=null,hi=null,Id=!1;function Nh(s,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Id||fr==null||fr!==_c(i)||(i=fr,"selectionStart"in i&&$d(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),hi&&xi(hi,i)||(hi=i,i=No(Bd,"onSelect"),0>=v,o-=v,xl=1<<32-ys(t)+o|n<_s?(Ls=Ye,Ye=null):Ls=Ye.sibling;var Ks=de(ee,Ye,re[_s],be);if(Ks===null){Ye===null&&(Ye=Ls);break}s&&Ye&&Ks.alternate===null&&t(ee,Ye),q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks,Ye=Ls}if(_s===re.length)return n(ee,Ye),Us&&wl(ee,_s),ss;if(Ye===null){for(;_s_s?(Ls=Ye,Ye=null):Ls=Ye.sibling;var jn=de(ee,Ye,Ks.value,be);if(jn===null){Ye===null&&(Ye=Ls);break}s&&Ye&&jn.alternate===null&&t(ee,Ye),q=x(jn,q,_s),Gs===null?ss=jn:Gs.sibling=jn,Gs=jn,Ye=Ls}if(Ks.done)return n(ee,Ye),Us&&wl(ee,_s),ss;if(Ye===null){for(;!Ks.done;_s++,Ks=re.next())Ks=ye(ee,Ks.value,be),Ks!==null&&(q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks);return Us&&wl(ee,_s),ss}for(Ye=i(Ye);!Ks.done;_s++,Ks=re.next())Ks=he(Ye,ee,_s,Ks.value,be),Ks!==null&&(s&&Ks.alternate!==null&&Ye.delete(Ks.key===null?_s:Ks.key),q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks);return s&&Ye.forEach(function(sw){return t(ee,sw)}),Us&&wl(ee,_s),ss}function ot(ee,q,re,be){if(typeof re=="object"&&re!==null&&re.type===z&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case y:e:{for(var ss=re.key;q!==null;){if(q.key===ss){if(ss=re.type,ss===z){if(q.tag===7){n(ee,q.sibling),be=o(q,re.props.children),be.return=ee,ee=be;break e}}else if(q.elementType===ss||typeof ss=="object"&&ss!==null&&ss.$$typeof===X&&In(ss)===q.type){n(ee,q.sibling),be=o(q,re.props),Ni(be,re),be.return=ee,ee=be;break e}n(ee,q);break}else t(ee,q);q=q.sibling}re.type===z?(be=On(re.props.children,ee.mode,be,re.key),be.return=ee,ee=be):(be=Lc(re.type,re.key,re.props,null,ee.mode,be),Ni(be,re),be.return=ee,ee=be)}return v(ee);case w:e:{for(ss=re.key;q!==null;){if(q.key===ss)if(q.tag===4&&q.stateNode.containerInfo===re.containerInfo&&q.stateNode.implementation===re.implementation){n(ee,q.sibling),be=o(q,re.children||[]),be.return=ee,ee=be;break e}else{n(ee,q);break}else t(ee,q);q=q.sibling}be=Kd(re,ee.mode,be),be.return=ee,ee=be}return v(ee);case X:return re=In(re),ot(ee,q,re,be)}if(pe(re))return Ve(ee,q,re,be);if(je(re)){if(ss=je(re),typeof ss!="function")throw Error(c(150));return re=ss.call(re),ls(ee,q,re,be)}if(typeof re.then=="function")return ot(ee,q,Hc(re),be);if(re.$$typeof===E)return ot(ee,q,Bc(ee,re),be);qc(ee,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,q!==null&&q.tag===6?(n(ee,q.sibling),be=o(q,re),be.return=ee,ee=be):(n(ee,q),be=Gd(re,ee.mode,be),be.return=ee,ee=be),v(ee)):n(ee,q)}return function(ee,q,re,be){try{vi=0;var ss=ot(ee,q,re,be);return kr=null,ss}catch(Ye){if(Ye===Sr||Ye===Pc)throw Ye;var Gs=Ea(29,Ye,null,ee.mode);return Gs.lanes=be,Gs.return=ee,Gs}finally{}}}var Fn=Hh(!0),qh=Hh(!1),en=!1;function nu(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ru(s,t){s=s.updateQueue,t.updateQueue===s&&(t.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function sn(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function tn(s,t,n){var i=s.updateQueue;if(i===null)return null;if(i=i.shared,(Js&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Oc(s),Ch(s,null,n),t}return Dc(s,i,t,n),Oc(s)}function bi(s,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,us(s,n)}}function iu(s,t){var n=s.updateQueue,i=s.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var o=null,x=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};x===null?o=x=v:x=x.next=v,n=n.next}while(n!==null);x===null?o=x=t:x=x.next=t}else o=x=t;n={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=t:s.next=t,n.lastBaseUpdate=t}var cu=!1;function yi(){if(cu){var s=_r;if(s!==null)throw s}}function wi(s,t,n,i){cu=!1;var o=s.updateQueue;en=!1;var x=o.firstBaseUpdate,v=o.lastBaseUpdate,k=o.shared.pending;if(k!==null){o.shared.pending=null;var I=k,ie=I.next;I.next=null,v===null?x=ie:v.next=ie,v=I;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,k=ve.lastBaseUpdate,k!==v&&(k===null?ve.firstBaseUpdate=ie:k.next=ie,ve.lastBaseUpdate=I))}if(x!==null){var ye=o.baseState;v=0,ve=ie=I=null,k=x;do{var de=k.lane&-536870913,he=de!==k.lane;if(he?(Os&de)===de:(i&de)===de){de!==0&&de===wr&&(cu=!0),ve!==null&&(ve=ve.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ve=s,ls=k;de=t;var ot=n;switch(ls.tag){case 1:if(Ve=ls.payload,typeof Ve=="function"){ye=Ve.call(ot,ye,de);break e}ye=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=ls.payload,de=typeof Ve=="function"?Ve.call(ot,ye,de):Ve,de==null)break e;ye=j({},ye,de);break e;case 2:en=!0}}de=k.callback,de!==null&&(s.flags|=64,he&&(s.flags|=8192),he=o.callbacks,he===null?o.callbacks=[de]:he.push(de))}else he={lane:de,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ve===null?(ie=ve=he,I=ye):ve=ve.next=he,v|=de;if(k=k.next,k===null){if(k=o.shared.pending,k===null)break;he=k,k=he.next,he.next=null,o.lastBaseUpdate=he,o.shared.pending=null}}while(!0);ve===null&&(I=ye),o.baseState=I,o.firstBaseUpdate=ie,o.lastBaseUpdate=ve,x===null&&(o.shared.lanes=0),cn|=v,s.lanes=v,s.memoizedState=ye}}function Vh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function Gh(s,t){var n=s.callbacks;if(n!==null)for(s.callbacks=null,s=0;sx?x:8;var v=D.T,k={};D.T=k,Cu(s,!1,t,n);try{var I=o(),ie=D.S;if(ie!==null&&ie(k,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ve=qy(I,i);ki(s,t,ve,Da(s))}else ki(s,t,i,Da(s))}catch(ye){ki(s,t,{then:function(){},status:"rejected",reason:ye},Da())}finally{Q.p=x,v!==null&&k.types!==null&&(v.types=k.types),D.T=v}}function Jy(){}function Su(s,t,n,i){if(s.tag!==5)throw Error(c(476));var o=Sf(s).queue;_f(s,o,t,B,n===null?Jy:function(){return kf(s),n(i)})}function Sf(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:B},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:n},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function kf(s){var t=Sf(s);t.next===null&&(t=s.alternate.memoizedState),ki(s,t.next.queue,{},Da())}function ku(){return Wt(Hi)}function Cf(){return Dt().memoizedState}function Tf(){return Dt().memoizedState}function Xy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var n=Da();s=sn(n);var i=tn(t,s,n);i!==null&&(ya(i,t,n),bi(i,t,n)),t={cache:su()},s.payload=t;return}t=t.return}}function Zy(s,t,n){var i=Da();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},eo(s)?Mf(t,n):(n=qd(s,t,n,i),n!==null&&(ya(n,s,i),Af(n,t,i)))}function Ef(s,t,n){var i=Da();ki(s,t,n,i)}function ki(s,t,n,i){var o={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(eo(s))Mf(t,o);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=t.lastRenderedReducer,x!==null))try{var v=t.lastRenderedState,k=x(v,n);if(o.hasEagerState=!0,o.eagerState=k,Ta(k,v))return Dc(s,t,o,0),xt===null&&Rc(),!1}catch{}finally{}if(n=qd(s,t,o,i),n!==null)return ya(n,s,i),Af(n,t,i),!0}return!1}function Cu(s,t,n,i){if(i={lane:2,revertLane:nm(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},eo(s)){if(t)throw Error(c(479))}else t=qd(s,n,i,2),t!==null&&ya(t,s,2)}function eo(s){var t=s.alternate;return s===ws||t!==null&&t===ws}function Mf(s,t){Tr=Kc=!0;var n=s.pending;n===null?t.next=t:(t.next=n.next,n.next=t),s.pending=t}function Af(s,t,n){if((n&4194048)!==0){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,us(s,n)}}var Ci={readContext:Wt,use:Jc,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};Ci.useEffectEvent=Mt;var zf={readContext:Wt,use:Jc,useCallback:function(s,t){return ma().memoizedState=[s,t===void 0?null:t],s},useContext:Wt,useEffect:ff,useImperativeHandle:function(s,t,n){n=n!=null?n.concat([s]):null,Zc(4194308,4,vf.bind(null,t,s),n)},useLayoutEffect:function(s,t){return Zc(4194308,4,s,t)},useInsertionEffect:function(s,t){Zc(4,2,s,t)},useMemo:function(s,t){var n=ma();t=t===void 0?null:t;var i=s();if(Hn){is(!0);try{s()}finally{is(!1)}}return n.memoizedState=[i,t],i},useReducer:function(s,t,n){var i=ma();if(n!==void 0){var o=n(t);if(Hn){is(!0);try{n(t)}finally{is(!1)}}}else o=t;return i.memoizedState=i.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},i.queue=s,s=s.dispatch=Zy.bind(null,ws,s),[i.memoizedState,s]},useRef:function(s){var t=ma();return s={current:s},t.memoizedState=s},useState:function(s){s=Nu(s);var t=s.queue,n=Ef.bind(null,ws,t);return t.dispatch=n,[s.memoizedState,n]},useDebugValue:wu,useDeferredValue:function(s,t){var n=ma();return _u(n,s,t)},useTransition:function(){var s=Nu(!1);return s=_f.bind(null,ws,s.queue,!0,!1),ma().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,n){var i=ws,o=ma();if(Us){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),xt===null)throw Error(c(349));(Os&127)!==0||Zh(i,t,n)}o.memoizedState=n;var x={value:n,getSnapshot:t};return o.queue=x,ff(ef.bind(null,i,x,s),[s]),i.flags|=2048,Mr(9,{destroy:void 0},Wh.bind(null,i,x,n,t),null),n},useId:function(){var s=ma(),t=xt.identifierPrefix;if(Us){var n=hl,i=xl;n=(i&~(1<<32-ys(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Qc++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?v.createElement(o,{is:i.is}):v.createElement(o)}}x[oe]=t,x[qe]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)x.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=x;e:switch(sa(x,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&El(t)}}return yt(t),Pu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,n),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==i&&El(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(s=A.current,br(t)){if(s=t.stateNode,n=t.memoizedProps,i=null,o=Zt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}s[oe]=t,s=!!(s.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Xp(s.nodeValue,n)),s||Zl(t,!0)}else s=bo(s).createTextNode(i),s[oe]=t,t.stateNode=s}return yt(t),null;case 31:if(n=t.memoizedState,s===null||s.memoizedState!==null){if(i=br(t),n!==null){if(s===null){if(!i)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[oe]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),s=!1}else n=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=n),s=!0;if(!s)return t.flags&256?(Aa(t),t):(Aa(t),null);if((t.flags&128)!==0)throw Error(c(558))}return yt(t),null;case 13:if(i=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=br(t),i!==null&&i.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[oe]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),o=!1}else o=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Aa(t),t):(Aa(t),null)}return Aa(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,s=s!==null&&s.memoizedState!==null,n&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==o&&(i.flags|=2048)),n!==s&&n&&(t.child.flags|=8192),no(t,t.updateQueue),yt(t),null);case 4:return se(),s===null&&om(t.stateNode.containerInfo),yt(t),null;case 10:return Sl(t.type),yt(t),null;case 19:if(fe(Rt),i=t.memoizedState,i===null)return yt(t),null;if(o=(t.flags&128)!==0,x=i.rendering,x===null)if(o)Ei(i,!1);else{if(At!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(x=Gc(s),x!==null){for(t.flags|=128,Ei(i,!1),s=x.updateQueue,t.updateQueue=s,no(t,s),t.subtreeFlags=0,s=n,n=t.child;n!==null;)Th(n,s),n=n.sibling;return Ee(Rt,Rt.current&1|2),Us&&wl(t,i.treeForkCount),t.child}s=s.sibling}i.tail!==null&&Is()>uo&&(t.flags|=128,o=!0,Ei(i,!1),t.lanes=4194304)}else{if(!o)if(s=Gc(x),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,no(t,s),Ei(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Us)return yt(t),null}else 2*Is()-i.renderingStartTime>uo&&n!==536870912&&(t.flags|=128,o=!0,Ei(i,!1),t.lanes=4194304);i.isBackwards?(x.sibling=t.child,t.child=x):(s=i.last,s!==null?s.sibling=x:t.child=x,i.last=x)}return i.tail!==null?(s=i.tail,i.rendering=s,i.tail=s.sibling,i.renderingStartTime=Is(),s.sibling=null,n=Rt.current,Ee(Rt,o?n&1|2:n&1),Us&&wl(t,i.treeForkCount),s):(yt(t),null);case 22:case 23:return Aa(t),du(),i=t.memoizedState!==null,s!==null?s.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),n=t.updateQueue,n!==null&&no(t,n.retryQueue),n=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),s!==null&&fe(Bn),null;case 24:return n=null,s!==null&&(n=s.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sl(Bt),yt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function a0(s,t){switch(Yd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Sl(Bt),se(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return cs(t),null;case 31:if(t.memoizedState!==null){if(Aa(t),t.alternate===null)throw Error(c(340));Ln()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Aa(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Ln()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return fe(Rt),null;case 4:return se(),null;case 10:return Sl(t.type),null;case 22:case 23:return Aa(t),du(),s!==null&&fe(Bn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Sl(Bt),null;case 25:return null;default:return null}}function tp(s,t){switch(Yd(t),t.tag){case 3:Sl(Bt),se();break;case 26:case 27:case 5:cs(t);break;case 4:se();break;case 31:t.memoizedState!==null&&Aa(t);break;case 13:Aa(t);break;case 19:fe(Rt);break;case 10:Sl(t.type);break;case 22:case 23:Aa(t),du(),s!==null&&fe(Bn);break;case 24:Sl(Bt)}}function Mi(s,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var o=i.next;n=o;do{if((n.tag&s)===s){i=void 0;var x=n.create,v=n.inst;i=x(),v.destroy=i}n=n.next}while(n!==o)}}catch(k){et(t,t.return,k)}}function nn(s,t,n){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var x=o.next;i=x;do{if((i.tag&s)===s){var v=i.inst,k=v.destroy;if(k!==void 0){v.destroy=void 0,o=t;var I=n,ie=k;try{ie()}catch(ve){et(o,I,ve)}}}i=i.next}while(i!==x)}}catch(ve){et(t,t.return,ve)}}function ap(s){var t=s.updateQueue;if(t!==null){var n=s.stateNode;try{Gh(t,n)}catch(i){et(s,s.return,i)}}}function lp(s,t,n){n.props=qn(s.type,s.memoizedProps),n.state=s.memoizedState;try{n.componentWillUnmount()}catch(i){et(s,t,i)}}function Ai(s,t){try{var n=s.ref;if(n!==null){switch(s.tag){case 26:case 27:case 5:var i=s.stateNode;break;case 30:i=s.stateNode;break;default:i=s.stateNode}typeof n=="function"?s.refCleanup=n(i):n.current=i}}catch(o){et(s,t,o)}}function fl(s,t){var n=s.ref,i=s.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(o){et(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){et(s,t,o)}else n.current=null}function np(s){var t=s.type,n=s.memoizedProps,i=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(o){et(s,s.return,o)}}function Fu(s,t,n){try{var i=s.stateNode;S0(i,s.type,n,t),i[qe]=t}catch(o){et(s,s.return,o)}}function rp(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xn(s.type)||s.tag===4}function Hu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||rp(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&xn(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function qu(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(s,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(s),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Nl));else if(i!==4&&(i===27&&xn(s.type)&&(n=s.stateNode,t=null),s=s.child,s!==null))for(qu(s,t,n),s=s.sibling;s!==null;)qu(s,t,n),s=s.sibling}function ro(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?n.insertBefore(s,t):n.appendChild(s);else if(i!==4&&(i===27&&xn(s.type)&&(n=s.stateNode),s=s.child,s!==null))for(ro(s,t,n),s=s.sibling;s!==null;)ro(s,t,n),s=s.sibling}function ip(s){var t=s.stateNode,n=s.memoizedProps;try{for(var i=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);sa(t,i,n),t[oe]=s,t[qe]=n}catch(x){et(s,s.return,x)}}var Ml=!1,Ft=!1,Vu=!1,cp=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function l0(s,t){if(s=s.containerInfo,mm=To,s=vh(s),$d(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else e:{n=(n=s.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var o=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{n.nodeType,x.nodeType}catch{n=null;break e}var v=0,k=-1,I=-1,ie=0,ve=0,ye=s,de=null;s:for(;;){for(var he;ye!==n||o!==0&&ye.nodeType!==3||(k=v+o),ye!==x||i!==0&&ye.nodeType!==3||(I=v+i),ye.nodeType===3&&(v+=ye.nodeValue.length),(he=ye.firstChild)!==null;)de=ye,ye=he;for(;;){if(ye===s)break s;if(de===n&&++ie===o&&(k=v),de===x&&++ve===i&&(I=v),(he=ye.nextSibling)!==null)break;ye=de,de=ye.parentNode}ye=he}n=k===-1||I===-1?null:{start:k,end:I}}else n=null}n=n||{start:0,end:0}}else n=null;for(xm={focusedElem:s,selectionRange:n},To=!1,Qt=t;Qt!==null;)if(t=Qt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Qt=s;else for(;Qt!==null;){switch(t=Qt,x=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(n=0;n title"))),sa(x,i,n),x[oe]=s,Kt(x),i=x;break e;case"link":var v=hg("link","href",o).get(i+(n.href||""));if(v){for(var k=0;kot&&(v=ot,ot=ls,ls=v);var ee=gh(k,ls),q=gh(k,ot);if(ee&&q&&(he.rangeCount!==1||he.anchorNode!==ee.node||he.anchorOffset!==ee.offset||he.focusNode!==q.node||he.focusOffset!==q.offset)){var re=ye.createRange();re.setStart(ee.node,ee.offset),he.removeAllRanges(),ls>ot?(he.addRange(re),he.extend(q.node,q.offset)):(re.setEnd(q.node,q.offset),he.addRange(re))}}}}for(ye=[],he=k;he=he.parentNode;)he.nodeType===1&&ye.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;kn?32:n,D.T=null,n=Zu,Zu=null;var x=dn,v=Ol;if(qt=0,Or=dn=null,Ol=0,(Js&6)!==0)throw Error(c(331));var k=Js;if(Js|=4,vp(x.current),pp(x,x.current,v,n),Js=k,Ui(0,!1),rs&&typeof rs.onPostCommitFiberRoot=="function")try{rs.onPostCommitFiberRoot(Cs,x)}catch{}return!0}finally{Q.p=o,D.T=i,Up(s,t)}}function Bp(s,t,n){t=Ga(n,t),t=Au(s.stateNode,t,2),s=tn(s,t,2),s!==null&&(U(s,2),pl(s))}function et(s,t,n){if(s.tag===3)Bp(s,s,n);else for(;t!==null;){if(t.tag===3){Bp(t,s,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(on===null||!on.has(i))){s=Ga(n,s),n=If(2),i=tn(t,n,2),i!==null&&(Pf(n,i,t,s),U(i,2),pl(i));break}}t=t.return}}function tm(s,t,n){var i=s.pingCache;if(i===null){i=s.pingCache=new i0;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(n)||(Qu=!0,o.add(n),s=m0.bind(null,s,t,n),t.then(s,s))}function m0(s,t,n){var i=s.pingCache;i!==null&&i.delete(t),s.pingedLanes|=s.suspendedLanes&n,s.warmLanes&=~n,xt===s&&(Os&n)===n&&(At===4||At===3&&(Os&62914560)===Os&&300>Is()-oo?(Js&2)===0&&Lr(s,0):Yu|=n,Dr===Os&&(Dr=0)),pl(s)}function Ip(s,t){t===0&&(t=te()),s=Dn(s,t),s!==null&&(U(s,t),pl(s))}function x0(s){var t=s.memoizedState,n=0;t!==null&&(n=t.retryLane),Ip(s,n)}function h0(s,t){var n=0;switch(s.tag){case 31:case 13:var i=s.stateNode,o=s.memoizedState;o!==null&&(n=o.retryLane);break;case 19:i=s.stateNode;break;case 22:i=s.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),Ip(s,n)}function f0(s,t){return Ts(s,t)}var go=null,$r=null,am=!1,jo=!1,lm=!1,mn=0;function pl(s){s!==$r&&s.next===null&&($r===null?go=$r=s:$r=$r.next=s),jo=!0,am||(am=!0,g0())}function Ui(s,t){if(!lm&&jo){lm=!0;do for(var n=!1,i=go;i!==null;){if(s!==0){var o=i.pendingLanes;if(o===0)var x=0;else{var v=i.suspendedLanes,k=i.pingedLanes;x=(1<<31-ys(42|s)+1)-1,x&=o&~(v&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(n=!0,qp(i,x))}else x=Os,x=ca(i,i===xt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||Fa(i,x)||(n=!0,qp(i,x));i=i.next}while(n);lm=!1}}function p0(){Pp()}function Pp(){jo=am=!1;var s=0;mn!==0&&C0()&&(s=mn);for(var t=Is(),n=null,i=go;i!==null;){var o=i.next,x=Fp(i,t);x===0?(i.next=null,n===null?go=o:n.next=o,o===null&&($r=n)):(n=i,(s!==0||(x&3)!==0)&&(jo=!0)),i=o}qt!==0&&qt!==5||Ui(s),mn!==0&&(mn=0)}function Fp(s,t){for(var n=s.suspendedLanes,i=s.pingedLanes,o=s.expirationTimes,x=s.pendingLanes&-62914561;0k)break;var ve=I.transferSize,ye=I.initiatorType;ve&&Zp(ye)&&(I=I.responseEnd,v+=ve*(I"u"?null:document;function dg(s,t,n){var i=Br;if(i&&typeof t=="string"&&t){var o=qa(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),og.has(o)||(og.add(o),s={rel:s,crossOrigin:n,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),sa(t,"link",s),Kt(t),i.head.appendChild(t)))}}function L0(s){Ll.D(s),dg("dns-prefetch",s,null)}function U0(s,t){Ll.C(s,t),dg("preconnect",s,t)}function $0(s,t,n){Ll.L(s,t,n);var i=Br;if(i&&s&&t){var o='link[rel="preload"][as="'+qa(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+qa(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+qa(n.imageSizes)+'"]')):o+='[href="'+qa(s)+'"]';var x=o;switch(t){case"style":x=Ir(s);break;case"script":x=Pr(s)}Za.has(x)||(s=j({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:s,as:t},n),Za.set(x,s),i.querySelector(o)!==null||t==="style"&&i.querySelector(Pi(x))||t==="script"&&i.querySelector(Fi(x))||(t=i.createElement("link"),sa(t,"link",s),Kt(t),i.head.appendChild(t)))}}function B0(s,t){Ll.m(s,t);var n=Br;if(n&&s){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+qa(i)+'"][href="'+qa(s)+'"]',x=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Pr(s)}if(!Za.has(x)&&(s=j({rel:"modulepreload",href:s},t),Za.set(x,s),n.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Fi(x)))return}i=n.createElement("link"),sa(i,"link",s),Kt(i),n.head.appendChild(i)}}}function I0(s,t,n){Ll.S(s,t,n);var i=Br;if(i&&s){var o=cr(i).hoistableStyles,x=Ir(s);t=t||"default";var v=o.get(x);if(!v){var k={loading:0,preload:null};if(v=i.querySelector(Pi(x)))k.loading=5;else{s=j({rel:"stylesheet",href:s,"data-precedence":t},n),(n=Za.get(x))&&Nm(s,n);var I=v=i.createElement("link");Kt(I),sa(I,"link",s),I._p=new Promise(function(ie,ve){I.onload=ie,I.onerror=ve}),I.addEventListener("load",function(){k.loading|=1}),I.addEventListener("error",function(){k.loading|=2}),k.loading|=4,wo(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:k},o.set(x,v)}}}function P0(s,t){Ll.X(s,t);var n=Br;if(n&&s){var i=cr(n).hoistableScripts,o=Pr(s),x=i.get(o);x||(x=n.querySelector(Fi(o)),x||(s=j({src:s,async:!0},t),(t=Za.get(o))&&bm(s,t),x=n.createElement("script"),Kt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function F0(s,t){Ll.M(s,t);var n=Br;if(n&&s){var i=cr(n).hoistableScripts,o=Pr(s),x=i.get(o);x||(x=n.querySelector(Fi(o)),x||(s=j({src:s,async:!0,type:"module"},t),(t=Za.get(o))&&bm(s,t),x=n.createElement("script"),Kt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function ug(s,t,n,i){var o=(o=A.current)?yo(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ir(n.href),n=cr(o).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){s=Ir(n.href);var x=cr(o).hoistableStyles,v=x.get(s);if(v||(o=o.ownerDocument||o,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,v),(x=o.querySelector(Pi(s)))&&!x._p&&(v.instance=x,v.state.loading=5),Za.has(s)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Za.set(s,n),x||H0(o,s,n,v.state))),t&&i===null)throw Error(c(528,""));return v}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Pr(n),n=cr(o).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function Ir(s){return'href="'+qa(s)+'"'}function Pi(s){return'link[rel="stylesheet"]['+s+"]"}function mg(s){return j({},s,{"data-precedence":s.precedence,precedence:null})}function H0(s,t,n,i){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=s.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),sa(t,"link",n),Kt(t),s.head.appendChild(t))}function Pr(s){return'[src="'+qa(s)+'"]'}function Fi(s){return"script[async]"+s}function xg(s,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=s.querySelector('style[data-href~="'+qa(n.href)+'"]');if(i)return t.instance=i,Kt(i),i;var o=j({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(s.ownerDocument||s).createElement("style"),Kt(i),sa(i,"style",o),wo(i,n.precedence,s),t.instance=i;case"stylesheet":o=Ir(n.href);var x=s.querySelector(Pi(o));if(x)return t.state.loading|=4,t.instance=x,Kt(x),x;i=mg(n),(o=Za.get(o))&&Nm(i,o),x=(s.ownerDocument||s).createElement("link"),Kt(x);var v=x;return v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),sa(x,"link",i),t.state.loading|=4,wo(x,n.precedence,s),t.instance=x;case"script":return x=Pr(n.src),(o=s.querySelector(Fi(x)))?(t.instance=o,Kt(o),o):(i=n,(o=Za.get(x))&&(i=j({},n),bm(i,o)),s=s.ownerDocument||s,o=s.createElement("script"),Kt(o),sa(o,"link",i),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,wo(i,n.precedence,s));return t.instance}function wo(s,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,x=o,v=0;v title"):null)}function q0(s,t,n){if(n===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function pg(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function V0(s,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Ir(i.href),x=t.querySelector(Pi(o));if(x){t=x._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=So.bind(s),t.then(s,s)),n.state.loading|=4,n.instance=x,Kt(x);return}x=t.ownerDocument||t,i=mg(i),(o=Za.get(o))&&Nm(i,o),x=x.createElement("link"),Kt(x);var v=x;v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),sa(x,"link",i),n.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(s.count++,n=So.bind(s),t.addEventListener("load",n),t.addEventListener("error",n))}}var ym=0;function G0(s,t){return s.stylesheets&&s.count===0&&Co(s,s.stylesheets),0ym?50:800)+t);return s.unsuspend=n,function(){s.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function So(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Co(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var ko=null;function Co(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,ko=new Map,t.forEach(K0,s),ko=null,So.call(s))}function K0(s,t){if(!(t.state.loading&4)){var n=ko.get(s);if(n)var i=n.get(null);else{n=new Map,ko.set(s,n);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Rm.exports=L_(),Rm.exports}var $_=U_();function P(...a){return xw(hw(a))}const Te=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("rounded-xl border bg-card text-card-foreground shadow",a),...l}));Te.displayName="Card";const Oe=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("flex flex-col space-y-1.5 p-6",a),...l}));Oe.displayName="CardHeader";const Ue=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("font-semibold leading-none tracking-tight",a),...l}));Ue.displayName="CardTitle";const Ns=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("text-sm text-muted-foreground",a),...l}));Ns.displayName="CardDescription";const ze=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("p-6 pt-0",a),...l}));ze.displayName="CardContent";const od=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("flex items-center p-6 pt-0",a),...l}));od.displayName="CardFooter";const Jt=pw,Gt=u.forwardRef(({className:a,...l},r)=>e.jsx(hj,{ref:r,className:P("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",a),...l}));Gt.displayName=hj.displayName;const Xe=u.forwardRef(({className:a,...l},r)=>e.jsx(fj,{ref:r,className:P("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a),...l}));Xe.displayName=fj.displayName;const Ss=u.forwardRef(({className:a,...l},r)=>e.jsx(pj,{ref:r,className:P("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",a),...l}));Ss.displayName=pj.displayName;const ts=u.forwardRef(({className:a,children:l,viewportRef:r,...c},d)=>e.jsxs(gj,{ref:d,className:P("relative overflow-hidden",a),...c,children:[e.jsx(gw,{ref:r,className:"h-full w-full rounded-[inherit]",children:l}),e.jsx(Xm,{}),e.jsx(Xm,{orientation:"horizontal"}),e.jsx(jw,{})]}));ts.displayName=gj.displayName;const Xm=u.forwardRef(({className:a,orientation:l="vertical",...r},c)=>e.jsx(jj,{ref:c,orientation:l,className:P("flex touch-none select-none transition-colors",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...r,children:e.jsx(vw,{className:"relative flex-1 rounded-full bg-border"})}));Xm.displayName=jj.displayName;function ks({className:a,...l}){return e.jsx("div",{className:P("animate-pulse rounded-md bg-primary/10",a),...l})}const tr=u.forwardRef(({className:a,value:l,...r},c)=>e.jsx(vj,{ref:c,className:P("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...r,children:e.jsx(Nw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(l||0)}%)`}})}));tr.displayName=vj.displayName;async function ke(a,l){const c=l?.body instanceof FormData?{...l?.headers}:{"Content-Type":"application/json",...l?.headers},d={...l,credentials:"include",headers:c},m=await fetch(a,d);if(m.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return m}function Zs(){return{"Content-Type":"application/json"}}async function B_(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(a){console.error("登出请求失败:",a)}window.location.href="/auth"}async function dc(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const I_={light:"",dark:".dark"},Mv=u.createContext(null);function Av(){const a=u.useContext(Mv);if(!a)throw new Error("useChart must be used within a ");return a}const Kr=u.forwardRef(({id:a,className:l,children:r,config:c,...d},m)=>{const h=u.useId(),f=`chart-${a||h.replace(/:/g,"")}`;return e.jsx(Mv.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:m,className:P("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",l),...d,children:[e.jsx(P_,{id:f,config:c}),e.jsx(Uj,{children:r})]})})});Kr.displayName="Chart";const P_=({id:a,config:l})=>{const r=Object.entries(l).filter(([,c])=>c.theme||c.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(I_).map(([c,d])=>` -${d} [data-chart=${a}] { -${r.map(([m,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${m}: ${f};`:null}).join(` -`)} -} -`).join(` -`)}}):null},Qi=$j,Qr=u.forwardRef(({active:a,payload:l,className:r,indicator:c="dot",hideLabel:d=!1,hideIndicator:m=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:N,nameKey:j,labelKey:b},y)=>{const{config:w}=Av(),z=u.useMemo(()=>{if(d||!l?.length)return null;const[S]=l,F=`${b||S?.dataKey||S?.name||"value"}`,E=Zm(w,S,F),C=!b&&typeof h=="string"?w[h]?.label||h:E?.label;return f?e.jsx("div",{className:P("font-medium",p),children:f(C,l)}):C?e.jsx("div",{className:P("font-medium",p),children:C}):null},[h,f,l,d,p,w,b]);if(!a||!l?.length)return null;const M=l.length===1&&c!=="dot";return e.jsxs("div",{ref:y,className:P("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[M?null:z,e.jsx("div",{className:"grid gap-1.5",children:l.filter(S=>S.type!=="none").map((S,F)=>{const E=`${j||S.name||S.dataKey||"value"}`,C=Zm(w,S,E),R=N||S.payload.fill||S.color;return e.jsx("div",{className:P("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:g&&S?.value!==void 0&&S.name?g(S.value,S.name,S,F,S.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!m&&e.jsx("div",{className:P("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":M&&c==="dashed"}),style:{"--color-bg":R,"--color-border":R}}),e.jsxs("div",{className:P("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[M?z:null,e.jsx("span",{className:"text-muted-foreground",children:C?.label||S.name})]}),S.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:S.value.toLocaleString()})]})]})},S.dataKey)})})]})});Qr.displayName="ChartTooltip";const F_=Zw,zv=u.forwardRef(({className:a,hideIcon:l=!1,payload:r,verticalAlign:c="bottom",nameKey:d},m)=>{const{config:h}=Av();return r?.length?e.jsx("div",{ref:m,className:P("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",a),children:r.filter(f=>f.type!=="none").map(f=>{const p=`${d||f.dataKey||"value"}`,g=Zm(h,f,p);return e.jsxs("div",{className:P("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!l?e.jsx(g.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),g?.label]},f.value)})}):null});zv.displayName="ChartLegend";function Zm(a,l,r){if(typeof l!="object"||l===null)return;const c="payload"in l&&typeof l.payload=="object"&&l.payload!==null?l.payload:void 0;let d=r;return r in l&&typeof l[r]=="string"?d=l[r]:c&&r in c&&typeof c[r]=="string"&&(d=c[r]),d in a?a[d]:a[r]}const si=ti("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=u.forwardRef(({className:a,variant:l,size:r,asChild:c=!1,...d},m)=>{const h=c?l1:"button";return e.jsx(h,{className:P(si({variant:l,size:r,className:a})),ref:m,...d})});_.displayName="Button";const H_=ti("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ce({className:a,variant:l,...r}){return e.jsx("div",{className:P(H_({variant:l}),a),...r})}async function q_(){const a=await ke("/api/webui/system/restart",{method:"POST",headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"重启失败")}return await a.json()}async function V_(){const a=await ke("/api/webui/system/status",{method:"GET",headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取状态失败")}return await a.json()}const Hr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Rv=u.createContext(null);function lr({children:a,onRestartComplete:l,onRestartFailed:r,healthCheckUrl:c="/api/webui/system/status",maxAttempts:d=Hr.MAX_ATTEMPTS}){const[m,h]=u.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),f=u.useRef({}),p=u.useCallback(()=>{const z=f.current;z.progress&&(clearInterval(z.progress),z.progress=void 0),z.elapsed&&(clearInterval(z.elapsed),z.elapsed=void 0),z.check&&(clearTimeout(z.check),z.check=void 0)},[]),g=u.useCallback(()=>{p(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d})},[p,d]),N=u.useCallback(async()=>{try{const z=new AbortController,M=setTimeout(()=>z.abort(),Hr.CHECK_TIMEOUT),S=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:z.signal});return clearTimeout(M),S.ok}catch{return!1}},[c]),j=u.useCallback(()=>{let z=0;const M=async()=>{if(z++,h(F=>({...F,status:"checking",checkAttempts:z})),await N())p(),h(F=>({...F,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},Hr.SUCCESS_REDIRECT_DELAY);else if(z>=d){p();const F=`健康检查超时 (${z}/${d})`;h(E=>({...E,status:"failed",error:F})),r?.(F)}else{const F=setTimeout(M,Hr.CHECK_INTERVAL);f.current.check=F}};M()},[N,p,d,l,r]),b=u.useCallback(()=>{h(z=>({...z,status:"checking",checkAttempts:0,error:void 0})),j()},[j]),y=u.useCallback(async z=>{const{delay:M=0,skipApiCall:S=!1}=z??{};if(m.status!=="idle"&&m.status!=="failed")return;if(p(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),M>0&&await new Promise(C=>setTimeout(C,M)),S)h(C=>({...C,status:"restarting"}));else try{h(C=>({...C,status:"restarting"})),await Promise.race([q_(),new Promise(C=>setTimeout(C,5e3))])}catch{}const F=setInterval(()=>{h(C=>({...C,progress:C.progress>=90?C.progress:C.progress+1}))},Hr.PROGRESS_INTERVAL),E=setInterval(()=>{h(C=>({...C,elapsedTime:C.elapsedTime+1}))},1e3);f.current.progress=F,f.current.elapsed=E,setTimeout(()=>{j()},Hr.INITIAL_DELAY)},[m.status,p,d,j]),w={state:m,isRestarting:m.status!=="idle",triggerRestart:y,resetState:g,retryHealthCheck:b};return e.jsx(Rv.Provider,{value:w,children:a})}function Tn(){const a=u.useContext(Rv);if(!a)throw new Error("useRestart must be used within a RestartProvider");return a}function G_(){try{return Tn()}catch{return null}}const K_=(a,l,r,c,d)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:d??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:d??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${l}/${r})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(st,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(Ut,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[a];function nr({visible:a,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m=!0,className:h}){const f=G_();return(f?f.isRestarting:a)?f?e.jsx(Dv,{state:f.state,onRetry:f.retryHealthCheck,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):e.jsx(Q_,{onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):null}function Dv({state:a,onRetry:l,onComplete:r,onFailed:c,title:d,description:m,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:N,checkAttempts:j,maxAttempts:b}=a;u.useEffect(()=>{p==="success"&&r?r():p==="failed"&&c&&c()},[p,r,c]);const y=K_(p,j,b,d,m),w=z=>{const M=Math.floor(z/60),S=z%60;return`${M}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:P("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(Y_,{}),e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8 relative z-10",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsxs("div",{className:"relative",children:[y.icon,(p==="restarting"||p==="checking")&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"})]}),e.jsx("h2",{className:"text-2xl font-bold",children:y.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:y.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(tr,{value:g,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[g,"%"]}),e.jsxs("span",{children:["已用时: ",w(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:y.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:l,variant:"secondary",className:"flex-1",children:[e.jsx(rc,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function Q_({onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m}){const[h,f]=u.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=u.useCallback(()=>{let g=0;const N=60,j=async()=>{g++,f(b=>({...b,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(y=>({...y,status:"success",progress:100})),setTimeout(()=>{a?.(),window.location.href="/auth"},1500);return}}catch{}g>=N?(f(b=>({...b,status:"failed"})),l?.()):setTimeout(j,2e3)};j()},[a,l]);return u.useEffect(()=>{const g=setInterval(()=>{f(b=>({...b,progress:b.progress>=90?b.progress:b.progress+1}))},200),N=setInterval(()=>{f(b=>({...b,elapsedTime:b.elapsedTime+1}))},1e3),j=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(N),clearTimeout(j)}},[p]),e.jsx(Dv,{state:h,onRetry:p,onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m})}function Y_(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}const Qs=i1,dd=c1,J_=n1,Ov=u.forwardRef(({className:a,...l},r)=>e.jsx(Bj,{ref:r,className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l}));Ov.displayName=Bj.displayName;const Hs=u.forwardRef(({className:a,children:l,preventOutsideClose:r=!1,hideCloseButton:c=!1,...d},m)=>e.jsxs(J_,{children:[e.jsx(Ov,{}),e.jsxs(Ij,{ref:m,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),onPointerDownOutside:r?h=>h.preventDefault():void 0,onInteractOutside:r?h=>h.preventDefault():void 0,...d,children:[l,!c&&e.jsxs(r1,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Sa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Hs.displayName=Ij.displayName;const qs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col space-y-1.5 text-center sm:text-left",a),...l});qs.displayName="DialogHeader";const gt=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});gt.displayName="DialogFooter";const Vs=u.forwardRef(({className:a,...l},r)=>e.jsx(Pj,{ref:r,className:P("text-lg font-semibold leading-none tracking-tight",a),...l}));Vs.displayName=Pj.displayName;const at=u.forwardRef(({className:a,...l},r)=>e.jsx(Fj,{ref:r,className:P("text-sm text-muted-foreground",a),...l}));at.displayName=Fj.displayName;const ne=u.forwardRef(({className:a,type:l,...r},c)=>e.jsx("input",{type:l,className:P("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:c,...r}));ne.displayName="Input";const tt=u.forwardRef(({className:a,...l},r)=>e.jsx(Hj,{ref:r,className:P("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...l,children:e.jsx(o1,{className:P("grid place-content-center text-current"),children:e.jsx(Ot,{className:"h-4 w-4"})})}));tt.displayName=Hj.displayName;const Pe=f1,Fe=p1,Be=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(qj,{ref:c,className:P("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,e.jsx(d1,{asChild:!0,children:e.jsx(Ba,{className:"h-4 w-4 opacity-50"})})]}));Be.displayName=qj.displayName;const Lv=u.forwardRef(({className:a,...l},r)=>e.jsx(Vj,{ref:r,className:P("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Xr,{className:"h-4 w-4"})}));Lv.displayName=Vj.displayName;const Uv=u.forwardRef(({className:a,...l},r)=>e.jsx(Gj,{ref:r,className:P("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Ba,{className:"h-4 w-4"})}));Uv.displayName=Gj.displayName;const Ie=u.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>e.jsx(u1,{children:e.jsxs(Kj,{ref:d,className:P("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[e.jsx(Lv,{}),e.jsx(m1,{className:P("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),e.jsx(Uv,{})]})}));Ie.displayName=Kj.displayName;const X_=u.forwardRef(({className:a,...l},r)=>e.jsx(Qj,{ref:r,className:P("px-2 py-1.5 text-sm font-semibold",a),...l}));X_.displayName=Qj.displayName;const W=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(Yj,{ref:c,className:P("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(x1,{children:e.jsx(Ot,{className:"h-4 w-4"})})}),e.jsx(h1,{children:l})]}));W.displayName=Yj.displayName;const Z_=u.forwardRef(({className:a,...l},r)=>e.jsx(Jj,{ref:r,className:P("-mx-1 my-1 h-px bg-muted",a),...l}));Z_.displayName=Jj.displayName;const fx=({className:a,...l})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:P("mx-auto flex w-full justify-center",a),...l});fx.displayName="Pagination";const px=u.forwardRef(({className:a,...l},r)=>e.jsx("ul",{ref:r,className:P("flex flex-row items-center gap-1",a),...l}));px.displayName="PaginationContent";const Xn=u.forwardRef(({className:a,...l},r)=>e.jsx("li",{ref:r,className:P("",a),...l}));Xn.displayName="PaginationItem";const jc=({className:a,isActive:l,size:r="icon",...c})=>e.jsx("a",{"aria-current":l?"page":void 0,className:P(si({variant:l?"outline":"ghost",size:r}),a),...c});jc.displayName="PaginationLink";const $v=({className:a,...l})=>e.jsxs(jc,{"aria-label":"Go to previous page",size:"default",className:P("gap-1 pl-2.5",a),...l,children:[e.jsx(Pa,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});$v.displayName="PaginationPrevious";const Bv=({className:a,...l})=>e.jsxs(jc,{"aria-label":"Go to next page",size:"default",className:P("gap-1 pr-2.5",a),...l,children:[e.jsx("span",{children:"下一页"}),e.jsx(ra,{className:"h-4 w-4"})]});Bv.displayName="PaginationNext";const Iv=({className:a,...l})=>e.jsxs("span",{"aria-hidden":!0,className:P("flex h-9 w-9 items-center justify-center",a),...l,children:[e.jsx(C1,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});Iv.displayName="PaginationEllipsis";const W_=5,e2=5e3;let Lm=0;function s2(){return Lm=(Lm+1)%Number.MAX_SAFE_INTEGER,Lm.toString()}const Um=new Map,Ug=a=>{if(Um.has(a))return;const l=setTimeout(()=>{Um.delete(a),ac({type:"REMOVE_TOAST",toastId:a})},e2);Um.set(a,l)},t2=(a,l)=>{switch(l.type){case"ADD_TOAST":return{...a,toasts:[l.toast,...a.toasts].slice(0,W_)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(r=>r.id===l.toast.id?{...r,...l.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=l;return r?Ug(r):a.toasts.forEach(c=>{Ug(c.id)}),{...a,toasts:a.toasts.map(c=>c.id===r||r===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return l.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(r=>r.id!==l.toastId)}}},Fo=[];let Ho={toasts:[]};function ac(a){Ho=t2(Ho,a),Fo.forEach(l=>{l(Ho)})}function aa({...a}){const l=s2(),r=d=>ac({type:"UPDATE_TOAST",toast:{...d,id:l}}),c=()=>ac({type:"DISMISS_TOAST",toastId:l});return ac({type:"ADD_TOAST",toast:{...a,id:l,open:!0,onOpenChange:d=>{d||c()}}}),{id:l,dismiss:c,update:r}}function nt(){const[a,l]=u.useState(Ho);return u.useEffect(()=>(Fo.push(l),()=>{const r=Fo.indexOf(l);r>-1&&Fo.splice(r,1)}),[a]),{...a,toast:aa,dismiss:r=>ac({type:"DISMISS_TOAST",toastId:r})}}const dl="/api/webui/expression";async function gx(){const a=await ke(`${dl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取聊天列表失败")}return a.json()}async function a2(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await ke(`${dl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取表达方式列表失败")}return r.json()}async function l2(a){const l=await ke(`${dl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取表达方式详情失败")}return l.json()}async function n2(a){const l=await ke(`${dl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"创建表达方式失败")}return l.json()}async function r2(a,l){const r=await ke(`${dl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新表达方式失败")}return r.json()}async function i2(a){const l=await ke(`${dl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除表达方式失败")}return l.json()}async function c2(a){const l=await ke(`${dl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除表达方式失败")}return l.json()}async function o2(){const a=await ke(`${dl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取统计数据失败")}return a.json()}async function jx(){const a=await ke(`${dl}/review/stats`);if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取审核统计失败")}return a.json()}async function $g(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.filter_type&&l.append("filter_type",a.filter_type),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await ke(`${dl}/review/list?${l}`);if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取审核列表失败")}return r.json()}async function $m(a){const l=await ke(`${dl}/review/batch`,{method:"POST",body:JSON.stringify({items:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量审核失败")}return l.json()}function Pv({open:a,onOpenChange:l}){const[r,c]=u.useState("list"),[d,m]=u.useState(null),[h,f]=u.useState([]),[p,g]=u.useState("unchecked"),[N,j]=u.useState([]),[b,y]=u.useState(0),[w,z]=u.useState(!1),[M,S]=u.useState(0),[F,E]=u.useState(1),[C,R]=u.useState(null),[H,O]=u.useState(0),[X,L]=u.useState(!1),[me,Ne]=u.useState(null),je=u.useRef(null),ce=u.useRef(null),ge=u.useRef(!1),[pe,D]=u.useState(!1),[Q,B]=u.useState(!1),[ue,Y]=u.useState(0),[we,fe]=u.useState(1),[Ee,G]=u.useState(20),[$,A]=u.useState(""),[K,Re]=u.useState("unchecked"),[se,$e]=u.useState(""),[cs,J]=u.useState(""),[Z,Le]=u.useState(new Set),[le,De]=u.useState(new Set),[xe,Me]=u.useState(new Map),{toast:ds}=nt(),Ts=u.useCallback(async()=>{try{B(!0);const U=await jx();m(U)}catch(U){console.error("加载统计失败:",U)}finally{B(!1)}},[]),Ct=u.useCallback(async()=>{try{D(!0);const U=await $g({page:we,page_size:Ee,filter_type:K,search:se||void 0});f(U.data),Y(U.total)}catch(U){ds({title:"加载失败",description:U instanceof Error?U.message:"无法加载列表",variant:"destructive"})}finally{D(!1)}},[we,Ee,K,se,ds]),ia=u.useCallback(async()=>{try{const U=await gx();if(U?.data){const Se=new Map;U.data.forEach(as=>{Se.set(as.chat_id,as.chat_name)}),Me(Se)}}catch(U){console.error("加载聊天名称失败:",U)}},[]),ut=u.useCallback(async(U=!0,Se=!1)=>{try{z(!0);const as=Se?F+1:F,us=await $g({page:as,page_size:20,filter_type:p});Se?(j(es=>[...es,...us.data]),E(as)):j(us.data),S(us.total),U&&y(0)}catch(as){ds({title:"加载失败",description:as instanceof Error?as.message:"无法加载列表",variant:"destructive"})}finally{z(!1)}},[F,p,ds]);u.useEffect(()=>{r==="quick"&&(E(1),y(0))},[p,r]),u.useEffect(()=>{a&&r==="quick"&&(ut(),Ts())},[a,r,F,p,ut,Ts]);const Is=u.useCallback(U=>U?p==="unchecked"?{left:!0,right:!0}:p==="passed"?{left:!0,right:!1}:p==="rejected"?{left:!1,right:!0}:U.checked?U.rejected?{left:!1,right:!0}:{left:!0,right:!1}:{left:!0,right:!0}:{left:!1,right:!1},[p]),V=u.useCallback(async U=>{const Se=N[b];if(!Se||X)return;const as=Is(Se);if(!(U&&!as.left||!U&&!as.right)){L(!0),R(U?"left":"right"),O(U?-400:400);try{(await $m([{id:Se.id,rejected:U,require_unchecked:p==="unchecked"}])).results[0]?.success?(ds({title:U?"已拒绝":"已通过",description:`表达方式 #${Se.id} ${U?"已拒绝":"已通过"}`}),setTimeout(()=>{j(es=>es.filter((Tt,$s)=>$s!==b)),S(es=>es-1),b>=N.length-1&&y(Math.max(0,b-1)),R(null),O(0),L(!1),Ts(),N.length<=1&&M>1&&ut(!1)},300)):(Ne(Se.id),ds({title:"数据冲突",description:"该条目已被后台任务处理,正在刷新数据...",variant:"destructive"}),setTimeout(()=>{Ne(null),R(null),O(0),L(!1),ut(!1),Ts()},1500))}catch(us){ds({title:"操作失败",description:us instanceof Error?us.message:"未知错误",variant:"destructive"}),R(null),O(0),L(!1)}}},[N,b,X,Is,p,ds,Ts,M,ut]),Ke=u.useCallback((U,Se)=>{X||(ce.current={x:U,y:Se},ge.current=!1)},[X]),He=u.useCallback(U=>{X||(L(!0),O(U==="left"?-30:30),setTimeout(()=>{O(0),setTimeout(()=>L(!1),300)},150))},[X]),Je=u.useCallback(U=>{if(!ce.current||X)return;const Se=U-ce.current.x,as=N[b],us=Is(as);if(Se<0&&!us.left){O(Se*.2),R(null);return}if(Se>0&&!us.right){O(Se*.2),R(null);return}ge.current=!0,O(Se),Math.abs(Se)>50?R(Se>0?"right":"left"):R(null)},[N,b,Is,X]),Es=u.useCallback(()=>{if(!ce.current)return;Math.abs(H)>100&&C?V(C==="left"):(O(0),R(null)),ce.current=null,ge.current=!1},[H,C,V]),ms=u.useCallback(U=>{Ke(U.clientX,U.clientY)},[Ke]),Ms=u.useCallback(U=>{ce.current&&(U.preventDefault(),Je(U.clientX))},[Je]),We=u.useCallback(()=>{Es()},[Es]),Cs=u.useCallback(()=>{ce.current&&Es()},[Es]),rs=u.useCallback(U=>{const Se=U.touches[0];Ke(Se.clientX,Se.clientY)},[Ke]),is=u.useCallback(U=>{const Se=U.touches[0];Je(Se.clientX)},[Je]),ys=u.useCallback(()=>{Es()},[Es]);u.useEffect(()=>{if(!a||r!=="quick")return;const U=Se=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Se.key)||(Se.preventDefault(),Se.stopPropagation(),Se.stopImmediatePropagation(),X||w))return;const as=N[b],us=Is(as);Se.key==="ArrowLeft"?us.left?V(!0):He("left"):Se.key==="ArrowRight"?us.right?V(!1):He("right"):Se.key==="ArrowDown"?bes+1):Se.key==="ArrowUp"&&b>0&&y(es=>es-1)};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[a,r,N,b,X,w,Is,V,He]),u.useEffect(()=>{if(!a||r!=="quick"||w)return;const U=N.length-b-1,Se=N.length{a&&(Ts(),Ct(),ia())},[a,Ts,Ct,ia]),u.useEffect(()=>{fe(1),Le(new Set)},[K,se]),u.useEffect(()=>{Le(new Set)},[h]);const rt=()=>{$e(cs),fe(1)},jt=U=>xe.get(U)||U,Ae=async(U,Se)=>{try{De(us=>new Set(us).add(U));const as=await $m([{id:U,rejected:Se,require_unchecked:K==="unchecked"}]);as.results[0]?.success?(ds({title:Se?"已拒绝":"已通过",description:`表达方式 #${U} ${Se?"已拒绝":"已通过"}`}),Ct(),Ts()):ds({title:"操作失败",description:as.results[0]?.message||"未知错误",variant:"destructive"})}catch(as){ds({title:"操作失败",description:as instanceof Error?as.message:"未知错误",variant:"destructive"})}finally{De(as=>{const us=new Set(as);return us.delete(U),us})}},Qe=async U=>{if(Z.size===0){ds({title:"请选择",description:"请先选择要审核的表达方式",variant:"destructive"});return}try{D(!0);const Se=Array.from(Z).map(us=>({id:us,rejected:U,require_unchecked:K==="unchecked"})),as=await $m(Se);ds({title:"批量审核完成",description:`成功 ${as.succeeded} 条,失败 ${as.failed} 条`,variant:as.failed>0?"destructive":"default"}),Le(new Set),Ct(),Ts()}catch(Se){ds({title:"批量审核失败",description:Se instanceof Error?Se.message:"未知错误",variant:"destructive"})}finally{D(!1)}},As=()=>{Z.size===h.length?Le(new Set):Le(new Set(h.map(U=>U.id)))},mt=U=>{Le(Se=>{const as=new Set(Se);return as.has(U)?as.delete(U):as.add(U),as})},Ht=U=>U?new Date(U*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",ca=U=>U.checked?U.rejected?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"已拒绝"]}):e.jsxs(Ce,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(st,{className:"h-3 w-3"}),"已通过"]}):e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(da,{className:"h-3 w-3"}),"待审核"]}),Fa=U=>U?U==="ai"?e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Yn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Fl,{className:"h-3 w-3"}),"人工"]}):null,Xt=Math.ceil(ue/Ee),te=()=>{const U=[];if(Xt<=7)for(let Se=1;Se<=Xt;Se++)U.push(Se);else{U.push(1),we>3&&U.push("ellipsis");const Se=Math.max(2,we-1),as=Math.min(Xt-1,we+1);for(let us=Se;us<=as;us++)U.push(us);we1&&U.push(Xt)}return U},_e=()=>{const U=parseInt($,10);!isNaN(U)&&U>=1&&U<=Xt&&(fe(U),A(""))};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-5xl w-[95vw] sm:w-full h-[90vh] sm:h-[85vh] flex flex-col p-0",hideCloseButton:!0,children:[e.jsxs("div",{className:"flex items-end bg-muted/30 px-2 pt-2 shrink-0",children:[e.jsxs("button",{onClick:()=>c("list"),className:P("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="list"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(rv,{className:"h-4 w-4"}),e.jsx("span",{children:"列表模式"}),r==="list"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsxs("button",{onClick:()=>c("quick"),className:P("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="quick"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(sl,{className:"h-4 w-4"}),e.jsx("span",{children:"快速审核"}),e.jsx(Ce,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:"新"}),r==="quick"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsx("div",{className:"flex-1 border-b border-border"}),e.jsx("button",{onClick:()=>l(!1),className:"mb-[1px] p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",children:e.jsx(Sa,{className:"h-4 w-4"})})]}),r==="list"&&e.jsxs(e.Fragment,{children:[e.jsxs(qs,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-4 border-b shrink-0",children:[e.jsx(Vs,{className:"text-lg sm:text-xl",children:"表达方式审核"}),e.jsx(at,{className:"text-xs sm:text-sm",children:"审核麦麦学习到的表达方式。通过审核的项目才会被使用(可在配置中调整),被拒绝的项目永远不会被使用。"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-orange-500",children:Q?"-":d?.unchecked??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"待审核"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-500",children:Q?"-":d?.passed??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已通过"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-500",children:Q?"-":d?.rejected??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已拒绝"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-500",children:Q?"-":d?.total??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"总计"})]})]})]}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsx(Jt,{value:K,onValueChange:U=>Re(U),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(da,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"待审核"}),e.jsx("span",{className:"sm:hidden",children:"待审"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.unchecked??0,")"]})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(st,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.passed??0,")"]})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.rejected??0,")"]})]}),e.jsxs(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx("span",{children:"全部"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.total??0,")"]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索情景或风格...",value:cs,onChange:U=>J(U.target.value),onKeyDown:U=>U.key==="Enter"&&rt(),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:rt,children:e.jsx($t,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{Ct(),Ts()},disabled:pe,children:e.jsx(dt,{className:P("h-4 w-4",pe&&"animate-spin")})})]}),Z.size>0&&e.jsx("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:K==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),"(",Z.size,")"]})]}):K==="passed"?e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量改为拒绝"}),e.jsx("span",{className:"sm:hidden",children:"改为拒绝"}),"(",Z.size,")"]}):K==="rejected"?e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量改为通过"}),e.jsx("span",{className:"sm:hidden",children:"改为通过"}),"(",Z.size,")"]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"批量拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"}),"(",Z.size,")"]})]})})]})]}),e.jsx(ts,{className:"flex-1 px-4 sm:px-6",children:pe&&h.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(dt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(Ut,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"没有找到表达方式"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[h.length>0&&e.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{checked:Z.size===h.length&&h.length>0,onCheckedChange:As}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Z.size===h.length&&h.length>0?`已全选当前页 (${h.length} 条)`:`全选当前页 (${h.length} 条)`})]}),Z.size>0&&e.jsx(_,{variant:"ghost",size:"sm",onClick:()=>Le(new Set),className:"h-7 text-xs",children:"取消选择"})]}),h.map(U=>e.jsx("div",{className:P("rounded-lg border p-3 sm:p-4 space-y-2 sm:space-y-3 transition-colors",Z.has(U.id)&&"bg-accent border-primary",le.has(U.id)&&"opacity-50"),children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx(tt,{checked:Z.has(U.id),onCheckedChange:()=>mt(U.id),disabled:le.has(U.id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"情景:"}),e.jsx("p",{className:"text-sm font-medium break-words",children:U.situation})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"风格:"}),e.jsx("p",{className:"text-sm text-muted-foreground break-words",children:U.style})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["#",U.id]}),e.jsx("span",{children:"·"}),e.jsx("span",{title:jt(U.chat_id),className:"truncate max-w-24 sm:max-w-32",children:jt(U.chat_id)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:Ht(U.create_date)}),e.jsxs("div",{className:"flex items-center gap-1",children:[ca(U),Fa(U.modified_by)]})]})]}),e.jsx("div",{className:"flex flex-col gap-1 sm:gap-2 shrink-0",children:K==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"通过"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]}):K==="passed"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):K==="rejected"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为通过"})]}):e.jsx(e.Fragment,{children:U.rejected?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为通过"})]}):U.checked?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"通过"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]})})})]})},U.id))]})}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-t shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:"每页"}),e.jsxs(Pe,{value:Ee.toString(),onValueChange:U=>{G(parseInt(U,10)),fe(1)},children:[e.jsx(Be,{className:"w-[70px] h-8",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsx("span",{className:"hidden sm:inline",children:"条"}),e.jsxs("span",{className:"text-muted-foreground",children:["共 ",ue," 条"]})]}),e.jsx(fx,{className:"mx-0 w-auto",children:e.jsxs(px,{children:[e.jsx(Xn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>fe(U=>Math.max(1,U-1)),disabled:we<=1||pe,children:e.jsx(Pa,{className:"h-4 w-4"})})}),te().map((U,Se)=>e.jsx(Xn,{children:U==="ellipsis"?e.jsx(Iv,{}):e.jsx(jc,{href:"#",isActive:U===we,onClick:as=>{as.preventDefault(),fe(U)},className:"h-8 w-8 cursor-pointer",children:U})},Se)),e.jsx(Xn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>fe(U=>Math.min(Xt,U+1)),disabled:we>=Xt||pe,children:e.jsx(ra,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"跳至"}),e.jsx(ne,{type:"number",min:1,max:Xt,value:$,onChange:U=>A(U.target.value),onKeyDown:U=>U.key==="Enter"&&_e(),className:"w-16 h-8 text-center",placeholder:we.toString()}),e.jsx("span",{className:"text-muted-foreground",children:"页"}),e.jsx(_,{variant:"outline",size:"sm",className:"h-8",onClick:_e,disabled:pe,children:"跳转"})]})]})]}),r==="quick"&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-muted-foreground",children:["待审核: ",e.jsx("span",{className:"font-medium text-orange-500",children:d?.unchecked??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["已通过: ",e.jsx("span",{className:"font-medium text-green-500",children:d?.passed??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["已拒绝: ",e.jsx("span",{className:"font-medium text-red-500",children:d?.rejected??0})]})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>{ut(),Ts()},disabled:w,children:[e.jsx(dt,{className:P("h-4 w-4 mr-1",w&&"animate-spin")}),"刷新"]})]}),e.jsx(Jt,{value:p,onValueChange:U=>g(U),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(da,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"待审核"}),e.jsx("span",{className:"sm:hidden",children:"待审"})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(st,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已通过"}),e.jsx("span",{className:"sm:hidden",children:"通过"})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"已拒绝"}),e.jsx("span",{className:"sm:hidden",children:"拒绝"})]}),e.jsx(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm",children:"全部"})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-8 relative overflow-hidden",children:w&&N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})]}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(st,{className:"h-10 w-10 text-green-500"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"全部审核完成!"}),e.jsx("p",{className:"text-muted-foreground",children:"当前筛选条件下没有待处理的项目"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 text-sm text-muted-foreground z-50",children:[b+1," / ",N.length,M>N.length&&e.jsxs("span",{className:"ml-1",children:["(共 ",M," 条)"]})]}),e.jsx("div",{className:"absolute inset-x-4 top-1/2 -translate-y-1/2 flex justify-between pointer-events-none z-40",children:(()=>{const U=N[b],Se=Is(U);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:P("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="left"?"bg-red-500/20 text-red-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Se.left&&"invisible"),children:[e.jsx(ta,{className:"h-8 w-8"}),e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"拒绝"})]}),e.jsxs("div",{className:P("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="right"?"bg-green-500/20 text-green-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Se.right&&"invisible"),children:[e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"通过"}),e.jsx(st,{className:"h-8 w-8"})]})]})})()}),e.jsx("div",{className:"relative w-full max-w-md h-[400px] flex items-center justify-center",children:N.slice(b,b+5).reverse().map((U,Se,as)=>{const us=as.length-1-Se,es=us===0;let Tt={zIndex:5-us,position:"absolute",width:"100%",transition:es&&!ge.current?"all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)":"none"};if(es)Tt={...Tt,transform:`translateX(${H}px) rotate(${H*.05}deg)`,opacity:Math.max(0,1-Math.abs(H)/500),cursor:"grab"};else{const $s=Math.min(Math.abs(H)/200,1),pa=vt=>{const Ca=vt*7%5,ll=vt*13%7;return{scale:1-vt*.05,translateY:vt*12,rotate:(vt%2===0?1:-1)*(vt*2)+Ca,translateX:(vt%2===0?-1:1)*(vt*4)+ll}},oa=pa(us),ae=pa(us-1),oe=oa.scale+(ae.scale-oa.scale)*$s,qe=oa.translateY+(ae.translateY-oa.translateY)*$s,Ys=oa.rotate+(ae.rotate-oa.rotate)*$s,Ps=oa.translateX+(ae.translateX-oa.translateX)*$s;Tt={...Tt,transform:`translate3d(${Ps}px, ${qe}px, 0) scale(${oe}) rotate(${Ys}deg)`,opacity:1-us*.15,filter:`blur(${Math.max(0,us*1-$s)}px)`,pointerEvents:"none"}}return e.jsxs("div",{ref:es?je:void 0,className:P("bg-card border rounded-xl shadow-xl p-6 select-none h-full flex flex-col",es&&"active:cursor-grabbing shadow-2xl ring-1 ring-border/50",es&&me===U.id&&"ring-4 ring-orange-500/50 bg-orange-50/10"),style:Tt,onMouseDown:es?ms:void 0,onMouseMove:es?Ms:void 0,onMouseUp:es?We:void 0,onMouseLeave:es?Cs:void 0,onTouchStart:es?rs:void 0,onTouchMove:es?is:void 0,onTouchEnd:es?ys:void 0,children:[es&&me===U.id&&e.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/80 backdrop-blur-sm animate-in fade-in duration-300 rounded-xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-orange-500/20 rounded-full animate-ping"}),e.jsx(dt,{className:"relative h-16 w-16 text-orange-500 mb-4 animate-spin duration-1000"})]}),e.jsx("h3",{className:"text-xl font-bold text-foreground animate-in slide-in-from-bottom-2 fade-in duration-500",children:"数据已更新"}),e.jsx("p",{className:"text-muted-foreground mt-2 animate-in slide-in-from-bottom-3 fade-in duration-700",children:"后台任务已处理此条目"})]}),es&&e.jsx("div",{className:P("absolute inset-0 flex items-center justify-center z-20 pointer-events-none transition-opacity duration-200",H<-10&&!Is(U).left||H>10&&!Is(U).right?"opacity-100":"opacity-0"),children:e.jsx("div",{className:"bg-background/80 backdrop-blur-sm p-4 rounded-full shadow-lg border border-border",children:e.jsx(iv,{className:"h-12 w-12 text-muted-foreground"})})}),e.jsxs("div",{className:"space-y-4 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-muted-foreground font-mono",children:["#",U.id]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ca(U),Fa(U.modified_by)]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"情景"}),e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg border border-border/50",children:e.jsx("p",{className:"text-lg font-medium leading-relaxed",children:U.situation})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"风格"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:U.style.split(/[,,]/).map(($s,pa)=>e.jsx(Ce,{variant:"secondary",className:"font-normal",children:$s.trim()},pa))})]})]}),e.jsxs("div",{className:"mt-auto pt-4 border-t flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(Fl,{className:"h-3 w-3"})}),e.jsx("span",{title:jt(U.chat_id),className:"truncate max-w-[120px] font-medium",children:jt(U.chat_id)})]}),e.jsx("span",{className:"font-mono",children:Ht(U.create_date)})]})]},U.id)})}),e.jsx("div",{className:"flex items-center gap-8 mt-8 sm:hidden z-50",children:(()=>{const U=N[b],Se=Is(U);return e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"lg",className:P("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Se.left?"hover:bg-red-50 hover:text-red-600 hover:border-red-200":"opacity-30 cursor-not-allowed"),onClick:()=>Se.left&&V(!0),disabled:!Se.left||X,children:e.jsx(ta,{className:"h-8 w-8"})}),e.jsx(_,{variant:"outline",size:"lg",className:P("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Se.right?"hover:bg-green-50 hover:text-green-600 hover:border-green-200":"opacity-30 cursor-not-allowed"),onClick:()=>Se.right&&V(!1),disabled:!Se.right||X,children:e.jsx(st,{className:"h-8 w-8"})})]})})()})]})}),e.jsxs("div",{className:"hidden sm:flex items-center justify-center gap-6 px-6 py-3 border-t text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"←"}),e.jsx("span",{children:"拒绝"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"→"}),e.jsx("span",{children:"通过"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"↑"}),e.jsx("span",{children:"上一条"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"↓"}),e.jsx("span",{children:"下一条"})]}),e.jsx("span",{className:"text-muted-foreground/50",children:"|"}),e.jsx("span",{children:"拖拽卡片滑动审核"})]})]})]})})}function d2(){return e.jsx(lr,{children:e.jsx(m2,{})})}const u2=a=>{const l=[];for(let r=0;r(H.current=!0,()=>{H.current=!1,O.current&&(clearInterval(O.current),O.current=null)}),[]);const X=u.useCallback(async()=>{try{const A=await jx();H.current&&E(A.unchecked)}catch(A){console.error("获取审核统计失败:",A)}},[]),L=u.useCallback(async()=>{try{y(!0);const A=await fw.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");H.current&&j({hitokoto:A.data.hitokoto,from:A.data.from||A.data.from_who||"未知"})}catch(A){console.error("获取一言失败:",A),H.current&&j({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{H.current&&y(!1)}},[]),me=u.useCallback(async()=>{try{const A=await ke("/api/webui/system/status");if(!H.current)return;if(A.ok){const K=await A.json();z(K)}else z(null)}catch(A){console.error("获取机器人状态失败:",A),H.current&&z(null)}},[]),Ne=async()=>{await C()},je=u.useCallback(async()=>{try{const A=await ke(`/api/webui/statistics/dashboard?hours=${h}`);if(!H.current)return;if(A.ok){const K=await A.json();l(K)}c(!1),m(100)}catch(A){console.error("Failed to fetch dashboard data:",A),H.current&&(c(!1),m(100))}},[h]);if(u.useEffect(()=>{if(!r)return;m(0);const A=setTimeout(()=>m(15),200),K=setTimeout(()=>m(30),800),Re=setTimeout(()=>m(45),2e3),se=setTimeout(()=>m(60),4e3),$e=setTimeout(()=>m(75),6500),cs=setTimeout(()=>m(85),9e3),J=setTimeout(()=>m(92),11e3);return()=>{clearTimeout(A),clearTimeout(K),clearTimeout(Re),clearTimeout(se),clearTimeout($e),clearTimeout(cs),clearTimeout(J)}},[r]),u.useEffect(()=>{je(),L(),me(),X()},[je,L,me,X]),u.useEffect(()=>{if(O.current&&(clearInterval(O.current),O.current=null),!!p)return O.current=setInterval(()=>{H.current&&(je(),me())},3e4),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[p,je,me]),r||!a)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(dt,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(tr,{value:d,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d,"%"]})]})]})});const{summary:ce,model_stats:ge=[],hourly_data:pe=[],daily_data:D=[],recent_activity:Q=[]}=a,B=ce??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ue=A=>{const K=Math.floor(A/3600),Re=Math.floor(A%3600/60);return`${K}小时${Re}分钟`},Y=A=>{const K=A.toLocaleString("zh-CN");return A>=1e9?{display:`${(A/1e9).toFixed(2)}B`,exact:K,needsExact:!0}:A>=1e6?{display:`${(A/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:A>=1e4?{display:`${(A/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:A>=1e3?{display:`${(A/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},we=A=>{const K=`¥${A.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return A>=1e6?{display:`¥${(A/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:A>=1e4?{display:`¥${(A/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:A>=1e3?{display:`¥${(A/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},fe=A=>new Date(A).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Ee=u2(ge.length),G=ge.map((A,K)=>({name:A.model_name,value:A.request_count,fill:Ee[K]})),$={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Jt,{value:h.toString(),onValueChange:A=>f(Number(A)),children:e.jsxs(Gt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Xe,{value:"24",children:"24小时"}),e.jsx(Xe,{value:"168",children:"7天"}),e.jsx(Xe,{value:"720",children:"30天"})]})}),e.jsxs(_,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:je,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[b?e.jsx(ks,{className:"h-5 flex-1"}):N?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',N.hitokoto,'" —— ',N.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:b,children:e.jsx(dt,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Te,{className:"lg:col-span-1",children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(pc,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(ze,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"运行中"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(Ce,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Ut,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",ue(w.uptime)]})]})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(ze,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,disabled:R,className:"gap-2",children:[e.jsx(rc,{className:`h-4 w-4 ${R?"animate-spin":""}`}),R?"重启中...":"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(cv,{className:"h-4 w-4"}),"表达审核",F>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:F>99?"99+":F})]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/logs",children:[e.jsx(Ua,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/plugins",children:[e.jsx(T1,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/settings",children:[e.jsx(Sn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(E1,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(Ns,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/webui-feedback",children:[e.jsx(Ua,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/maibot-feedback",children:[e.jsx(Ia,{className:"h-4 w-4"}),"麦麦反馈"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(nx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Y(B.total_requests).display,Y(B.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(B.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"总花费"}),e.jsx(M1,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[we(B.total_cost).display,we(B.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",we(B.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B.cost_per_hour>0?`¥${B.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Zr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Y(B.total_tokens).display,Y(B.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(B.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B.tokens_per_hour>0?`${Y(B.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(sl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[B.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(da,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ue(B.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",B.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[Y(B.total_messages).display,Y(B.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(B.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",Y(B.total_replies).display,Y(B.total_replies).needsExact&&e.jsxs("span",{children:["(",Y(B.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-xl font-bold",children:B.total_messages>0?`¥${(B.total_cost/B.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(Jt,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Xe,{value:"trends",children:"趋势"}),e.jsx(Xe,{value:"models",children:"模型"}),e.jsx(Xe,{value:"activity",children:"活动"}),e.jsx(Xe,{value:"daily",children:"日统计"})]}),e.jsxs(Ss,{value:"trends",className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"请求趋势"}),e.jsxs(Ns,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Ww,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(e1,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"花费趋势"}),e.jsx(Ns,{children:"API调用成本变化"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Bo,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(Zi,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"Token消耗"}),e.jsx(Ns,{children:"Token使用量变化"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Bo,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(Zi,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ss,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"模型请求分布"}),e.jsxs(Ns,{children:["各模型使用占比 (共 ",ge.length," 个模型)"]})]}),e.jsx(ze,{children:e.jsx(Kr,{config:Object.fromEntries(ge.map((A,K)=>[A.model_name,{label:A.model_name,color:Ee[K]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(s1,{children:[e.jsx(Qi,{content:e.jsx(Qr,{})}),e.jsx(t1,{data:G,cx:"50%",cy:"50%",labelLine:!1,label:({name:A,percent:K})=>K&&K<.05?"":`${A} ${K?(K*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:G.map((A,K)=>e.jsx(a1,{fill:A.fill},`cell-${K}`))})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"模型详细统计"}),e.jsx(Ns,{children:"请求数、花费和性能"})]}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:ge.map((A,K)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:A.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${K%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),e.jsx("span",{className:"ml-1 font-medium",children:A.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",A.total_cost.toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[(A.total_tokens/1e3).toFixed(1),"K"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),e.jsxs("span",{className:"ml-1 font-medium",children:[A.avg_response_time.toFixed(2),"s"]})]})]})]},K))})})})]})]})}),e.jsx(Ss,{value:"activity",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"最近活动"}),e.jsx(Ns,{children:"最新的API调用记录"})]}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:Q.map((A,K)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:A.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:A.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:fe(A.timestamp)})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),e.jsx("span",{className:"ml-1",children:A.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",A.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[A.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${A.status==="success"?"text-green-600":"text-red-600"}`,children:A.status})]})]})]},K))})})})]})}),e.jsx(Ss,{value:"daily",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"每日统计"}),e.jsx(Ns,{children:"最近7天的数据汇总"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:e.jsxs(Bo,{data:D,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>{const K=new Date(A);return`${K.getMonth()+1}/${K.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>new Date(A).toLocaleDateString("zh-CN")})}),e.jsx(F_,{content:e.jsx(zv,{})}),e.jsx(Zi,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Zi,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(nr,{}),e.jsx(Pv,{open:M,onOpenChange:A=>{S(A),A||X()}})]})})}const x2={theme:"system",setTheme:()=>null},Fv=u.createContext(x2),vx=()=>{const a=u.useContext(Fv);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},h2=(a,l,r)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){l(a);return}const d=r.clientX,m=r.clientY,h=Math.hypot(Math.max(d,innerWidth-d),Math.max(m,innerHeight-m));document.startViewTransition(()=>{l(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${d}px ${m}px)`,`circle(${h}px at ${d}px ${m}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Hv=u.createContext(void 0),qv=()=>{const a=u.useContext(Hv);if(a===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return a},Ge=u.forwardRef(({className:a,...l},r)=>e.jsx(Nj,{className:P("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...l,ref:r,children:e.jsx(bw,{className:P("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ge.displayName=Nj.displayName;const f2=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=u.forwardRef(({className:a,...l},r)=>e.jsx(Xj,{ref:r,className:P(f2(),a),...l}));T.displayName=Xj.displayName;const p2=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:a=>a.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:a=>/[A-Z]/.test(a)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:a=>/[a-z]/.test(a)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:a=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(a)}];function g2(a){const l=p2.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(a)}));return{isValid:l.every(c=>c.passed),rules:l}}const ud="0.12.2",Nx="MaiBot Dashboard",j2=`${Nx} v${ud}`,v2=(a="v")=>`${a}${ud}`,wa={THEME:"maibot-ui-theme",ACCENT_COLOR:"accent-color",ENABLE_ANIMATIONS:"maibot-animations",ENABLE_WAVES_BACKGROUND:"maibot-waves-background",LOG_CACHE_SIZE:"maibot-log-cache-size",LOG_AUTO_SCROLL:"maibot-log-auto-scroll",LOG_FONT_SIZE:"maibot-log-font-size",LOG_LINE_SPACING:"maibot-log-line-spacing",DATA_SYNC_INTERVAL:"maibot-data-sync-interval",WS_RECONNECT_INTERVAL:"maibot-ws-reconnect-interval",WS_MAX_RECONNECT_ATTEMPTS:"maibot-ws-max-reconnect-attempts",COMPLETED_TOURS:"maibot-completed-tours"},jl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function zt(a){const l=Vv(a),r=localStorage.getItem(l);if(r===null)return jl[a];const c=jl[a];if(typeof c=="boolean")return r==="true";if(typeof c=="number"){const d=parseFloat(r);return isNaN(d)?c:d}return r}function Yr(a,l){const r=Vv(a);localStorage.setItem(r,String(l)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:a,value:l}}))}function N2(){return{theme:zt("theme"),accentColor:zt("accentColor"),enableAnimations:zt("enableAnimations"),enableWavesBackground:zt("enableWavesBackground"),logCacheSize:zt("logCacheSize"),logAutoScroll:zt("logAutoScroll"),logFontSize:zt("logFontSize"),logLineSpacing:zt("logLineSpacing"),dataSyncInterval:zt("dataSyncInterval"),wsReconnectInterval:zt("wsReconnectInterval"),wsMaxReconnectAttempts:zt("wsMaxReconnectAttempts")}}function b2(){const a=N2(),l=localStorage.getItem(wa.COMPLETED_TOURS),r=l?JSON.parse(l):[];return{...a,completedTours:r}}function y2(a){const l=[],r=[];for(const[c,d]of Object.entries(a)){if(c==="completedTours"){Array.isArray(d)?(localStorage.setItem(wa.COMPLETED_TOURS,JSON.stringify(d)),l.push("completedTours")):r.push("completedTours");continue}if(c in jl){const m=c,h=jl[m];if(typeof d==typeof h){if(m==="theme"&&!["light","dark","system"].includes(d)){r.push(c);continue}if(m==="logFontSize"&&!["xs","sm","base"].includes(d)){r.push(c);continue}Yr(m,d),l.push(c)}else r.push(c)}else r.push(c)}return{success:l.length>0,imported:l,skipped:r}}function w2(){for(const a of Object.keys(jl))Yr(a,jl[a]);localStorage.removeItem(wa.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function _2(){const a=[],l=[],r=[];for(let c=0;cc.size-r.size),{used:a,items:localStorage.length,details:l}}function S2(a){if(a===0)return"0 B";const l=1024,r=["B","KB","MB"],c=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,c)).toFixed(2))+" "+r[c]}function Vv(a){return{theme:wa.THEME,accentColor:wa.ACCENT_COLOR,enableAnimations:wa.ENABLE_ANIMATIONS,enableWavesBackground:wa.ENABLE_WAVES_BACKGROUND,logCacheSize:wa.LOG_CACHE_SIZE,logAutoScroll:wa.LOG_AUTO_SCROLL,logFontSize:wa.LOG_FONT_SIZE,logLineSpacing:wa.LOG_LINE_SPACING,dataSyncInterval:wa.DATA_SYNC_INTERVAL,wsReconnectInterval:wa.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:wa.WS_MAX_RECONNECT_ATTEMPTS}[a]}const el=u.forwardRef(({className:a,...l},r)=>e.jsxs(bj,{ref:r,className:P("relative flex w-full touch-none select-none items-center",a),...l,children:[e.jsx(yw,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(ww,{className:"absolute h-full bg-primary"})}),e.jsx(_w,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));el.displayName=bj.displayName;class k2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return zt("logCacheSize")}getMaxReconnectAttempts(){return zt("wsMaxReconnectAttempts")}getReconnectInterval(){return zt("wsReconnectInterval")}getWebSocketUrl(l){let r;{const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host;r=`${c}//${d}/ws/logs`}return l?`${r}?token=${encodeURIComponent(l)}`:r}async getWsToken(){try{const l=await ke("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const r=await l.json();return r.success&&r.token?r.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("📡 在登录页面,跳过 WebSocket 连接");return}if(!await dc()){console.log("📡 未登录,跳过 WebSocket 连接");return}const r=await this.getWsToken();if(!r){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(r);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=d=>{try{if(d.data==="pong")return;const m=JSON.parse(d.data);this.notifyLog(m)}catch(m){console.error("解析日志消息失败:",m)}},this.ws.onerror=d=>{console.error("❌ WebSocket 错误:",d),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(d){console.error("创建 WebSocket 连接失败:",d),this.attemptReconnect()}}attemptReconnect(){const l=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=l)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),c=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(l){return this.logCallbacks.add(l),()=>this.logCallbacks.delete(l)}onConnectionChange(l){return this.connectionCallbacks.add(l),l(this.isConnected),()=>this.connectionCallbacks.delete(l)}notifyLog(l){if(!this.logCache.some(c=>c.id===l.id)){this.logCache.push(l);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(d=>{try{d(l)}catch(m){console.error("日志回调执行失败:",m)}})}}notifyConnection(l){this.connectionCallbacks.forEach(r=>{try{r(l)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Qn=new k2;typeof window<"u"&&setTimeout(()=>{Qn.connect()},100);const bs=kw,wt=Cw,C2=Sw,Gv=u.forwardRef(({className:a,...l},r)=>e.jsx(yj,{className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:r}));Gv.displayName=yj.displayName;const xs=u.forwardRef(({className:a,...l},r)=>e.jsxs(C2,{children:[e.jsx(Gv,{}),e.jsx(wj,{ref:r,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l})]}));xs.displayName=wj.displayName;const hs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col space-y-2 text-center sm:text-left",a),...l});hs.displayName="AlertDialogHeader";const fs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});fs.displayName="AlertDialogFooter";const ps=u.forwardRef(({className:a,...l},r)=>e.jsx(_j,{ref:r,className:P("text-lg font-semibold",a),...l}));ps.displayName=_j.displayName;const gs=u.forwardRef(({className:a,...l},r)=>e.jsx(Sj,{ref:r,className:P("text-sm text-muted-foreground",a),...l}));gs.displayName=Sj.displayName;const js=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(kj,{ref:c,className:P(si({variant:l}),a),...r}));js.displayName=kj.displayName;const vs=u.forwardRef(({className:a,...l},r)=>e.jsx(Cj,{ref:r,className:P(si({variant:"outline"}),"mt-2 sm:mt-0",a),...l}));vs.displayName=Cj.displayName;function T2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),e.jsxs(Jt,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(A1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(Xe,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ov,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(Xe,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Sn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(Xe,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Yt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(ts,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ss,{value:"appearance",className:"mt-0",children:e.jsx(E2,{})}),e.jsx(Ss,{value:"security",className:"mt-0",children:e.jsx(M2,{})}),e.jsx(Ss,{value:"other",className:"mt-0",children:e.jsx(A2,{})}),e.jsx(Ss,{value:"about",className:"mt-0",children:e.jsx(z2,{})})]})]})]})}function Ig(a){const l=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[a];if(c)l.style.setProperty("--primary",c.hsl),c.gradient?(l.style.setProperty("--primary-gradient",c.gradient),l.classList.add("has-gradient")):(l.style.removeProperty("--primary-gradient"),l.classList.remove("has-gradient"));else if(a.startsWith("#")){const d=m=>{m=m.replace("#","");const h=parseInt(m.substring(0,2),16)/255,f=parseInt(m.substring(2,4),16)/255,p=parseInt(m.substring(4,6),16)/255,g=Math.max(h,f,p),N=Math.min(h,f,p);let j=0,b=0;const y=(g+N)/2;if(g!==N){const w=g-N;switch(b=y>.5?w/(2-g-N):w/(g+N),g){case h:j=((f-p)/w+(flocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Ig(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Ig(g)};return e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[e.jsx(Bm,{value:"light",current:a,onChange:l,label:"浅色",description:"始终使用浅色主题"}),e.jsx(Bm,{value:"dark",current:a,onChange:l,label:"深色",description:"始终使用深色主题"}),e.jsx(Bm,{value:"system",current:a,onChange:l,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(Wa,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Wa,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Wa,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Wa,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Wa,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Wa,{value:"red",current:h,onChange:p,label:"红色",colorClass:"bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(Wa,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Wa,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Wa,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Wa,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Wa,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Wa,{value:"gradient-twilight",current:h,onChange:p,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:g=>p(g.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ne,{type:"text",value:h,onChange:g=>p(g.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Ge,{id:"animations",checked:r,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Ge,{id:"waves-background",checked:d,onCheckedChange:m})]})})]})]})]})}function M2(){const a=ha(),[l,r]=u.useState(""),[c,d]=u.useState(""),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,b]=u.useState(!1),[y,w]=u.useState(!1),[z,M]=u.useState(!1),[S,F]=u.useState(""),[E,C]=u.useState(!1),{toast:R}=nt(),H=u.useMemo(()=>g2(c),[c]),O=async ce=>{if(!l){R({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(ce),w(!0),R({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{R({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},X=async()=>{if(!c.trim()){R({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!H.isValid){const ce=H.rules.filter(ge=>!ge.passed).map(ge=>ge.label).join(", ");R({title:"格式错误",description:`Token 不符合要求: ${ce}`,variant:"destructive"});return}N(!0);try{const ce=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),ge=await ce.json();ce.ok&&ge.success?(d(""),r(c.trim()),R({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{a({to:"/auth"})},1500)):R({title:"更新失败",description:ge.message||"无法更新 Token",variant:"destructive"})}catch(ce){console.error("更新 Token 错误:",ce),R({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},L=async()=>{b(!0);try{const ce=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ge=await ce.json();ce.ok&&ge.success?(r(ge.token),F(ge.token),M(!0),C(!1),R({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):R({title:"生成失败",description:ge.message||"无法生成新 Token",variant:"destructive"})}catch(ce){console.error("生成 Token 错误:",ce),R({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{b(!1)}},me=async()=>{try{await navigator.clipboard.writeText(S),C(!0),R({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{R({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},Ne=()=>{M(!1),setTimeout(()=>{F(""),C(!1)},300),setTimeout(()=>{a({to:"/auth"})},500)},je=ce=>{ce||Ne()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Qs,{open:z,onOpenChange:je,children:e.jsxs(Hs,{className:"sm:max-w-md",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(at,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:S})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(gt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:me,className:"gap-2",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(qo,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(_,{onClick:Ne,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ne,{id:"current-token",type:m?"text":"password",value:l||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{l?h(!m):R({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:m?"隐藏":"显示",children:m?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:()=>O(l),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!l,children:y?e.jsx(Ot,{className:"h-4 w-4 text-green-500"}):e.jsx(qo,{className:"h-4 w-4"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:j,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(dt,{className:P("h-4 w-4",j&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认重新生成 Token"}),e.jsx(gs,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:L,children:"确认生成"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"new-token",type:f?"text":"password",value:c,onChange:ce=>d(ce.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"隐藏":"显示",children:f?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),e.jsx("div",{className:"space-y-1.5",children:H.rules.map(ce=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ce.passed?e.jsx(st,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(ta,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:P(ce.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ce.label})]},ce.id))}),H.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:X,disabled:g||!H.isValid||!c,className:"w-full sm:w-auto",children:g?"更新中...":"更新自定义 Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),e.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),e.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),e.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),e.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),e.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function A2(){const a=ha(),{toast:l}=nt(),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(()=>zt("logCacheSize")),[p,g]=u.useState(()=>zt("wsReconnectInterval")),[N,j]=u.useState(()=>zt("wsMaxReconnectAttempts")),[b,y]=u.useState(()=>zt("dataSyncInterval")),[w,z]=u.useState(()=>Bg()),[M,S]=u.useState(!1),[F,E]=u.useState(!1),C=u.useRef(null);if(d)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const R=()=>{z(Bg())},H=D=>{const Q=D[0];f(Q),Yr("logCacheSize",Q)},O=D=>{const Q=D[0];g(Q),Yr("wsReconnectInterval",Q)},X=D=>{const Q=D[0];j(Q),Yr("wsMaxReconnectAttempts",Q)},L=D=>{const Q=D[0];y(Q),Yr("dataSyncInterval",Q)},me=()=>{Qn.clearLogs(),l({title:"日志已清除",description:"日志缓存已清空"})},Ne=()=>{const D=_2();R(),l({title:"缓存已清除",description:`已清除 ${D.clearedKeys.length} 项缓存数据`})},je=()=>{S(!0);try{const D=b2(),Q=JSON.stringify(D,null,2),B=new Blob([Q],{type:"application/json"}),ue=URL.createObjectURL(B),Y=document.createElement("a");Y.href=ue,Y.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(ue),l({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(D){console.error("导出设置失败:",D),l({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{S(!1)}},ce=D=>{const Q=D.target.files?.[0];if(!Q)return;E(!0);const B=new FileReader;B.onload=ue=>{try{const Y=ue.target?.result,we=JSON.parse(Y),fe=y2(we);fe.success?(f(zt("logCacheSize")),g(zt("wsReconnectInterval")),j(zt("wsMaxReconnectAttempts")),y(zt("dataSyncInterval")),R(),l({title:"导入成功",description:`成功导入 ${fe.imported.length} 项设置${fe.skipped.length>0?`,跳过 ${fe.skipped.length} 项`:""}`}),(fe.imported.includes("theme")||fe.imported.includes("accentColor"))&&l({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):l({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(Y){console.error("导入设置失败:",Y),l({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{E(!1),C.current&&(C.current.value="")}},B.readAsText(Q)},ge=()=>{w2(),f(jl.logCacheSize),g(jl.wsReconnectInterval),j(jl.wsMaxReconnectAttempts),y(jl.dataSyncInterval),R(),l({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},pe=async()=>{c(!0);try{const D=await ke("/api/webui/setup/reset",{method:"POST"}),Q=await D.json();D.ok&&Q.success?(l({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{a({to:"/setup"})},1e3)):l({title:"重置失败",description:Q.message||"无法重置配置状态",variant:"destructive"})}catch(D){console.error("重置配置状态错误:",D),l({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Zr,{className:"h-5 w-5"}),"性能与存储"]}),e.jsxs("div",{className:"space-y-4 sm:space-y-5",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(z1,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:R,className:"h-7 px-2",children:e.jsx(dt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:S2(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(el,{value:[h],onValueChange:H,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制日志查看器最多缓存的日志条数,较大的值会占用更多内存"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[b," 秒"]})]}),e.jsx(el,{value:[b],onValueChange:L,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," 秒"]})]}),e.jsx(el,{value:[p],onValueChange:O,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 次"]})]}),e.jsx(el,{value:[N],onValueChange:X,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"连接失败后的最大重连尝试次数"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认清除本地缓存"}),e.jsx(gs,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:Ne,children:"确认清除"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(na,{className:"h-5 w-5"}),"导入/导出设置"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"导出当前的界面设置以便备份,或从之前导出的文件中恢复设置。"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",onClick:je,disabled:M,className:"gap-2",children:[e.jsx(na,{className:"h-4 w-4"}),M?"导出中...":"导出设置"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:ce,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>C.current?.click(),disabled:F,className:"gap-2",children:[e.jsx(cc,{className:"h-4 w-4"}),F?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(rc,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认重置所有设置"}),e.jsx(gs,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:ge,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(rc,{className:P("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认重新配置"}),e.jsx(gs,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:pe,children:"确认重置"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认触发错误"}),e.jsx(gs,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>m(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function z2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:P("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",Nx]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",ud]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(ts,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(Et,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(Et,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(Et,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(Et,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(Et,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(Et,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(Et,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(Et,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(Et,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(Et,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(Et,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(Et,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(Et,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(Et,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(Et,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(Et,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(Et,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:e.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function Et({name:a,description:l,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:a}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:l})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function Bm({value:a,current:l,onChange:r,label:c,description:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:P("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:d})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[a==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),a==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),a==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Wa({value:a,current:l,onChange:r,label:c,colorClass:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:P("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:P("h-8 w-8 sm:h-10 sm:w-10 rounded-full",d)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const R2=Date.now()%1e6;class D2{grad3;p;perm;constructor(l=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(l,r,c){return l[0]*r+l[1]*c}mix(l,r,c){return(1-c)*l+c*r}fade(l){return l*l*l*(l*(l*6-15)+10)}perlin2(l,r){const c=Math.floor(l)&255,d=Math.floor(r)&255;l-=Math.floor(l),r-=Math.floor(r);const m=this.fade(l),h=this.fade(r),f=this.perm[c]+d,p=this.perm[f],g=this.perm[f+1],N=this.perm[c+1]+d,j=this.perm[N],b=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],l,r),this.dot(this.grad3[j%12],l-1,r),m),this.mix(this.dot(this.grad3[g%12],l,r-1),this.dot(this.grad3[b%12],l-1,r-1),m),h)}}function Pg(){const a=u.useRef(null),l=u.useRef(null),r=u.useRef(void 0),[c]=u.useState(()=>new D2(R2)),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return u.useEffect(()=>{const m=l.current,h=a.current;if(!m||!h)return;const f=d.current;f.noise=c;const p=()=>{const M=m.getBoundingClientRect();f.bounding=M,h.style.width=`${M.width}px`,h.style.height=`${M.height}px`},g=()=>{if(!f.bounding)return;const{width:M,height:S}=f.bounding;f.lines=[],f.paths.forEach(me=>me.remove()),f.paths=[];const F=10,E=32,C=M+200,R=S+30,H=Math.ceil(C/F),O=Math.ceil(R/E),X=(M-F*H)/2,L=(S-E*O)/2;for(let me=0;me<=H;me++){const Ne=[];for(let ce=0;ce<=O;ce++){const ge={x:X+F*me,y:L+E*ce,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};Ne.push(ge)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(je),f.paths.push(je),f.lines.push(Ne)}},N=M=>{const{lines:S,mouse:F,noise:E}=f;S.forEach(C=>{C.forEach(R=>{const H=E.perlin2((R.x+M*.0125)*.002,(R.y+M*.005)*.0015)*12;R.wave.x=Math.cos(H)*32,R.wave.y=Math.sin(H)*16;const O=R.x-F.sx,X=R.y-F.sy,L=Math.hypot(O,X),me=Math.max(175,F.vs);if(L{const F={x:M.x+M.wave.x+(S?M.cursor.x:0),y:M.y+M.wave.y+(S?M.cursor.y:0)};return F.x=Math.round(F.x*10)/10,F.y=Math.round(F.y*10)/10,F},b=()=>{const{lines:M,paths:S}=f;M.forEach((F,E)=>{let C=j(F[0],!1),R=`M ${C.x} ${C.y}`;F.forEach((H,O)=>{const X=O===F.length-1;C=j(H,!X),R+=`L ${C.x} ${C.y}`}),S[E].setAttribute("d",R)})},y=M=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const F=S.x-S.lx,E=S.y-S.ly,C=Math.hypot(F,E);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(E,F),m&&(m.style.setProperty("--x",`${S.sx}px`),m.style.setProperty("--y",`${S.sy}px`)),N(M),b(),r.current=requestAnimationFrame(y)},w=M=>{if(!f.bounding)return;const{mouse:S}=f;S.x=M.pageX-f.bounding.left,S.y=M.pageY-f.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},z=()=>{p(),g()};return p(),g(),window.addEventListener("resize",z),window.addEventListener("mousemove",w),r.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",z),window.removeEventListener("mousemove",w),r.current&&cancelAnimationFrame(r.current)}},[c]),e.jsxs("div",{ref:l,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:a,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` - path { - fill: none; - stroke: hsl(var(--primary) / 0.20); - stroke-width: 1px; - } - `})})]})}function O2(){const[a,l]=u.useState(""),[r,c]=u.useState(!1),[d,m]=u.useState(""),[h,f]=u.useState(!0),p=ha(),{enableWavesBackground:g,setEnableWavesBackground:N}=qv(),{theme:j,setTheme:b}=vx();u.useEffect(()=>{(async()=>{try{await dc()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const w=j==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":j,z=()=>{b(w==="dark"?"light":"dark")},M=async S=>{if(S.preventDefault(),m(""),!a.trim()){m("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const F=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:a.trim()})});console.log("Token 验证响应状态:",F.status);const E=await F.json();if(console.log("Token 验证响应数据:",E),F.ok&&E.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",E.is_first_setup),await new Promise(R=>setTimeout(R,100));const C=await dc();console.log("跳转前认证状态检查:",C),E.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",E.message),m(E.message||"Token 验证失败,请检查后重试")}catch(F){console.error("Token 验证错误:",F),m("连接服务器失败,请检查网络连接")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Pg,{}),e.jsx("div",{className:"text-muted-foreground",children:"正在检查登录状态..."})]}):e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Pg,{}),e.jsxs(Te,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:z,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(ix,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(tc,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Oe,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Jm,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ue,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(Ns,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(ze,{children:e.jsxs("form",{onSubmit:M,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(cx,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ne,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:a,onChange:S=>l(S.target.value),className:P("pl-10",d&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Ut,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:d})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),e.jsxs(Qs,{children:[e.jsx(dd,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(ox,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Hs,{className:"sm:max-w-md",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Jm,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(at,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(R1,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),e.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),e.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ua,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ut,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(sl,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(sl,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(gs,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),e.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>N(!1),children:"关闭动画"})]})]})]})]})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:e.jsx("p",{children:j2})})]})}const pt=u.forwardRef(({className:a,autoResize:l=!0,minHeight:r=60,maxHeight:c,value:d,onChange:m,...h},f)=>{const p=u.useRef(null),[g,N]=u.useState(!1);u.useImperativeHandle(f,()=>p.current),u.useEffect(()=>{if(a){const y=/\b(h-\d+|h-\[[\d.]+(?:px|rem|em)\]|min-h-\[[\d.]+(?:px|rem|em)\])\b/.test(a);N(y)}},[a]);const j=u.useCallback(()=>{const y=p.current;if(!y||!l||g)return;y.style.height="auto";const w=y.scrollHeight;let z=Math.max(w,r);c&&c>0&&(z=Math.min(z,c)),y.style.height=`${z}px`,c&&c>0&&w>c?y.style.overflowY="auto":y.style.overflowY="hidden"},[l,g,r,c]);u.useEffect(()=>{j()},[d,j]),u.useEffect(()=>{j()},[j]);const b=u.useCallback(y=>{m?.(y),requestAnimationFrame(()=>{j()})},[m,j]);return e.jsx("textarea",{className:P("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","custom-scrollbar",l&&!g&&"resize-none overflow-hidden",a),ref:p,value:d,onChange:b,style:{minHeight:l&&!g?`${r}px`:void 0},...h})});pt.displayName="Textarea";const la=u.forwardRef(({className:a,orientation:l="horizontal",decorative:r=!0,...c},d)=>e.jsx(Tj,{ref:d,decorative:r,orientation:l,className:P("shrink-0 bg-border",l==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",a),...c}));la.displayName=Tj.displayName;function L2({config:a,onChange:l}){const r=d=>{d.trim()&&!a.alias_names.includes(d.trim())&&l({...a,alias_names:[...a.alias_names,d.trim()]})},c=d=>{l({...a,alias_names:a.alias_names.filter((m,h)=>h!==d)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(ne,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:a.qq_account||"",onChange:d=>l({...a,qq_account:Number(d.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(ne,{id:"nickname",placeholder:"请输入机器人的昵称",value:a.nickname,onChange:d=>l({...a,nickname:d.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:a.alias_names.map((d,m)=>e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[d,e.jsx("button",{type:"button",onClick:()=>c(m),className:"ml-1 hover:text-destructive",children:e.jsx(Sa,{className:"h-3 w-3"})})]},m))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:d=>{d.key==="Enter"&&(r(d.target.value),d.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const d=document.getElementById("alias_input");d&&(r(d.value),d.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function U2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(pt,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:a.personality,onChange:r=>l({...a,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(pt,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:a.reply_style,onChange:r=>l({...a,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(pt,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:a.interest,onChange:r=>l({...a,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(pt,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:a.plan_style,onChange:r=>l({...a,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(pt,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:a.private_plan_style,onChange:r=>l({...a,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function $2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(a.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ne,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:a.emoji_chance,onChange:r=>l({...a,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",max:"200",value:a.max_reg_num,onChange:r=>l({...a,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Ge,{id:"do_replace",checked:a.do_replace,onCheckedChange:r=>l({...a,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",max:"120",value:a.check_interval,onChange:r=>l({...a,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Ge,{id:"steal_emoji",checked:a.steal_emoji,onCheckedChange:r=>l({...a,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Ge,{id:"content_filtration",checked:a.content_filtration,onCheckedChange:r=>l({...a,content_filtration:r})})]}),a.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ne,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:a.filtration_prompt,onChange:r=>l({...a,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function B2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Ge,{id:"enable_tool",checked:a.enable_tool,onCheckedChange:r=>l({...a,enable_tool:r})})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Ge,{id:"all_global",checked:a.all_global,onCheckedChange:r=>l({...a,all_global:r})})]})]})}function I2({config:a,onChange:l}){const[r,c]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(Io,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:a.api_key,onChange:d=>l({api_key:d.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!r),children:r?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[e.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),e.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),e.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),e.jsx("li",{children:"SenseVoice - 语音识别"}),e.jsx("li",{children:"BGE-M3 - 文本嵌入"}),e.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),e.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:e.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function P2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("读取Bot配置失败");const r=(await a.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function F2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("读取人格配置失败");const r=(await a.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function H2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("读取表情包配置失败");const r=(await a.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function q2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("读取其他配置失败");const r=(await a.json()).config,c=r.tool||{},d=r.expression||{};return{enable_tool:c.enable_tool??!0,all_global:d.all_global_jargon??!0}}async function V2(){const a=await ke("/api/webui/config/model",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("读取模型配置失败");return{api_key:((await a.json()).config.api_providers||[]).find(m=>m.name==="SiliconFlow")?.api_key||""}}async function G2(a){const l=await ke("/api/webui/config/bot/section/bot",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await l.json()}async function K2(a){const l=await ke("/api/webui/config/bot/section/personality",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存人格配置失败")}return await l.json()}async function Q2(a){const l=await ke("/api/webui/config/bot/section/emoji",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"保存表情包配置失败")}return await l.json()}async function Y2(a){const l=[];l.push(ke("/api/webui/config/bot/section/tool",{method:"POST",headers:Zs(),body:JSON.stringify({enable_tool:a.enable_tool})})),l.push(ke("/api/webui/config/bot/section/expression",{method:"POST",headers:Zs(),body:JSON.stringify({all_global_jargon:a.all_global})}));const r=await Promise.all(l);for(const c of r)if(!c.ok){const d=await c.json();throw new Error(d.detail||"保存其他配置失败")}return{success:!0}}async function J2(a){const l=await ke("/api/webui/config/model",{method:"GET",headers:Zs()});if(!l.ok)throw new Error("读取模型配置失败");const c=(await l.json()).config,d=c.api_providers||[],m=d.findIndex(p=>p.name==="SiliconFlow");m>=0?d[m]={...d[m],api_key:a.api_key}:d.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:a.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:d},f=await ke("/api/webui/config/model",{method:"POST",headers:Zs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function Fg(){const a=await ke("/api/webui/setup/complete",{method:"POST"});if(!a.ok){const l=await a.json();throw new Error(l.message||"标记配置完成失败")}return await a.json()}function X2(){return e.jsx(lr,{children:e.jsx(Z2,{})})}function Z2(){const a=ha(),{toast:l}=nt(),{triggerRestart:r}=Tn(),[c,d]=u.useState(0),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!0),[j,b]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[y,w]=u.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[z,M]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,F]=u.useState({enable_tool:!0,all_global:!0}),[E,C]=u.useState({api_key:""}),R=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Yn},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Fl},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:rd},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:Sn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:cx}],H=(c+1)/R.length*100;u.useEffect(()=>{(async()=>{try{N(!0);const[ge,pe,D,Q,B]=await Promise.all([P2(),F2(),H2(),q2(),V2()]);b(ge),w(pe),M(D),F(Q),C(B)}catch(ge){l({title:"加载配置失败",description:ge instanceof Error?ge.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[l]);const O=async()=>{p(!0);try{switch(c){case 0:await G2(j);break;case 1:await K2(y);break;case 2:await Q2(z);break;case 3:await Y2(S);break;case 4:await J2(E);break}return l({title:"保存成功",description:`${R[c].title}配置已保存`}),!0}catch(ce){return l({title:"保存失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},X=async()=>{await O()&&c{c>0&&d(c-1)},me=async()=>{h(!0);try{if(!await O()){h(!1);return}await Fg(),l({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await r()}catch(ce){l({title:"配置失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{h(!1)}},Ne=async()=>{try{await Fg(),a({to:"/"})}catch(ce){l({title:"跳过失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}},je=()=>{switch(c){case 0:return e.jsx(L2,{config:j,onChange:b});case 1:return e.jsx(U2,{config:y,onChange:w});case 2:return e.jsx($2,{config:z,onChange:M});case 3:return e.jsx(B2,{config:S,onChange:F});case 4:return e.jsx(I2,{config:E,onChange:C});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[e.jsx(nr,{}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),e.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),g?e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),e.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[e.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(D1,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),e.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",Nx," 的初始配置"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",c+1," / ",R.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(H),"%"]})]}),e.jsx(tr,{value:H,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:R.map((ce,ge)=>{const pe=ce.icon;return e.jsxs("div",{className:P("flex flex-1 flex-col items-center gap-1 md:gap-2",gea({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(id,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(_,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx($a,{className:"h-4 w-4"}),"返回上一页"]})]}),e.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}const W2=Bs.memo(function({config:l,onChange:r}){const c=l.platforms||[],d=l.alias_names||[],m=()=>{r({...l,platforms:[...c,""]})},h=j=>{r({...l,platforms:c.filter((b,y)=>y!==j)})},f=(j,b)=>{const y=[...c];y[j]=b,r({...l,platforms:y})},p=()=>{r({...l,alias_names:[...d,""]})},g=j=>{r({...l,alias_names:d.filter((b,y)=>y!==j)})},N=(j,b)=>{const y=[...d];y[j]=b,r({...l,alias_names:y})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"platform",children:"平台"}),e.jsx(ne,{id:"platform",value:l.platform,onChange:j=>r({...l,platform:j.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(ne,{id:"qq_account",value:l.qq_account,onChange:j=>r({...l,qq_account:j.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(ne,{id:"nickname",value:l.nickname,onChange:j=>r({...l,nickname:j.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"别名"}),e.jsxs(_,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[d.map((j,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:y=>N(b,y.target.value),placeholder:"小麦"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除别名 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>g(b),children:"删除"})]})]})]})]},b)),d.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"其他平台账号"}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((j,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:y=>f(b,y.target.value),placeholder:"wx:114514"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除平台账号 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>h(b),children:"删除"})]})]})]})]},b)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]})]})]})})}),eS=Bs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,states:[...l.states,""]})},d=h=>{r({...l,states:l.states.filter((f,p)=>p!==h)})},m=(h,f)=>{const p=[...l.states];p[h]=f,r({...l,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"personality",children:"人格特质"}),e.jsx(pt,{id:"personality",value:l.personality,onChange:h=>r({...l,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"多重人格"}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加人格"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"可以定义多个不同的人格状态,麦麦会随机切换"}),e.jsx("div",{className:"space-y-2",children:l.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(pt,{value:h,onChange:p=>m(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsx(gs,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>d(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"替换为多重人格概率"}),e.jsx(ne,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:l.state_probability,onChange:h=>r({...l,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时,用多重人格替换主人格的概率(0.0-1.0)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(pt,{id:"reply_style",value:l.reply_style,onChange:h=>r({...l,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(pt,{id:"plan_style",value:l.plan_style,onChange:h=>r({...l,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(pt,{id:"visual_style",value:l.visual_style,onChange:h=>r({...l,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]})]})]})})}),cl=Ew,ol=Mw,tl=u.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>e.jsx(Tw,{children:e.jsx(Ej,{ref:d,align:l,sideOffset:r,className:P("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...c})}));tl.displayName=Ej.displayName;const sS=Bs.memo(function({value:l,onChange:r}){const c=u.useMemo(()=>{const y=l.split("-");if(y.length===2){const[w,z]=y,[M,S]=w.split(":"),[F,E]=z.split(":");return{startHour:M?M.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:F?F.padStart(2,"0"):"23",endMinute:E?E.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[l]),[d,m]=u.useState(c.startHour),[h,f]=u.useState(c.startMinute),[p,g]=u.useState(c.endHour),[N,j]=u.useState(c.endMinute);u.useEffect(()=>{m(c.startHour),f(c.startMinute),g(c.endHour),j(c.endMinute)},[c]);const b=(y,w,z,M)=>{const S=`${y}:${w}-${z}:${M}`;r(S)};return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(da,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),e.jsx(tl,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Pe,{value:d,onValueChange:y=>{m(y),b(y,h,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Pe,{value:h,onValueChange:y=>{f(y),b(d,y,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"小时"}),e.jsxs(Pe,{value:p,onValueChange:y=>{g(y),b(d,h,y,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Pe,{value:N,onValueChange:y=>{j(y),b(d,h,p,y)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]})]})})]})}),tS=Bs.memo(function({rule:l}){const r=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(tl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),aS=Bs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,talk_value_rules:[...l.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},d=h=>{r({...l,talk_value_rules:l.talk_value_rules.filter((f,p)=>p!==h)})},m=(h,f,p)=>{const g=[...l.talk_value_rules];g[h]={...g[h],[f]:p},r({...l,talk_value_rules:g})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(ne,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:l.talk_value,onChange:h=>r({...l,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"think_mode",children:"思考模式"}),e.jsxs(Pe,{value:l.think_mode||"classic",onValueChange:h=>r({...l,think_mode:h}),children:[e.jsx(Be,{id:"think_mode",children:e.jsx(Fe,{placeholder:"选择思考模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"classic",children:"经典模式 - 浅度思考和回复"}),e.jsx(W,{value:"deep",children:"深度模式 - 进行深度思考和回复"}),e.jsx(W,{value:"dynamic",children:"动态模式 - 自动选择思考深度"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制麦麦的思考深度。经典模式回复快但简单;深度模式更深入但较慢;动态模式根据情况自动选择"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"mentioned_bot_reply",checked:l.mentioned_bot_reply,onCheckedChange:h=>r({...l,mentioned_bot_reply:h})}),e.jsx(T,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(ne,{id:"max_context_size",type:"number",min:"1",value:l.max_context_size,onChange:h=>r({...l,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(ne,{id:"planner_smooth",type:"number",step:"1",min:"0",value:l.planner_smooth,onChange:h=>r({...l,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_reply_log_max_per_chat",children:"每个聊天流最大日志数量"}),e.jsx(ne,{id:"plan_reply_log_max_per_chat",type:"number",step:"1",min:"100",value:l.plan_reply_log_max_per_chat??1024,onChange:h=>r({...l,plan_reply_log_max_per_chat:parseInt(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每个聊天流保存的 Plan/Reply 日志最大数量,超过此数量时会自动删除最老的日志"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"llm_quote",checked:l.llm_quote??!1,onCheckedChange:h=>r({...l,llm_quote:h})}),e.jsx(T,{htmlFor:"llm_quote",className:"cursor-pointer",children:"启用 LLM 控制引用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2 ml-10",children:"启用后,LLM 可以决定是否在回复时引用消息"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_talk_value_rules",checked:l.enable_talk_value_rules,onCheckedChange:h=>r({...l,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]})]})]}),l.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),e.jsxs(_,{onClick:c,size:"sm",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.talk_value_rules&&l.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:l.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tS,{rule:h}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>d(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Pe,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?m(f,"target",""):m(f,"target","qq::group")},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"global",children:"全局配置"}),e.jsx(W,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",j=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:g,onValueChange:b=>{m(f,"target",`${b}:${N}:${j}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ne,{value:N,onChange:b=>{m(f,"target",`${g}:${b.target.value}:${j}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:j,onValueChange:b=>{m(f,"target",`${g}:${N}:${b}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群组(group)"}),e.jsx(W,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",h.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(sS,{value:h.time,onChange:p=>m(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(ne,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const g=parseFloat(p.target.value);isNaN(g)||m(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(el,{value:[h.value],onValueChange:p=>m(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (极少发言)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (正常)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}),lS=Bs.memo(function({config:l,onChange:r}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[F,E]=S.split(":");return{platform:F,userId:E}},{platform:d,userId:m}=c(l.dream_send),[h,f]=u.useState(d),[p,g]=u.useState(m),N=S=>{const[F,E]=S.split("-");return{startTime:F||"09:00",endTime:E||"22:00"}},j=(S,F)=>{const E=F?`${S}:${F}`:"";r({...l,dream_send:E})},b=S=>{f(S),j(S,p)},y=S=>{g(S),j(h,S)},w=()=>{r({...l,dream_time_ranges:[...l.dream_time_ranges,"09:00-22:00"]})},z=S=>{r({...l,dream_time_ranges:l.dream_time_ranges.filter((F,E)=>E!==S)})},M=(S,F,E)=>{const C=[...l.dream_time_ranges],R=N(C[S]);F==="startTime"?R.startTime=E:R.endTime=E,C[S]=`${R.startTime}-${R.endTime}`,r({...l,dream_time_ranges:C})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"做梦配置"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"interval_minutes",children:"做梦时间间隔(分钟)"}),e.jsx(ne,{id:"interval_minutes",type:"number",min:"1",value:l.interval_minutes,onChange:S=>r({...l,interval_minutes:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"默认30分钟"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"max_iterations",children:"做梦最大轮次"}),e.jsx(ne,{id:"max_iterations",type:"number",min:"1",value:l.max_iterations,onChange:S=>r({...l,max_iterations:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"默认20轮"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"first_delay_seconds",children:"首次做梦延迟(秒)"}),e.jsx(ne,{id:"first_delay_seconds",type:"number",min:"0",value:l.first_delay_seconds,onChange:S=>r({...l,first_delay_seconds:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"程序启动后首次做梦前的延迟时间,默认60秒"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"做梦结果推送目标"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:h,onValueChange:b,children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{placeholder:"选择平台"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]}),e.jsx(ne,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:S=>y(S.target.value),className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择平台并输入用户ID,做梦结束后将梦境发送给该用户。用户ID为空则不推送"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"做梦时间段配置"}),e.jsx(_,{type:"button",size:"sm",onClick:w,children:"添加时间段"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置允许做梦的时间段,支持跨夜区间(如 23:00 到次日 02:00)。列表为空则全天允许做梦"}),e.jsxs("div",{className:"space-y-2",children:[l.dream_time_ranges.map((S,F)=>{const{startTime:E,endTime:C}=N(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"time",value:E,onChange:R=>M(F,"startTime",R.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(ne,{type:"time",value:C,onChange:R=>M(F,"endTime",R.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>z(F),children:e.jsx(Sa,{className:"h-4 w-4"})})]},F)}),l.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"dream_visible",checked:l.dream_visible,onCheckedChange:S=>r({...l,dream_visible:S})}),e.jsx(T,{htmlFor:"dream_visible",className:"cursor-pointer",children:"梦境结果存储到上下文"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后,梦境发送给配置的用户后,也会存储到聊天上下文中,在后续对话中可见"})]})]})}),nS=Bs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),l.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM 模式"}),e.jsxs(Pe,{value:l.lpmm_mode,onValueChange:c=>r({...l,lpmm_mode:c}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"classic",children:"经典模式"}),e.jsx(W,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词搜索 TopK"}),e.jsx(ne,{type:"number",min:"1",value:l.rag_synonym_search_top_k,onChange:c=>r({...l,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词阈值"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:l.rag_synonym_threshold,onChange:c=>r({...l,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"实体提取线程数"}),e.jsx(ne,{type:"number",min:"1",value:l.info_extraction_workers,onChange:c=>r({...l,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入向量维度"}),e.jsx(ne,{type:"number",min:"1",value:l.embedding_dimension,onChange:c=>r({...l,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入并发线程数"}),e.jsx(ne,{type:"number",min:"1",value:l.max_embedding_workers,onChange:c=>r({...l,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"每批嵌入条数"}),e.jsx(ne,{type:"number",min:"1",value:l.embedding_chunk_size,onChange:c=>r({...l,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义实体数上限"}),e.jsx(ne,{type:"number",min:"1",value:l.max_synonym_entities,onChange:c=>r({...l,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable_ppr,onCheckedChange:c=>r({...l,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),rS=Bs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState("WARNING"),f=()=>{c&&!l.suppress_libraries.includes(c)&&(r({...l,suppress_libraries:[...l.suppress_libraries,c]}),d(""))},p=w=>{r({...l,suppress_libraries:l.suppress_libraries.filter(z=>z!==w)})},g=()=>{c&&!l.library_log_levels[c]&&(r({...l,library_log_levels:{...l.library_log_levels,[c]:m}}),d(""),h("WARNING"))},N=w=>{const z={...l.library_log_levels};delete z[w],r({...l,library_log_levels:z})},j=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],b=["FULL","compact","lite"],y=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日期格式"}),e.jsx(ne,{value:l.date_style,onChange:w=>r({...l,date_style:w.target.value}),placeholder:"例如: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志级别样式"}),e.jsxs(Pe,{value:l.log_level_style,onValueChange:w=>r({...l,log_level_style:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:b.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志文本颜色"}),e.jsxs(Pe,{value:l.color_text,onValueChange:w=>r({...l,color_text:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:y.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"全局日志级别"}),e.jsxs(Pe,{value:l.log_level,onValueChange:w=>r({...l,log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"控制台日志级别"}),e.jsxs(Pe,{value:l.console_log_level,onValueChange:w=>r({...l,console_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"文件日志级别"}),e.jsxs(Pe,{value:l.file_log_level,onValueChange:w=>r({...l,file_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:w=>d(w.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(w),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:w=>d(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(l.library_log_levels).map(([w,z])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:z}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(w),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),iS=Bs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Ge,{checked:l.show_prompt,onCheckedChange:c=>r({...l,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Ge,{checked:l.show_replyer_prompt,onCheckedChange:c=>r({...l,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Ge,{checked:l.show_replyer_reasoning,onCheckedChange:c=>r({...l,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Ge,{checked:l.show_jargon_prompt,onCheckedChange:c=>r({...l,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Ge,{checked:l.show_memory_prompt,onCheckedChange:c=>r({...l,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Ge,{checked:l.show_planner_prompt,onCheckedChange:c=>r({...l,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Ge,{checked:l.show_lpmm_paragraph,onCheckedChange:c=>r({...l,show_lpmm_paragraph:c})})]})]})]})}),cS=Bs.memo(function({config:l,onChange:r}){const c=g=>{const N=g.split(":");if(N.length>=4){const j=N[0],b=N[1],y=N[2],w=N.slice(3).join(":");return{platform:j,id:b,type:y,prompt:w}}return{platform:"qq",id:"",type:"group",prompt:""}},d=g=>`${g.platform}:${g.id}:${g.type}:${g.prompt}`,m=()=>{r({...l,chat_prompts:[...l.chat_prompts,"qq::group:"]})},h=g=>{r({...l,chat_prompts:l.chat_prompts.filter((N,j)=>j!==g)})},f=(g,N)=>{const b={...c(l.chat_prompts[g]),...N},y=[...l.chat_prompts];y[g]=d(b),r({...l,chat_prompts:y})},p=({promptStr:g})=>e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(tl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsxs("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:['"',g,'"']}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]});return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[e.jsx(Lt,{className:"h-5 w-5 text-orange-500 shrink-0 mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"font-medium text-orange-500",children:"实验性功能"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"此部分包含实验性功能,可能不稳定或在未来版本中发生变化。请谨慎使用,并注意不推荐在生产环境中修改私聊规则。"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"实验性设置"}),e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"私聊规则(实验性)"}),e.jsx(pt,{id:"private_plan_style",value:l.private_plan_style,onChange:g=>r({...l,private_plan_style:g.target.value}),placeholder:"私聊的说话规则和行为风格(不推荐修改)",rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"⚠️ 不推荐修改此项,可能会影响私聊对话的稳定性"})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{children:"特定聊天 Prompt 配置"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"为指定聊天添加额外的 prompt,用于定制特定场景的对话行为"})]}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加配置"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.chat_prompts.map((g,N)=>{const j=c(g);return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4 bg-card",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Prompt 配置 ",N+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{promptStr:g}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsx(gs,{children:"确定要删除这个 prompt 配置吗?此操作无法撤销。"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>h(N),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:j.platform,onValueChange:b=>f(N,{platform:b}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择平台"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:j.type==="group"?"群号":"用户ID"}),e.jsx(ne,{value:j.id,onChange:b=>f(N,{id:b.target.value}),placeholder:j.type==="group"?"输入群号":"输入用户ID",className:"font-mono"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:j.type,onValueChange:b=>f(N,{type:b}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群聊 (group)"}),e.jsx(W,{value:"private",children:"私聊 (private)"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"Prompt 内容"}),e.jsx(pt,{value:j.prompt,onChange:b=>f(N,{prompt:b.target.value}),placeholder:"输入额外的 prompt 内容,例如:这是一个摄影群,你精通摄影知识",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这段文本会作为系统提示添加到该聊天的上下文中"})]}),e.jsxs("div",{className:"rounded-md bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(dx,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"原始格式"})]}),e.jsx("code",{className:"text-xs font-mono text-muted-foreground break-all",children:g||"(未配置)"})]})]})]},N)}),l.chat_prompts.length===0&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{className:"text-sm",children:"暂无特定聊天 prompt 配置"}),e.jsx("p",{className:"text-xs mt-1",children:'点击上方"添加配置"按钮创建新配置'})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 p-4 rounded-lg bg-muted/30 border",children:[e.jsx("p",{className:"font-medium text-foreground",children:"💡 使用说明"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 pl-2",children:[e.jsx("li",{children:"为不同的聊天环境配置专属的行为提示"}),e.jsx("li",{children:"支持多个平台:QQ、微信、WebUI"}),e.jsx("li",{children:"可为群聊或私聊分别配置"}),e.jsx("li",{children:"Prompt 会自动注入到该聊天的上下文中"})]}),e.jsx("p",{className:"font-medium text-foreground mt-3",children:"📝 配置示例"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 pl-2",children:[e.jsxs("li",{children:["摄影群:",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"这是一个摄影群,你精通摄影知识"})]}),e.jsxs("li",{children:["二次元群:",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"这是一个二次元交流群"})]}),e.jsxs("li",{children:["好友私聊:",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"这是你与好朋友的私聊"})]})]})]})]})]})]})]})}),oS=Bs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),f=()=>{c&&!l.auth_token.includes(c)&&(r({...l,auth_token:[...l.auth_token,c]}),d(""))},p=j=>{r({...l,auth_token:l.auth_token.filter((b,y)=>y!==j)})},g=()=>{m&&!l.api_server_allowed_api_keys.includes(m)&&(r({...l,api_server_allowed_api_keys:[...l.api_server_allowed_api_keys,m]}),h(""))},N=j=>{r({...l,api_server_allowed_api_keys:l.api_server_allowed_api_keys.filter((b,y)=>y!==j)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"旧版 API 认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"用于旧版 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:j=>d(j.target.value),placeholder:"输入认证令牌",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.auth_token.map((j,b)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(b),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"新版 API Server 配置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用新版 API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否启用额外的新版 API Server(额外监听端口)"})]}),e.jsx(Ge,{checked:l.enable_api_server,onCheckedChange:j=>r({...l,enable_api_server:j})})]}),l.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"主机地址"}),e.jsx(ne,{value:l.api_server_host,onChange:j=>r({...l,api_server_host:j.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"端口号"}),e.jsx(ne,{type:"number",value:l.api_server_port,onChange:j=>r({...l,api_server_port:parseInt(j.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.api_server_use_wss,onCheckedChange:j=>r({...l,api_server_use_wss:j})}),e.jsx(T,{children:"启用 WSS 安全连接"})]}),l.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 证书文件路径"}),e.jsx(ne,{value:l.api_server_cert_file,onChange:j=>r({...l,api_server_cert_file:j.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 密钥文件路径"}),e.jsx(ne,{value:l.api_server_key_file,onChange:j=>r({...l,api_server_key_file:j.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"允许的 API Key 列表"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"为空则允许所有连接"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:m,onChange:j=>h(j.target.value),placeholder:"输入 API Key",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.api_server_allowed_api_keys.map((j,b)=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-mono",children:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(b),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]})]})]})]})]})}),dS=Bs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})})]})]})}),uS=Bs.memo(function({emojiConfig:l,memoryConfig:r,toolConfig:c,voiceConfig:d,onEmojiChange:m,onMemoryChange:h,onToolChange:f,onVoiceChange:p}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:g=>f({...c,enable_tool:g})}),e.jsx(T,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦使用各种工具来增强功能"}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(Ge,{id:"enable_asr",checked:d.enable_asr,onCheckedChange:g=>p({...d,enable_asr:g})}),e.jsx(T,{htmlFor:"enable_asr",className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(ne,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:g=>h({...r,max_agent_iterations:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(ne,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:g=>h({...r,agent_timeout_seconds:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"记忆检索的超时时间,避免过长的等待"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:g=>h({...r,enable_jargon_detection:g})}),e.jsx(T,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:g=>h({...r,global_memory:g})}),e.jsx(T,{htmlFor:"global_memory",className:"cursor-pointer",children:"全局记忆查询"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许记忆检索在所有聊天记录中进行全局查询(忽略当前聊天流)"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(ne,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:l.emoji_chance,onChange:g=>m({...l,emoji_chance:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",value:l.max_reg_num,onChange:g=>m({...l,max_reg_num:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",value:l.check_interval,onChange:g=>m({...l,check_interval:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"do_replace",checked:l.do_replace,onCheckedChange:g=>m({...l,do_replace:g})}),e.jsx(T,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:g=>m({...l,steal_emoji:g})}),e.jsx(T,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:g=>m({...l,content_filtration:g})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),l.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ne,{id:"filtration_prompt",value:l.filtration_prompt,onChange:g=>m({...l,filtration_prompt:g.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),mS=Bs.memo(function({member:l,groupIndex:r,memberIndex:c,availableChatIds:d,onUpdate:m,onRemove:h}){const f=d.includes(l)||l==="*",[p,g]=u.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(ne,{value:l,onChange:N=>m(r,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),d.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:l,onValueChange:N=>m(r,c,N),children:[e.jsx(Be,{className:"flex-1",children:e.jsx(Fe,{placeholder:"选择聊天流"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"*",children:"* (全局共享)"}),d.map((N,j)=>e.jsx(W,{value:N,children:N},j))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除组成员 "',l||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>h(r,c),children:"删除"})]})]})]})]})}),xS=Bs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,learning_list:[...l.learning_list,["","enable","enable","1.0"]]})},d=b=>{r({...l,learning_list:l.learning_list.filter((y,w)=>w!==b)})},m=(b,y,w)=>{const z=[...l.learning_list];z[b][y]=w,r({...l,learning_list:z})},h=({rule:b})=>{const y=`["${b[0]}", "${b[1]}", "${b[2]}", "${b[3]}"]`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(tl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{r({...l,expression_groups:[...l.expression_groups,[]]})},p=b=>{r({...l,expression_groups:l.expression_groups.filter((y,w)=>w!==b)})},g=b=>{const y=[...l.expression_groups];y[b]=[...y[b],""],r({...l,expression_groups:y})},N=(b,y)=>{const w=[...l.expression_groups];w[b]=w[b].filter((z,M)=>M!==y),r({...l,expression_groups:w})},j=(b,y,w)=>{const z=[...l.expression_groups];z[b][y]=w,r({...l,expression_groups:z})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"all_global_jargon",checked:l.all_global_jargon??!1,onCheckedChange:b=>r({...l,all_global_jargon:b})}),e.jsx(T,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_explanation",checked:l.enable_jargon_explanation??!0,onCheckedChange:b=>r({...l,enable_jargon_explanation:b})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"启用黑话解释"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"在回复前尝试对上下文中的黑话进行解释。关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习。"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Pe,{value:l.jargon_mode??"context",onValueChange:b=>r({...l,jargon_mode:b}),children:[e.jsx(Be,{id:"jargon_mode",className:"mt-2",children:e.jsx(Fe,{placeholder:"选择黑话解释来源"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(W,{value:"planner",children:"Planner模式(使用unknown_words列表)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["上下文模式:使用上下文自动匹配黑话并解释",e.jsx("br",{}),"Planner模式:仅使用Planner在reply动作中给出的unknown_words列表进行黑话检索"]})]})]}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.learning_list.map((b,y)=>{const w=l.learning_list.some((C,R)=>R!==y&&C[0]===""),z=b[0]==="",M=b[0].split(":"),S=M[0]||"qq",F=M[1]||"",E=M[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",y+1," ",z&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除学习规则 ",y+1," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>d(y),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Pe,{value:z?"global":"specific",onValueChange:C=>{C==="global"?m(y,0,""):m(y,0,"qq::group")},disabled:w&&!z,children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"global",children:"全局配置"}),e.jsx(W,{value:"specific",disabled:w&&!z,children:"详细配置"})]})]}),w&&!z&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!z&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:S,onValueChange:C=>{m(y,0,`${C}:${F}:${E}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ne,{value:F,onChange:C=>{m(y,0,`${S}:${C.target.value}:${E}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:E,onValueChange:C=>{m(y,0,`${S}:${F}:${C}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群组(group)"}),e.jsx(W,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",b[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Ge,{checked:b[1]==="enable",onCheckedChange:C=>m(y,1,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Ge,{checked:b[2]==="enable",onCheckedChange:C=>m(y,2,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"启用黑话学习"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦在此聊天流中学习和记录黑话"})]}),e.jsx(Ge,{checked:b[3]==="true"||b[3]==="enable",onCheckedChange:C=>m(y,3,C?"true":"false")})]})})]})]},y)}),l.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达优化配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何优化和改进表达方式"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_self_reflect",className:"cursor-pointer font-medium",children:"自动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会自动检查并优化表达方式,无需管理员手动干预"})]}),e.jsx(Ge,{id:"expression_self_reflect",checked:l.expression_self_reflect??!1,onCheckedChange:b=>r({...l,expression_self_reflect:b})})]}),l.expression_self_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_interval",children:"自动检查间隔(秒)"}),e.jsx(ne,{id:"expression_auto_check_interval",type:"number",min:"60",value:l.expression_auto_check_interval??3600,onChange:b=>r({...l,expression_auto_check_interval:parseInt(b.target.value)||3600})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"表达方式自动检查的间隔时间(单位:秒),默认值:3600秒(1小时)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_count",children:"每次检查数量"}),e.jsx(ne,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:l.expression_auto_check_count??10,onChange:b=>r({...l,expression_auto_check_count:parseInt(b.target.value)||10})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次自动检查时随机选取的表达方式数量,默认值:10条"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"自定义评估标准"}),e.jsxs(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:[...l.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加标准"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.expression_auto_check_custom_criteria||[]).map((b,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:b,onChange:w=>{const z=[...l.expression_auto_check_custom_criteria||[]];z[y]=w.target.value,r({...l,expression_auto_check_custom_criteria:z})},placeholder:"输入评估标准,例如:是否符合角色人设",className:"flex-1"}),e.jsx(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:(l.expression_auto_check_custom_criteria||[]).filter((w,z)=>z!==y)})},size:"icon",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},y)),(!l.expression_auto_check_custom_criteria||l.expression_auto_check_custom_criteria.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:'暂无自定义标准,点击"添加标准"开始配置'})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这些标准会被添加到评估提示词中,作为额外的评估要求"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_checked_only",className:"cursor-pointer font-medium",children:"仅使用已审核通过的表达方式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后,只有通过审核(已检查)的项目会被使用;关闭时,未审核的项目也会被使用。无论开关状态,被拒绝的项目永远不会被使用。"})]}),e.jsx(Ge,{id:"expression_checked_only",checked:l.expression_checked_only??!1,onCheckedChange:b=>r({...l,expression_checked_only:b})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_manual_reflect",className:"cursor-pointer font-medium",children:"手动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会主动向管理员询问表达方式是否合适"})]}),e.jsx(Ge,{id:"expression_manual_reflect",checked:l.expression_manual_reflect??!1,onCheckedChange:b=>r({...l,expression_manual_reflect:b})})]}),l.expression_manual_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const y=(l.manual_reflect_operator_id||"").split(":"),w=y[0]||"qq",z=y[1]||"",M=y[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Pe,{value:w,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${S}:${z}:${M}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ne,{value:z,onChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${S.target.value}:${M}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Pe,{value:M,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${z}:${S}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"private",children:"私聊(private)"}),e.jsx(W,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",l.manual_reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'手动表达优化操作员ID,格式:platform:id:type (例如 "qq:123456:private" 或 "qq:654321:group")'})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许进行表达反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思(前提是启用了手动表达优化)"})]}),e.jsxs(_,{onClick:()=>{r({...l,allow_reflect:[...l.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.allow_reflect||[]).map((b,y)=>{const w=b.split(":"),z=w[0]||"qq",M=w[1]||"",S=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Pe,{value:z,onValueChange:F=>{const E=[...l.allow_reflect];E[y]=`${F}:${M}:${S}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"微信"})]})]}),e.jsx(ne,{value:M,onChange:F=>{const E=[...l.allow_reflect];E[y]=`${z}:${F.target.value}:${S}`,r({...l,allow_reflect:E})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Pe,{value:S,onValueChange:F=>{const E=[...l.allow_reflect];E[y]=`${z}:${M}:${F}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"群组"}),e.jsx(W,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{r({...l,allow_reflect:l.allow_reflect.filter((F,E)=>E!==y)})},size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},y)}),(!l.allow_reflect||l.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"列表为空,所有聊天流都可以进行表达反思"})]})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),e.jsxs(_,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.expression_groups.map((b,y)=>{const w=l.learning_list.map(z=>z[0]).filter(z=>z!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",y+1,b.length===1&&b[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(y),size:"sm",variant:"outline",children:e.jsx(Xs,{className:"h-4 w-4"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除共享组 ",y+1," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>p(y),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:b.map((z,M)=>e.jsx(mS,{member:z,groupIndex:y,memberIndex:M,availableChatIds:w,onUpdate:j,onRemove:N},`${y}-${M}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},y)}),l.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})});function hS({regex:a,reaction:l,onRegexChange:r,onReactionChange:c}){const[d,m]=u.useState(!1),[h,f]=u.useState(""),[p,g]=u.useState(null),[N,j]=u.useState(""),[b,y]=u.useState({}),[w,z]=u.useState(""),M=u.useRef(null),[S,F]=u.useState("build"),E=O=>O.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(O,X=0)=>{const L=M.current;if(!L)return;const me=L.selectionStart||0,Ne=L.selectionEnd||0,je=a.substring(0,me)+O+a.substring(Ne);r(je),setTimeout(()=>{const ce=me+O.length+X;L.setSelectionRange(ce,ce),L.focus()},0)};u.useEffect(()=>{if(!a||!h){p!==null&&g(null),Object.keys(b).length>0&&y({}),w!==l&&z(l),N!==""&&j("");return}try{const O=E(a),X=new RegExp(O,"g"),L=h.match(X);g(L),j("");const Ne=new RegExp(O).exec(h);if(Ne&&Ne.groups){y(Ne.groups);let je=l;Object.entries(Ne.groups).forEach(([ce,ge])=>{je=je.replace(new RegExp(`\\[${ce}\\]`,"g"),ge||"")}),z(je)}else y({}),z(l)}catch(O){j(O.message),g(null),y({}),z(l)}},[a,h,l,p,b,w,N]);const R=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const O=E(a),X=new RegExp(O,"g");let L=0;const me=[];let Ne;for(;(Ne=X.exec(h))!==null;)Ne.index>L&&me.push(e.jsx("span",{children:h.substring(L,Ne.index)},`text-${L}`)),me.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Ne[0]},`match-${Ne.index}`)),L=Ne.index+Ne[0].length;return L)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Qs,{open:d,onOpenChange:m,children:[e.jsx(dd,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ux,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"正则表达式编辑器"}),e.jsx(at,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(ts,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(Jt,{value:S,onValueChange:O=>F(O),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"build",children:"🔧 构建器"}),e.jsx(Xe,{value:"test",children:"🧪 测试器"})]}),e.jsxs(Ss,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(ne,{ref:M,value:a,onChange:O=>r(O.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(pt,{value:l,onChange:O=>c(O.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[H.map(O=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:O.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:O.items.map(X=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>C(X.pattern,X.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:X.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:X.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:X.desc})]})},X.label))})]},O.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(Ss,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:a||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(pt,{id:"test-text",value:h,onChange:O=>f(O.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),N&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:N})]}),!N&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",p.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(ts,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:R()})})]}),Object.keys(b).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(ts,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(b).map(([O,X])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",O,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:X})]},O))})})]}),Object.keys(b).length>0&&l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(ts,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const fS=Bs.memo(function({keywordReactionConfig:l,responsePostProcessConfig:r,chineseTypoConfig:c,responseSplitterConfig:d,onKeywordReactionChange:m,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{m({...l,regex_rules:[...l.regex_rules,{regex:[""],reaction:""}]})},N=C=>{m({...l,regex_rules:l.regex_rules.filter((R,H)=>H!==C)})},j=(C,R,H)=>{const O=[...l.regex_rules];R==="regex"&&typeof H=="string"?O[C]={...O[C],regex:[H]}:R==="reaction"&&typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,regex_rules:O})},b=()=>{m({...l,keyword_rules:[...l.keyword_rules,{keywords:[],reaction:""}]})},y=C=>{m({...l,keyword_rules:l.keyword_rules.filter((R,H)=>H!==C)})},w=(C,R,H)=>{const O=[...l.keyword_rules];typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,keyword_rules:O})},z=C=>{const R=[...l.keyword_rules];R[C]={...R[C],keywords:[...R[C].keywords||[],""]},m({...l,keyword_rules:R})},M=(C,R)=>{const H=[...l.keyword_rules];H[C]={...H[C],keywords:(H[C].keywords||[]).filter((O,X)=>X!==R)},m({...l,keyword_rules:H})},S=(C,R,H)=>{const O=[...l.keyword_rules],X=[...O[C].keywords||[]];X[R]=H,O[C]={...O[C],keywords:X},m({...l,keyword_rules:O})},F=({rule:C})=>{const R=`{ regex = [${(C.regex||[]).map(H=>`"${H}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(tl,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(ts,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},E=({rule:C})=>{const R=`[[keyword_reaction.keyword_rules]] -keywords = [${(C.keywords||[]).map(H=>`"${H}"`).join(", ")}] -reaction = "${C.reaction}"`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(tl,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(ts,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),e.jsxs(_,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.regex_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hS,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:H=>j(R,"regex",H),onReactionChange:H=>j(R,"reaction",H)}),e.jsx(F,{rule:C}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除正则规则 ",R+1," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>N(R),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(ne,{value:C.regex&&C.regex[0]||"",onChange:H=>j(R,"regex",H.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(pt,{value:C.reaction,onChange:H=>j(R,"reaction",H.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},R)),l.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(_,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.keyword_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{rule:C}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除关键词规则 ",R+1," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>y(R),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(_,{onClick:()=>z(R),size:"sm",variant:"ghost",children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((H,O)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:H,onChange:X=>S(R,O,X.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>M(R,O),size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},O)),(!C.keywords||C.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(pt,{value:C.reaction,onChange:H=>w(R,"reaction",H.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},R)),l.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:C=>h({...r,enable_response_post_process:C})}),e.jsx(T,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:C=>f({...c,enable:C})}),e.jsx(T,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(ne,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:C=>f({...c,error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ne,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:C=>f({...c,min_freq:parseInt(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(ne,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:C=>f({...c,tone_error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(ne,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:C=>f({...c,word_replace_rate:parseFloat(C.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_response_splitter",checked:d.enable,onCheckedChange:C=>p({...d,enable:C})}),e.jsx(T,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(ne,{id:"max_length",type:"number",min:"1",value:d.max_length,onChange:C=>p({...d,max_length:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(ne,{id:"max_sentence_num",type:"number",min:"1",value:d.max_sentence_num,onChange:C=>p({...d,max_sentence_num:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_kaomoji_protection",checked:d.enable_kaomoji_protection,onCheckedChange:C=>p({...d,enable_kaomoji_protection:C})}),e.jsx(T,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_overflow_return_all",checked:d.enable_overflow_return_all,onCheckedChange:C=>p({...d,enable_overflow_return_all:C})}),e.jsx(T,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})});function pS({config:a,onChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(""),h=()=>{const b=r.trim();b&&!a.ban_words.includes(b)&&(l({...a,ban_words:[...a.ban_words,b]}),c(""))},f=b=>{l({...a,ban_words:a.ban_words.filter((y,w)=>w!==b)})},p=b=>{b.key==="Enter"&&(b.preventDefault(),h())},g=()=>{const b=d.trim();if(b&&!a.ban_msgs_regex.includes(b))try{new RegExp(b),l({...a,ban_msgs_regex:[...a.ban_msgs_regex,b]}),m("")}catch(y){alert(`正则表达式语法错误:${y.message}`)}},N=b=>{l({...a,ban_msgs_regex:a.ban_msgs_regex.filter((y,w)=>w!==b)})},j=b=>{b.key==="Enter"&&(b.preventDefault(),g())};return e.jsx("div",{className:"space-y-6",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"消息过滤配置"}),e.jsx(Ns,{children:"配置消息过滤规则,过滤特定消息或在特定群组启用静默模式"})]}),e.jsx(ze,{children:e.jsxs(Jt,{defaultValue:"ban_words",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"ban_words",children:"禁用关键词"}),e.jsx(Xe,{value:"ban_regex",children:"禁用正则"})]}),e.jsx(Ss,{value:"ban_words",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"包含以下关键词的消息将被过滤,Bot 不会读取这些消息"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{placeholder:"输入要禁用的关键词(按回车添加)",value:r,onChange:b=>c(b.target.value),onKeyDown:p}),e.jsx(_,{onClick:h,size:"icon",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),a.ban_words.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁用关键词,点击上方添加"})}):e.jsx("div",{className:"space-y-2",children:a.ban_words.map((b,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm",children:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除关键词 ",e.jsxs("code",{children:['"',b,'"']})," 吗?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>f(y),children:"删除"})]})]})]})]},y))})]})}),e.jsx(Ss,{value:"ban_regex",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"匹配以下正则表达式的消息将被过滤"}),e.jsx("p",{className:"text-xs",children:"⚠️ 若不了解正则表达式,请勿随意修改"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(pt,{placeholder:`输入正则表达式(按回车添加) -示例:https?://[^\\s]+ 匹配链接`,value:d,onChange:b=>m(b.target.value),onKeyDown:j,className:"min-h-[60px] font-mono text-sm"}),e.jsx(_,{onClick:g,size:"icon",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),a.ban_msgs_regex.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁用正则表达式,点击上方添加"})}):e.jsx("div",{className:"space-y-2",children:a.ban_msgs_regex.map((b,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm font-mono flex-1 break-all",children:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"ml-2 flex-shrink-0",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除正则表达式 ",e.jsxs("code",{children:['"',b,'"']})," 吗?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>N(y),children:"删除"})]})]})]})]},y))})]})})]})})]})})}const gS=Bs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),[f,p]=u.useState(!1),g=l.allowed_ips?l.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],N=l.trusted_proxies?l.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],j=()=>{if(!c.trim())return;const S=[...g,c.trim()];r({...l,allowed_ips:S.join(",")}),d("")},b=S=>{const F=g.filter((E,C)=>C!==S);r({...l,allowed_ips:F.join(",")})},y=()=>{if(!m.trim())return;const S=[...N,m.trim()];r({...l,trusted_proxies:S.join(",")}),h("")},w=S=>{const F=N.filter((E,C)=>C!==S);r({...l,trusted_proxies:F.join(",")})},z=S=>{!S&&l.enabled?p(!0):r({...l,enabled:S})},M=()=>{r({...l,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI 服务配置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enabled,onCheckedChange:z}),e.jsx(T,{className:"cursor-pointer",children:"启用 WebUI"})]}),l.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"运行模式"}),e.jsxs(Pe,{value:l.mode,onValueChange:S=>r({...l,mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择运行模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"development",children:"开发模式"}),e.jsx(W,{value:"production",children:"生产模式"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"注意: WebUI 的监听地址和端口请在 .env 文件中配置 WEBUI_HOST 和 WEBUI_PORT"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"防爬虫模式"}),e.jsxs(Pe,{value:l.anti_crawler_mode,onValueChange:S=>r({...l,anti_crawler_mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择防爬虫模式"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"false",children:"禁用"}),e.jsx(W,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(W,{value:"loose",children:"宽松"}),e.jsx(W,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:c,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),j())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:j,disabled:!c.trim(),children:e.jsx(Xs,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((S,F)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>b(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Sa,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持精确IP、CIDR格式和通配符(如:127.0.0.1、192.168.1.0/24)"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"信任的代理 IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:m,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),y())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:y,disabled:!m.trim(),children:e.jsx(Xs,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((S,F)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>w(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Sa,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有来自这些IP的X-Forwarded-For头才被信任"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.trust_xff,onCheckedChange:S=>r({...l,trust_xff:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用 X-Forwarded-For 代理解析"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.secure_cookie,onCheckedChange:S=>r({...l,secure_cookie:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(bs,{open:f,onOpenChange:p,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"警告:即将关闭 WebUI"}),e.jsxs(gs,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{variant:"destructive",onClick:M,children:"确认关闭"})]})]})})]})}),En="/api/webui/config";async function Hg(){const l=await(await ke(`${En}/bot`)).json();if(!l.success)throw new Error("获取配置数据失败");return l.config}async function Nn(){const l=await(await ke(`${En}/model`)).json();if(!l.success)throw new Error("获取模型配置数据失败");return l.config}async function qg(a){const r=await(await ke(`${En}/bot`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function jS(){const l=await(await ke(`${En}/bot/raw`)).json();if(!l.success)throw new Error("获取配置源代码失败");return l.content}async function vS(a){const r=await(await ke(`${En}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:a})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function lc(a){const r=await(await ke(`${En}/model`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function NS(a,l){const c=await(await ke(`${En}/bot/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${a} 失败`)}async function Wm(a,l){const c=await(await ke(`${En}/model/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${a} 失败`)}async function bS(a,l="openai",r="/models"){const c=new URLSearchParams({provider_name:a,parser:l,endpoint:r}),d=await ke(`/api/webui/models/list?${c}`);if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${d.status})`)}const m=await d.json();if(!m.success)throw new Error("获取模型列表失败");return m.models}async function yS(a){const l=new URLSearchParams({provider_name:a}),r=await ke(`/api/webui/models/test-connection-by-name?${l}`,{method:"POST"});if(!r.ok){const c=await r.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${r.status})`)}return await r.json()}const wS=ti("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ht=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx("div",{ref:c,role:"alert",className:P(wS({variant:l}),a),...r}));ht.displayName="Alert";const Jn=u.forwardRef(({className:a,...l},r)=>e.jsx("h5",{ref:r,className:P("mb-1 font-medium leading-none tracking-tight",a),...l}));Jn.displayName="AlertTitle";const ft=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("text-sm [&_p]:leading-relaxed",a),...l}));ft.displayName="AlertDescription";const _S={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(a,l){let r;if(!l.inString&&(r=a.match(/^('''|"""|'|")/))&&(l.stringType=r[0],l.inString=!0),a.sol()&&!l.inString&&l.inArray===0&&(l.lhs=!0),l.inString){for(;l.inString;)if(a.match(l.stringType))l.inString=!1;else if(a.peek()==="\\")a.next(),a.next();else{if(a.eol())break;a.match(/^.[^\\\"\']*/)}return l.lhs?"property":"string"}else{if(l.inArray&&a.peek()==="]")return a.next(),l.inArray--,"bracket";if(l.lhs&&a.peek()==="["&&a.skipTo("]"))return a.next(),a.peek()==="]"&&a.next(),"atom";if(a.peek()==="#")return a.skipToEnd(),"comment";if(a.eatSpace())return null;if(l.lhs&&a.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(l.lhs&&a.peek()==="=")return a.next(),l.lhs=!1,null;if(!l.lhs&&a.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!l.lhs&&(a.match("true")||a.match("false")))return"atom";if(!l.lhs&&a.peek()==="[")return l.inArray++,a.next(),"bracket";if(!l.lhs&&a.match(/^\-?\d+(?:\.\d+)?/))return"number";a.eatSpace()||a.next()}return null},languageData:{commentTokens:{line:"#"}}},SS={python:[d_()],json:[u_(),m_()],toml:[o_.define(_S)],text:[]};function Qv({value:a,onChange:l,language:r="text",readOnly:c=!1,height:d="400px",minHeight:m,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[N,j]=u.useState(!1);if(u.useEffect(()=>{j(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:d,minHeight:m,maxHeight:h}});const b=[...SS[r]||[],zm.lineWrapping,zm.theme({"&":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-content":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-gutters":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-scroller":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'}})];return c&&b.push(zm.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border custom-scrollbar ${g}`,children:e.jsx(x_,{value:a,height:d,minHeight:m,maxHeight:h,theme:p==="dark"?h_:void 0,extensions:b,onChange:l,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function kS({id:a,index:l,itemType:r,itemFields:c,value:d,onChange:m,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:N,listeners:j,setNodeRef:b,transform:y,transition:w,isDragging:z}=Cv({id:a,disabled:f}),M={transform:Tv.Transform.toString(y),transition:w};return e.jsxs("div",{ref:b,style:M,className:P("flex items-start gap-2 group",z&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:P("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...N,...j,children:e.jsx(dv,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:r==="object"&&c?e.jsx(CS,{value:d,onChange:m,fields:c,disabled:f}):r==="number"?e.jsx(ne,{type:"number",value:d??"",onChange:S=>m(parseFloat(S.target.value)||0),placeholder:g??`第 ${l+1} 项`,disabled:f,className:"font-mono"}):e.jsx(ne,{type:"text",value:d??"",onChange:S=>m(S.target.value),placeholder:g??`第 ${l+1} 项`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:P("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(os,{className:"h-4 w-4"})})]})}function CS({value:a,onChange:l,fields:r,disabled:c}){const d=u.useCallback((h,f)=>{l({...a,[h]:f})},[a,l]),m=(h,f)=>{const p=a?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Ge,{checked:!!(p??f.default),onCheckedChange:g=>d(h,g),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const g=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(el,{value:[g],onValueChange:N=>d(h,N[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Pe,{value:String(p??f.default??""),onValueChange:g=>d(h,g),disabled:c,children:[e.jsx(Be,{className:"h-8 text-sm",children:e.jsx(Fe,{placeholder:f.placeholder??"请选择"})}),e.jsx(Ie,{children:f.choices.map(g=>e.jsx(W,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ne,{type:"number",value:p??f.default??"",onChange:g=>d(h,parseFloat(g.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ne,{type:"text",value:p??f.default??"",onChange:g=>d(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(Te,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(r).map(([h,f])=>e.jsx("div",{children:m(h,f)},h))})}function TS({value:a,onChange:l,itemType:r="string",itemFields:c,minItems:d,maxItems:m,disabled:h,placeholder:f}){const p=u.useMemo(()=>Array.isArray(a)?a:typeof a=="string"&&a.trim()?a.split(",").map(E=>E.trim()):[],[a]),[g]=u.useState(()=>new Map),N=u.useCallback(E=>(g.has(E)||g.set(E,`item-${Date.now()}-${E}-${Math.random().toString(36).slice(2)}`),g.get(E)),[g]),j=u.useMemo(()=>{const E=[];for(let C=0;C{const{active:C,over:R}=E;if(R&&C.id!==R.id){const H=j.indexOf(C.id),O=j.indexOf(R.id),X=wv(p,H,O);l(X)}},[p,j,l]),w=u.useCallback(()=>{if(m!=null&&p.length>=m)return;let E;r==="object"&&c?E=Object.fromEntries(Object.entries(c).map(([C,R])=>[C,R.default??""])):r==="number"?E=0:E="",l([...p,E])},[p,m,r,c,l]),z=u.useCallback((E,C)=>{const R=[...p];R[E]=C,l(R)},[p,l]),M=u.useCallback(E=>{if(d!=null&&p.length<=d)return;const C=p.filter((R,H)=>H!==E);g.delete(E),l(C)},[p,d,g,l]),S=m==null||p.lengthd;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(_v,{sensors:b,collisionDetection:Sv,onDragEnd:y,children:e.jsx(kv,{items:j,strategy:f_,children:e.jsx("div",{className:"space-y-2",children:p.map((E,C)=>e.jsx(kS,{id:j[C],index:C,itemType:r,itemFields:c,value:E,onChange:R=>z(C,R),onRemove:()=>M(C),disabled:h,canRemove:F,placeholder:f},j[C]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:h||!S,className:"w-full",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"添加项目",m!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",m,")"]})]}),(d!=null||m!=null)&&(d!==null||m!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:d!=null&&m!=null?`允许 ${d} - ${m} 项`:d!=null?`至少 ${d} 项`:`最多 ${m} 项`})]})}function bx({content:a,className:l=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${l}`,children:e.jsx(b_,{remarkPlugins:[w_,__],rehypePlugins:[y_],components:{code({inline:r,className:c,children:d,...m}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...m,children:d}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...m,children:d})},table({children:r,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:r})})},th({children:r,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:r})},td({children:r,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:r})},a({children:r,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:r})},blockquote({children:r,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:r})},h1({children:r,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:r})},h2({children:r,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:r})},h3({children:r,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:r})},h4({children:r,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:r})},ul({children:r,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:r})},ol({children:r,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:r})},p({children:r,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:a})})}function ES(a,l){let r=a.slice(0,l).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function MS(a,l,r){let c=a.split(/\r\n|\n|\r/g),d="",m=(Math.log10(l+1)|0)+1;for(let h=l-1;h<=l+1;h++){let f=c[h-1];f&&(d+=h.toString().padEnd(m," "),d+=": ",d+=f,d+=` -`,h===l&&(d+=" ".repeat(m+r+2),d+=`^ -`))}return d}class Ds extends Error{line;column;codeblock;constructor(l,r){const[c,d]=ES(r.toml,r.ptr),m=MS(r.toml,c,d);super(`Invalid TOML document: ${l} - -${m}`,r),this.line=c,this.column=d,this.codeblock=m}}function AS(a,l){let r=0;for(;a[l-++r]==="\\";);return--r&&r%2}function Xo(a,l=0,r=a.length){let c=a.indexOf(` -`,l);return a[c-1]==="\r"&&c--,c<=r?c:-1}function yx(a,l){for(let r=l;r-1&&r!=="'"&&AS(a,l));return l>-1&&(l+=c.length,c.length>1&&(a[l]===r&&l++,a[l]===r&&l++)),l}let zS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Jr extends Date{#s=!1;#t=!1;#e=null;constructor(l){let r=!0,c=!0,d="Z";if(typeof l=="string"){let m=l.match(zS);m?(m[1]||(r=!1,l=`0000-01-01T${l}`),c=!!m[2],c&&l[10]===" "&&(l=l.replace(" ","T")),m[2]&&+m[2]>23?l="":(d=m[3]||null,l=l.toUpperCase(),!d&&c&&(l+="Z"))):l=""}super(l),isNaN(this.getTime())||(this.#s=r,this.#t=c,this.#e=d)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let l=super.toISOString();if(this.isDate())return l.slice(0,10);if(this.isTime())return l.slice(11,23);if(this.#e===null)return l.slice(0,-1);if(this.#e==="Z")return l;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(l,r="Z"){let c=new Jr(l);return c.#e=r,c}static wrapAsLocalDateTime(l){let r=new Jr(l);return r.#e=null,r}static wrapAsLocalDate(l){let r=new Jr(l);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(l){let r=new Jr(l);return r.#s=!1,r.#e=null,r}}let RS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,DS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,OS=/^[+-]?0[0-9_]/,LS=/^[0-9a-f]{4,8}$/i,Gg={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function Jv(a,l=0,r=a.length){let c=a[l]==="'",d=a[l++]===a[l]&&a[l]===a[l+1];d&&(r-=2,a[l+=2]==="\r"&&l++,a[l]===` -`&&l++);let m=0,h,f="",p=l;for(;l-1&&(yx(a,m),d=d.slice(0,m));let h=d.trimEnd();if(!c){let f=d.indexOf(` -`,h.length);if(f>-1)throw new Ds("newlines are not allowed in inline tables",{toml:a,ptr:l+f})}return[h,m]}function wx(a,l,r,c,d){if(c===0)throw new Ds("document contains excessively nested structures. aborting.",{toml:a,ptr:l});let m=a[l];if(m==="["||m==="{"){let[p,g]=m==="["?PS(a,l,c,d):IS(a,l,c,d),N=r?Vg(a,g,",",r):g;if(g-N&&r==="}"){let j=Xo(a,g,N);if(j>-1)throw new Ds("newlines are not allowed in inline tables",{toml:a,ptr:j})}return[p,N]}let h;if(m==='"'||m==="'"){h=Yv(a,l);let p=Jv(a,l,h);if(r){if(h=Pl(a,h,r!=="]"),a[h]&&a[h]!==","&&a[h]!==r&&a[h]!==` -`&&a[h]!=="\r")throw new Ds("unexpected character encountered",{toml:a,ptr:h});h+=+(a[h]===",")}return[p,h]}h=Vg(a,l,",",r);let f=$S(a,l,h-+(a[h-1]===","),r==="]");if(!f[0])throw new Ds("incomplete key-value declaration: no value specified",{toml:a,ptr:l});return r&&f[1]>-1&&(h=Pl(a,l+f[1]),h+=+(a[h]===",")),[US(f[0],a,l,d),h]}let BS=/^[a-zA-Z0-9-_]+[ \t]*$/;function ex(a,l,r="="){let c=l-1,d=[],m=a.indexOf(r,l);if(m<0)throw new Ds("incomplete key-value: cannot find end of key",{toml:a,ptr:l});do{let h=a[l=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===a[l+1]&&h===a[l+2])throw new Ds("multiline strings are not allowed in keys",{toml:a,ptr:l});let f=Yv(a,l);if(f<0)throw new Ds("unfinished string encountered",{toml:a,ptr:l});c=a.indexOf(".",f);let p=a.slice(f,c<0||c>m?m:c),g=Xo(p);if(g>-1)throw new Ds("newlines are not allowed in keys",{toml:a,ptr:l+c+g});if(p.trimStart())throw new Ds("found extra tokens after the string part",{toml:a,ptr:f});if(mm?m:c);if(!BS.test(f))throw new Ds("only letter, numbers, dashes and underscores are allowed in keys",{toml:a,ptr:l});d.push(f.trimEnd())}}while(c+1&&c{try{l(!0),await NS(b,y),r(!1),m?.()}catch(w){console.error(`自动保存 ${b} 失败:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{l(!1)}},[l,r,m,h]),g=u.useCallback((b,y)=>{a||(r(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(b,y)},d))},[a,r,p,d]),N=u.useCallback(async(b,y)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(b,y)},[p]),j=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return u.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:j}}function Vt(a,l,r,c){u.useEffect(()=>{a&&!r&&c(l,a)},[a])}const QS=500;function YS(){return e.jsx(lr,{children:e.jsx(JS,{})})}function JS(){const[a,l]=u.useState(!0),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState("visual"),[N,j]=u.useState(""),[b,y]=u.useState(!1),[w,z]=u.useState(""),{toast:M}=nt(),{triggerRestart:S,isRestarting:F}=Tn(),[E,C]=u.useState(null),[R,H]=u.useState(null),[O,X]=u.useState(null),[L,me]=u.useState(null),[Ne,je]=u.useState(null),[ce,ge]=u.useState(null),[pe,D]=u.useState(null),[Q,B]=u.useState(null),[ue,Y]=u.useState(null),[we,fe]=u.useState(null),[Ee,G]=u.useState(null),[$,A]=u.useState(null),[K,Re]=u.useState(null),[se,$e]=u.useState(null),[cs,J]=u.useState(null),[Z,Le]=u.useState(null),[le,De]=u.useState(null),[xe,Me]=u.useState(null),[ds,Ts]=u.useState(null),[Ct,ia]=u.useState(null),[ut,Is]=u.useState(null),V=u.useRef(!0),Ke=u.useRef({}),He=Ae=>{const Qe=Ae.split(` -`);let As=Qe[0];As=As.replace(/^Error:\s*/,"");const mt=[[/Invalid TOML document: unrecognized escape sequence/,"TOML 文档错误:无法识别的转义序列(提示:在双引号字符串中使用 \\\\ 转义反斜杠,或使用单引号字符串)"],[/Invalid TOML document: only letter, numbers, dashes and underscores are allowed in keys/,"TOML 文档错误:键名只能包含字母、数字、短横线和下划线"],[/Invalid TOML document: (.+)/,"TOML 文档错误:$1"],[/Unexpected character.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:意外的字符"],[/Expected.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:缺少必要的字符"],[/Invalid.*at line (\d+), column (\d+)/,"第 $1 行第 $2 列:无效的语法"],[/Unterminated string at line (\d+)/,"第 $1 行:字符串未正常结束(缺少引号)"],[/Duplicate key.*at line (\d+)/,"第 $1 行:重复的键名"],[/Invalid escape sequence at line (\d+)/,"第 $1 行:无效的转义序列(提示:在双引号字符串中使用 \\\\ 转义反斜杠)"],[/Expected.*but got.*at line (\d+)/,"第 $1 行:类型不匹配"],[/line (\d+), column (\d+)/,"第 $1 行第 $2 列"],[/Unexpected end of input/,"意外的文件结束(可能缺少闭合符号)"],[/Unexpected token/,"意外的标记"],[/Invalid number/,"无效的数字"],[/Invalid date/,"无效的日期格式"],[/Invalid boolean/,"无效的布尔值(应为 true 或 false)"],[/Unexpected character/,"意外的字符"],[/unrecognized escape sequence/,"无法识别的转义序列"]];for(const[Ht,ca]of mt)if(Ht.test(As)){As=As.replace(Ht,ca);break}return Qe.length>1?(Qe[0]=As,Qe.join(` -`)):As},Je=u.useCallback(Ae=>{Ke.current=Ae,C(Ae.bot),H(Ae.personality);const Qe=Ae.chat;Qe.talk_value_rules||(Qe.talk_value_rules=[]),X(Qe),me(Ae.expression),je(Ae.emoji),ge(Ae.memory),D(Ae.tool),B(Ae.voice),Y(Ae.message_receive),fe(Ae.dream),G(Ae.lpmm_knowledge),A(Ae.keyword_reaction),Re(Ae.response_post_process),$e(Ae.chinese_typo),J(Ae.response_splitter),Le(Ae.log),De(Ae.debug),Me(Ae.experimental),Ts(Ae.maim_message),ia(Ae.telemetry),Is(Ae.webui)},[]),Es=u.useCallback(()=>({...Ke.current,bot:E,personality:R,chat:O,expression:L,emoji:Ne,memory:ce,tool:pe,voice:Q,message_receive:ue,dream:we,lpmm_knowledge:Ee,keyword_reaction:$,response_post_process:K,chinese_typo:se,response_splitter:cs,log:Z,debug:le,experimental:xe,maim_message:ds,telemetry:Ct,webui:ut}),[E,R,O,L,Ne,ce,pe,Q,ue,we,Ee,$,K,se,cs,Z,le,xe,ds,Ct,ut]),ms=u.useCallback(async()=>{try{const Qe=(await jS()).replace(/"([^"]*)"/g,(As,mt)=>`"${mt.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);j(Qe),y(!1)}catch(Ae){M({variant:"destructive",title:"加载失败",description:Ae instanceof Error?Ae.message:"加载源代码失败"})}},[M]),Ms=u.useCallback(async()=>{try{l(!0);const Ae=await Hg();Je(Ae),f(!1),V.current=!1,await ms()}catch(Ae){console.error("加载配置失败:",Ae),M({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{l(!1)}},[M,ms,Je]);u.useEffect(()=>{Ms()},[Ms]);const{triggerAutoSave:We,cancelPendingAutoSave:Cs}=KS(V.current,m,f);Vt(E,"bot",V.current,We),Vt(R,"personality",V.current,We),Vt(O,"chat",V.current,We),Vt(L,"expression",V.current,We),Vt(Ne,"emoji",V.current,We),Vt(ce,"memory",V.current,We),Vt(pe,"tool",V.current,We),Vt(Q,"voice",V.current,We),Vt(we,"dream",V.current,We),Vt(Ee,"lpmm_knowledge",V.current,We),Vt($,"keyword_reaction",V.current,We),Vt(K,"response_post_process",V.current,We),Vt(se,"chinese_typo",V.current,We),Vt(cs,"response_splitter",V.current,We),Vt(Z,"log",V.current,We),Vt(le,"debug",V.current,We),Vt(ds,"maim_message",V.current,We),Vt(Ct,"telemetry",V.current,We),Vt(ut,"webui",V.current,We);const rs=async()=>{try{c(!0);try{_x(N)}catch(Qe){const As=Qe instanceof Error?Qe.message:"TOML 格式错误",mt=He(As);y(!0),z(mt),M({variant:"destructive",title:"TOML 格式错误",description:mt}),c(!1);return}const Ae=N.replace(/"([^"]*)"/g,(Qe,As)=>`"${As.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await vS(Ae),f(!1),y(!1),z(""),M({title:"保存成功",description:"配置已保存"}),await Ms()}catch(Ae){y(!0);const Qe=Ae instanceof Error?Ae.message:"保存配置失败";z(Qe),M({variant:"destructive",title:"保存失败",description:Qe})}finally{c(!1)}},is=async Ae=>{if(h){M({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(Ae),Ae==="source")await ms();else try{const Qe=await Hg();Je(Qe),f(!1)}catch(Qe){console.error("加载配置失败:",Qe),M({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},ys=async()=>{try{c(!0),Cs(),await qg(Es()),f(!1),M({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Ae){console.error("保存配置失败:",Ae),M({title:"保存失败",description:Ae.message,variant:"destructive"})}finally{c(!1)}},rt=async()=>{await S()},jt=async()=>{try{c(!0),Cs(),await qg(Es()),f(!1),M({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ae=>setTimeout(Ae,QS)),await rt()}catch(Ae){console.error("保存失败:",Ae),M({title:"保存失败",description:Ae.message,variant:"destructive"})}finally{c(!1)}};return a?e.jsx(ts,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:p==="visual"?ys:rs,disabled:r||d||!h||F,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(gc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"保存中":d?"自动":h?"保存":"已保存"})]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:r||d||F,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(pc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:F?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认重启麦麦?"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:h?jt:rt,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(Jt,{value:p,onValueChange:Ae=>is(Ae),className:"w-full",children:e.jsxs(Gt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Xe,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(uv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(Xe,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(dx,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在前端验证格式,只有格式完全正确才能保存。",b&&w&&e.jsxs("div",{className:"text-destructive font-semibold mt-3 p-3 bg-destructive/10 rounded-md",children:[e.jsx("div",{className:"font-bold mb-2",children:"⚠️ TOML 格式错误:"}),e.jsx("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words",children:w})]})]})]}),e.jsx(Qv,{value:N,onChange:Ae=>{j(Ae),f(!0),b&&(y(!1),z(""))},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(Jt,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Gt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Xe,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(Xe,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(Xe,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(Xe,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(Xe,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(Xe,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(Xe,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"做梦"}),e.jsx(Xe,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(Xe,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(Xe,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(Ss,{value:"bot",className:"space-y-4",children:E&&e.jsx(W2,{config:E,onChange:C})}),e.jsx(Ss,{value:"personality",className:"space-y-4",children:R&&e.jsx(eS,{config:R,onChange:H})}),e.jsx(Ss,{value:"chat",className:"space-y-4",children:O&&e.jsx(aS,{config:O,onChange:X})}),e.jsx(Ss,{value:"expression",className:"space-y-4",children:L&&e.jsx(xS,{config:L,onChange:me})}),e.jsx(Ss,{value:"features",className:"space-y-4",children:Ne&&ce&&pe&&Q&&e.jsx(uS,{emojiConfig:Ne,memoryConfig:ce,toolConfig:pe,voiceConfig:Q,onEmojiChange:je,onMemoryChange:ge,onToolChange:D,onVoiceChange:B})}),e.jsxs(Ss,{value:"processing",className:"space-y-4",children:[$&&K&&se&&cs&&e.jsx(fS,{keywordReactionConfig:$,responsePostProcessConfig:K,chineseTypoConfig:se,responseSplitterConfig:cs,onKeywordReactionChange:A,onResponsePostProcessChange:Re,onChineseTypoChange:$e,onResponseSplitterChange:J}),ue&&e.jsx(pS,{config:ue,onChange:Y})]}),e.jsx(Ss,{value:"dream",className:"space-y-4",children:we&&e.jsx(lS,{config:we,onChange:fe})}),e.jsx(Ss,{value:"lpmm",className:"space-y-4",children:Ee&&e.jsx(nS,{config:Ee,onChange:G})}),e.jsx(Ss,{value:"webui",className:"space-y-4",children:ut&&e.jsx(gS,{config:ut,onChange:Is})}),e.jsxs(Ss,{value:"other",className:"space-y-4",children:[Z&&e.jsx(rS,{config:Z,onChange:Le}),le&&e.jsx(iS,{config:le,onChange:De}),xe&&e.jsx(cS,{config:xe,onChange:Me}),ds&&e.jsx(oS,{config:ds,onChange:Ts}),Ct&&e.jsx(dS,{config:Ct,onChange:ia})]})]})}),e.jsx(nr,{})]})})}const ql=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:P("w-full caption-bottom text-sm",a),...l})}));ql.displayName="Table";const Vl=u.forwardRef(({className:a,...l},r)=>e.jsx("thead",{ref:r,className:P("[&_tr]:border-b",a),...l}));Vl.displayName="TableHeader";const Gl=u.forwardRef(({className:a,...l},r)=>e.jsx("tbody",{ref:r,className:P("[&_tr:last-child]:border-0",a),...l}));Gl.displayName="TableBody";const XS=u.forwardRef(({className:a,...l},r)=>e.jsx("tfoot",{ref:r,className:P("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...l}));XS.displayName="TableFooter";const _t=u.forwardRef(({className:a,...l},r)=>e.jsx("tr",{ref:r,className:P("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...l}));_t.displayName="TableRow";const ns=u.forwardRef(({className:a,...l},r)=>e.jsx("th",{ref:r,className:P("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));ns.displayName="TableHead";const Ze=u.forwardRef(({className:a,...l},r)=>e.jsx("td",{ref:r,className:P("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));Ze.displayName="TableCell";const ZS=u.forwardRef(({className:a,...l},r)=>e.jsx("caption",{ref:r,className:P("mt-4 text-sm text-muted-foreground",a),...l}));ZS.displayName="TableCaption";const md=u.forwardRef(({className:a,...l},r)=>e.jsx(ka,{ref:r,className:P("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",a),...l}));md.displayName=ka.displayName;const xd=u.forwardRef(({className:a,...l},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx($t,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ka.Input,{ref:r,className:P("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),...l})]}));xd.displayName=ka.Input.displayName;const hd=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.List,{ref:r,className:P("max-h-[300px] overflow-y-auto overflow-x-hidden",a),...l}));hd.displayName=ka.List.displayName;const fd=u.forwardRef((a,l)=>e.jsx(ka.Empty,{ref:l,className:"py-6 text-center text-sm",...a}));fd.displayName=ka.Empty.displayName;const uc=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Group,{ref:r,className:P("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",a),...l}));uc.displayName=ka.Group.displayName;const WS=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Separator,{ref:r,className:P("-mx-1 h-px bg-border",a),...l}));WS.displayName=ka.Separator.displayName;const mc=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Item,{ref:r,className:P("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a),...l}));mc.displayName=ka.Item.displayName;const Zv=j1,Wv=v1,eN=N1,Tx=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(g1,{children:e.jsx(Zj,{ref:c,sideOffset:l,className:P("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...r})}));Tx.displayName=Zj.displayName;function Bl({content:a,className:l,iconClassName:r,side:c="top",align:d="center",maxWidth:m="300px"}){return e.jsx(Zv,{delayDuration:200,children:e.jsxs(Wv,{children:[e.jsx(eN,{asChild:!0,children:e.jsxs("button",{type:"button",className:P("inline-flex items-center justify-center rounded-full","text-muted-foreground hover:text-foreground","transition-colors cursor-help","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",l),onClick:h=>h.preventDefault(),children:[e.jsx(ox,{className:P("h-4 w-4",r)}),e.jsx("span",{className:"sr-only",children:"帮助信息"})]})}),e.jsx(Tx,{side:c,align:d,className:P("max-w-[var(--max-width)] text-sm leading-relaxed","bg-background text-foreground","border-2 border-primary shadow-lg","p-4"),style:{"--max-width":m},children:a})]})})}const sN=u.createContext(null),tN="maibot-completed-tours";function e4(){try{const a=localStorage.getItem(tN);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}}function Qg(a){localStorage.setItem(tN,JSON.stringify([...a]))}function s4({children:a}){const[l,r]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=u.useState(()=>new Map),[d,m]=u.useState(e4),[,h]=u.useState(0),f=u.useCallback((E,C)=>{c.set(E,C),h(R=>R+1)},[c]),p=u.useCallback(E=>{c.delete(E),r(C=>C.activeTourId===E?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=u.useCallback((E,C=0)=>{c.has(E)&&r({activeTourId:E,stepIndex:C,isRunning:!0})},[c]),N=u.useCallback(()=>{r(E=>({...E,isRunning:!1}))},[]),j=u.useCallback(E=>{r(C=>({...C,stepIndex:E}))},[]),b=u.useCallback(()=>{r(E=>({...E,stepIndex:E.stepIndex+1}))},[]),y=u.useCallback(()=>{r(E=>({...E,stepIndex:Math.max(0,E.stepIndex-1)}))},[]),w=u.useCallback(()=>l.activeTourId?c.get(l.activeTourId)||[]:[],[l.activeTourId,c]),z=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.add(E),Qg(R),R})},[]),M=u.useCallback(E=>{const{action:C,index:R,status:H,type:O}=E,X=["finished","skipped"];if(C==="close"){r(L=>({...L,isRunning:!1,stepIndex:0}));return}X.includes(H)?r(L=>(H==="finished"&&L.activeTourId&&setTimeout(()=>z(L.activeTourId),0),{...L,isRunning:!1,stepIndex:0})):O==="step:after"&&(C==="next"?r(L=>({...L,stepIndex:R+1})):C==="prev"&&r(L=>({...L,stepIndex:R-1})))},[z]),S=u.useCallback(E=>d.has(E),[d]),F=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.delete(E),Qg(R),R})},[]);return e.jsx(sN.Provider,{value:{state:l,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:j,nextStep:b,prevStep:y,getCurrentSteps:w,handleJoyrideCallback:M,isTourCompleted:S,markTourCompleted:z,resetTourCompleted:F},children:a})}function Ex(){const a=u.useContext(sN);if(!a)throw new Error("useTour must be used within a TourProvider");return a}const t4={options:{zIndex:1e4,primaryColor:"hsl(var(--primary))",textColor:"hsl(var(--foreground))",backgroundColor:"hsl(var(--background))",arrowColor:"hsl(var(--background))",overlayColor:"rgba(0, 0, 0, 0.5)"},tooltip:{borderRadius:"var(--radius)",padding:"1rem"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"1rem",fontWeight:600,marginBottom:"0.5rem"},tooltipContent:{fontSize:"0.875rem",padding:"0.5rem 0"},buttonNext:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",borderRadius:"calc(var(--radius) - 2px)",fontSize:"0.875rem",padding:"0.5rem 1rem"},buttonBack:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem",marginRight:"0.5rem"},buttonSkip:{color:"hsl(var(--muted-foreground))",fontSize:"0.875rem"},buttonClose:{color:"hsl(var(--muted-foreground))"},spotlight:{borderRadius:"var(--radius)"}},a4={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function l4(){const{state:a,getCurrentSteps:l,handleJoyrideCallback:r}=Ex(),c=l(),[d,m]=u.useState(!1),h=u.useRef(a.stepIndex),f=u.useRef(null);u.useEffect(()=>{h.current!==a.stepIndex&&(m(!1),h.current=a.stepIndex)},[a.stepIndex]),u.useEffect(()=>{if(!a.isRunning||c.length===0){m(!1);return}const j=c[a.stepIndex];if(!j){m(!1);return}const b=j.target;if(b==="body"){m(!0);return}m(!1);const y=setTimeout(()=>{const w=()=>{const F=document.querySelector(b);if(F){const E=F.getBoundingClientRect();if(E.width>0&&E.height>0)return!0}return!1};if(w()){setTimeout(()=>m(!0),100);return}const z=setInterval(()=>{w()&&(clearInterval(z),setTimeout(()=>m(!0),100))},100),M=setTimeout(()=>{clearInterval(z),m(!0)},5e3),S=()=>{clearInterval(z),clearTimeout(M)};f.current=S},150);return()=>{clearTimeout(y),f.current&&(f.current(),f.current=null)}},[a.isRunning,a.stepIndex,c]);const[p,g]=u.useState(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g(j),()=>{}},[]),!a.isRunning||c.length===0||!d)return null;const N=e.jsx(g_,{steps:c,stepIndex:a.stepIndex,run:a.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:t4,locale:a4,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${a.stepIndex}`);return p?tw.createPortal(N,p):N}const gl="model-assignment-tour",aN=[{target:"body",content:"本引导旨在帮助你配置模型提供商和对应的模型,并为麦麦的各个组件分配合适的模型。",placement:"center",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="sidebar-model-provider"]',content:'第一步,你需要配置模型提供商。模型提供商决定了你要使用谁家的模型,无论是单一厂商(如 DeepSeek),还是模型平台(如 Siliconflow),都可以在这里进行配置。点击"下一步"进入配置页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-provider-button"]',content:'点击"添加提供商"按钮,开始配置你的模型提供商。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="provider-dialog"]',content:"在这里,你可以选择你想要配置的模型提供商,填写相关信息后保存即可。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-name-input"]',content:"这里的名称是你为这个模型提供商起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-apikey-input"]',content:"这里需要填写你从模型提供商那里获取的 API 密钥,用于验证和调用模型服务。对于不同的提供商,获取 API 密钥的方式可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-url-input"]',content:"这里需要填写模型提供商的 API 访问地址,确保填写正确以便系统能够连接到模型服务。对于不同的提供商,API 地址可能有所不同,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-template-select"]',content:"当然,如果你不知道如何填写这些信息,很多模型提供商在这里都提供了预设的模板供你选择,选择对应的模板后,相关信息会自动填充。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-save-button"]',content:"填写完所有信息后,点击保存按钮,模型提供商就配置完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="provider-cancel-button"]',content:"因为这次咱们什么都没有填写,所以点击取消按钮退出吧。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="sidebar-model-management"]',content:'配置好模型提供商后,接下来我们需要为麦麦添加模型并分配功能。点击"下一步"进入模型管理页面。',placement:"right",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="add-model-button"]',content:'在为麦麦的组件分配模型之前,首先需要添加你想要分配的模型,点击"添加模型"按钮开始添加。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="model-dialog"]',content:"在这里,你可以选择你之前配置好的模型提供商,然后选择对应的模型来添加。",placement:"left",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-name-input"]',content:"这里的模型名称是你为这个模型起的一个名字,方便你在后续使用时识别它。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-provider-select"]',content:"在这里选择你之前配置好的模型提供商,这样系统才能知道你要添加哪个提供商的模型。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-identifier-input"]',content:"这里需要填写你想要添加的模型的标识符,不同的模型提供商可能有不同的标识符格式,请参考对应提供商的文档。",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-save-button"]',content:"填写完所有信息后,点击保存按钮,模型就添加完成了。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1},{target:'[data-tour="model-cancel-button"]',content:"当然,因为这次咱们什么都没有填写,所以直接点击取消按钮退出吧,等你准备好了再来添加模型。",placement:"top",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="tasks-tab-trigger"]',content:'最后一步,添加好模型后,切换到"为模型分配功能"标签页,为麦麦的各个组件分配合适的模型。',placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!0,hideFooter:!0},{target:'[data-tour="task-model-select"]',content:"在这里,你可以为每个组件选择一个或多个合适的模型,选择完成后配置会自动保存。恭喜你完成了模型配置的学习!",placement:"bottom",disableBeacon:!0,disableOverlayClose:!0,hideCloseButton:!1,spotlightClicks:!1}],lN={0:"/config/model",1:"/config/model",2:"/config/modelProvider",3:"/config/modelProvider",4:"/config/modelProvider",5:"/config/modelProvider",6:"/config/modelProvider",7:"/config/modelProvider",8:"/config/modelProvider",9:"/config/modelProvider",10:"/config/modelProvider",11:"/config/model",12:"/config/model",13:"/config/model",14:"/config/model",15:"/config/model",16:"/config/model",17:"/config/model",18:"/config/model",19:"/config/model"},Wi=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini",modelFetcher:{endpoint:"/models",parser:"gemini"}},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI",modelFetcher:{endpoint:"/models",parser:"openai"}},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function Yg(a){return a?a.replace(/\/+$/,"").toLowerCase():""}function n4(a){if(!a)return null;const l=Yg(a);return Wi.find(r=>r.id!=="custom"&&Yg(r.base_url)===l)||null}const Lo=a=>({...a,max_retry:a.max_retry??2,timeout:a.timeout??30,retry_interval:a.retry_interval??10}),r4=(a,l=[],r=null)=>{const c={};return a?(a.name?.trim()?l.some((m,h)=>r!==null&&h===r?!1:m.name.trim().toLowerCase()===a.name.trim().toLowerCase())&&(c.name="提供商名称已存在,请使用其他名称"):c.name="请输入提供商名称",a.base_url?.trim()||(c.base_url="请输入基础 URL"),a.api_key?.trim()||(c.api_key="请输入 API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"提供商数据为空"}}};function i4(){return e.jsx(lr,{children:e.jsx(c4,{})})}function c4(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[b,y]=u.useState(null),[w,z]=u.useState(null),[M,S]=u.useState("custom"),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,ce]=u.useState(new Set),[ge,pe]=u.useState(!1),[D,Q]=u.useState(1),[B,ue]=u.useState(20),[Y,we]=u.useState(""),[fe,Ee]=u.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[G,$]=u.useState({}),[A,K]=u.useState(new Set),[Re,se]=u.useState(new Map),{toast:$e}=nt(),cs=ha(),{state:J,goToStep:Z,registerTour:Le}=Ex(),{triggerRestart:le,isRestarting:De}=Tn(),xe=u.useRef(null),Me=u.useRef(!0);u.useEffect(()=>{Le(gl,aN)},[Le]),u.useEffect(()=>{if(J.activeTourId===gl&&J.isRunning){const te=lN[J.stepIndex];te&&!window.location.pathname.endsWith(te.replace("/config/",""))&&cs({to:te})}},[J.stepIndex,J.activeTourId,J.isRunning,cs]);const ds=u.useRef(J.stepIndex);u.useEffect(()=>{if(J.activeTourId===gl&&J.isRunning){const te=ds.current,_e=J.stepIndex;te>=3&&te<=9&&_e<3&&j(!1),te>=10&&_e>=3&&_e<=9&&($({}),S("custom"),y({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),z(null),L(!1),j(!0)),ds.current=_e}},[J.stepIndex,J.activeTourId,J.isRunning]),u.useEffect(()=>{if(J.activeTourId!==gl||!J.isRunning)return;const te=_e=>{const U=_e.target,Se=J.stepIndex;Se===2&&U.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Z(3),300):Se===9&&U.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Z(10),300)};return document.addEventListener("click",te,!0),()=>document.removeEventListener("click",te,!0)},[J,Z]),u.useEffect(()=>{Ts()},[]);const Ts=async()=>{try{c(!0);const te=await Nn();l(te.api_providers||[]),g(!1),Me.current=!1}catch(te){console.error("加载配置失败:",te)}finally{c(!1)}},Ct=async()=>{await le()},ia=async()=>{try{m(!0),xe.current&&clearTimeout(xe.current);const te=a.map(es=>({...es,max_retry:es.max_retry??2,timeout:es.timeout??30,retry_interval:es.retry_interval??10})),{shouldProceed:_e}=await ut(te,"restart");if(!_e){m(!1);return}const U=await Nn(),Se=new Set(te.map(es=>es.name)),us=(U.models||[]).filter(es=>Se.has(es.api_provider));U.api_providers=te,U.models=us,await lc(U),g(!1),$e({title:"保存成功",description:"正在重启麦麦..."}),await Ct()}catch(te){console.error("保存配置失败:",te),$e({title:"保存失败",description:te.message,variant:"destructive"}),m(!1)}},ut=u.useCallback(async(te,_e="auto")=>{try{const U=await Nn(),Se=new Set(a.map($s=>$s.name)),as=new Set(te.map($s=>$s.name)),us=Array.from(Se).filter($s=>!as.has($s));if(us.length===0)return{shouldProceed:!0,providers:te};const Tt=(U.models||[]).filter($s=>us.includes($s.api_provider));return Tt.length===0?{shouldProceed:!0,providers:te}:(Ee({isOpen:!0,providersToDelete:us,affectedModels:Tt,pendingProviders:te,context:_e,oldProviders:[...a]}),{shouldProceed:!1,providers:te})}catch(U){return console.error("检查删除影响失败:",U),{shouldProceed:!0,providers:te}}},[a]),Is=async()=>{try{(fe.context==="auto"?f:m)(!0),Ee($s=>({...$s,isOpen:!1}));const _e=await Nn(),U=fe.pendingProviders.map(Lo),Se=new Set(U.map($s=>$s.name)),us=(_e.models||[]).filter($s=>Se.has($s.api_provider)),es=new Set(fe.affectedModels.map($s=>$s.name)),Tt=_e.model_task_config;Tt&&Object.keys(Tt).forEach($s=>{const pa=Tt[$s];pa&&Array.isArray(pa.model_list)&&(pa.model_list=pa.model_list.filter(oa=>!es.has(oa)))}),_e.api_providers=U,_e.models=us,_e.model_task_config=Tt,await lc(_e),l(fe.pendingProviders),g(!1),$e({title:"删除成功",description:`已删除 ${fe.providersToDelete.length} 个提供商和 ${fe.affectedModels.length} 个关联模型`}),Ee({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),ce(new Set),fe.context==="restart"&&await Ct()}catch(te){console.error("删除失败:",te),$e({title:"删除失败",description:te.message,variant:"destructive"})}finally{fe.context==="auto"?f(!1):m(!1)}},V=()=>{fe.oldProviders.length>0&&l(fe.oldProviders),Ee({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},Ke=u.useCallback(async te=>{if(Me.current)return;const{shouldProceed:_e}=await ut(te,"auto");if(!_e){g(!0);return}try{f(!0);const U=te.map(Lo);await Wm("api_providers",U),g(!1)}catch(U){console.error("自动保存失败:",U),$e({title:"自动保存失败",description:U.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[a,ut]);u.useEffect(()=>{if(!Me.current)return g(!0),xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>{Ke(a)},2e3),()=>{xe.current&&clearTimeout(xe.current)}},[a,Ke]);const He=async()=>{try{m(!0),xe.current&&clearTimeout(xe.current);const te=a.map(Lo),{shouldProceed:_e}=await ut(te,"manual");if(!_e){m(!1);return}const U=await Nn(),Se=new Set(te.map(es=>es.name)),as=U.models||[],us=as.filter(es=>{const Tt=Se.has(es.api_provider);return Tt||console.warn(`模型 "${es.name}" 引用了已删除的提供商 "${es.api_provider}",将被移除`),Tt});if(as.length!==us.length){const es=as.length-us.length;$e({title:"注意",description:`已自动移除 ${es} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",te),U.api_providers=te,U.models=us,console.log("完整配置数据:",U),await lc(U),g(!1),$e({title:"保存成功",description:"模型提供商配置已保存"})}catch(te){console.error("保存配置失败:",te),$e({title:"保存失败",description:te.message,variant:"destructive"})}finally{m(!1)}},Je=(te,_e)=>{if($({}),te){const U=Wi.find(Se=>Se.base_url===te.base_url&&Se.client_type===te.client_type);S(U?.id||"custom"),y(te)}else S("custom"),y({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});z(_e),L(!1),j(!0)},Es=u.useCallback(te=>{S(te),E(!1);const _e=Wi.find(U=>U.id===te);_e&&_e.id!=="custom"?y(U=>({...U,name:_e.name,base_url:_e.base_url,client_type:_e.client_type})):_e?.id==="custom"&&y(U=>({...U,name:"",base_url:"",client_type:"openai"}))},[]),ms=u.useMemo(()=>M!=="custom",[M]),Ms=u.useCallback(async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),$e({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{$e({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[b?.api_key,$e]),We=()=>{if(!b)return;const{isValid:te,errors:_e}=r4(b,a,w);if(!te){$(_e);return}$({});const U=Lo(b);if(w!==null){const Se=[...a];Se[w]=U,l(Se)}else l([...a,U]);j(!1),y(null),z(null)},Cs=te=>{if(!te&&b){const _e={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};y(_e)}j(te)},rs=te=>{O(te),R(!0)},is=async()=>{if(H!==null){const te=a.filter((U,Se)=>Se!==H),{shouldProceed:_e}=await ut(te,"manual");_e&&(l(te),$e({title:"删除成功",description:"提供商已从列表中移除"}))}R(!1),O(null)},ys=te=>{const _e=new Set(je);_e.has(te)?_e.delete(te):_e.add(te),ce(_e)},rt=()=>{if(je.size===Qe.length)ce(new Set);else{const te=Qe.map((_e,U)=>a.findIndex(Se=>Se===Qe[U]));ce(new Set(te))}},jt=()=>{if(je.size===0){$e({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}pe(!0)},Ae=async()=>{const te=a.filter((U,Se)=>!je.has(Se)),{shouldProceed:_e}=await ut(te,"manual");_e&&(l(te),ce(new Set),$e({title:"批量删除成功",description:`已删除 ${je.size} 个提供商`})),pe(!1)},Qe=u.useMemo(()=>{if(!me)return a;const te=me.toLowerCase();return a.filter(_e=>_e.name.toLowerCase().includes(te)||_e.base_url.toLowerCase().includes(te)||_e.client_type.toLowerCase().includes(te))},[a,me]),{totalPages:As,paginatedProviders:mt}=u.useMemo(()=>{const te=Math.ceil(Qe.length/B),_e=Qe.slice((D-1)*B,D*B);return{totalPages:te,paginatedProviders:_e}},[Qe,D,B]),Ht=u.useCallback(()=>{const te=parseInt(Y);te>=1&&te<=As&&(Q(te),we(""))},[Y,As]),ca=async te=>{K(_e=>new Set(_e).add(te));try{const _e=await yS(te);se(U=>new Map(U).set(te,_e)),_e.network_ok?_e.api_key_valid===!0?$e({title:"连接正常",description:`${te} 网络连接正常,API Key 有效 (${_e.latency_ms}ms)`}):_e.api_key_valid===!1?$e({title:"连接正常但 Key 无效",description:`${te} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):$e({title:"网络连接正常",description:`${te} 可以访问 (${_e.latency_ms}ms)`}):$e({title:"连接失败",description:_e.error||"无法连接到提供商",variant:"destructive"})}catch(_e){$e({title:"测试失败",description:_e.message,variant:"destructive"})}finally{K(_e=>{const U=new Set(_e);return U.delete(te),U})}},Fa=async()=>{for(const te of a)await ca(te.name)},Xt=te=>{const _e=A.has(te),U=Re.get(te);return _e?e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),"测试中"]}):U?U.network_ok?U.api_key_valid===!0?e.jsxs(Ce,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(st,{className:"h-3 w-3"}),"正常"]}):U.api_key_valid===!1?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ut,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Ce,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(st,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"离线"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[je.size>0&&e.jsxs(_,{onClick:jt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",je.size,")"]}),e.jsxs(_,{onClick:Fa,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:a.length===0||A.size>0,children:[e.jsx(sl,{className:"mr-2 h-4 w-4"}),A.size>0?`测试中 (${A.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>Je(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(Xs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:He,disabled:d||h||!p||De,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(gc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),d?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:d||h||De,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),De?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认重启麦麦?"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:p?ia:Ct,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(ts,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索提供商名称、URL 或类型...",value:me,onChange:te=>Ne(te.target.value),className:"pl-9"})]}),me&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Qe.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Qe.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:me?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):mt.map((te,_e)=>{const U=a.findIndex(Se=>Se===te);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:te.name}),Xt(te.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:te.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ca(te.name),disabled:A.has(te.name),title:"测试连接",children:A.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(sl,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>Je(te,U),children:e.jsx(Zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>rs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(os,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),e.jsx("p",{className:"font-medium",children:te.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:te.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:te.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:te.retry_interval})]})]})]},_e)})}),e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:je.size===Qe.length&&Qe.length>0,onCheckedChange:rt})}),e.jsx(ns,{children:"状态"}),e.jsx(ns,{children:"名称"}),e.jsx(ns,{children:"基础URL"}),e.jsx(ns,{children:"客户端类型"}),e.jsx(ns,{className:"text-right",children:"最大重试"}),e.jsx(ns,{className:"text-right",children:"超时(秒)"}),e.jsx(ns,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(ns,{className:"text-right",children:"操作"})]})}),e.jsx(Gl,{children:mt.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:9,className:"text-center text-muted-foreground py-8",children:me?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):mt.map((te,_e)=>{const U=a.findIndex(Se=>Se===te);return e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:je.has(U),onCheckedChange:()=>ys(U)})}),e.jsx(Ze,{children:Xt(te.name)||e.jsx(Ce,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ze,{className:"font-medium",children:te.name}),e.jsx(Ze,{className:"max-w-xs truncate",title:te.base_url,children:te.base_url}),e.jsx(Ze,{children:te.client_type}),e.jsx(Ze,{className:"text-right",children:te.max_retry}),e.jsx(Ze,{className:"text-right",children:te.timeout}),e.jsx(Ze,{className:"text-right",children:te.retry_interval}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ca(te.name),disabled:A.has(te.name),title:"测试连接",children:A.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(sl,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Je(te,U),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>rs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},_e)})})]})})}),Qe.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:B.toString(),onValueChange:te=>{ue(parseInt(te)),Q(1),ce(new Set)},children:[e.jsx(Be,{id:"page-size-provider",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(D-1)*B+1," 到"," ",Math.min(D*B,Qe.length)," 条,共 ",Qe.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(1),disabled:D===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>Math.max(1,te-1)),disabled:D===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:Y,onChange:te=>we(te.target.value),onKeyDown:te=>te.key==="Enter"&&Ht(),placeholder:D.toString(),className:"w-16 h-8 text-center",min:1,max:As}),e.jsx(_,{variant:"outline",size:"sm",onClick:Ht,disabled:!Y,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>te+1),disabled:D>=As,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(As),disabled:D>=As,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Qs,{open:N,onOpenChange:Cs,children:e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:J.isRunning,children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:w!==null?"编辑提供商":"添加提供商"}),e.jsx(at,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:te=>{te.preventDefault(),We()},autoComplete:"off",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"provider-template-select",children:[e.jsx(T,{htmlFor:"template",children:"提供商模板"}),e.jsxs(cl,{open:F,onOpenChange:E,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":F,className:"w-full justify-between",children:[M?Wi.find(te=>te.id===M)?.display_name:"选择提供商模板...",e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(tl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"搜索提供商模板..."}),e.jsx(ts,{className:"h-[300px]",children:e.jsxs(hd,{className:"max-h-none overflow-visible",children:[e.jsx(fd,{children:"未找到匹配的模板"}),e.jsx(uc,{children:Wi.map(te=>e.jsxs(mc,{value:te.display_name,onSelect:()=>Es(te.id),children:[e.jsx(Ot,{className:`mr-2 h-4 w-4 ${M===te.id?"opacity-100":"opacity-0"}`}),te.display_name]},te.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"name",className:G.name?"text-destructive":"",children:"名称 *"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"提供商名称"}),e.jsx("p",{children:"为这个 API 提供商设置一个便于识别的名称,用于在模型配置中引用。"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsx("li",{children:"推荐使用厂商官方名称,如 DeepSeek、OpenAI"}),e.jsx("li",{children:"名称需要唯一,不能与现有提供商重复"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsx(ne,{id:"name",value:b?.name||"",onChange:te=>{y(_e=>_e?{..._e,name:te.target.value}:null),G.name&&$(_e=>({..._e,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:G.name?"border-destructive focus-visible:ring-destructive":""}),G.name&&e.jsx("p",{className:"text-xs text-destructive",children:G.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"base_url",className:G.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API 基础地址"}),e.jsx("p",{children:"提供商的 API 端点基础 URL,通常以 /v1 结尾。"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI 格式:"}),"https://api.openai.com/v1"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"DeepSeek:"}),"https://api.deepseek.com"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"硅基流动:"}),"https://api.siliconflow.cn/v1"]}),e.jsx("li",{children:"选择模板会自动填充正确的 URL"})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx(ne,{id:"base_url",value:b?.base_url||"",onChange:te=>{y(_e=>_e?{..._e,base_url:te.target.value}:null),G.base_url&&$(_e=>({..._e,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:ms,className:`${ms?"bg-muted cursor-not-allowed":""} ${G.base_url?"border-destructive focus-visible:ring-destructive":""}`}),G.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:G.base_url}),ms&&!G.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"api_key",className:G.api_key?"text-destructive":"",children:"API Key *"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API 密钥"}),e.jsx("p",{children:"从提供商平台获取的身份验证密钥。"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:["通常以 ",e.jsx("code",{children:"sk-"})," 开头"]}),e.jsx("li",{children:"请妥善保管,不要泄露给他人"}),e.jsx("li",{children:"可以点击眼睛图标切换显示/隐藏"}),e.jsx("li",{children:"点击复制图标可快速复制密钥"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"api_key",type:X?"text":"password",value:b?.api_key||"",onChange:te=>{y(_e=>_e?{..._e,api_key:te.target.value}:null),G.api_key&&$(_e=>({..._e,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${G.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>L(!X),title:X?"隐藏密钥":"显示密钥",children:X?e.jsx(ic,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:Ms,title:"复制密钥",children:e.jsx(qo,{className:"h-4 w-4"})})]}),G.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:G.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"client_type",children:"客户端类型"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API 客户端类型"}),e.jsx("p",{children:"指定与提供商通信时使用的 API 协议格式。"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI:"}),"兼容 OpenAI API 格式的提供商"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Gemini:"}),"Google Gemini 专用格式"]}),e.jsx("li",{children:"大部分第三方提供商都兼容 OpenAI 格式"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsxs(Pe,{value:b?.client_type||"openai",onValueChange:te=>y(_e=>_e?{..._e,client_type:te}:null),disabled:ms,children:[e.jsx(Be,{id:"client_type",className:ms?"bg-muted cursor-not-allowed":"",children:e.jsx(Fe,{placeholder:"选择客户端类型"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"openai",children:"OpenAI"}),e.jsx(W,{value:"gemini",children:"Gemini"})]})]}),ms&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(Bl,{content:"API 请求失败时的最大重试次数。设置为 0 表示不重试。默认值:2",side:"top",maxWidth:"250px"})]}),e.jsx(ne,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,max_retry:_e}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(Bl,{content:"单次 API 请求的超时时间(秒)。超时后会触发重试或报错。默认值:30 秒",side:"top",maxWidth:"250px"})]}),e.jsx(ne,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,timeout:_e}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(Bl,{content:"两次重试之间的等待时间(秒)。适当的间隔可以避免触发 API 限流。默认值:10 秒",side:"top",maxWidth:"250px"})]}),e.jsx(ne,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,retry_interval:_e}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>j(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(bs,{open:C,onOpenChange:R,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除提供商 "',H!==null?a[H]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:is,children:"删除"})]})]})}),e.jsx(bs,{open:ge,onOpenChange:pe,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认批量删除"}),e.jsxs(gs,{children:["确定要删除选中的 ",je.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:Ae,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(bs,{open:fe.isOpen,onOpenChange:te=>Ee(_e=>({..._e,isOpen:te})),children:e.jsxs(xs,{className:"max-w-2xl",children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除提供商"}),e.jsx(gs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:fe.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",fe.affectedModels.length," 个关联的模型:"]}),e.jsx(ts,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:fe.affectedModels.map((te,_e)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"•"}),e.jsx("span",{className:"ml-2 font-medium",children:te.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",te.model_identifier,")"]})]},_e))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:V,children:"取消"}),e.jsx(js,{onClick:Is,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(nr,{})]})}function nc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Im(a){return a===null?"null":Array.isArray(a)?"array":typeof a=="object"?"object":typeof a=="boolean"?"boolean":typeof a=="number"?"number":"string"}function sx(a){return Object.entries(a).map(([l,r])=>{const c=Im(r),d={id:nc(),key:l,value:r,type:c,expanded:!0};return c==="object"&&r&&typeof r=="object"?d.children=sx(r):c==="array"&&Array.isArray(r)&&(d.children=r.map((m,h)=>{const f=Im(m),p={id:nc(),key:String(h),value:m,type:f,expanded:!0};return f==="object"&&m&&typeof m=="object"?p.children=sx(m):f==="array"&&Array.isArray(m)&&(p.children=m.map((g,N)=>({id:nc(),key:String(N),value:g,type:Im(g),expanded:!0}))),p})),d})}function tx(a){const l={};for(const r of a)r.key.trim()&&(r.type==="object"&&r.children?l[r.key]=tx(r.children):r.type==="array"&&r.children?l[r.key]=r.children.map(c=>c.type==="object"&&c.children?tx(c.children):c.type==="array"&&c.children?c.children.map(d=>d.value):c.value):r.type==="null"?l[r.key]=null:l[r.key]=r.value);return l}function Jg(a,l){switch(l){case"boolean":return a==="true";case"number":{const r=parseFloat(a);return isNaN(r)?0:r}case"null":return null;default:return a}}function nN({node:a,level:l,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m}){const h=a.type==="object"||a.type==="array",f=a.children&&a.children.length>0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 items-center",style:{gridTemplateColumns:h?"32px 1fr 90px 64px":"32px 1fr 1fr 90px 32px",paddingLeft:`${l*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>m(a.id),disabled:!h||!f,children:h&&f?a.expanded?e.jsx(Ba,{className:"h-4 w-4"}):e.jsx(ra,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(ne,{value:a.key,onChange:p=>r(a.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:a.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:a.value===!0,onCheckedChange:p=>r(a.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a.value?"true":"false"})]}):a.type==="null"?e.jsx("div",{className:"flex items-center h-8 px-3 border rounded-md bg-muted text-sm text-muted-foreground",children:"null"}):e.jsx(ne,{type:a.type==="number"?"number":"text",value:a.value,onChange:p=>r(a.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:a.type==="number"?"any":void 0})}),e.jsxs(Pe,{value:a.type,onValueChange:p=>r(a.id,"type",p),children:[e.jsx(Be,{className:"h-8 text-xs",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"string",children:"字符串"}),e.jsx(W,{value:"number",children:"数字"}),e.jsx(W,{value:"boolean",children:"布尔"}),e.jsx(W,{value:"null",children:"Null"}),e.jsx(W,{value:"object",children:"对象"}),e.jsx(W,{value:"array",children:"数组"})]})]}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[h&&e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-primary",onClick:()=>d(a.id),title:"添加子项",children:e.jsx(Xs,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>c(a.id),title:"删除",children:e.jsx(os,{className:"h-4 w-4"})})]})]}),h&&a.expanded&&a.children&&a.children.length>0&&e.jsx("div",{className:"space-y-1",children:a.children.map(p=>e.jsx(nN,{node:p,level:l+1,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m},p.id))})]})}function o4({value:a,onChange:l,placeholder:r="添加参数..."}){const[c,d]=u.useState(()=>sx(a||{})),m=u.useCallback(j=>{d(j),l(tx(j))},[l]),h=u.useCallback(()=>{const j={id:nc(),key:"",value:"",type:"string",expanded:!1};m([...c,j])},[c,m]),f=u.useCallback((j,b,y)=>{const w=z=>z.map(M=>{if(M.id===j)if(b==="type"){const S=y;if(S==="object")return{...M,type:S,value:{},children:[]};if(S==="array")return{...M,type:S,value:[],children:[]};if(S==="null")return{...M,type:S,value:null};{const F=Jg(String(M.value),S);return{...M,type:S,value:F,children:void 0}}}else if(b==="value"){const S=Jg(String(y),M.type);return{...M,value:S}}else return{...M,[b]:String(y)};return M.children?{...M,children:w(M.children)}:M});m(w(c))},[c,m]),p=u.useCallback(j=>{const b=y=>y.filter(w=>w.id!==j).map(w=>w.children?{...w,children:b(w.children)}:w);m(b(c))},[c,m]),g=u.useCallback(j=>{const b=y=>y.map(w=>{if(w.id===j){const z={id:nc(),key:w.type==="array"?String(w.children?.length||0):"",value:"",type:"string",expanded:!0};return{...w,children:[...w.children||[],z]}}return w.children?{...w,children:b(w.children)}:w});m(b(c))},[c,m]),N=u.useCallback(j=>{const b=y=>y.map(w=>w.id===j?{...w,expanded:!w.expanded}:w.children?{...w,children:b(w.children)}:w);d(b(c))},[c]);return e.jsxs("div",{className:"h-full flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.length," 个参数"]}),e.jsxs(_,{type:"button",size:"sm",variant:"outline",onClick:h,className:"h-7 text-xs",children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),"添加参数"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-1",children:c.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:r}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 text-xs text-muted-foreground px-1 sticky top-0 bg-background z-10",style:{gridTemplateColumns:"32px 1fr 1fr 90px 32px"},children:[e.jsx("span",{}),e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),c.map(j=>e.jsx(nN,{node:j,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:N},j.id))]})})]})}function Xg(a){if(!a.trim())return{valid:!0,parsed:{}};try{const l=JSON.parse(a);return typeof l!="object"||l===null||Array.isArray(l)?{valid:!1,error:"必须是一个 JSON 对象 {}"}:{valid:!0,parsed:l}}catch{return{valid:!1,error:"JSON 格式错误"}}}function d4({value:a,onChange:l,className:r,placeholder:c="添加额外参数..."}){const[d,m]=u.useState("list"),h=u.useMemo(()=>Object.keys(a||{}).length>0?JSON.stringify(a,null,2):"",[a]),[f,p]=u.useState(h),[g,N]=u.useState(null);u.useEffect(()=>{p(h)},[h]);const j=u.useMemo(()=>{const w=Xg(f);return w.valid&&w.parsed?{success:!0,data:w.parsed}:{success:!1,data:{}}},[f]),b=u.useCallback(w=>{const z=w;z==="json"&&d==="list"&&(p(Object.keys(a).length>0?JSON.stringify(a,null,2):""),N(null)),m(z)},[d,a]),y=u.useCallback(w=>{p(w);const z=Xg(w);z.valid&&z.parsed?(N(null),l(z.parsed)):N(z.error||"JSON 格式错误")},[l]);return e.jsx("div",{className:P("h-full flex flex-col",r),children:e.jsxs(Jt,{value:d,onValueChange:b,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Gt,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(Xe,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"可视化编辑"}),e.jsx(Xe,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON 编辑"})]}),e.jsx(Ss,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(o4,{value:a,onChange:l,placeholder:c})}),e.jsx(Ss,{value:"json",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),g?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Ut,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:g})]}):f.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(Ot,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(pt,{value:f,onChange:w=>y(w.target.value),placeholder:`{ - "key": "value" -}`,className:P("font-mono text-sm flex-1 resize-none",g&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持任意 JSON 类型(包括嵌套对象和数组)"})]}),e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:j.success&&Object.keys(j.data).length>0?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:JSON.stringify(j.data,null,2)}):j.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})})}function u4({open:a,onOpenChange:l,value:r,onChange:c}){const[d,m]=u.useState(r),h=g=>{g&&m(r),l(g)},f=()=>{c(d),l(!1)},p=()=>{m(r),l(!1)};return e.jsx(Qs,{open:a,onOpenChange:h,children:e.jsxs(Hs,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"编辑额外参数"}),e.jsx(at,{children:"配置模型调用时的额外参数,支持嵌套对象和数组"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(d4,{value:d,onChange:m,placeholder:"添加额外参数(如 thinking、top_p 等)..."})}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:p,children:"取消"}),e.jsx(_,{onClick:f,children:"保存"})]})]})})}const ai="https://maibot-plugin-stats.maibot-webui.workers.dev";async function m4(a){const l=new URLSearchParams;a?.status&&l.set("status",a.status),a?.page&&l.set("page",a.page.toString()),a?.page_size&&l.set("page_size",a.page_size.toString()),a?.search&&l.set("search",a.search),a?.sort_by&&l.set("sort_by",a.sort_by),a?.sort_order&&l.set("sort_order",a.sort_order);const r=await fetch(`${ai}/pack?${l.toString()}`);if(!r.ok)throw new Error(`获取 Pack 列表失败: ${r.status}`);return r.json()}async function x4(a){const l=await fetch(`${ai}/pack/${a}`);if(!l.ok)throw new Error(`获取 Pack 失败: ${l.status}`);const r=await l.json();if(!r.success)throw new Error(r.error||"获取 Pack 失败");return r.pack}async function h4(a){const r=await(await fetch(`${ai}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.error||"创建 Pack 失败");return r}async function f4(a,l){await fetch(`${ai}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})}async function rN(a,l){const c=await(await fetch(`${ai}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function iN(a,l){return(await(await fetch(`${ai}/pack/like/check?pack_id=${a}&user_id=${l}`)).json()).liked||!1}async function p4(a){const l=await ke("/api/webui/config/model");if(!l.ok)throw new Error("获取当前模型配置失败");const r=await l.json(),c=r.config||r;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",a.providers),console.log("Local providers:",c.api_providers);const d={existing_providers:[],new_providers:[],conflicting_models:[]},m=c.api_providers||[];for(const f of a.providers){console.log(` -Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${Pm(f.base_url)}`);const p=m.filter(g=>{const N=Pm(g.base_url),j=Pm(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${N}`),console.log(` Match: ${N===j}`),N===j});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),d.existing_providers.push({pack_provider:f,local_providers:p.map(g=>({name:g.name,base_url:g.base_url}))})):(console.log(" ✗ No match found - will need API key"),d.new_providers.push(f))}const h=c.models||[];console.log(` -=== Model Conflict Detection ===`);for(const f of a.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),d.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` -=== Detection Summary ===`),console.log(`Existing providers: ${d.existing_providers.length}`),console.log(`New providers: ${d.new_providers.length}`),console.log(`Conflicting models: ${d.conflicting_models.length}`),console.log(`=========================== -`),d}async function g4(a,l,r,c){const d=await ke("/api/webui/config/model");if(!d.ok)throw new Error("获取当前模型配置失败");const m=await d.json(),h=m.config||m;if(l.apply_providers){const p=l.selected_providers?a.providers.filter(g=>l.selected_providers.includes(g.name)):a.providers;for(const g of p){if(r[g.name])continue;const N=c[g.name];if(!N)throw new Error(`提供商 "${g.name}" 缺少 API Key`);const j={...g,api_key:N},b=h.api_providers.findIndex(y=>y.name===g.name);b>=0?h.api_providers[b]=j:h.api_providers.push(j)}}if(l.apply_models){const p=l.selected_models?a.models.filter(g=>l.selected_models.includes(g.name)):a.models;for(const g of p){const N=r[g.api_provider]||g.api_provider,j={...g,api_provider:N},b=h.models.findIndex(y=>y.name===g.name);b>=0?h.models[b]=j:h.models.push(j)}}if(l.apply_task_config){const p=l.selected_tasks||Object.keys(a.task_config);for(const g of p){const N=a.task_config[g];if(!N)continue;const j=new Set(l.selected_models||a.models.map(w=>w.name)),b=N.model_list.filter(w=>j.has(w));if(b.length===0)continue;const y={...N,model_list:b};if(l.task_mode==="replace")h.model_task_config[g]=y;else{const w=h.model_task_config[g];if(w){const z=[...new Set([...w.model_list,...b])];h.model_task_config[g]={...w,model_list:z}}else h.model_task_config[g]=y}}}if(!(await ke("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function j4(a){const l=await ke("/api/webui/config/model");if(!l.ok)throw new Error("获取当前模型配置失败");const r=await l.json();if(!r.success||!r.config)throw new Error("获取配置失败");const c=r.config;let d=(c.api_providers||[]).map(g=>({name:g.name,base_url:g.base_url,client_type:g.client_type,max_retry:g.max_retry,timeout:g.timeout,retry_interval:g.retry_interval}));a.selectedProviders&&(d=d.filter(g=>a.selectedProviders.includes(g.name)));let m=c.models||[];a.selectedModels&&(m=m.filter(g=>a.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=a.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:d,models:m,task_config:h}}function Pm(a){try{const l=new URL(a);return`${l.protocol}//${l.host}${l.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return a.toLowerCase().replace(/\/$/,"")}}function cN(){const a="maibot_pack_user_id";let l=localStorage.getItem(a);return l||(l="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(a,l)),l}const v4={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},N4=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function b4({trigger:a}){const[l,r]=u.useState(!1),[c,d]=u.useState(1),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState([]),[j,b]=u.useState([]),[y,w]=u.useState({}),[z,M]=u.useState(new Set),[S,F]=u.useState(new Set),[E,C]=u.useState(new Set),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(""),[Ne,je]=u.useState([]);u.useEffect(()=>{l&&c===1&&ce()},[l,c]);const ce=async()=>{h(!0);try{const G=await j4({name:"",description:"",author:""});N(G.providers),b(G.models),w(G.task_config),M(new Set(G.providers.map($=>$.name))),F(new Set(G.models.map($=>$.name))),C(new Set(Object.keys(G.task_config)))}catch(G){console.error("加载配置失败:",G),aa({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},ge=G=>{const $=new Set(z),A=new Set(S),K=new Set(E);$.has(G)?($.delete(G),j.filter(se=>se.api_provider===G).forEach(se=>A.delete(se.name)),Object.entries(y).forEach(([se,$e])=>{$e.model_list&&($e.model_list.some(J=>A.has(J))||K.delete(se))})):($.add(G),j.filter(se=>se.api_provider===G).forEach(se=>A.add(se.name)),Object.entries(y).forEach(([se,$e])=>{$e.model_list&&$e.model_list.some(J=>{const Z=j.find(Le=>Le.name===J);return Z&&Z.api_provider===G})&&K.add(se)})),M($),F(A),C(K)},pe=G=>{const $=new Set(S),A=new Set(E);$.has(G)?($.delete(G),Object.entries(y).forEach(([K,Re])=>{Re.model_list&&(Re.model_list.some($e=>$.has($e))||A.delete(K))})):($.add(G),Object.entries(y).forEach(([K,Re])=>{Re.model_list&&Re.model_list.includes(G)&&A.add(K)})),F($),C(A)},D=G=>{const $=new Set(E);$.has(G)?$.delete(G):$.add(G),C($)},Q=G=>{Ne.includes(G)?je(Ne.filter($=>$!==G)):Ne.length<5?je([...Ne,G]):aa({title:"最多选择 5 个标签",variant:"destructive"})},B=()=>{z.size===g.length?M(new Set):M(new Set(g.map(G=>G.name)))},ue=()=>{S.size===j.length?F(new Set):F(new Set(j.map(G=>G.name)))},Y=()=>{const G=Object.keys(y);E.size===G.length?C(new Set):C(new Set(G))},we=async()=>{if(!R.trim()){aa({title:"请输入模板名称",variant:"destructive"});return}if(!O.trim()){aa({title:"请输入模板描述",variant:"destructive"});return}if(!L.trim()){aa({title:"请输入作者名称",variant:"destructive"});return}if(z.size===0&&S.size===0&&E.size===0){aa({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const G=g.filter(K=>z.has(K.name)),$=j.filter(K=>S.has(K.name)),A={};for(const[K,Re]of Object.entries(y))E.has(K)&&(A[K]=Re);await h4({name:R.trim(),description:O.trim(),author:L.trim(),tags:Ne,providers:G,models:$,task_config:A}),aa({title:"模板已提交审核,审核通过后将显示在市场中"}),r(!1),fe()}catch(G){console.error("提交失败:",G),aa({title:G instanceof Error?G.message:"提交失败",variant:"destructive"})}finally{p(!1)}},fe=()=>{d(1),H(""),X(""),me(""),je([]),M(new Set),F(new Set),C(new Set)},Ee=2;return e.jsxs(Qs,{open:l,onOpenChange:r,children:[e.jsx(dd,{asChild:!0,children:a||e.jsxs(_,{variant:"outline",children:[e.jsx(mv,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Hs,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(xa,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(at,{children:["步骤 ",c," / ",Ee,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(ts,{className:"h-[calc(85vh-220px)] pr-4",children:m?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在加载当前配置..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"安全提示"}),e.jsxs(ft,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(Jt,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(Hl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[z.size,"/",g.length]})]}),e.jsxs(Xe,{value:"models",children:[e.jsx(Wn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[S.size,"/",j.length]})]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(er,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[E.size,"/",Object.keys(y).length]})]})]}),e.jsx(Ss,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:B,children:z.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(G=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(tt,{id:`provider-${G.name}`,checked:z.has(G.name),onCheckedChange:()=>ge(G.name)}),e.jsxs(T,{htmlFor:`provider-${G.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:G.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:G.base_url})]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:G.client_type})]},G.name))]})}),e.jsx(Ss,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:ue,children:S.size===j.length?"取消全选":"全选"})}),j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):j.map(G=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(tt,{id:`model-${G.name}`,checked:S.has(G.name),onCheckedChange:()=>pe(G.name)}),e.jsxs(T,{htmlFor:`model-${G.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:G.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:G.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:G.api_provider})]},G.name))]})}),e.jsx(Ss,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:E.size===Object.keys(y).length?"取消全选":"全选"})}),Object.keys(y).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(y).map(([G,$])=>e.jsxs("div",{className:"space-y-2 p-2 rounded hover:bg-muted",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:`task-${G}`,checked:E.has(G),onCheckedChange:()=>D(G)}),e.jsx(T,{htmlFor:`task-${G}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:v4[G]||G})}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[$.model_list.length," 个模型"]})]}),$.model_list&&$.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:$.model_list.map(A=>{const K=j.find(se=>se.name===A),Re=S.has(A);return e.jsxs(Ce,{variant:Re?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>pe(A),children:[A,K&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",K.api_provider,")"]})]},A)})})]},G))]})})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Hl,{className:"w-4 h-4"}),z.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Wn,{className:"w-4 h-4"}),S.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(er,{className:"w-4 h-4"}),E.size," 个任务"]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-name",children:"模板名称 *"}),e.jsx(ne,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:R,onChange:G=>H(G.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[R.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(pt,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:O,onChange:G=>X(G.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(ne,{id:"pack-author",placeholder:"你的昵称或 ID",value:L,onChange:G=>me(G.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:N4.map(G=>e.jsxs(Ce,{variant:Ne.includes(G)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>Q(G),children:[Ne.includes(G)&&e.jsx(Ot,{className:"w-3 h-3 mr-1"}),e.jsx(cd,{className:"w-3 h-3 mr-1"}),G]},G))})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"审核说明"}),e.jsx(ft,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(gt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{r(!1),fe()},disabled:f,children:"取消"}),cd(c+1),disabled:m||z.size===0&&S.size===0&&E.size===0,children:"下一步"}):e.jsxs(_,{onClick:we,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function y4({value:a,label:l,onRemove:r}){const{attributes:c,listeners:d,setNodeRef:m,transform:h,transition:f,isDragging:p}=Cv({id:a}),g={transform:Tv.Transform.toString(h),transition:f,opacity:p?.5:1},N=b=>{b.preventDefault(),b.stopPropagation(),r(a)},j=b=>{b.stopPropagation()};return e.jsx("div",{ref:m,style:g,className:P("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Ce,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...d,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(dv,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:l}),e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive cursor-pointer",onClick:N,onPointerDown:j,onMouseDown:b=>b.stopPropagation(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),N(b))},children:e.jsx(Sa,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function w4({options:a,selected:l,onChange:r,placeholder:c="选择选项...",emptyText:d="未找到选项",className:m}){const[h,f]=u.useState(!1),p=vv(Qo(yv,{activationConstraint:{distance:8}}),Qo(bv,{coordinateGetter:Nv})),g=b=>{l.includes(b)?r(l.filter(y=>y!==b)):r([...l,b])},N=b=>{r(l.filter(y=>y!==b))},j=b=>{const{active:y,over:w}=b;if(w&&y.id!==w.id){const z=l.indexOf(y.id),M=l.indexOf(w.id);r(wv(l,z,M))}};return e.jsxs(cl,{open:h,onOpenChange:f,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:P("w-full justify-between min-h-10 h-auto",m),children:[e.jsx(_v,{sensors:p,collisionDetection:Sv,onDragEnd:j,children:e.jsx(kv,{items:l,strategy:p_,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:l.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):l.map(b=>{const y=a.find(w=>w.value===b);return e.jsx(y4,{value:b,label:y?.label||b,onRemove:N},b)})})})}),e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(tl,{className:"w-full p-0",align:"start",children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"搜索...",className:"h-9"}),e.jsxs(hd,{children:[e.jsx(fd,{children:d}),e.jsx(uc,{children:a.map(b=>{const y=l.includes(b.value);return e.jsxs(mc,{value:b.value,onSelect:()=>g(b.value),children:[e.jsx("div",{className:P("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",y?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ot,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:b.label})]},b.value)})})]})]})})]})}const Ul=Bs.memo(function({title:l,description:r,taskConfig:c,modelNames:d,onChange:m,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=N=>{m("model_list",N)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:l}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(T,{children:"模型列表"}),e.jsx(w4,{options:d.map(N=>({label:N,value:N})),selected:c.model_list||[],onChange:g,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!h&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"温度"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const j=parseFloat(N.target.value);!isNaN(j)&&j>=0&&j<=1&&m("temperature",j)},className:"w-20 h-8 text-sm"})]}),e.jsx(el,{value:[c.temperature??.3],onValueChange:N=>m("temperature",N[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"最大 Token"}),e.jsx(ne,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>m("max_tokens",parseInt(N.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(ne,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const j=parseInt(N.target.value);!isNaN(j)&&j>=1&&m("slow_threshold",j)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"模型选择策略"}),e.jsxs(Pe,{value:c.selection_strategy??"balance",onValueChange:N=>m("selection_strategy",N),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择模型选择策略"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"balance",children:"负载均衡(balance)"}),e.jsx(W,{value:"random",children:"随机选择(random)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"负载均衡:优先选择使用次数少的模型。随机选择:完全随机从模型列表中选择"})]})]})]})}),_4=Bs.memo(function({paginatedModels:l,allModels:r,onEdit:c,onDelete:d,isModelUsed:m,searchQuery:h}){return l.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"未找到匹配的模型":"暂无模型配置"}):e.jsx("div",{className:"md:hidden space-y-3",children:l.map((f,p)=>{const g=r.findIndex(j=>j===f),N=m(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(Ce,{variant:N?"default":"secondary",className:N?"bg-green-600 hover:bg-green-700":"",children:N?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:f.model_identifier,children:f.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>d(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),e.jsx("p",{className:"font-medium",children:f.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:f.temperature!=null?f.temperature:e.jsx("span",{className:"text-muted-foreground",children:"默认"})})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",f.price_out,"/M"]})]})]})]},p)})})}),S4=Bs.memo(function({paginatedModels:l,allModels:r,filteredModels:c,selectedModels:d,onEdit:m,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:g,searchQuery:N}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:d.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(ns,{className:"w-24",children:"使用状态"}),e.jsx(ns,{children:"模型名称"}),e.jsx(ns,{children:"模型标识符"}),e.jsx(ns,{children:"提供商"}),e.jsx(ns,{className:"text-center",children:"温度"}),e.jsx(ns,{className:"text-right",children:"输入价格"}),e.jsx(ns,{className:"text-right",children:"输出价格"}),e.jsx(ns,{className:"text-right",children:"操作"})]})}),e.jsx(Gl,{children:l.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"未找到匹配的模型":"暂无模型配置"})}):l.map((j,b)=>{const y=r.findIndex(z=>z===j),w=g(j.name);return e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:d.has(y),onCheckedChange:()=>f(y)})}),e.jsx(Ze,{children:e.jsx(Ce,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Ze,{className:"font-medium",children:j.name}),e.jsx(Ze,{className:"max-w-xs truncate",title:j.model_identifier,children:j.model_identifier}),e.jsx(Ze,{children:j.api_provider}),e.jsx(Ze,{className:"text-center",children:j.temperature!=null?j.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ze,{className:"text-right",children:["¥",j.price_in,"/M"]}),e.jsxs(Ze,{className:"text-right",children:["¥",j.price_out,"/M"]}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>m(j,y),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(y),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},b)})})]})})})}),k4=300*1e3,Zg=new Map,C4=[10,20,50,100],T4=Bs.memo(function({page:l,pageSize:r,totalItems:c,jumpToPage:d,onPageChange:m,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const N=Math.ceil(c/r),j=y=>{h(parseInt(y)),m(1),g?.()},b=y=>{y.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:r.toString(),onValueChange:j,children:[e.jsx(Be,{id:"page-size-model",className:"w-20",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:C4.map(y=>e.jsx(W,{value:y.toString(),children:y},y))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(l-1)*r+1," 到"," ",Math.min(l*r,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(1),disabled:l===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(Math.max(1,l-1)),disabled:l===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:d,onChange:y=>f(y.target.value),onKeyDown:b,placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!d,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(l+1),disabled:l>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(N),disabled:l>=N,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})});function E4(a){const{models:l,taskConfig:r,debounceMs:c=2e3,onSavingChange:d,onUnsavedChange:m}=a,h=u.useRef(null),f=u.useRef(null),p=u.useRef(!0),g=u.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=u.useCallback(y=>{const w={model_identifier:y.model_identifier,name:y.name,api_provider:y.api_provider,price_in:y.price_in??0,price_out:y.price_out??0,force_stream_mode:y.force_stream_mode??!1,extra_params:y.extra_params??{}};return y.temperature!=null&&(w.temperature=y.temperature),y.max_tokens!=null&&(w.max_tokens=y.max_tokens),w},[]),j=u.useCallback(async y=>{try{d?.(!0);const w=y.map(N);await Wm("models",w),m?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),m?.(!0)}finally{d?.(!1)}},[d,m,N]),b=u.useCallback(async y=>{try{d?.(!0),await Wm("model_task_config",y),m?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),m?.(!0)}finally{d?.(!1)}},[d,m]);return u.useEffect(()=>{if(!p.current)return m?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{j(l)},c),()=>{h.current&&clearTimeout(h.current)}},[l,j,c,m]),u.useEffect(()=>{if(!(p.current||!r))return m?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{b(r)},c),()=>{f.current&&clearTimeout(f.current)}},[r,b,c,m]),u.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function M4(a={}){const{onCloseEditDialog:l}=a,r=ha(),{registerTour:c,startTour:d,state:m,goToStep:h}=Ex(),f=u.useRef(m.stepIndex);return u.useEffect(()=>{c(gl,aN)},[c]),u.useEffect(()=>{if(m.activeTourId===gl&&m.isRunning){const g=lN[m.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&r({to:g})}},[m.stepIndex,m.activeTourId,m.isRunning,r]),u.useEffect(()=>{if(m.activeTourId===gl&&m.isRunning){const g=f.current,N=m.stepIndex;g>=12&&g<=17&&N<12&&l?.(),f.current=N}},[m.stepIndex,m.activeTourId,m.isRunning,l]),u.useEffect(()=>{if(m.activeTourId!==gl||!m.isRunning)return;const g=N=>{const j=N.target,b=m.stepIndex;b===2&&j.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):b===9&&j.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):b===11&&j.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):b===17&&j.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):b===18&&j.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[m,h]),{startTour:u.useCallback(()=>{d(gl)},[d]),isRunning:m.isRunning&&m.activeTourId===gl,stepIndex:m.stepIndex}}function A4(a){const{getProviderConfig:l}=a,[r,c]=u.useState([]),[d,m]=u.useState(!1),[h,f]=u.useState(null),[p,g]=u.useState(null),N=u.useCallback(()=>{c([]),f(null),g(null)},[]),j=u.useCallback(async(b,y=!1)=>{const w=l(b);if(!w?.base_url){c([]),g(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){c([]),g(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const z=n4(w.base_url);if(g(z),!z?.modelFetcher){c([]),f(null);return}const M=`${b}:${w.base_url}`,S=Zg.get(M);if(!y&&S&&Date.now()-S.timestampE(!1)}),{clearTimers:V,initialLoadRef:Ke}=E4({models:a,taskConfig:p,onSavingChange:z,onUnsavedChange:S}),He=u.useCallback((ae,oe)=>{if(!ae)return;const qe=new Set(oe.map(Ca=>Ca.name)),Ys=[],Ps=[],vt=[{key:"utils",label:"工具模型"},{key:"tool_use",label:"工具调用模型"},{key:"replyer",label:"回复模型"},{key:"planner",label:"规划器模型"},{key:"vlm",label:"视觉模型"},{key:"voice",label:"语音模型"},{key:"embedding",label:"嵌入模型"},{key:"lpmm_entity_extract",label:"LPMM实体抽取"},{key:"lpmm_rdf_build",label:"LPMM关系构建"}];for(const{key:Ca,label:ll}of vt){const ml=ae[Ca];if(!ml)continue;if(!ml.model_list||ml.model_list.length===0){Ps.push(ll);continue}const rr=ml.model_list.filter(Ql=>!qe.has(Ql));rr.length>0&&Ys.push({taskName:ll,invalidModels:rr})}le(Ys),xe(Ps)},[]),Je=u.useCallback(async()=>{try{j(!0);const ae=await Nn(),oe=ae.models||[];l(oe),f(oe.map(vt=>vt.name));const qe=ae.api_providers||[];c(qe.map(vt=>vt.name)),m(qe);const Ys=ae.model_task_config||null;g(Ys),He(Ys,oe);const Ps=Ys?.embedding?.model_list||[];J.current=[...Ps],S(!1),Ke.current=!1}catch(ae){console.error("加载配置失败:",ae)}finally{j(!1)}},[Ke,He]);u.useEffect(()=>{Je()},[Je]);const Es=u.useCallback(ae=>d.find(oe=>oe.name===ae),[d]),{availableModels:ms,fetchingModels:Ms,modelFetchError:We,matchedTemplate:Cs,fetchModelsForProvider:rs,clearModels:is}=A4({getProviderConfig:Es});u.useEffect(()=>{F&&C?.api_provider&&rs(C.api_provider)},[F,C?.api_provider,rs]);const ys=async()=>{await Ct()},rt=u.useCallback(()=>{if(!p)return;const ae=new Set(a.map(Ys=>Ys.name)),oe={...p},qe=Object.keys(oe);for(const Ys of qe){const Ps=oe[Ys];Ps&&Ps.model_list&&(Ps.model_list=Ps.model_list.filter(vt=>ae.has(vt)))}g(oe),le([]),Ts({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,a,Ts]),jt=ae=>{const oe={model_identifier:ae.model_identifier,name:ae.name,api_provider:ae.api_provider,price_in:ae.price_in??0,price_out:ae.price_out??0,force_stream_mode:ae.force_stream_mode??!1,extra_params:ae.extra_params??{}};return ae.temperature!=null&&(oe.temperature=ae.temperature),ae.max_tokens!=null&&(oe.max_tokens=ae.max_tokens),oe},Ae=async()=>{try{y(!0),V();const ae=await Nn();ae.models=a.map(jt),ae.model_task_config=p,await lc(ae),S(!1),Ts({title:"保存成功",description:"正在重启麦麦..."}),await ys()}catch(ae){console.error("保存配置失败:",ae),Ts({title:"保存失败",description:ae.message,variant:"destructive"}),y(!1)}},Qe=async()=>{try{y(!0),V();const ae=await Nn();ae.models=a.map(jt),ae.model_task_config=p,await lc(ae),S(!1),Ts({title:"保存成功",description:"模型配置已保存"}),await Je()}catch(ae){console.error("保存配置失败:",ae),Ts({title:"保存失败",description:ae.message,variant:"destructive"})}finally{y(!1)}},As=(ae,oe)=>{ds({}),R(ae||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),O(oe),E(!0)},mt=()=>{if(!C)return;const ae={};if(C.name?.trim()?a.some((vt,Ca)=>H!==null&&Ca===H?!1:vt.name.trim().toLowerCase()===C.name.trim().toLowerCase())&&(ae.name="模型名称已存在,请使用其他名称"):ae.name="请输入模型名称",C.api_provider?.trim()||(ae.api_provider="请选择 API 提供商"),C.model_identifier?.trim()||(ae.model_identifier="请输入模型标识符"),Object.keys(ae).length>0){ds(ae);return}ds({});const oe={model_identifier:C.model_identifier,name:C.name,api_provider:C.api_provider,price_in:C.price_in??0,price_out:C.price_out??0,force_stream_mode:C.force_stream_mode??!1,extra_params:C.extra_params??{}};C.temperature!=null&&(oe.temperature=C.temperature),C.max_tokens!=null&&(oe.max_tokens=C.max_tokens);let qe,Ys=null;if(H!==null?(Ys=a[H].name,qe=[...a],qe[H]=oe):qe=[...a,oe],l(qe),f(qe.map(Ps=>Ps.name)),Ys&&Ys!==oe.name&&p){const Ps=vt=>vt.map(Ca=>Ca===Ys?oe.name:Ca);g({...p,utils:{...p.utils,model_list:Ps(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:Ps(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:Ps(p.replyer?.model_list||[])},planner:{...p.planner,model_list:Ps(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:Ps(p.vlm?.model_list||[])},voice:{...p.voice,model_list:Ps(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:Ps(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:Ps(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:Ps(p.lpmm_rdf_build?.model_list||[])}})}E(!1),R(null),O(null),Ts({title:H!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},Ht=ae=>{if(!ae&&C){const oe={...C,price_in:C.price_in??0,price_out:C.price_out??0};R(oe)}E(ae)},ca=ae=>{ce(ae),Ne(!0)},Fa=()=>{if(je!==null){const ae=a.filter((oe,qe)=>qe!==je);l(ae),f(ae.map(oe=>oe.name)),He(p,ae),Ts({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}Ne(!1),ce(null)},Xt=ae=>{const oe=new Set(D);oe.has(ae)?oe.delete(ae):oe.add(ae),Q(oe)},te=()=>{if(D.size===es.length)Q(new Set);else{const ae=es.map((oe,qe)=>a.findIndex(Ys=>Ys===es[qe]));Q(new Set(ae))}},_e=()=>{if(D.size===0){Ts({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},U=()=>{const ae=D.size,oe=a.filter((qe,Ys)=>!D.has(Ys));l(oe),f(oe.map(qe=>qe.name)),He(p,oe),Q(new Set),ue(!1),Ts({title:"批量删除成功",description:`已删除 ${ae} 个模型,配置将在 2 秒后自动保存`})},Se=(ae,oe,qe)=>{if(!p)return;if(ae==="embedding"&&oe==="model_list"&&Array.isArray(qe)){const Ps=J.current,vt=qe;if((Ps.length!==vt.length||Ps.some(ll=>!vt.includes(ll))||vt.some(ll=>!Ps.includes(ll)))&&Ps.length>0){Z.current={field:oe,value:qe},cs(!0);return}}const Ys={...p,[ae]:{...p[ae],[oe]:qe}};g(Ys),He(Ys,a),ae==="embedding"&&oe==="model_list"&&Array.isArray(qe)&&(J.current=[...qe])},as=()=>{if(!p||!Z.current)return;const{field:ae,value:oe}=Z.current,qe={...p,embedding:{...p.embedding,[ae]:oe}};g(qe),He(qe,a),ae==="model_list"&&Array.isArray(oe)&&(J.current=[...oe]),Z.current=null,cs(!1),Ts({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},us=()=>{Z.current=null,cs(!1)},es=a.filter(ae=>{if(!ge)return!0;const oe=ge.toLowerCase();return ae.name.toLowerCase().includes(oe)||ae.model_identifier.toLowerCase().includes(oe)||ae.api_provider.toLowerCase().includes(oe)}),Tt=Math.ceil(es.length/fe),$s=es.slice((Y-1)*fe,Y*fe),pa=()=>{const ae=parseInt(G);ae>=1&&ae<=Tt&&(we(ae),$(""))},oa=ae=>p?[p.utils?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[]].some(qe=>qe.includes(ae)):!1;return N?e.jsx(ts,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(b4,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(mv,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(_,{onClick:Qe,disabled:b||w||!M||ia,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(gc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),b?"保存中...":w?"自动保存中...":M?"保存配置":"已保存"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:b||w||ia,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),ia?"重启中...":M?"保存并重启":"重启麦麦"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认重启麦麦?"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:M?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:M?Ae:ys,children:M?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),Le.length>0&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("strong",{children:"检测到无效的模型引用"}),e.jsx("div",{className:"mt-2 space-y-1",children:Le.map(({taskName:ae,invalidModels:oe})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:ae})," 引用了不存在的模型: ",oe.join(", ")]},ae))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:rt,children:"一键清理"})]})]}),De.length>0&&e.jsxs(ht,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(ft,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[De.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(ht,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:ut,children:[e.jsx(U1,{className:"h-4 w-4 text-primary"}),e.jsxs(ft,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(_,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(Jt,{defaultValue:"models",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Xe,{value:"models",children:"添加模型"}),e.jsx(Xe,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(Ss,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[D.size>0&&e.jsxs(_,{onClick:_e,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",D.size,")"]}),e.jsxs(_,{onClick:()=>As(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(Xs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索模型名称、标识符或提供商...",value:ge,onChange:ae=>pe(ae.target.value),className:"pl-9"})]}),ge&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",es.length," 个结果"]})]}),e.jsx(_4,{paginatedModels:$s,allModels:a,onEdit:As,onDelete:ca,isModelUsed:oa,searchQuery:ge}),e.jsx(S4,{paginatedModels:$s,allModels:a,filteredModels:es,selectedModels:D,onEdit:As,onDelete:ca,onToggleSelection:Xt,onToggleSelectAll:te,isModelUsed:oa,searchQuery:ge}),e.jsx(T4,{page:Y,pageSize:fe,totalItems:es.length,jumpToPage:G,onPageChange:we,onPageSizeChange:Ee,onJumpToPageChange:$,onJumpToPage:pa,onSelectionClear:()=>Q(new Set)})]}),e.jsxs(Ss,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),p&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(Ul,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(ae,oe)=>Se("utils",ae,oe),dataTour:"task-model-select"}),e.jsx(Ul,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(ae,oe)=>Se("tool_use",ae,oe)}),e.jsx(Ul,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(ae,oe)=>Se("replyer",ae,oe)}),e.jsx(Ul,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(ae,oe)=>Se("planner",ae,oe)}),e.jsx(Ul,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(ae,oe)=>Se("vlm",ae,oe),hideTemperature:!0}),e.jsx(Ul,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(ae,oe)=>Se("voice",ae,oe),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Ul,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(ae,oe)=>Se("embedding",ae,oe),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Ul,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(ae,oe)=>Se("lpmm_entity_extract",ae,oe)}),e.jsx(Ul,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(ae,oe)=>Se("lpmm_rdf_build",ae,oe)})]})]})]})]}),e.jsx(Qs,{open:F,onOpenChange:Ht,children:e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Is,children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:H!==null?"编辑模型":"添加模型"}),e.jsx(at,{children:"配置模型的基本信息和参数"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":"model-name-input",children:[e.jsx(T,{htmlFor:"model_name",className:Me.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ne,{id:"model_name",value:C?.name||"",onChange:ae=>{R(oe=>oe?{...oe,name:ae.target.value}:null),Me.name&&ds(oe=>({...oe,name:void 0}))},placeholder:"例如: qwen3-30b",className:Me.name?"border-destructive focus-visible:ring-destructive":""}),Me.name?e.jsx("p",{className:"text-xs text-destructive",children:Me.name}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-provider-select",children:[e.jsx(T,{htmlFor:"api_provider",className:Me.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Pe,{value:C?.api_provider||"",onValueChange:ae=>{R(oe=>oe?{...oe,api_provider:ae}:null),is(),Me.api_provider&&ds(oe=>({...oe,api_provider:void 0}))},children:[e.jsx(Be,{id:"api_provider",className:Me.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Fe,{placeholder:"选择提供商"})}),e.jsx(Ie,{children:r.map(ae=>e.jsx(W,{value:ae,children:ae},ae))})]}),Me.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Me.api_provider})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"model-identifier-input",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"model_identifier",className:Me.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Cs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{variant:"secondary",className:"text-xs",children:Cs.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&rs(C.api_provider,!0),disabled:Ms,children:Ms?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):e.jsx(dt,{className:"h-3 w-3"})})]})]}),Cs?.modelFetcher?e.jsxs(cl,{open:Re,onOpenChange:se,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":Re,className:"w-full justify-between font-normal",disabled:Ms||!!We,children:[Ms?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):We?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):C?.model_identifier?e.jsx("span",{className:"truncate",children:C.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(tl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"搜索模型..."}),e.jsx(ts,{className:"h-[300px]",children:e.jsxs(hd,{className:"max-h-none overflow-visible",children:[e.jsx(fd,{children:We?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:We}),!We.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&rs(C.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(uc,{heading:"可用模型",children:ms.map(ae=>e.jsxs(mc,{value:ae.id,onSelect:()=>{R(oe=>oe?{...oe,model_identifier:ae.id}:null),se(!1)},children:[e.jsx(Ot,{className:`mr-2 h-4 w-4 ${C?.model_identifier===ae.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:ae.id}),ae.name!==ae.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:ae.name})]})]},ae.id))}),e.jsx(uc,{heading:"手动输入",children:e.jsxs(mc,{value:"__manual_input__",onSelect:()=>{se(!1)},children:[e.jsx(Zn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ne,{id:"model_identifier",value:C?.model_identifier||"",onChange:ae=>{R(oe=>oe?{...oe,model_identifier:ae.target.value}:null),Me.model_identifier&&ds(oe=>({...oe,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Me.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Me.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Me.model_identifier}),We&&Cs?.modelFetcher&&!Me.model_identifier&&e.jsxs(ht,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{className:"text-xs",children:We})]}),Cs?.modelFetcher&&e.jsx(ne,{value:C?.model_identifier||"",onChange:ae=>{R(oe=>oe?{...oe,model_identifier:ae.target.value}:null),Me.model_identifier&&ds(oe=>({...oe,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${Me.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Me.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:We?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Cs?.modelFetcher?`已识别为 ${Cs.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(ne,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:ae=>{const oe=ae.target.value===""?null:parseFloat(ae.target.value);R(qe=>qe?{...qe,price_in:oe}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ne,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:ae=>{const oe=ae.target.value===""?null:parseFloat(ae.target.value);R(qe=>qe?{...qe,price_out:oe}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"什么是温度(Temperature)?"}),e.jsx("p",{children:"温度控制模型输出的随机性和创造性:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"低温度(0.1-0.3)"}),":更确定、更保守的输出,适合事实性任务"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"中温度(0.5-0.7)"}),":平衡创造性与可控性"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"高温度(0.8-1.0)"}),":更有创意、更多样化的输出"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"极高温度(1.0-2.0)"}),":极度随机,可能产生不可预测的结果"]})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Ge,{id:"enable_model_temperature",checked:C?.temperature!=null,onCheckedChange:ae=>{R(ae?oe=>oe?{...oe,temperature:.5}:null:oe=>oe?{...oe,temperature:null}:null)}})]}),C?.temperature!=null&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(T,{className:"text-sm",children:"温度值"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:C.temperature,onChange:ae=>{const oe=parseFloat(ae.target.value);!isNaN(oe)&&oe>=0&&oe<=2&&R(qe=>qe?{...qe,temperature:oe}:null)},onBlur:ae=>{const oe=parseFloat(ae.target.value);isNaN(oe)||oe<0?R(qe=>qe?{...qe,temperature:0}:null):oe>2&&R(qe=>qe?{...qe,temperature:2}:null)},step:.01,min:0,max:2,className:"w-20 h-8 text-sm text-right tabular-nums"}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(!A),className:"h-8 px-2",title:A?"切换到基础模式 (0-1)":"解锁高级范围 (0-2)",children:A?e.jsx($1,{className:"h-4 w-4"}):e.jsx(Jm,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:"0"}),e.jsx(el,{value:[C.temperature],onValueChange:ae=>R(oe=>oe?{...oe,temperature:ae[0]}:null),min:0,max:A?2:1,step:A?.05:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:A?"2":"1"})]}),A&&e.jsxs(ht,{className:"bg-amber-500/10 border-amber-500/20 [&>svg+div]:translate-y-0",children:[e.jsx(Lt,{className:"h-4 w-4 text-amber-500"}),e.jsx(ft,{className:"text-xs text-amber-600 dark:text-amber-400",children:"高级模式:温度 > 1 会产生更随机、更不可预测的输出,请谨慎使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A?"较低(0.1-0.5)产生确定输出,中等(0.5-1.0)平衡创造性,较高(1.0-2.0)产生极度随机输出":"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"什么是最大 Token?"}),e.jsx("p",{children:"控制模型单次回复的最大长度。1 token ≈ 0.75 个英文单词或 0.5 个中文字符。"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"较小值(512-1024)"}),":简短回复,节省成本"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"中等值(2048-4096)"}),":正常对话长度"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"较大值(8192+)"}),":长文本生成,成本较高"]})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Ge,{id:"enable_model_max_tokens",checked:C?.max_tokens!=null,onCheckedChange:ae=>{R(ae?oe=>oe?{...oe,max_tokens:2048}:null:oe=>oe?{...oe,max_tokens:null}:null)}})]}),C?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"最大 Token 数"}),e.jsx(ne,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:ae=>{const oe=parseInt(ae.target.value);!isNaN(oe)&&oe>=1&&R(qe=>qe?{...qe,max_tokens:oe}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"force_stream_mode",checked:C?.force_stream_mode||!1,onCheckedChange:ae=>R(oe=>oe?{...oe,force_stream_mode:ae}:null)}),e.jsx(T,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"额外参数"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"flex-1 justify-start h-9",onClick:()=>L(!0),children:[e.jsx(Sn,{className:"h-4 w-4 mr-2"}),Object.keys(C?.extra_params||{}).length>0?e.jsxs("span",{children:["已配置 ",Object.keys(C?.extra_params||{}).length," 个参数"]}):e.jsx("span",{className:"text-muted-foreground",children:"未配置额外参数"})]})}),Object.keys(C?.extra_params||{}).length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:[Object.keys(C?.extra_params||{}).slice(0,3).map(ae=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:ae})},ae)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:mt,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(bs,{open:me,onOpenChange:Ne,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除模型 "',je!==null?a[je]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:Fa,children:"删除"})]})]})}),e.jsx(bs,{open:B,onOpenChange:ue,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认批量删除"}),e.jsxs(gs,{children:["确定要删除选中的 ",D.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(bs,{open:$e,onOpenChange:cs,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(gs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-foreground",children:"注意:"}),"更换嵌入模型可能会影响知识库的匹配精度!"]}),e.jsxs("ul",{className:"space-y-2 ml-4 list-disc text-muted-foreground",children:[e.jsx("li",{children:"不同的嵌入模型会产生不同的向量表示"}),e.jsx("li",{children:"这可能导致现有知识库的检索结果不准确"}),e.jsx("li",{children:"建议更换嵌入模型后重新生成所有知识库的向量"})]}),e.jsx("p",{className:"text-foreground font-medium",children:"确定要更换嵌入模型吗?"})]})})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:us,children:"取消"}),e.jsx(js,{onClick:as,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(u4,{open:X,onOpenChange:L,value:C?.extra_params||{},onChange:ae=>R(oe=>oe?{...oe,extra_params:ae}:null)}),e.jsx(nr,{})]})})}const xc=Mj,hc=Aw,fc=zw,pd="/api/webui/config";async function D4(){const l=await(await ke(`${pd}/adapter-config/path`)).json();return!l.success||!l.path?null:{path:l.path,lastModified:l.lastModified}}async function Wg(a){const r=await(await ke(`${pd}/adapter-config/path`,{method:"POST",headers:Zs(),body:JSON.stringify({path:a})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function ej(a){const r=await(await ke(`${pd}/adapter-config?path=${encodeURIComponent(a)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function sj(a,l){const c=await(await ke(`${pd}/adapter-config`,{method:"POST",headers:Zs(),body:JSON.stringify({path:a,content:l})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const kt={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},forward:{image_threshold:30},debug:{level:"INFO"}},Fm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:xa},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:B1}};function Hm(a){try{const l=_x(a);return{inner:{...kt.inner,...l.inner},nickname:{...kt.nickname,...l.nickname},napcat_server:{...kt.napcat_server,...l.napcat_server},maibot_server:{...kt.maibot_server,...l.maibot_server},chat:{...kt.chat,...l.chat},voice:{...kt.voice,...l.voice},forward:{...kt.forward,...l.forward},debug:{...kt.debug,...l.debug}}}catch(l){throw console.error("TOML 解析失败:",l),new Error(`无法解析 TOML 文件: ${l instanceof Error?l.message:"未知错误"}`)}}function qm(a){try{const l=(d,m)=>d===""||d===null||d===void 0?m:d,r={inner:{version:l(a.inner.version,kt.inner.version)},nickname:{nickname:l(a.nickname.nickname,kt.nickname.nickname)},napcat_server:{host:l(a.napcat_server.host,kt.napcat_server.host),port:l(a.napcat_server.port||0,kt.napcat_server.port),token:l(a.napcat_server.token,kt.napcat_server.token),heartbeat_interval:l(a.napcat_server.heartbeat_interval||0,kt.napcat_server.heartbeat_interval)},maibot_server:{host:l(a.maibot_server.host,kt.maibot_server.host),port:l(a.maibot_server.port||0,kt.maibot_server.port)},chat:{group_list_type:l(a.chat.group_list_type,kt.chat.group_list_type),group_list:a.chat.group_list||[],private_list_type:l(a.chat.private_list_type,kt.chat.private_list_type),private_list:a.chat.private_list||[],ban_user_id:a.chat.ban_user_id||[],ban_qq_bot:a.chat.ban_qq_bot??kt.chat.ban_qq_bot,enable_poke:a.chat.enable_poke??kt.chat.enable_poke},voice:{use_tts:a.voice.use_tts??kt.voice.use_tts},forward:{image_threshold:l(a.forward.image_threshold||0,kt.forward.image_threshold)},debug:{level:l(a.debug.level,kt.debug.level)}};let c=GS(r);return c=O4(c),c}catch(l){throw console.error("TOML 生成失败:",l),new Error(`无法生成 TOML 文件: ${l instanceof Error?l.message:"未知错误"}`)}}function O4(a){const l=a.split(` -`),r=[];for(let c=0;c"|?*\x00-\x1F]/.test(a)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function L4(){const[a,l]=u.useState("upload"),[r,c]=u.useState(null),[d,m]=u.useState(""),[h,f]=u.useState(""),[p,g]=u.useState("oneclick"),[N,j]=u.useState(""),[b,y]=u.useState(!1),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(!1),X=u.useRef(null),{toast:L}=nt(),me=u.useRef(null),Ne=A=>{if(f(A),A.trim()){const K=Vm(A);j(K.error)}else j("")},je=u.useCallback(async A=>{const K=Fm[A];z(!0);try{const Re=await ej(K.path),se=Hm(Re);c(se),g(A),f(K.path),await Wg(K.path),L({title:"加载成功",description:`已从${K.name}预设加载配置`})}catch(Re){console.error("加载预设配置失败:",Re),L({title:"加载失败",description:Re instanceof Error?Re.message:"无法读取预设配置文件",variant:"destructive"})}finally{z(!1)}},[L]),ce=u.useCallback(async A=>{const K=Vm(A);if(!K.valid){j(K.error),L({title:"路径无效",description:K.error,variant:"destructive"});return}j(""),z(!0);try{const Re=await ej(A),se=Hm(Re);c(se),f(A),await Wg(A),L({title:"加载成功",description:"已从配置文件加载"})}catch(Re){console.error("加载配置失败:",Re),L({title:"加载失败",description:Re instanceof Error?Re.message:"无法读取配置文件",variant:"destructive"})}finally{z(!1)}},[L]);u.useEffect(()=>{(async()=>{try{const K=await D4();if(K&&K.path){f(K.path);const Re=Object.entries(Fm).find(([,se])=>se.path===K.path);Re?(l("preset"),g(Re[0]),await je(Re[0])):(l("path"),await ce(K.path))}}catch(K){console.error("加载保存的路径失败:",K)}})()},[ce,je]);const ge=u.useCallback(A=>{a!=="path"&&a!=="preset"||!h||(me.current&&clearTimeout(me.current),me.current=setTimeout(async()=>{y(!0);try{const K=qm(A);await sj(h,K),L({title:"自动保存成功",description:"配置已保存到文件"})}catch(K){console.error("自动保存失败:",K),L({title:"自动保存失败",description:K instanceof Error?K.message:"保存配置失败",variant:"destructive"})}finally{y(!1)}},1e3))},[a,h,L]),pe=async()=>{if(!r||!h)return;const A=Vm(h);if(!A.valid){L({title:"保存失败",description:A.error,variant:"destructive"});return}y(!0);try{const K=qm(r);await sj(h,K),L({title:"保存成功",description:"配置已保存到文件"})}catch(K){console.error("保存失败:",K),L({title:"保存失败",description:K instanceof Error?K.message:"保存配置失败",variant:"destructive"})}finally{y(!1)}},D=async()=>{h&&await ce(h)},Q=A=>{if(A!==a){if(r){R(A),S(!0);return}B(A)}},B=A=>{c(null),m(""),j(""),l(A),A==="preset"&&je("oneclick"),L({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[A]})},ue=()=>{C&&(B(C),R(null)),S(!1)},Y=()=>{if(r){E(!0);return}we()},we=()=>{f(""),c(null),j(""),L({title:"已清空",description:"路径和配置已清空"})},fe=()=>{we(),E(!1)},Ee=A=>{const K=A.target.files?.[0];if(!K)return;const Re=new FileReader;Re.onload=se=>{try{const $e=se.target?.result,cs=Hm($e);c(cs),m(K.name),L({title:"上传成功",description:`已加载配置文件:${K.name}`})}catch($e){console.error("解析配置文件失败:",$e),L({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Re.readAsText(K)},G=()=>{if(!r)return;const A=qm(r),K=new Blob([A],{type:"text/plain;charset=utf-8"}),Re=URL.createObjectURL(K),se=document.createElement("a");se.href=Re,se.download=d||"config.toml",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(Re),L({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},$=()=>{c(JSON.parse(JSON.stringify(kt))),m("config.toml"),L({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsx(xc,{open:H,onOpenChange:O,children:e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"工作模式"}),e.jsx(Ns,{children:"选择配置文件的管理方式"})]}),e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Ba,{className:`h-4 w-4 transition-transform duration-200 ${H?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(fc,{children:e.jsxs(ze,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(xa,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(cc,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(I1,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),a==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(T,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Fm).map(([A,K])=>{const Re=K.icon,se=p===A;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${se?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(A),je(A)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:K.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:K.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:K.path})]})]})},A)})})]}),a==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ne,{id:"config-path",value:h,onChange:A=>Ne(A.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${N?"border-destructive":""}`}),N&&e.jsx("p",{className:"text-xs text-destructive",children:N})]}),e.jsx(_,{onClick:()=>ce(h),disabled:w||!h||!!N,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"加载配置"}),e.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"路径格式说明"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})})]})}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{children:a==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",b&&" (正在保存...)"]}):a==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",b&&" (正在保存...)"]})})]}),a==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:X,type:"file",accept:".toml",className:"hidden",onChange:Ee}),e.jsxs(_,{onClick:()=>X.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(cc,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:$,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),a==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:G,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(na,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(a==="preset"||a==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:pe,size:"sm",disabled:b||!!N,className:"w-full sm:w-auto",children:[e.jsx(gc,{className:"mr-2 h-4 w-4"}),b?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:D,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(dt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),a==="path"&&e.jsxs(_,{onClick:Y,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(Jt,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(Gt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Xe,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(Xe,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),e.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),e.jsxs(Xe,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),e.jsx("span",{className:"sm:hidden",children:"聊天"})]}),e.jsxs(Xe,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"语音与转发"}),e.jsx("span",{className:"sm:hidden",children:"语音"})]}),e.jsx(Xe,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(Ss,{value:"napcat",className:"space-y-4",children:e.jsx(U4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"maibot",className:"space-y-4",children:e.jsx($4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"chat",className:"space-y-4",children:e.jsx(B4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"voice",className:"space-y-4",children:e.jsx(I4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"debug",className:"space-y-4",children:e.jsx(P4,{config:r,onChange:A=>{c(A),ge(A)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Ua,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:a==="preset"?"请选择预设的部署方式":a==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(bs,{open:M,onOpenChange:S,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认切换模式"}),e.jsxs(gs,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>{S(!1),R(null)},children:"取消"}),e.jsx(js,{onClick:ue,children:"确认切换"})]})]})}),e.jsx(bs,{open:F,onOpenChange:E,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认清空路径"}),e.jsxs(gs,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>E(!1),children:"取消"}),e.jsx(js,{onClick:fe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function U4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ne,{id:"napcat-host",value:a.napcat_server.host,onChange:r=>l({...a,napcat_server:{...a.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ne,{id:"napcat-port",type:"number",value:a.napcat_server.port||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(ne,{id:"napcat-token",type:"password",value:a.napcat_server.token,onChange:r=>l({...a,napcat_server:{...a.napcat_server,token:r.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(ne,{id:"napcat-heartbeat",type:"number",value:a.napcat_server.heartbeat_interval||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function $4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ne,{id:"maibot-host",value:a.maibot_server.host,onChange:r=>l({...a,maibot_server:{...a.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ne,{id:"maibot-port",type:"number",value:a.maibot_server.port||"",onChange:r=>l({...a,maibot_server:{...a.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function B4({config:a,onChange:l}){const r=m=>{const h={...a};m==="group"?h.chat.group_list=[...h.chat.group_list,0]:m==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],l(h)},c=(m,h)=>{const f={...a};m==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):m==="private"?f.chat.private_list=f.chat.private_list.filter((p,g)=>g!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,g)=>g!==h),l(f)},d=(m,h,f)=>{const p={...a};m==="group"?p.chat.group_list[h]=f:m==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,l(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Pe,{value:a.chat.group_list_type,onValueChange:m=>l({...a,chat:{...a.chat,group_list_type:m}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(W,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(_,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),a.chat.group_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除群号 ",m," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),a.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Pe,{value:a.chat.private_list_type,onValueChange:m=>l({...a,chat:{...a.chat,private_list_type:m}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(W,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(_,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),a.chat.private_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要删除用户 ",m," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),a.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(_,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),a.chat.ban_user_id.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:["确定要从全局禁止名单中删除用户 ",m," 吗?此操作无法撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),a.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Ge,{checked:a.chat.ban_qq_bot,onCheckedChange:m=>l({...a,chat:{...a.chat,ban_qq_bot:m}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Ge,{checked:a.chat.enable_poke,onCheckedChange:m=>l({...a,chat:{...a.chat,enable_poke:m}})})]})]})]})})}function I4({config:a,onChange:l}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Ge,{checked:a.voice.use_tts,onCheckedChange:r=>l({...a,voice:{...a.voice,use_tts:r}})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"转发消息处理设置"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"image-threshold",className:"text-sm md:text-base",children:"图片数量阈值"}),e.jsx(ne,{id:"image-threshold",type:"number",value:a.forward.image_threshold||"",onChange:r=>l({...a,forward:{...a.forward,image_threshold:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"转发消息中图片数量超过此值时使用占位符(避免麦麦VLM处理卡死)"})]})]})]})}function P4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Pe,{value:a.debug.level,onValueChange:r=>l({...a,debug:{level:r}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(W,{value:"INFO",children:"INFO(信息)"}),e.jsx(W,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(W,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const F4=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spellCheck","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],H4=/^(aria-|data-)/,oN=a=>Object.fromEntries(Object.entries(a).filter(([l])=>H4.test(l)||F4.includes(l)));function q4(a,l){const r=oN(a);return Object.keys(a).some(c=>!Object.hasOwn(r,c)&&a[c]!==l[c])}class V4 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(l){if(l.uppy!==this.props.uppy)this.uninstallPlugin(l),this.installPlugin();else if(q4(this.props,l)){const{uppy:r,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:l,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};l.use(v_,r),this.plugin=l.getPlugin(r.id)}uninstallPlugin(l=this.props){const{uppy:r}=l;r.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:l=>{this.container=l},...oN(this.props)})}}function G4({src:a,alt:l="表情包",className:r,maxRetries:c=5,retryInterval:d=1500}){const[m,h]=u.useState("loading"),[f,p]=u.useState(0),[g,N]=u.useState(null),[j,b]=u.useState(a);a!==j&&(h("loading"),p(0),N(null),b(a));const y=u.useCallback(async()=>{try{const w=await fetch(a,{credentials:"include"});if(w.status===202){h("generating"),f{p(S=>S+1)},d):h("error");return}if(!w.ok){h("error");return}const z=await w.blob(),M=URL.createObjectURL(z);N(M),h("loaded")}catch(w){console.error("加载缩略图失败:",w),h("error")}},[a,f,c,d]);return u.useEffect(()=>{y()},[y]),u.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),m==="loading"||m==="generating"?e.jsx(ks,{className:P("w-full h-full",r)}):m==="error"||!g?e.jsx("div",{className:P("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(xx,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:l,className:P("w-full h-full object-contain",r)})}function K4({children:a,className:l}){return e.jsx(bx,{content:a,className:l})}const al="/api/webui/emoji";async function Q4(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_registered!==void 0&&l.append("is_registered",a.is_registered.toString()),a.is_banned!==void 0&&l.append("is_banned",a.is_banned.toString()),a.format&&l.append("format",a.format),a.sort_by&&l.append("sort_by",a.sort_by),a.sort_order&&l.append("sort_order",a.sort_order);const r=await ke(`${al}/list?${l}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function Y4(a){const l=await ke(`${al}/${a}`,{});if(!l.ok)throw new Error(`获取表情包详情失败: ${l.statusText}`);return l.json()}async function J4(a,l){const r=await ke(`${al}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function X4(a){const l=await ke(`${al}/${a}`,{method:"DELETE"});if(!l.ok)throw new Error(`删除表情包失败: ${l.statusText}`);return l.json()}async function Z4(){const a=await ke(`${al}/stats/summary`,{});if(!a.ok)throw new Error(`获取统计数据失败: ${a.statusText}`);return a.json()}async function W4(a){const l=await ke(`${al}/${a}/register`,{method:"POST"});if(!l.ok)throw new Error(`注册表情包失败: ${l.statusText}`);return l.json()}async function ek(a){const l=await ke(`${al}/${a}/ban`,{method:"POST"});if(!l.ok)throw new Error(`封禁表情包失败: ${l.statusText}`);return l.json()}function sk(a,l=!1){return l?`${al}/${a}/thumbnail?original=true`:`${al}/${a}/thumbnail`}function tk(a){return`${al}/${a}/thumbnail?original=true`}async function ak(a){const l=await ke(`${al}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除失败")}return l.json()}function lk(){return`${al}/upload`}function nk(){const[a,l]=u.useState([]),[r,c]=u.useState(null),[d,m]=u.useState(!1),[h,f]=u.useState(1),[p,g]=u.useState(0),[N,j]=u.useState(20),[b,y]=u.useState("all"),[w,z]=u.useState("all"),[M,S]=u.useState("all"),[F,E]=u.useState("usage_count"),[C,R]=u.useState("desc"),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(!1),[je,ce]=u.useState(!1),[ge,pe]=u.useState(new Set),[D,Q]=u.useState(!1),[B,ue]=u.useState(""),[Y,we]=u.useState("medium"),[fe,Ee]=u.useState(!1),{toast:G}=nt(),$=u.useCallback(async()=>{try{m(!0);const xe=await Q4({page:h,page_size:N,is_registered:b==="all"?void 0:b==="registered",is_banned:w==="all"?void 0:w==="banned",format:M==="all"?void 0:M,sort_by:F,sort_order:C});l(xe.data),g(xe.total)}catch(xe){const Me=xe instanceof Error?xe.message:"加载表情包列表失败";G({title:"错误",description:Me,variant:"destructive"})}finally{m(!1)}},[h,N,b,w,M,F,C,G]),A=async()=>{try{const xe=await Z4();c(xe.data)}catch(xe){console.error("加载统计数据失败:",xe)}};u.useEffect(()=>{$()},[$]),u.useEffect(()=>{A()},[]);const K=async xe=>{try{const Me=await Y4(xe.id);O(Me.data),L(!0)}catch(Me){const ds=Me instanceof Error?Me.message:"加载详情失败";G({title:"错误",description:ds,variant:"destructive"})}},Re=xe=>{O(xe),Ne(!0)},se=xe=>{O(xe),ce(!0)},$e=async()=>{if(H)try{await X4(H.id),G({title:"成功",description:"表情包已删除"}),ce(!1),O(null),$(),A()}catch(xe){const Me=xe instanceof Error?xe.message:"删除失败";G({title:"错误",description:Me,variant:"destructive"})}},cs=async xe=>{try{await W4(xe.id),G({title:"成功",description:"表情包已注册"}),$(),A()}catch(Me){const ds=Me instanceof Error?Me.message:"注册失败";G({title:"错误",description:ds,variant:"destructive"})}},J=async xe=>{try{await ek(xe.id),G({title:"成功",description:"表情包已封禁"}),$(),A()}catch(Me){const ds=Me instanceof Error?Me.message:"封禁失败";G({title:"错误",description:ds,variant:"destructive"})}},Z=xe=>{const Me=new Set(ge);Me.has(xe)?Me.delete(xe):Me.add(xe),pe(Me)},Le=async()=>{try{const xe=await ak(Array.from(ge));G({title:"批量删除完成",description:xe.message}),pe(new Set),Q(!1),$(),A()}catch(xe){G({title:"批量删除失败",description:xe instanceof Error?xe.message:"批量删除失败",variant:"destructive"})}},le=()=>{const xe=parseInt(B),Me=Math.ceil(p/N);xe>=1&&xe<=Me?(f(xe),ue("")):G({title:"无效的页码",description:`请输入1-${Me}之间的页码`,variant:"destructive"})},De=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),e.jsxs(_,{onClick:()=>Ee(!0),className:"gap-2",children:[e.jsx(cc,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"总数"}),e.jsx(Ue,{className:"text-2xl",children:r.total})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"已注册"}),e.jsx(Ue,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"已封禁"}),e.jsx(Ue,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"未注册"}),e.jsx(Ue,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx(Po,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(ze,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"排序方式"}),e.jsxs(Pe,{value:`${F}-${C}`,onValueChange:xe=>{const[Me,ds]=xe.split("-");E(Me),R(ds),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(W,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(W,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(W,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(W,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(W,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(W,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(W,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"注册状态"}),e.jsxs(Pe,{value:b,onValueChange:xe=>{y(xe),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),e.jsx(W,{value:"registered",children:"已注册"}),e.jsx(W,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"封禁状态"}),e.jsxs(Pe,{value:w,onValueChange:xe=>{z(xe),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),e.jsx(W,{value:"banned",children:"已封禁"}),e.jsx(W,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"格式"}),e.jsxs(Pe,{value:M,onValueChange:xe=>{S(xe),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),De.map(xe=>e.jsxs(W,{value:xe,children:[xe.toUpperCase()," (",r?.formats[xe],")"]},xe))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[ge.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",ge.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Pe,{value:Y,onValueChange:xe=>we(xe),children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"small",children:"小"}),e.jsx(W,{value:"medium",children:"中"}),e.jsx(W,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:N.toString(),onValueChange:xe=>{j(parseInt(xe)),f(1),pe(new Set)},children:[e.jsx(Be,{id:"emoji-page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"40",children:"40"}),e.jsx(W,{value:"60",children:"60"}),e.jsx(W,{value:"100",children:"100"})]})]}),ge.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>pe(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>Q(!0),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:$,disabled:d,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"表情包列表"}),e.jsxs(Ns,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(ze,{children:[a.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${Y==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":Y==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:a.map(xe=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${ge.has(xe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>Z(xe.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ge.has(xe.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${ge.has(xe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ge.has(xe.id)&&e.jsx(st,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[xe.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),xe.is_banned&&e.jsx(Ce,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${Y==="small"?"p-1":Y==="medium"?"p-2":"p-3"}`,children:e.jsx(G4,{src:sk(xe.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${Y==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ce,{variant:"outline",className:"text-[10px] px-1 py-0",children:xe.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[xe.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${Y==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),Re(xe)},title:"编辑",children:e.jsx(sr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),K(xe)},title:"详情",children:e.jsx(Yt,{className:"h-3 w-3"})}),!xe.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Me=>{Me.stopPropagation(),cs(xe)},title:"注册",children:e.jsx(st,{className:"h-3 w-3"})}),!xe.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Me=>{Me.stopPropagation(),J(xe)},title:"封禁",children:e.jsx(iv,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Me=>{Me.stopPropagation(),se(xe)},title:"删除",children:e.jsx(os,{className:"h-3 w-3"})})]})]})]},xe.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(h-1)*N+1," 到"," ",Math.min(h*N,p)," 条,共 ",p," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(xe=>Math.max(1,xe-1)),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:B,onChange:xe=>ue(xe.target.value),onKeyDown:xe=>xe.key==="Enter"&&le(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(_,{variant:"outline",size:"sm",onClick:le,disabled:!B,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(xe=>xe+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(rk,{emoji:H,open:X,onOpenChange:L}),e.jsx(ik,{emoji:H,open:me,onOpenChange:Ne,onSuccess:()=>{$(),A()}}),e.jsx(ck,{open:fe,onOpenChange:Ee,onSuccess:()=>{$(),A()}})]})}),e.jsx(bs,{open:D,onOpenChange:Q,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认批量删除"}),e.jsxs(gs,{children:["你确定要删除选中的 ",ge.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:Le,children:"确认删除"})]})]})}),e.jsx(Qs,{open:je,onOpenChange:ce,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"确认删除"}),e.jsx(at,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>ce(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:$e,children:"删除"})]})]})})]})}function rk({emoji:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"表情包详情"})}),e.jsx(ts,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:tk(a.id),alt:a.description||"表情包",className:"w-full h-full object-cover",onError:d=>{const m=d.target;m.style.display="none";const h=m.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:a.id})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",children:a.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.full_path})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"描述"}),a.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(K4,{className:"prose-sm",children:a.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:a.emotion?e.jsx("span",{className:"text-sm",children:a.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[a.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"已注册"}),a.is_banned&&e.jsx(Ce,{variant:"destructive",children:"已封禁"}),!a.is_registered&&!a.is_banned&&e.jsx(Ce,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:a.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.last_used_time)})]})]})})]})})}function ik({emoji:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState(""),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),{toast:b}=nt();u.useEffect(()=>{a&&(m(a.emotion||""),f(a.is_registered),g(a.is_banned))},[a]);const y=async()=>{if(a)try{j(!0);const w=d.split(/[,,]/).map(z=>z.trim()).filter(Boolean).join(",");await J4(a.id,{emotion:w||void 0,is_registered:h,is_banned:p}),b({title:"成功",description:"表情包信息已更新"}),r(!1),c()}catch(w){const z=w instanceof Error?w.message:"保存失败";b({title:"错误",description:z,variant:"destructive"})}finally{j(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"编辑表情包"}),e.jsx(at,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"情绪"}),e.jsx(pt,{value:d,onChange:w=>m(w.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"is_banned",checked:p,onCheckedChange:w=>{w===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:y,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function ck({open:a,onOpenChange:l,onSuccess:r}){const[c,d]=u.useState("select"),[m,h]=u.useState([]),[f,p]=u.useState(null),[g,N]=u.useState(!1),{toast:j}=nt(),b=u.useMemo(()=>new N_({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);u.useEffect(()=>{const H=()=>{const O=b.getFiles();if(O.length===0)return;const X=O.map(L=>({id:L.id,name:L.name,previewUrl:L.preview||URL.createObjectURL(L.data),emotion:"",description:"",isRegistered:!0,file:L.data}));h(X),O.length===1?(p(X[0].id),d("edit-single")):d("edit-multiple")};return b.on("upload",H),()=>{b.off("upload",H)}},[b]),u.useEffect(()=>{a||(b.cancelAll(),d("select"),h([]),p(null),N(!1))},[a,b]);const y=u.useCallback((H,O)=>{h(X=>X.map(L=>L.id===H?{...L,...O}:L))},[]),w=u.useCallback(H=>H.emotion.trim().length>0,[]),z=u.useMemo(()=>m.length>0&&m.every(w),[m,w]),M=u.useMemo(()=>m.find(H=>H.id===f)||null,[m,f]),S=u.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(d("select"),h([]),p(null))},[c]),F=u.useCallback(async()=>{if(!z){j({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let H=0,O=0;try{for(const X of m){const L=new FormData;L.append("file",X.file),L.append("emotion",X.emotion),L.append("description",X.description),L.append("is_registered",X.isRegistered.toString());try{(await ke(lk(),{method:"POST",body:L})).ok?H++:O++}catch{O++}}O===0?(j({title:"上传成功",description:`成功上传 ${H} 个表情包`}),l(!1),r()):(j({title:"部分上传失败",description:`成功 ${H} 个,失败 ${O} 个`,variant:"destructive"}),r())}finally{N(!1)}},[z,m,j,l,r]),E=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(V4,{uppy:b,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),C=()=>{const H=m[0];return H?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx($a,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"编辑表情包信息"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:H.previewUrl,alt:H.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:H.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"single-emotion",value:H.emotion,onChange:O=>y(H.id,{emotion:O.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:H.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"single-description",children:"描述"}),e.jsx(ne,{id:"single-description",value:H.description,onChange:O=>y(H.id,{description:O.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"single-is-registered",checked:H.isRegistered,onCheckedChange:O=>y(H.id,{isRegistered:O===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:F,disabled:!z||g,children:g?"上传中...":"上传"})})]}):null},R=()=>{const H=m.filter(w).length,O=m.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx($a,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",H,"/",O," 已完成)"]})]}),e.jsx(Ce,{variant:z?"default":"secondary",children:z?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ts,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:m.map(X=>{const L=w(X),me=f===X.id;return e.jsxs("div",{onClick:()=>p(X.id),className:` - flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all - ${me?"ring-2 ring-primary":""} - ${L?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} - `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:X.previewUrl,alt:X.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:X.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:X.emotion||"未填写情感标签"})]}),L?e.jsx(st,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},X.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:M.previewUrl,alt:M.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:M.name}),w(M)&&e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"multi-emotion",value:M.emotion,onChange:X=>y(M.id,{emotion:X.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:M.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"multi-description",children:"描述"}),e.jsx(ne,{id:"multi-description",value:M.description,onChange:X=>y(M.id,{description:X.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"multi-is-registered",checked:M.isRegistered,onCheckedChange:X=>y(M.id,{isRegistered:X===!0})}),e.jsx(T,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"上传后立即注册"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(xx,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(gt,{children:e.jsx(_,{onClick:F,disabled:!z||g,children:g?"上传中...":`上传全部 (${O})`})})]})};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(cc,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(at,{children:[c==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",c==="edit-single"&&"请填写表情包的情感标签(必填)和描述",c==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&E(),c==="edit-single"&&C(),c==="edit-multiple"&&R()]})]})})}function ok(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState(null),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(new Set),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,ce]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ge,pe]=u.useState([]),[D,Q]=u.useState(new Map),[B,ue]=u.useState(!1),[Y,we]=u.useState(0),{toast:fe}=nt(),Ee=async()=>{try{c(!0);const le=await a2({page:h,page_size:p,search:N||void 0});l(le.data),m(le.total)}catch(le){fe({title:"加载失败",description:le instanceof Error?le.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},G=async()=>{try{const le=await o2();le?.data&&ce(le.data)}catch(le){console.error("加载统计数据失败:",le)}},$=async()=>{try{const le=await jx();we(le.unchecked)}catch(le){console.error("加载审核统计失败:",le)}},A=async()=>{try{const le=await gx();if(le?.data){pe(le.data);const De=new Map;le.data.forEach(xe=>{De.set(xe.chat_id,xe.chat_name)}),Q(De)}}catch(le){console.error("加载聊天列表失败:",le)}},K=le=>D.get(le)||le;u.useEffect(()=>{Ee(),$(),G(),A()},[h,p,N]);const Re=async le=>{try{const De=await l2(le.id);y(De.data),z(!0)}catch(De){fe({title:"加载详情失败",description:De instanceof Error?De.message:"无法加载表达方式详情",variant:"destructive"})}},se=le=>{y(le),S(!0)},$e=async le=>{try{await i2(le.id),fe({title:"删除成功",description:`已删除表达方式: ${le.situation}`}),R(null),Ee(),G()}catch(De){fe({title:"删除失败",description:De instanceof Error?De.message:"无法删除表达方式",variant:"destructive"})}},cs=le=>{const De=new Set(H);De.has(le)?De.delete(le):De.add(le),O(De)},J=()=>{H.size===a.length&&a.length>0?O(new Set):O(new Set(a.map(le=>le.id)))},Z=async()=>{try{await c2(Array.from(H)),fe({title:"批量删除成功",description:`已删除 ${H.size} 个表达方式`}),O(new Set),L(!1),Ee(),G()}catch(le){fe({title:"批量删除失败",description:le instanceof Error?le.message:"无法批量删除表达方式",variant:"destructive"})}},Le=()=>{const le=parseInt(me),De=Math.ceil(d/p);le>=1&&le<=De?(f(le),Ne("")):fe({title:"无效的页码",description:`请输入1-${De}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Ia,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>ue(!0),className:"gap-2",children:[e.jsx(cv,{className:"h-4 w-4"}),"人工审核",Y>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:Y>99?"99+":Y})]}),e.jsxs(_,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(Xs,{className:"h-4 w-4"}),"新增表达方式"]})]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:je.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:je.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:je.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索情境、风格或上下文...",value:N,onChange:le=>j(le.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:H.size>0&&e.jsxs("span",{children:["已选择 ",H.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:le=>{g(parseInt(le)),f(1),O(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),H.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>O(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:H.size===a.length&&a.length>0,onCheckedChange:J})}),e.jsx(ns,{children:"情境"}),e.jsx(ns,{children:"风格"}),e.jsx(ns,{children:"聊天"}),e.jsx(ns,{className:"text-right",children:"操作"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(le=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:H.has(le.id),onCheckedChange:()=>cs(le.id)})}),e.jsx(Ze,{className:"font-medium max-w-xs truncate",children:le.situation}),e.jsx(Ze,{className:"max-w-xs truncate",children:le.style}),e.jsx(Ze,{className:"max-w-[200px] truncate",title:K(le.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:K(le.chat_id)})}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>se(le),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Re(le),title:"查看详情",children:e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>R(le),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},le.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(le=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:H.has(le.id),onCheckedChange:()=>cs(le.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:le.situation,children:le.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:le.style,children:le.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:K(le.chat_id),style:{wordBreak:"keep-all"},children:K(le.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>se(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Re(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(ua,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>R(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},le.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:me,onChange:le=>Ne(le.target.value),onKeyDown:le=>le.key==="Enter"&&Le(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Le,disabled:!me,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(dk,{expression:b,open:w,onOpenChange:z,chatNameMap:D}),e.jsx(uk,{open:F,onOpenChange:E,chatList:ge,onSuccess:()=>{Ee(),G(),E(!1)}}),e.jsx(mk,{expression:b,open:M,onOpenChange:S,chatList:ge,onSuccess:()=>{Ee(),G(),S(!1)}}),e.jsx(bs,{open:!!C,onOpenChange:()=>R(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除表达方式 "',C?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>C&&$e(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(xk,{open:X,onOpenChange:L,onConfirm:Z,count:H.size}),e.jsx(Pv,{open:B,onOpenChange:le=>{ue(le),le||(Ee(),G(),$())}})]})}function dk({expression:a,open:l,onOpenChange:r,chatNameMap:c}){if(!a)return null;const d=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",m=h=>c.get(h)||h;return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"表达方式详情"}),e.jsx(at,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Yi,{label:"情境",value:a.situation}),e.jsx(Yi,{label:"风格",value:a.style}),e.jsx(Yi,{label:"聊天",value:m(a.chat_id)}),e.jsx(Yi,{icon:Wr,label:"记录ID",value:a.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Yi,{icon:da,label:"创建时间",value:d(a.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-3 block",children:"状态标记"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",a.checked?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.checked?e.jsx(st,{className:"h-5 w-5"}):e.jsx(Vo,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.checked?"已通过审核":"未审核"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",a.rejected?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.rejected?e.jsx(ta,{className:"h-5 w-5"}):e.jsx(Vo,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.rejected?"不会被使用":"正常"})]})]})]})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function Yi({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function uk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({situation:"",style:"",chat_id:""}),[h,f]=u.useState(!1),{toast:p}=nt(),g=async()=>{if(!d.situation||!d.style||!d.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await n2(d),p({title:"创建成功",description:"表达方式已创建"}),m({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"新增表达方式"}),e.jsx(at,{children:"创建新的表达方式记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"situation",value:d.situation,onChange:N=>m({...d,situation:N.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"style",value:d.style,onChange:N=>m({...d,style:N.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:r.map(N=>e.jsx(W,{value:N.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[N.chat_name,N.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},N.chat_id))})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function mk({expression:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=nt();u.useEffect(()=>{a&&h({situation:a.situation,style:a.style,chat_id:a.chat_id,checked:a.checked,rejected:a.rejected})},[a]);const N=async()=>{if(a)try{p(!0),await r2(a.id,m),g({title:"保存成功",description:"表达方式已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"编辑表达方式"}),e.jsx(at,{children:"修改表达方式的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_situation",children:"情境"}),e.jsx(ne,{id:"edit_situation",value:m.situation||"",onChange:j=>h({...m,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"风格"}),e.jsx(ne,{id:"edit_style",value:m.style||"",onChange:j=>h({...m,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},j.chat_id))})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{className:"text-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:"状态标记说明:"})}),e.jsx("p",{children:"• 已检查:表示该表达方式已通过审核(可由AI自动检查或人工审核)"}),e.jsx("p",{children:"• 已拒绝:表示该表达方式被标记为不合适,将永远不会被使用"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['根据配置中"仅使用已审核通过的表达方式"设置:',e.jsx("br",{}),"• 开启时:只有通过审核(已检查)的项目会被使用",e.jsx("br",{}),"• 关闭时:未审核的项目也会被使用"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"已通过审核"})]}),e.jsx(Ge,{id:"edit_checked",checked:m.checked??!1,onCheckedChange:j=>h({...m,checked:j})})]}),e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"不会被使用"})]}),e.jsx(Ge,{id:"edit_rejected",checked:m.rejected??!1,onCheckedChange:j=>h({...m,rejected:j})})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function xk({open:a,onOpenChange:l,onConfirm:r,count:c}){return e.jsx(bs,{open:a,onOpenChange:l,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认批量删除"}),e.jsxs(gs,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Kl="/api/webui/jargon";async function hk(){const a=await ke(`${Kl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取聊天列表失败")}return a.json()}async function fk(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id),a.is_jargon!==void 0&&a.is_jargon!==null&&l.append("is_jargon",a.is_jargon.toString()),a.is_global!==void 0&&l.append("is_global",a.is_global.toString());const r=await ke(`${Kl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取黑话列表失败")}return r.json()}async function pk(a){const l=await ke(`${Kl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取黑话详情失败")}return l.json()}async function gk(a){const l=await ke(`${Kl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"创建黑话失败")}return l.json()}async function jk(a,l){const r=await ke(`${Kl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新黑话失败")}return r.json()}async function vk(a){const l=await ke(`${Kl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除黑话失败")}return l.json()}async function Nk(a){const l=await ke(`${Kl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除黑话失败")}return l.json()}async function bk(){const a=await ke(`${Kl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取黑话统计失败")}return a.json()}async function yk(a,l){const r=new URLSearchParams;a.forEach(d=>r.append("ids",d.toString())),r.append("is_jargon",l.toString());const c=await ke(`${Kl}/batch/set-jargon?${r}`,{method:"POST"});if(!c.ok){const d=await c.json();throw new Error(d.detail||"批量设置黑话状态失败")}return c.json()}function wk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState("all"),[w,z]=u.useState("all"),[M,S]=u.useState(null),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(!1),[X,L]=u.useState(null),[me,Ne]=u.useState(new Set),[je,ce]=u.useState(!1),[ge,pe]=u.useState(""),[D,Q]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[B,ue]=u.useState([]),{toast:Y}=nt(),we=async()=>{try{c(!0);const Z=await fk({page:h,page_size:p,search:N||void 0,chat_id:b==="all"?void 0:b,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});l(Z.data),m(Z.total)}catch(Z){Y({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},fe=async()=>{try{const Z=await bk();Z?.data&&Q(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}},Ee=async()=>{try{const Z=await hk();Z?.data&&ue(Z.data)}catch(Z){console.error("加载聊天列表失败:",Z)}};u.useEffect(()=>{we(),fe(),Ee()},[h,p,N,b,w]);const G=async Z=>{try{const Le=await pk(Z.id);S(Le.data),E(!0)}catch(Le){Y({title:"加载详情失败",description:Le instanceof Error?Le.message:"无法加载黑话详情",variant:"destructive"})}},$=Z=>{S(Z),R(!0)},A=async Z=>{try{await vk(Z.id),Y({title:"删除成功",description:`已删除黑话: ${Z.content}`}),L(null),we(),fe()}catch(Le){Y({title:"删除失败",description:Le instanceof Error?Le.message:"无法删除黑话",variant:"destructive"})}},K=Z=>{const Le=new Set(me);Le.has(Z)?Le.delete(Z):Le.add(Z),Ne(Le)},Re=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(Z=>Z.id)))},se=async()=>{try{await Nk(Array.from(me)),Y({title:"批量删除成功",description:`已删除 ${me.size} 个黑话`}),Ne(new Set),ce(!1),we(),fe()}catch(Z){Y({title:"批量删除失败",description:Z instanceof Error?Z.message:"无法批量删除黑话",variant:"destructive"})}},$e=async Z=>{try{await yk(Array.from(me),Z),Y({title:"操作成功",description:`已将 ${me.size} 个词条设为${Z?"黑话":"非黑话"}`}),Ne(new Set),we(),fe()}catch(Le){Y({title:"操作失败",description:Le instanceof Error?Le.message:"批量设置失败",variant:"destructive"})}},cs=()=>{const Z=parseInt(ge),Le=Math.ceil(d/p);Z>=1&&Z<=Le?(f(Z),pe("")):Y({title:"无效的页码",description:`请输入1-${Le}之间的页码`,variant:"destructive"})},J=Z=>Z===!0?e.jsxs(Ce,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"是黑话"]}):Z===!1?e.jsxs(Ce,{variant:"secondary",children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Ce,{variant:"outline",children:[e.jsx(ox,{className:"h-3 w-3 mr-1"}),"未判定"]});return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(P1,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(_,{onClick:()=>O(!0),className:"gap-2",children:[e.jsx(Xs,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:D.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:D.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:D.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:D.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:D.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索内容、含义...",value:N,onChange:Z=>j(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"聊天筛选"}),e.jsxs(Pe,{value:b,onValueChange:y,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"全部聊天"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部聊天"}),B.map(Z=>e.jsx(W,{value:Z.chat_id,children:Z.chat_name},Z.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"状态筛选"}),e.jsxs(Pe,{value:w,onValueChange:z,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"全部状态"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部状态"}),e.jsx(W,{value:"true",children:"是黑话"}),e.jsx(W,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:Z=>{g(parseInt(Z)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]})]})]}),me.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",me.size," 个"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$e(!0),children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$e(!1),children:[e.jsx(Sa,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>ce(!0),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:me.size===a.length&&a.length>0,onCheckedChange:Re})}),e.jsx(ns,{children:"内容"}),e.jsx(ns,{children:"含义"}),e.jsx(ns,{children:"聊天"}),e.jsx(ns,{children:"状态"}),e.jsx(ns,{className:"text-center",children:"次数"}),e.jsx(ns,{className:"text-right",children:"操作"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(Z=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:me.has(Z.id),onCheckedChange:()=>K(Z.id)})}),e.jsx(Ze,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Go,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:Z.content,children:Z.content})]})}),e.jsx(Ze,{className:"max-w-[200px] truncate",title:Z.meaning||"",children:Z.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ze,{className:"max-w-[150px] truncate",title:Z.chat_name||Z.chat_id,children:Z.chat_name||Z.chat_id}),e.jsx(Ze,{children:J(Z.is_jargon)}),e.jsx(Ze,{className:"text-center",children:Z.count}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>$(Z),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>G(Z),title:"查看详情",children:e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>L(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:me.has(Z.id),onCheckedChange:()=>K(Z.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_global&&e.jsx(Go,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:Z.content})]}),Z.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:Z.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[J(Z.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",Z.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",Z.chat_name||Z.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$(Z),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>G(Z),className:"text-xs px-2 py-1 h-auto",children:e.jsx(ua,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(Z),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},Z.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:ge,onChange:Z=>pe(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&cs(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:cs,disabled:!ge,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(_k,{jargon:M,open:F,onOpenChange:E}),e.jsx(Sk,{open:H,onOpenChange:O,chatList:B,onSuccess:()=>{we(),fe(),O(!1)}}),e.jsx(kk,{jargon:M,open:C,onOpenChange:R,chatList:B,onSuccess:()=>{we(),fe(),R(!1)}}),e.jsx(bs,{open:!!X,onOpenChange:()=>L(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除黑话 "',X?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>X&&A(X),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(bs,{open:je,onOpenChange:ce,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认批量删除"}),e.jsxs(gs,{children:["您即将删除 ",me.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:se,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function _k({jargon:a,open:l,onOpenChange:r}){return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"黑话详情"}),e.jsx(at,{children:"查看黑话的完整信息"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Gm,{icon:Wr,label:"记录ID",value:a.id.toString(),mono:!0}),e.jsx(Gm,{label:"使用次数",value:a.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:a.content})]}),a.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(a.raw_content);return Array.isArray(c)?c.map((d,m)=>e.jsxs("div",{children:[m>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:d})]},m)):e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:a.meaning?e.jsx(bx,{content:a.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Gm,{label:"聊天",value:a.chat_name||a.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.is_jargon===!0&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"是黑话"}),a.is_jargon===!1&&e.jsx(Ce,{variant:"secondary",children:"非黑话"}),a.is_jargon===null&&e.jsx(Ce,{variant:"outline",children:"未判定"}),a.is_global&&e.jsx(Ce,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),a.is_complete&&e.jsx(Ce,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),a.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_with_context})]}),a.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_content_only})]})]})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Gm({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Sk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=u.useState(!1),{toast:p}=nt(),g=async()=>{if(!d.content||!d.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await gk(d),p({title:"创建成功",description:"黑话已创建"}),m({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建黑话",variant:"destructive"})}finally{f(!1)}};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"新增黑话"}),e.jsx(at,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"content",value:d.content,onChange:N=>m({...d,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"含义"}),e.jsx(pt,{id:"meaning",value:d.meaning||"",onChange:N=>m({...d,meaning:N.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:r.map(N=>e.jsx(W,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"is_global",checked:d.is_global,onCheckedChange:N=>m({...d,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function kk({jargon:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=nt();u.useEffect(()=>{a&&h({content:a.content,meaning:a.meaning||"",chat_id:a.stream_id||a.chat_id,is_global:a.is_global,is_jargon:a.is_jargon})},[a]);const N=async()=>{if(a)try{p(!0),await jk(a.id,m),g({title:"保存成功",description:"黑话已更新"}),d()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"编辑黑话"}),e.jsx(at,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_content",children:"内容"}),e.jsx(ne,{id:"edit_content",value:m.content||"",onChange:j=>h({...m,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(pt,{id:"edit_meaning",value:m.meaning||"",onChange:j=>h({...m,meaning:j.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择关联的聊天"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"黑话状态"}),e.jsxs(Pe,{value:m.is_jargon===null?"null":m.is_jargon?.toString()||"null",onValueChange:j=>h({...m,is_jargon:j==="null"?null:j==="true"}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"null",children:"未判定"}),e.jsx(W,{value:"true",children:"是黑话"}),e.jsx(W,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit_is_global",checked:m.is_global,onCheckedChange:j=>h({...m,is_global:j})}),e.jsx(T,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const li="/api/webui/person";async function Ck(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_known!==void 0&&l.append("is_known",a.is_known.toString()),a.platform&&l.append("platform",a.platform);const r=await ke(`${li}/list?${l}`,{headers:Zs()});if(!r.ok){const c=await r.json();throw new Error(c.detail||"获取人物列表失败")}return r.json()}async function Tk(a){const l=await ke(`${li}/${a}`,{headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取人物详情失败")}return l.json()}async function Ek(a,l){const r=await ke(`${li}/${a}`,{method:"PATCH",headers:Zs(),body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"更新人物信息失败")}return r.json()}async function Mk(a){const l=await ke(`${li}/${a}`,{method:"DELETE",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"删除人物信息失败")}return l.json()}async function Ak(){const a=await ke(`${li}/stats/summary`,{headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"获取统计数据失败")}return a.json()}async function zk(a){const l=await ke(`${li}/batch/delete`,{method:"POST",headers:Zs(),body:JSON.stringify({person_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"批量删除失败")}return l.json()}function Rk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState(void 0),[w,z]=u.useState(void 0),[M,S]=u.useState(null),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[me,Ne]=u.useState(new Set),[je,ce]=u.useState(!1),[ge,pe]=u.useState(""),{toast:D}=nt(),Q=async()=>{try{c(!0);const se=await Ck({page:h,page_size:p,search:N||void 0,is_known:b,platform:w});l(se.data),m(se.total)}catch(se){D({title:"加载失败",description:se instanceof Error?se.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},B=async()=>{try{const se=await Ak();se?.data&&L(se.data)}catch(se){console.error("加载统计数据失败:",se)}};u.useEffect(()=>{Q(),B()},[h,p,N,b,w]);const ue=async se=>{try{const $e=await Tk(se.person_id);S($e.data),E(!0)}catch($e){D({title:"加载详情失败",description:$e instanceof Error?$e.message:"无法加载人物详情",variant:"destructive"})}},Y=se=>{S(se),R(!0)},we=async se=>{try{await Mk(se.person_id),D({title:"删除成功",description:`已删除人物信息: ${se.person_name||se.nickname||se.user_id}`}),O(null),Q(),B()}catch($e){D({title:"删除失败",description:$e instanceof Error?$e.message:"无法删除人物信息",variant:"destructive"})}},fe=u.useMemo(()=>Object.keys(X.platforms),[X.platforms]),Ee=se=>{const $e=new Set(me);$e.has(se)?$e.delete(se):$e.add(se),Ne($e)},G=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(se=>se.person_id)))},$=()=>{if(me.size===0){D({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ce(!0)},A=async()=>{try{const se=await zk(Array.from(me));D({title:"批量删除完成",description:se.message}),Ne(new Set),ce(!1),Q(),B()}catch(se){D({title:"批量删除失败",description:se instanceof Error?se.message:"批量删除失败",variant:"destructive"})}},K=()=>{const se=parseInt(ge),$e=Math.ceil(d/p);se>=1&&se<=$e?(f(se),pe("")):D({title:"无效的页码",description:`请输入1-${$e}之间的页码`,variant:"destructive"})},Re=se=>se?new Date(se*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(oc,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:X.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:X.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:X.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:se=>j(se.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Pe,{value:b===void 0?"all":b.toString(),onValueChange:se=>{y(se==="all"?void 0:se==="true"),f(1)},children:[e.jsx(Be,{id:"filter-known",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部"}),e.jsx(W,{value:"true",children:"已认识"}),e.jsx(W,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Pe,{value:w||"all",onValueChange:se=>{z(se==="all"?void 0:se),f(1)},children:[e.jsx(Be,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部平台"}),fe.map(se=>e.jsxs(W,{value:se,children:[se," (",X.platforms[se],")"]},se))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:me.size>0&&e.jsxs("span",{children:["已选择 ",me.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Pe,{value:p.toString(),onValueChange:se=>{g(parseInt(se)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),me.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:$,children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:a.length>0&&me.size===a.length,onCheckedChange:G,"aria-label":"全选"})}),e.jsx(ns,{children:"状态"}),e.jsx(ns,{children:"名称"}),e.jsx(ns,{children:"昵称"}),e.jsx(ns,{children:"平台"}),e.jsx(ns,{children:"用户ID"}),e.jsx(ns,{children:"最后更新"}),e.jsx(ns,{className:"text-right",children:"操作"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):a.map(se=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:me.has(se.person_id),onCheckedChange:()=>Ee(se.person_id),"aria-label":`选择 ${se.person_name||se.nickname||se.user_id}`})}),e.jsx(Ze,{children:e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"已认识":"未认识"})}),e.jsx(Ze,{className:"font-medium",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ze,{children:se.nickname||"-"}),e.jsx(Ze,{children:se.platform}),e.jsx(Ze,{className:"font-mono text-sm",children:se.user_id}),e.jsx(Ze,{className:"text-sm text-muted-foreground",children:Re(se.last_know)}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ue(se),children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Y(se),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>O(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},se.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):a.map(se=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:me.has(se.person_id),onCheckedChange:()=>Ee(se.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),se.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",se.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),e.jsx("p",{className:"font-medium text-xs",children:se.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:se.user_id,children:se.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),e.jsx("p",{className:"text-xs",children:Re(se.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ue(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(ua,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Y(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},se.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",d," 条记录,第 ",h," / ",Math.ceil(d/p)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:ge,onChange:se=>pe(se.target.value),onKeyDown:se=>se.key==="Enter"&&K(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:K,disabled:!ge,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Dk,{person:M,open:F,onOpenChange:E}),e.jsx(Ok,{person:M,open:C,onOpenChange:R,onSuccess:()=>{Q(),B(),R(!1)}}),e.jsx(bs,{open:!!H,onOpenChange:()=>O(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认删除"}),e.jsxs(gs,{children:['确定要删除人物信息 "',H?.person_name||H?.nickname||H?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:()=>H&&we(H),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(bs,{open:je,onOpenChange:ce,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"确认批量删除"}),e.jsxs(gs,{children:["确定要删除选中的 ",me.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"取消"}),e.jsx(js,{onClick:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Dk({person:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"人物详情"}),e.jsxs(at,{children:["查看 ",a.person_name||a.nickname||a.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx($l,{icon:Fl,label:"人物名称",value:a.person_name}),e.jsx($l,{icon:Ia,label:"昵称",value:a.nickname}),e.jsx($l,{icon:Wr,label:"用户ID",value:a.user_id,mono:!0}),e.jsx($l,{icon:Wr,label:"人物ID",value:a.person_id,mono:!0}),e.jsx($l,{label:"平台",value:a.platform}),e.jsx($l,{label:"状态",value:a.is_known?"已认识":"未认识"})]}),a.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:a.name_reason})]}),a.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:a.memory_points})]}),a.group_nick_name&&a.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:a.group_nick_name.map((d,m)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:d.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:d.group_nick_name})]},m))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx($l,{icon:da,label:"认识时间",value:c(a.know_times)}),e.jsx($l,{icon:da,label:"首次记录",value:c(a.know_since)}),e.jsx($l,{icon:da,label:"最后更新",value:c(a.last_know)})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function $l({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Ok({person:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState({}),[h,f]=u.useState(!1),{toast:p}=nt();u.useEffect(()=>{a&&m({person_name:a.person_name||"",name_reason:a.name_reason||"",nickname:a.nickname||"",is_known:a.is_known})},[a]);const g=async()=>{if(a)try{f(!0),await Ek(a.person_id,d),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(N){p({title:"保存失败",description:N instanceof Error?N.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"编辑人物信息"}),e.jsxs(at,{children:["修改 ",a.person_name||a.nickname||a.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"person_name",children:"人物名称"}),e.jsx(ne,{id:"person_name",value:d.person_name||"",onChange:N=>m({...d,person_name:N.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(ne,{id:"nickname",value:d.nickname||"",onChange:N=>m({...d,nickname:N.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(pt,{id:"name_reason",value:d.name_reason||"",onChange:N=>m({...d,name_reason:N.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(T,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Ge,{id:"is_known",checked:d.is_known,onCheckedChange:N=>m({...d,is_known:N})})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var Lk=S_();const tj=mw(Lk),Mx="/api/webui";async function Uk(a=100,l="all"){const r=`${Mx}/knowledge/graph?limit=${a}&node_type=${l}`,c=await fetch(r);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function $k(){const a=await fetch(`${Mx}/knowledge/stats`);if(!a.ok)throw new Error("获取知识图谱统计信息失败");return a.json()}async function Bk(a){const l=await fetch(`${Mx}/knowledge/search?query=${encodeURIComponent(a)}`);if(!l.ok)throw new Error("搜索知识节点失败");return l.json()}const dN=u.memo(({data:a})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Yo,{type:"target",position:Jo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:a.content,children:a.label}),e.jsx(Yo,{type:"source",position:Jo.Bottom})]}));dN.displayName="EntityNode";const uN=u.memo(({data:a})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Yo,{type:"target",position:Jo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:a.content,children:a.label}),e.jsx(Yo,{type:"source",position:Jo.Bottom})]}));uN.displayName="ParagraphNode";const Ik={entity:dN,paragraph:uN};function Pk(a,l){const r=new tj.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],d=[];return a.forEach(m=>{r.setNode(m.id,{width:150,height:50})}),l.forEach(m=>{r.setEdge(m.source,m.target)}),tj.layout(r),a.forEach(m=>{const h=r.node(m.id);c.push({id:m.id,type:m.type,position:{x:h.x-75,y:h.y-25},data:{label:m.content.slice(0,20)+(m.content.length>20?"...":""),content:m.content}})}),l.forEach((m,h)=>{const f={id:`edge-${h}`,source:m.source,target:m.target,animated:a.length<=200&&m.weight>5,style:{strokeWidth:Math.min(m.weight/2,5),opacity:.6}};m.weight>10&&a.length<100&&(f.label=`${m.weight.toFixed(0)}`),d.push(f)}),{nodes:c,edges:d}}function Fk(){const a=ha(),[l,r]=u.useState(!1),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState("all"),[g,N]=u.useState(50),[j,b]=u.useState("50"),[y,w]=u.useState(!1),[z,M]=u.useState(!0),[S,F]=u.useState(!1),[E,C]=u.useState(!1),[R,H,O]=k_([]),[X,L,me]=C_([]),[Ne,je]=u.useState(0),[ce,ge]=u.useState(null),[pe,D]=u.useState(null),{toast:Q}=nt(),B=u.useCallback(A=>A.type==="entity"?"#6366f1":A.type==="paragraph"?"#10b981":"#6b7280",[]),ue=u.useCallback(async(A=!1)=>{try{if(!A&&g>200){C(!0);return}r(!0);const[K,Re]=await Promise.all([Uk(g,f),$k()]);if(d(Re),K.nodes.length===0){Q({title:"提示",description:"知识库为空,请先导入知识数据"}),H([]),L([]);return}const{nodes:se,edges:$e}=Pk(K.nodes,K.edges);H(se),L($e),je(se.length),Re&&Re.total_nodes>g&&Q({title:"提示",description:`知识图谱包含 ${Re.total_nodes} 个节点,当前显示 ${se.length} 个`}),Q({title:"加载成功",description:`已加载 ${se.length} 个节点,${$e.length} 条边`})}catch(K){console.error("加载知识图谱失败:",K),Q({title:"加载失败",description:K instanceof Error?K.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[g,f,Q]),Y=u.useCallback(async()=>{if(!m.trim()){Q({title:"提示",description:"请输入搜索关键词"});return}try{const A=await Bk(m);if(A.length===0){Q({title:"未找到",description:"没有找到匹配的节点"});return}const K=new Set(A.map(Re=>Re.id));H(Re=>Re.map(se=>({...se,style:{...se.style,opacity:K.has(se.id)?1:.3,filter:K.has(se.id)?"brightness(1.2)":"brightness(0.8)"}}))),Q({title:"搜索完成",description:`找到 ${A.length} 个匹配节点`})}catch(A){console.error("搜索失败:",A),Q({title:"搜索失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},[m,Q]),we=u.useCallback(()=>{H(A=>A.map(K=>({...K,style:{...K.style,opacity:1,filter:"brightness(1)"}})))},[]),fe=u.useCallback(()=>{M(!1),F(!0),ue()},[ue]),Ee=u.useCallback(()=>{C(!1),setTimeout(()=>{ue(!0)},0)},[ue]),G=u.useCallback((A,K)=>{R.find(se=>se.id===K.id)&&ge({id:K.id,type:K.type,content:K.data.content})},[R]);u.useEffect(()=>{z||S&&ue()},[g,f,z,S]);const $=u.useCallback((A,K)=>{const Re=R.find(cs=>cs.id===K.source),se=R.find(cs=>cs.id===K.target),$e=X.find(cs=>cs.id===K.id);Re&&se&&$e&&D({source:{id:Re.id,type:Re.type,content:Re.data.content},target:{id:se.id,type:se.type,content:se.data.content},edge:{source:K.source,target:K.target,weight:parseFloat(K.label||"0")}})},[R,X]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Zr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(xv,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Yt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Ua,{className:"h-3 w-3"}),"段落: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ne,{placeholder:"搜索节点内容...",value:m,onChange:A=>h(A.target.value),onKeyDown:A=>A.key==="Enter"&&Y(),className:"flex-1"}),e.jsx(_,{onClick:Y,size:"sm",children:e.jsx($t,{className:"h-4 w-4"})}),e.jsx(_,{onClick:we,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:f,onValueChange:A=>p(A),children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部节点"}),e.jsx(W,{value:"entity",children:"仅实体"}),e.jsx(W,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Pe,{value:g===1e4?"all":y?"custom":g.toString(),onValueChange:A=>{A==="custom"?(w(!0),b(g.toString())):A==="all"?(w(!1),N(1e4)):(w(!1),N(Number(A)))},children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"50",children:"50 节点"}),e.jsx(W,{value:"100",children:"100 节点"}),e.jsx(W,{value:"200",children:"200 节点"}),e.jsx(W,{value:"500",children:"500 节点"}),e.jsx(W,{value:"1000",children:"1000 节点"}),e.jsx(W,{value:"all",children:"全部 (最多10000)"}),e.jsx(W,{value:"custom",children:"自定义..."})]})]}),y&&e.jsx(ne,{type:"number",min:"50",value:j,onChange:A=>b(A.target.value),onBlur:()=>{const A=parseInt(j);!isNaN(A)&&A>=50?N(A):(b("50"),N(50))},onKeyDown:A=>{if(A.key==="Enter"){const K=parseInt(j);!isNaN(K)&&K>=50?N(K):(b("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>ue(),variant:"outline",size:"sm",disabled:l,children:e.jsx(dt,{className:P("h-4 w-4",l&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:l?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):R.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Zr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),e.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):e.jsxs(T_,{nodes:R,edges:X,onNodesChange:O,onEdgesChange:me,onNodeClick:G,onEdgeClick:$,nodeTypes:Ik,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:Ne<=500,nodesDraggable:Ne<=1e3,attributionPosition:"bottom-left",children:[e.jsx(E_,{variant:M_.Dots,gap:12,size:1}),e.jsx(A_,{}),Ne<=500&&e.jsx(z_,{nodeColor:B,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(R_,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"实体节点"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"段落节点"})]}),Ne>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"性能模式"}),e.jsx("div",{children:"已禁用动画"}),Ne>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Qs,{open:!!ce,onOpenChange:A=>!A&&ge(null),children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"节点详情"})}),ce&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:ce.type==="entity"?"default":"secondary",children:ce.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ce.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(ts,{className:"mt-1 max-h-[400px] p-3 bg-muted rounded border",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ce.content})})]})]})]})}),e.jsx(Qs,{open:!!pe,onOpenChange:A=>!A&&D(null),children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"边详情"})}),pe&&e.jsx(ts,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",className:"text-base font-mono",children:pe.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(bs,{open:z,onOpenChange:M,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"加载知识图谱"}),e.jsxs(gs,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>a({to:"/"}),children:"取消 (返回首页)"}),e.jsx(js,{onClick:fe,children:"确认加载"})]})]})}),e.jsx(bs,{open:E,onOpenChange:C,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"⚠️ 节点数量较多"}),e.jsx(gs,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:g>=1e4?"全部 (最多10000个)":g})," 个节点。"]}),e.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),e.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[e.jsx("li",{children:"页面加载时间较长"}),e.jsx("li",{children:"浏览器卡顿或崩溃"}),e.jsx("li",{children:"系统资源占用过高"})]}),e.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>{C(!1),g>200&&(N(50),w(!1))},children:"取消"}),e.jsx(js,{onClick:Ee,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Hk(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"麦麦知识库管理"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"管理和组织麦麦的知识库内容"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(Te,{children:[e.jsxs(Oe,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Zr,{className:"h-10 w-10 text-primary"})}),e.jsx(Ue,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(Ns,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(ze,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function aj({className:a,classNames:l,showOutsideDays:r=!0,captionLayout:c="label",buttonVariant:d="ghost",formatters:m,components:h,...f}){const p=Ev();return e.jsx(j_,{showOutsideDays:r,className:P("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,a),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...m},classNames:{root:P("w-fit",p.root),months:P("relative flex flex-col gap-4 md:flex-row",p.months),month:P("flex w-full flex-col gap-4",p.month),nav:P("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:P(si({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:P(si({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:P("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:P("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:P("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:P("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:P("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:P("flex",p.weekdays),weekday:P("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:P("mt-2 flex w-full",p.week),week_number_header:P("w-[--cell-size] select-none",p.week_number_header),week_number:P("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:P("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:P("bg-accent rounded-l-md",p.range_start),range_middle:P("rounded-none",p.range_middle),range_end:P("bg-accent rounded-r-md",p.range_end),today:P("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:P("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:P("text-muted-foreground opacity-50",p.disabled),hidden:P("invisible",p.hidden),...l},components:{Root:({className:g,rootRef:N,...j})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:P(g),...j}),Chevron:({className:g,orientation:N,...j})=>N==="left"?e.jsx(Pa,{className:P("size-4",g),...j}):N==="right"?e.jsx(ra,{className:P("size-4",g),...j}):e.jsx(Ba,{className:P("size-4",g),...j}),DayButton:qk,WeekNumber:({children:g,...N})=>e.jsx("td",{...N,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:g})}),...h},...f})}function qk({className:a,day:l,modifiers:r,...c}){const d=Ev(),m=u.useRef(null);return u.useEffect(()=>{r.focused&&m.current?.focus()},[r.focused]),e.jsx(_,{ref:m,variant:"ghost",size:"icon","data-day":l.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:P("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",d.day,a),...c})}const Uo={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function Vk(){const[a,l]=u.useState([]),[r,c]=u.useState(""),[d,m]=u.useState("all"),[h,f]=u.useState("all"),[p,g]=u.useState(void 0),[N,j]=u.useState(void 0),[b,y]=u.useState(!0),[w,z]=u.useState(!1),[M,S]=u.useState("xs"),[F,E]=u.useState(4),[C,R]=u.useState(!1),H=u.useRef(null);u.useEffect(()=>{const Y=Qn.getAllLogs();l(Y);const we=Qn.onLog(()=>{l(Qn.getAllLogs())}),fe=Qn.onConnectionChange(Ee=>{z(Ee)});return()=>{we(),fe()}},[]);const O=u.useMemo(()=>{const Y=new Set(a.map(we=>we.module).filter(we=>we&&we.trim()!==""));return Array.from(Y).sort()},[a]),X=Y=>{switch(Y){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},L=Y=>{switch(Y){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},me=()=>{window.location.reload()},Ne=()=>{Qn.clearLogs(),l([])},je=()=>{const Y=pe.map(G=>`${G.timestamp} [${G.level.padEnd(8)}] [${G.module}] ${G.message}`).join(` -`),we=new Blob([Y],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(we),Ee=document.createElement("a");Ee.href=fe,Ee.download=`logs-${Em(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Ee.click(),URL.revokeObjectURL(fe)},ce=()=>{y(!b)},ge=()=>{g(void 0),j(void 0)},pe=u.useMemo(()=>a.filter(Y=>{const we=r===""||Y.message.toLowerCase().includes(r.toLowerCase())||Y.module.toLowerCase().includes(r.toLowerCase()),fe=d==="all"||Y.level===d,Ee=h==="all"||Y.module===h;let G=!0;if(p||N){const $=new Date(Y.timestamp);if(p){const A=new Date(p);A.setHours(0,0,0,0),G=G&&$>=A}if(N){const A=new Date(N);A.setHours(23,59,59,999),G=G&&$<=A}}return we&&fe&&Ee&&G}),[a,r,d,h,p,N]),D=Uo[M].rowHeight+F,Q=aw({count:pe.length,getScrollElement:()=>H.current,estimateSize:()=>D,overscan:50}),B=u.useRef(!1),ue=u.useRef(pe.length);return u.useEffect(()=>{const Y=H.current;if(!Y)return;const we=()=>{if(B.current)return;const{scrollTop:fe,scrollHeight:Ee,clientHeight:G}=Y,$=Ee-fe-G;$>100&&b?y(!1):$<50&&!b&&y(!0)};return Y.addEventListener("scroll",we,{passive:!0}),()=>Y.removeEventListener("scroll",we)},[b]),u.useEffect(()=>{const Y=pe.length>ue.current;ue.current=pe.length,b&&pe.length>0&&Y&&(B.current=!0,Q.scrollToIndex(pe.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{B.current=!1})}))},[pe.length,b,Q]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-2 sm:space-y-3 p-2 sm:p-3 lg:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 hidden sm:block",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:w?"已连接":"未连接"})]})]}),e.jsx(Te,{className:"p-2 sm:p-3",children:e.jsx(xc,{open:C,onOpenChange:R,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative min-w-0",children:[e.jsx($t,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索日志...",value:r,onChange:Y=>c(Y.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:b?"default":"outline",size:"sm",onClick:ce,className:"h-8 px-2",title:b?"自动滚动":"已暂停",children:[b?e.jsx(F1,{className:"h-3.5 w-3.5"}):e.jsx(H1,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:b?"滚动":"暂停"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2",title:"清空日志",children:[e.jsx(os,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"清空"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(na,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"收起筛选":"展开筛选",children:[e.jsx(Po,{className:"h-3.5 w-3.5"}),C?e.jsx(Xr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Ba,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[pe.length," / ",a.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(fc,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Pe,{value:d,onValueChange:m,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Po,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"级别"})]}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部级别"}),e.jsx(W,{value:"DEBUG",children:"DEBUG"}),e.jsx(W,{value:"INFO",children:"INFO"}),e.jsx(W,{value:"WARNING",children:"WARNING"}),e.jsx(W,{value:"ERROR",children:"ERROR"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Pe,{value:h,onValueChange:f,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Po,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"模块"})]}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部模块"}),O.map(Y=>e.jsx(W,{value:Y,children:Y},Y))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Ko,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?Em(p,"PP",{locale:Oo}):"开始日期"})]})}),e.jsx(tl,{className:"w-auto p-0",align:"start",children:e.jsx(aj,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:Oo})})]}),e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Ko,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?Em(N,"PP",{locale:Oo}):"结束日期"})]})}),e.jsx(tl,{className:"w-auto p-0",align:"start",children:e.jsx(aj,{mode:"single",selected:N,onSelect:j,initialFocus:!0,locale:Oo})})]}),(p||N)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,className:"w-full sm:w-auto h-8",children:[e.jsx(Sa,{className:"h-3.5 w-3.5 sm:mr-1"}),e.jsx("span",{className:"text-xs",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(q1,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Uo).map(Y=>e.jsx(_,{variant:M===Y?"default":"outline",size:"sm",onClick:()=>S(Y),className:"h-6 px-2 text-xs",children:Uo[Y].label},Y))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(el,{value:[F],onValueChange:([Y])=>E(Y),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[F,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"flex-1 h-8",children:[e.jsx(dt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"flex-1 h-8",children:[e.jsx(na,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"导出"})]})]})]})]})]})})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-2 sm:px-3 lg:px-4 pb-2 sm:pb-3 lg:pb-4",children:e.jsx(Te,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:H,className:P("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:P("p-2 sm:p-3 font-mono relative",Uo[M].class),style:{height:`${Q.getTotalSize()}px`},children:pe.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):Q.getVirtualItems().map(Y=>{const we=pe[Y.index];return e.jsxs("div",{"data-index":Y.index,ref:Q.measureElement,className:P("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",L(we.level)),style:{transform:`translateY(${Y.start}px)`,paddingTop:`${F/2}px`,paddingBottom:`${F/2}px`},children:[e.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 text-[10px]",children:we.timestamp}),e.jsxs("span",{className:P("font-semibold text-[10px]",X(we.level)),children:["[",we.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:we.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:we.message})]}),e.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[e.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:we.timestamp}),e.jsxs("span",{className:P("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",X(we.level)),children:["[",we.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:we.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:we.message})]})]},Y.key)})})})})})]})}async function Gk(){return(await ke("/api/planner/overview")).json()}async function Kk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await ke(`/api/planner/chat/${a}/logs?${d}`)).json()}async function Qk(a,l){return(await ke(`/api/planner/log/${a}/${l}`)).json()}async function Yk(){return(await ke("/api/replier/overview")).json()}async function Jk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await ke(`/api/replier/chat/${a}/logs?${d}`)).json()}async function Xk(a,l){return(await ke(`/api/replier/log/${a}/${l}`)).json()}function mN(){const[a,l]=u.useState(new Map),[r,c]=u.useState(!0),d=u.useCallback(async()=>{try{c(!0);const h=await gx();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),l(f)}}catch(h){console.error("加载聊天列表失败:",h)}finally{c(!1)}},[]);u.useEffect(()=>{d()},[d]);const m=u.useCallback(h=>a.get(h)||h,[a]);return{chatNameMap:a,getChatName:m,loading:r,reload:d}}function Zo(a){return new Date(a*1e3).toLocaleString("zh-CN")}function xN(a){const r=Date.now()/1e3-a;return r<60?"刚刚":r<3600?`${Math.floor(r/60)} 分钟前`:r<86400?`${Math.floor(r/3600)} 小时前`:`${Math.floor(r/86400)} 天前`}function hN(a,l,r=1e4){u.useEffect(()=>{if(!a)return;const c=setInterval(l,r);return()=>clearInterval(c)},[a,l,r])}function Zk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=mN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(!1),[z,M]=u.useState(1),[S,F]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Gk();p($)}catch($){console.error("加载规划器总览失败:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Kk(d.chat_id,z,S,R||void 0);b($)}catch($){console.error("加载聊天日志失败:",$)}finally{w(!1)}},[d,z,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),hN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const Q=$=>{m($),M(1),H(""),X(""),c("chat-logs")},B=()=>{c("overview"),m(null),b(null),H(""),X("")},ue=()=>{H(O),M(1)},Y=()=>{X(""),H(""),M(1)},we=async($,A)=>{try{ge(!0),je(!0);const K=await Qk($,A);me(K)}catch(K){console.error("加载计划详情失败:",K)}finally{ge(!1)}},fe=$=>{F(Number($)),M(1)},Ee=()=>{const $=parseInt(E),A=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=A&&(M($),C(""))},G=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"计划总数"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_plans||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"聊天列表"}),e.jsx(Ns,{children:"点击查看该聊天的所有计划记录"})]}),e.jsx(ze,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:$.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",xN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",j?.total||0," 条计划记录"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"计划执行记录"}),e.jsx(Ns,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{placeholder:"搜索提示词内容...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx($t,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:"清除"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10条/页"}),e.jsx(W,{value:"20",children:"20条/页"}),e.jsx(W,{value:"50",children:"50条/页"}),e.jsx(W,{value:"100",children:"100条/页"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(ze,{children:y?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-20 w-full"},A))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>we($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Zo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[$.action_count," 个动作"]}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[$.total_plan_ms.toFixed(0),"ms"]})]})]}),$.action_types&&$.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:$.action_types.map((A,K)=>e.jsx(Ce,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800",children:A},K))}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.reasoning_preview||"无推理内容"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",j.total," 条记录,第 ",z," / ",G," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:z===1,children:e.jsx(Pa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ne,{type:"number",min:1,max:G,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Ee(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ee,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[z,"/",G]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(G,$+1)),disabled:z===G,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(G),disabled:z===G,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无计划记录"})})]})]})}),e.jsx(Qs,{open:Ne,onOpenChange:je,children:e.jsxs(Hs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Ua,{className:"h-5 w-5"}),"计划执行详情"]}),e.jsx(at,{children:"查看麦麦的详细计划推理过程和执行动作"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ce?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(da,{className:"h-4 w-4"}),"基本信息"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"时间戳"}),e.jsx("div",{className:"text-sm",children:Zo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"类型"}),e.jsx(Ce,{variant:"outline",children:L.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"动作数量"}),e.jsxs(Ce,{children:[L.actions.length," 个动作"]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"提示词构建"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM 推理"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"总计划时间"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(hx,{className:"h-4 w-4"}),"推理过程"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning||"无推理内容"})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(rv,{className:"h-4 w-4"}),"执行动作 (",L.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:L.actions.map(($,A)=>e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-3",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ce,{variant:"default",children:["动作 ",A+1]}),e.jsx(Ce,{variant:"outline",children:$.action_type})]})})}),e.jsxs(ze,{className:"p-4 pt-0 space-y-3",children:[$.reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"推理依据"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.reasoning=="string"?$.reasoning:JSON.stringify($.reasoning)})]}),$.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作消息"}),typeof $.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:$.action_message}):e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify($.action_message,null,2)})]}),$.action_data&&Object.keys($.action_data).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作数据"}),e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto",children:JSON.stringify($.action_data,null,2)})]}),$.action_reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作推理"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.action_reasoning=="string"?$.action_reasoning:JSON.stringify($.action_reasoning)})]})]})]},A))})]}),e.jsx(la,{}),L.raw_output&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"原始输出"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整原始输出"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.raw_output})})]})]}),L.prompt&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"完整提示词"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整提示词"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function Wk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=mN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(!1),[z,M]=u.useState(1),[S,F]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Yk();p($)}catch($){console.error("加载回复器总览失败:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Jk(d.chat_id,z,S,R||void 0);b($)}catch($){console.error("加载聊天日志失败:",$)}finally{w(!1)}},[d,z,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),hN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const Q=$=>{m($),M(1),H(""),X(""),c("chat-logs")},B=()=>{c("overview"),m(null),b(null),H(""),X("")},ue=()=>{H(O),M(1)},Y=()=>{X(""),H(""),M(1)},we=async($,A)=>{try{ge(!0),je(!0);const K=await Xk($,A);me(K)}catch(K){console.error("加载回复详情失败:",K)}finally{ge(!1)}},fe=$=>{F(Number($)),M(1)},Ee=()=>{const $=parseInt(E),A=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=A&&(M($),C(""))},G=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"回复总数"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_replies||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"聊天列表"}),e.jsx(Ns,{children:"点击查看该聊天的所有回复记录"})]}),e.jsx(ze,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:$.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",xN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",j?.total||0," 条回复记录"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"回复生成记录"}),e.jsx(Ns,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{placeholder:"搜索提示词内容...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx($t,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:"清除"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10条/页"}),e.jsx(W,{value:"20",children:"20条/页"}),e.jsx(W,{value:"50",children:"50条/页"}),e.jsx(W,{value:"100",children:"100条/页"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(ze,{children:y?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-20 w-full"},A))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>we($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Zo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[$.success?e.jsxs(Ce,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(Mg,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(Ce,{variant:"destructive",className:"text-xs",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"失败"]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:$.model}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[$.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.output_preview||"无输出内容"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",j.total," 条记录,第 ",z," / ",G," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:z===1,children:e.jsx(Pa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ne,{type:"number",min:1,max:G,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Ee(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ee,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[z,"/",G]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(G,$+1)),disabled:z===G,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(G),disabled:z===G,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无回复记录"})})]})]})}),e.jsx(Qs,{open:Ne,onOpenChange:je,children:e.jsxs(Hs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Ua,{className:"h-5 w-5"}),"回复生成详情"]}),e.jsx(at,{children:"查看麦麦的详细回复生成过程"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ce?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(da,{className:"h-4 w-4"}),"基本信息"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"时间戳"}),e.jsx("div",{className:"text-sm",children:Zo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"状态"}),L.success?e.jsxs(Ce,{variant:"default",className:"bg-green-600",children:[e.jsx(Mg,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(Ce,{variant:"destructive",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"失败"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"思考深度"}),e.jsxs(Ce,{variant:"outline",children:["Level ",L.think_level]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(V1,{className:"h-4 w-4"}),"模型信息"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx(Ce,{variant:"secondary",className:"text-sm",children:L.model})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"提示词构建"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM 推理"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"总耗时"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),L.timing.timing_logs&&L.timing.timing_logs.length>0&&e.jsxs("div",{className:"mt-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"耗时详情"}),e.jsx("div",{className:"space-y-1",children:L.timing.timing_logs.map(($,A)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:$},A))})]}),L.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"近乎零耗时: "}),L.timing.almost_zero]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(hx,{className:"h-4 w-4"}),"回复输出"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.output||"无输出内容"})})]}),L.processed_output&&L.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"处理后的输出"}),e.jsx("div",{className:"space-y-2",children:L.processed_output.map(($,A)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$})},A))})]})]}),L.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"推理过程"}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning})})]})]}),L.error&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-destructive",children:"错误信息"}),e.jsx("div",{className:"p-4 bg-destructive/10 rounded-lg border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive whitespace-pre-wrap",children:L.error})})]})]}),L.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"完整提示词"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"点击展开查看完整提示词"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function eC(){const[a,l]=u.useState("planner"),[r,c]=u.useState(!1),[d,m]=u.useState(0),h=u.useCallback(()=>{m(f=>f+1)},[]);return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"计划器 & 回复器监控"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"实时监控麦麦的任务计划器和回复生成器运行状态"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:r?"default":"outline",size:"sm",onClick:()=>c(!r),children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),r?"自动刷新中":"自动刷新"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs(Jt,{value:a,onValueChange:f=>l(f),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"planner",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(nx,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"计划器监控"})]}),e.jsxs(Xe,{value:"replier",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(G1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"回复器监控"})]})]}),e.jsxs(ts,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ss,{value:"planner",className:"mt-0",children:e.jsx(Zk,{autoRefresh:r,refreshKey:d})}),e.jsx(Ss,{value:"replier",className:"mt-0",children:e.jsx(Wk,{autoRefresh:r,refreshKey:d})})]})]})]})}const sC="Mai-with-u",tC="plugin-repo",aC="main",lC="plugin_details.json";async function nC(){try{const a=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:sC,repo:tC,branch:aC,file_path:lC})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success||!l.data)throw new Error(l.error||"获取插件列表失败");return JSON.parse(l.data).filter(d=>!d?.id||!d?.manifest?(console.warn("跳过无效插件数据:",d),!1):!d.manifest.name||!d.manifest.version?(console.warn("跳过缺少必需字段的插件:",d.id),!1):!0).map(d=>({id:d.id,manifest:{manifest_version:d.manifest.manifest_version||1,name:d.manifest.name,version:d.manifest.version,description:d.manifest.description||"",author:d.manifest.author||{name:"Unknown"},license:d.manifest.license||"Unknown",host_application:d.manifest.host_application||{min_version:"0.0.0"},homepage_url:d.manifest.homepage_url,repository_url:d.manifest.repository_url,keywords:d.manifest.keywords||[],categories:d.manifest.categories||[],default_locale:d.manifest.default_locale||"zh-CN",locales_path:d.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(a){throw console.error("Failed to fetch plugin list:",a),a}}async function fN(){try{const a=await ke("/api/webui/plugins/git-status");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to check Git status:",a),{installed:!1,error:"无法检测 Git 安装状态"}}}async function pN(){try{const a=await ke("/api/webui/plugins/version");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to get Maimai version:",a),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function gN(a,l,r){const c=a.split(".").map(f=>parseInt(f)||0),d=c[0]||0,m=c[1]||0,h=c[2]||0;if(r.version_majorparseInt(j)||0),p=f[0]||0,g=f[1]||0,N=f[2]||0;if(r.version_major>p||r.version_major===p&&r.version_minor>g||r.version_major===p&&r.version_minor===g&&r.version_patch>N)return!1}return!0}async function rC(){try{const a=await ke("/api/webui/ws-token");if(!a.ok)return console.error("获取 WebSocket token 失败:",a.status),null;const l=await a.json();return l.success&&l.token?l.token:null}catch(a){return console.error("获取 WebSocket token 失败:",a),null}}async function iC(a,l){const r=await rC();if(!r)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=`${c}//${d}/api/webui/ws/plugin-progress?token=${encodeURIComponent(r)}`;try{const h=new WebSocket(m);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);a(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),l?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function Il(){try{const a=await ke("/api/webui/plugins/installed",{headers:Zs()});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success)throw new Error(l.message||"获取已安装插件列表失败");return l.plugins||[]}catch(a){return console.error("Failed to get installed plugins:",a),[]}}function bn(a,l){return l.some(r=>r.id===a)}function yn(a,l){const r=l.find(c=>c.id===a);if(r)return r.manifest?.version||r.version}async function jN(a,l,r="main"){const c=await ke("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"安装失败")}return await c.json()}async function vN(a){const l=await ke("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"卸载失败")}return await l.json()}async function NN(a,l,r="main"){const c=await ke("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"更新失败")}return await c.json()}async function cC(a){const l=await ke(`/api/webui/plugins/config/${a}/schema`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function oC(a){const l=await ke(`/api/webui/plugins/config/${a}`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function dC(a){const l=await ke(`/api/webui/plugins/config/${a}/raw`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function uC(a,l){const r=await ke(`/api/webui/plugins/config/${a}`,{method:"PUT",headers:Zs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"保存配置失败")}return await r.json()}async function mC(a,l){const r=await ke(`/api/webui/plugins/config/${a}/raw`,{method:"PUT",headers:Zs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"保存配置失败")}return await r.json()}async function xC(a){const l=await ke(`/api/webui/plugins/config/${a}/reset`,{method:"POST",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"重置配置失败")}return await l.json()}async function hC(a){const l=await ke(`/api/webui/plugins/config/${a}/toggle`,{method:"POST",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"切换状态失败")}return await l.json()}const Nc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function bN(a){try{const l=await fetch(`${Nc}/stats/${a}`);return l.ok?await l.json():(console.error("Failed to fetch plugin stats:",l.statusText),null)}catch(l){return console.error("Error fetching plugin stats:",l),null}}async function fC(a,l){try{const r=l||Ax(),c=await fetch(`${Nc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function pC(a,l){try{const r=l||Ax(),c=await fetch(`${Nc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function gC(a,l,r,c){if(l<1||l>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const d=c||Ax(),m=await fetch(`${Nc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,rating:l,comment:r,user_id:d})}),h=await m.json();return m.status===429?{success:!1,error:"每天最多评分 3 次"}:m.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(d){return console.error("Error rating plugin:",d),{success:!1,error:"网络错误"}}}async function yN(a){try{const l=await fetch(`${Nc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a})}),r=await l.json();return l.status===429?(console.warn("Download recording rate limited"),{success:!0}):l.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(l){return console.error("Error recording download:",l),{success:!1,error:"网络错误"}}}function jC(){const a=navigator,l=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,a.deviceMemory||0].join("|");let r=0;for(let c=0;c{const Z=J.map(async De=>{try{const xe=await bN(De.id);return{id:De.id,stats:xe}}catch(xe){return console.warn(`Failed to load stats for ${De.id}:`,xe),{id:De.id,stats:null}}}),Le=await Promise.all(Z),le={};Le.forEach(({id:De,stats:xe})=>{xe&&(le[De]=xe)}),L(le)};u.useEffect(()=>{let J=null,Z=!1;return(async()=>{if(J=await iC(le=>{Z||(C(le),le.stage==="success"?setTimeout(()=>{Z||C(null)},2e3):le.stage==="error"&&(w(!1),M(le.error||"加载失败")))},le=>{console.error("WebSocket error:",le),Z||fe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(le=>{if(!J){le();return}const De=()=>{J&&J.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),le()):J&&J.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),le()):setTimeout(De,100)};De()}),!Z){const le=await fN();F(le),le.installed||fe({title:"Git 未安装",description:le.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!Z){const le=await pN();H(le)}if(!Z)try{w(!0),M(null);const le=await nC();if(!Z){const De=await Il();O(De);const xe=le.map(Me=>{const ds=bn(Me.id,De),Ts=yn(Me.id,De);return{...Me,installed:ds,installed_version:Ts}});for(const Me of De)!xe.some(Ts=>Ts.id===Me.id)&&Me.manifest&&xe.push({id:Me.id,manifest:{manifest_version:Me.manifest.manifest_version||1,name:Me.manifest.name,version:Me.manifest.version,description:Me.manifest.description||"",author:Me.manifest.author,license:Me.manifest.license||"Unknown",host_application:Me.manifest.host_application,homepage_url:Me.manifest.homepage_url,repository_url:Me.manifest.repository_url,keywords:Me.manifest.keywords||[],categories:Me.manifest.categories||[],default_locale:Me.manifest.default_locale||"zh-CN",locales_path:Me.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Me.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(xe),Ee(xe)}}catch(le){if(!Z){const De=le instanceof Error?le.message:"加载插件列表失败";M(De),fe({title:"加载失败",description:De,variant:"destructive"})}}finally{Z||w(!1)}})(),()=>{Z=!0,J&&J.close()}},[fe]);const G=J=>{if(!J.installed&&R&&!$(J))return e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ut,{className:"h-3 w-3"}),"不兼容"]});if(J.installed){const Z=J.installed_version?.trim(),Le=J.manifest.version?.trim();if(Z!==Le){const le=Z?.split(".").map(Number)||[0,0,0],De=Le?.split(".").map(Number)||[0,0,0];for(let xe=0;xe<3;xe++){if((De[xe]||0)>(le[xe]||0))return e.jsxs(Ce,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Ut,{className:"h-3 w-3"}),"可更新"]});if((De[xe]||0)<(le[xe]||0))break}}return e.jsxs(Ce,{variant:"default",className:"gap-1",children:[e.jsx(st,{className:"h-3 w-3"}),"已安装"]})}return null},$=J=>!R||!J.manifest?.host_application?!0:gN(J.manifest.host_application.min_version,J.manifest.host_application.max_version,R),A=J=>{if(!J.installed||!J.installed_version||!J.manifest?.version)return!1;const Z=J.installed_version.trim(),Le=J.manifest.version.trim();if(Z===Le)return!1;const le=Z.split(".").map(Number),De=Le.split(".").map(Number);for(let xe=0;xe<3;xe++){if((De[xe]||0)>(le[xe]||0))return!0;if((De[xe]||0)<(le[xe]||0))return!1}return!1},K=j.filter(J=>{if(!J.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",J.id),!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(xe=>xe.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m);let le=!0;f==="installed"?le=J.installed===!0:f==="updates"&&(le=J.installed===!0&&A(J));const De=!g||!R||$(J);return Z&&Le&&le&&De}),Re=J=>{if(!S?.installed){fe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(R&&!$(J)){fe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}ce(J),pe("main"),Q(""),ue("preset"),we(!1),Ne(!0)},se=async()=>{if(!je)return;const J=B==="custom"?D:ge;if(!J||J.trim()===""){fe({title:"分支名称不能为空",variant:"destructive"});return}try{Ne(!1),await jN(je.id,je.manifest.repository_url||"",J),yN(je.id).catch(Le=>{console.warn("Failed to record download:",Le)}),fe({title:"安装成功",description:`${je.manifest.name} 已成功安装`});const Z=await Il();O(Z),b(Le=>Le.map(le=>{if(le.id===je.id){const De=bn(le.id,Z),xe=yn(le.id,Z);return{...le,installed:De,installed_version:xe}}return le}))}catch(Z){fe({title:"安装失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}finally{ce(null)}},$e=async J=>{try{await vN(J.id),fe({title:"卸载成功",description:`${J.manifest.name} 已成功卸载`});const Z=await Il();O(Z),b(Le=>Le.map(le=>{if(le.id===J.id){const De=bn(le.id,Z),xe=yn(le.id,Z);return{...le,installed:De,installed_version:xe}}return le}))}catch(Z){fe({title:"卸载失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},cs=async J=>{if(!S?.installed){fe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const Z=await NN(J.id,J.manifest.repository_url||"","main");fe({title:"更新成功",description:`${J.manifest.name} 已从 ${Z.old_version} 更新到 ${Z.new_version}`});const Le=await Il();O(Le),b(le=>le.map(De=>{if(De.id===J.id){const xe=bn(De.id,Le),Me=yn(De.id,Le);return{...De,installed:xe,installed_version:Me}}return De}))}catch(Z){fe({title:"更新失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>l(),disabled:r,children:[e.jsx(hv,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{onClick:()=>a({to:"/plugin-mirrors"}),children:[e.jsx(K1,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(Te,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(ze,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["安装、卸载或更新插件后,需要",e.jsx("span",{className:"font-semibold",children:"重启麦麦"}),"才能使更改生效"]})]})})}),S&&!S.installed&&e.jsxs(Te,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(Ns,{className:"text-orange-800 dark:text-orange-200",children:S.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(ze,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索插件...",value:c,onChange:J=>d(J.target.value),className:"pl-9"})]}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Be,{className:"w-full sm:w-[200px]",children:e.jsx(Fe,{placeholder:"选择分类"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"全部分类"}),e.jsx(W,{value:"Group Management",children:"群组管理"}),e.jsx(W,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(W,{value:"Utility Tools",children:"实用工具"}),e.jsx(W,{value:"Content Generation",children:"内容生成"}),e.jsx(W,{value:"Multimedia",children:"多媒体"}),e.jsx(W,{value:"External Integration",children:"外部集成"}),e.jsx(W,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(W,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"compatible-only",checked:g,onCheckedChange:J=>N(J===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),e.jsx(Jt,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"all",children:["全部插件 (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),le=!g||!R||$(J);return Z&&Le&&le}).length,")"]}),e.jsxs(Xe,{value:"installed",children:["已安装 (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),le=!g||!R||$(J);return J.installed&&Z&&Le&&le}).length,")"]}),e.jsxs(Xe,{value:"updates",children:["可更新 (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),le=!g||!R||$(J);return J.installed&&A(J)&&Z&&Le&&le}).length,")"]})]})}),E&&E.stage==="loading"&&E.operation==="fetch"&&e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"加载插件列表"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),e.jsx(tr,{value:E.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.message}),E.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",E.loaded_plugins," / ",E.total_plugins," 个插件"]})]})}),E&&E.stage==="error"&&E.error&&e.jsx(Te,{className:"border-destructive bg-destructive/10",children:e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(Ns,{className:"text-destructive/80",children:E.error})]})]})})}),y?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):z?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Lt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:z}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):K.length===0?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx($t,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c||m!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:K.map(J=>e.jsxs(Te,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Ue,{className:"text-xl",children:J.manifest?.name||J.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[J.manifest?.categories&&J.manifest.categories[0]&&e.jsx(Ce,{variant:"secondary",className:"text-xs whitespace-nowrap",children:vC[J.manifest.categories[0]]||J.manifest.categories[0]}),G(J)]})]}),e.jsx(Ns,{className:"line-clamp-2",children:J.manifest?.description||"无描述"})]}),e.jsx(ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:(X[J.id]?.downloads??J.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(X[J.id]?.rating??J.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[J.manifest?.keywords&&J.manifest.keywords.slice(0,3).map(Z=>e.jsx(Ce,{variant:"outline",className:"text-xs",children:Z},Z)),J.manifest?.keywords&&J.manifest.keywords.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",J.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",J.manifest?.version||"unknown"," · ",J.manifest?.author?.name||"Unknown"]}),J.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[J.manifest.host_application.min_version,J.manifest.host_application.max_version?` - ${J.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(od,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>a({to:"/plugin-detail",search:{pluginId:J.id}}),children:"查看详情"}),J.installed?A(J)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>cs(J),children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>$e(J),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||E?.operation==="install"||R!==null&&!$(J),title:S?.installed?R!==null&&!$(J)?`不兼容当前版本 (需要 ${J.manifest?.host_application?.min_version||"未知"}${J.manifest?.host_application?.max_version?` - ${J.manifest.host_application.max_version}`:"+"},当前 ${R?.version})`:void 0:"Git 未安装",onClick:()=>Re(J),children:[e.jsx(na,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===J.id?"安装中...":"安装"]})]})}),E&&(E.stage==="loading"||E.stage==="success"||E.stage==="error")&&E.operation!=="fetch"&&E.plugin_id===J.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${E.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":E.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.stage==="loading"?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):E.stage==="success"?e.jsx(st,{className:"h-3 w-3 text-green-600"}):e.jsx(Ut,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":E.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:E.stage==="loading"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"正在安装",E.operation==="uninstall"&&"正在卸载",E.operation==="update"&&"正在更新"]}):E.stage==="success"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装完成",E.operation==="uninstall"&&"卸载完成",E.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装失败",E.operation==="uninstall"&&"卸载失败",E.operation==="update"&&"更新失败"]})})]}),E.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[E.progress,"%"]})]}),E.stage!=="error"&&e.jsx(tr,{value:E.progress,className:`h-1.5 ${E.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${E.stage==="success"?"text-green-600 dark:text-green-400 truncate":E.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:E.stage==="error"?E.error||E.message||"操作失败":E.message})]})})]},J.id))}),e.jsx(Qs,{open:me,onOpenChange:Ne,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"安装插件"}),e.jsxs(at,{children:["安装 ",je?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",je?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof je?.manifest.author=="string"?je.manifest.author:je?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"advanced-options",checked:Y,onCheckedChange:J=>we(J)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),Y&&e.jsx("div",{className:"space-y-4 p-4 border rounded-lg",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"分支选择"}),e.jsxs(Jt,{value:B,onValueChange:J=>ue(J),children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(Xe,{value:"custom",className:"text-xs",children:"自定义分支"})]}),B==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Pe,{value:ge,onValueChange:pe,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"选择分支"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"main",children:"main (默认)"}),e.jsx(W,{value:"master",children:"master"}),e.jsx(W,{value:"dev",children:"dev (开发版)"}),e.jsx(W,{value:"develop",children:"develop"}),e.jsx(W,{value:"beta",children:"beta (测试版)"}),e.jsx(W,{value:"stable",children:"stable (稳定版)"})]})]})}),B==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:D,onChange:J=>Q(J.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!Y&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>Ne(!1),children:"取消"}),e.jsxs(_,{onClick:se,children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(nr,{})]})})}function yC(){return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(fv,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(ts,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Te,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Oe,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(xa,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Ue,{className:"text-2xl",children:"功能开发中"}),e.jsx(Ns,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"📦 即将推出的功能:"}),e.jsxs("ul",{className:"space-y-2 ml-6",children:[e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"浏览社区共享的模型分配预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"一键下载和应用预设配置"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"分享自己的模型分配方案"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"预设配置评分和评论系统"})]}),e.jsxs("li",{className:"flex items-start",children:[e.jsx("span",{className:"mr-2",children:"•"}),e.jsx("span",{children:"根据使用场景智能推荐配置"})]})]})]})})]})})})]})}function wC({field:a,value:l,onChange:r}){const[c,d]=u.useState(!1);switch(a.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:a.label}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]}),e.jsx(Ge,{checked:!!l,onCheckedChange:r,disabled:a.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ne,{type:"number",value:l??a.default,onChange:m=>r(parseFloat(m.target.value)||0),min:a.min,max:a.max,step:a.step??1,placeholder:a.placeholder,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:a.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:l??a.default})]}),e.jsx(el,{value:[l??a.default],onValueChange:m=>r(m[0]),min:a.min??0,max:a.max??100,step:a.step??1,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs(Pe,{value:String(l??a.default),onValueChange:r,disabled:a.disabled,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder??"请选择"})}),e.jsx(Ie,{children:a.choices?.map(m=>e.jsx(W,{value:String(m),children:String(m)},String(m)))})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(pt,{value:l??a.default,onChange:m=>r(m.target.value),placeholder:a.placeholder,rows:a.rows??3,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{type:c?"text":"password",value:l??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,disabled:a.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>d(!c),children:c?e.jsx(ic,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(TS,{value:Array.isArray(l)?l:[],onChange:m=>r(m),itemType:a.item_type??"string",itemFields:a.item_fields,minItems:a.min_items,maxItems:a.max_items,disabled:a.disabled,placeholder:a.placeholder}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ne,{type:"text",value:l??a.default??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,maxLength:a.max_length,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]})}}function lj({section:a,config:l,onChange:r}){const[c,d]=u.useState(!a.collapsed),m=Object.entries(a.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(xc,{open:c,onOpenChange:d,children:e.jsxs(Te,{children:[e.jsx(hc,{asChild:!0,children:e.jsxs(Oe,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ue,{className:"text-lg",children:a.title})]}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[m.length," 项"]})]}),a.description&&e.jsx(Ns,{className:"ml-6",children:a.description})]})}),e.jsx(fc,{children:e.jsx(ze,{className:"space-y-4 pt-0",children:m.map(([h,f])=>e.jsx(wC,{field:f,value:l[a.name]?.[h],onChange:p=>r(a.name,h,p),sectionName:a.name},h))})})]})})}function _C({plugin:a,onBack:l}){const{toast:r}=nt(),{triggerRestart:c,isRestarting:d}=Tn(),[m,h]=u.useState("visual"),[f,p]=u.useState(null),[g,N]=u.useState({}),[j,b]=u.useState({}),[y,w]=u.useState(""),[z,M]=u.useState(""),[S,F]=u.useState(!0),[E,C]=u.useState(!1),[R,H]=u.useState(!1),[O,X]=u.useState(!1),[L,me]=u.useState(!1),Ne=u.useCallback(async()=>{F(!0);try{const[B,ue,Y]=await Promise.all([cC(a.id),oC(a.id),dC(a.id)]);p(B),N(ue),b(JSON.parse(JSON.stringify(ue))),w(Y),M(Y)}catch(B){r({title:"加载配置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{F(!1)}},[a.id,r]);u.useEffect(()=>{Ne()},[Ne]),u.useEffect(()=>{H(m==="visual"?JSON.stringify(g)!==JSON.stringify(j):y!==z)},[g,j,y,z,m]);const je=(B,ue,Y)=>{N(we=>({...we,[B]:{...we[B]||{},[ue]:Y}}))},ce=async()=>{C(!0);try{if(m==="source"){try{_x(y)}catch(B){X(!0),r({title:"TOML 格式错误",description:B instanceof Error?B.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),C(!1);return}await mC(a.id,y),M(y),X(!1)}else await uC(a.id,g),b(JSON.parse(JSON.stringify(g)));r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(B){r({title:"保存失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{C(!1)}},ge=async()=>{try{await xC(a.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),me(!1),Ne()}catch(B){r({title:"重置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}},pe=async()=>{try{const B=await hC(a.id);r({title:B.message,description:B.note}),Ne()}catch(B){r({title:"切换状态失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}};if(S)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Ut,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:l,variant:"outline",children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"返回"]})]});const D=Object.values(f.sections).sort((B,ue)=>B.order-ue.order),Q=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:l,children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||a.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Ce,{variant:Q?"default":"secondary",children:Q?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||a.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(m==="visual"?"source":"visual"),children:m==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(dx,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(uv,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:d,children:[e.jsx(hv,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:pe,children:[e.jsx(pc,{className:"h-4 w-4 mr-2"}),Q?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>me(!0),children:[e.jsx(rc,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:ce,disabled:!R||E,children:[E?e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(gc,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),R&&e.jsx(Te,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(ze,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),m==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(Qv,{value:y,onChange:B=>{w(B),O&&X(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),m==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(Jt,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Gt,{children:f.layout.tabs.map(B=>e.jsxs(Xe,{value:B.id,children:[B.title,B.badge&&e.jsx(Ce,{variant:"secondary",className:"ml-2 text-xs",children:B.badge})]},B.id))}),f.layout.tabs.map(B=>e.jsx(Ss,{value:B.id,className:"space-y-4 mt-4",children:B.sections.map(ue=>{const Y=f.sections[ue];return Y?e.jsx(lj,{section:Y,config:g,onChange:je},ue):null})},B.id))]}):e.jsx("div",{className:"space-y-4",children:D.map(B=>e.jsx(lj,{section:B,config:g,onChange:je},B.name))})]}),e.jsx(Qs,{open:L,onOpenChange:me,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"确认重置配置"}),e.jsx(at,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>me(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:ge,children:"确认重置"})]})]})})]})}function SC(){return e.jsx(lr,{children:e.jsx(kC,{})})}function kC(){const{toast:a}=nt(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState(null),g=async()=>{d(!0);try{const w=await Il();r(w)}catch(w){a({title:"加载插件列表失败",description:w instanceof Error?w.message:"未知错误",variant:"destructive"})}finally{d(!1)}};u.useEffect(()=>{g()},[]);const j=l.filter(w=>{const z=m.toLowerCase();return w.id.toLowerCase().includes(z)||w.manifest.name.toLowerCase().includes(z)||w.manifest.description?.toLowerCase().includes(z)}).filter((w,z,M)=>z===M.findIndex(S=>S.id===w.id)),b=l.length,y=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(ts,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(_C,{plugin:f,onBack:()=>p(null)})})}),e.jsx(nr,{})]}):e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(xa,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"正在加载...":"个插件"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"已启用"}),e.jsx(st,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Ut,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:y}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索插件...",value:m,onChange:w=>h(w.target.value),className:"pl-9"})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"已安装的插件"}),e.jsx(Ns,{children:"点击插件查看和编辑配置"})]}),e.jsx(ze,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(xa,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:m?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(w=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(w),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(xa,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:w.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",w.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:w.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(Sn,{className:"h-4 w-4"})}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]})]},w.id))})})]})]})})}function CC(){const a=ha(),{toast:l}=nt(),[r,c]=u.useState([]),[d,m]=u.useState(!0),[h,f]=u.useState(null),[p,g]=u.useState(null),[N,j]=u.useState(!1),[b,y]=u.useState(!1),[w,z]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M=u.useCallback(async()=>{try{m(!0),f(null);const O=await ke("/api/webui/plugins/mirrors");if(!O.ok)throw new Error("获取镜像源列表失败");const X=await O.json();c(X.mirrors||[])}catch(O){const X=O instanceof Error?O.message:"加载镜像源失败";f(X),l({title:"加载失败",description:X,variant:"destructive"})}finally{m(!1)}},[l]);u.useEffect(()=>{M()},[M]);const S=async()=>{try{const O=await ke("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(w)});if(!O.ok){const X=await O.json();throw new Error(X.detail||"添加镜像源失败")}l({title:"添加成功",description:"镜像源已添加"}),j(!1),z({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M()}catch(O){l({title:"添加失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},F=async()=>{if(p)try{if(!(await ke(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("更新镜像源失败");l({title:"更新成功",description:"镜像源已更新"}),y(!1),g(null),M()}catch(O){l({title:"更新失败",description:O instanceof Error?O.message:"未知错误",variant:"destructive"})}},E=async O=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await ke(`/api/webui/plugins/mirrors/${O}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");l({title:"删除成功",description:"镜像源已删除"}),M()}catch(X){l({title:"删除失败",description:X instanceof Error?X.message:"未知错误",variant:"destructive"})}},C=async O=>{try{if(!(await ke(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({enabled:!O.enabled})})).ok)throw new Error("更新状态失败");M()}catch(X){l({title:"更新失败",description:X instanceof Error?X.message:"未知错误",variant:"destructive"})}},R=O=>{g(O),z({id:O.id,name:O.name,raw_prefix:O.raw_prefix,clone_prefix:O.clone_prefix,enabled:O.enabled,priority:O.priority}),y(!0)},H=async(O,X)=>{const L=X==="up"?O.priority-1:O.priority+1;if(!(L<1))try{if(!(await ke(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");M()}catch(me){l({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),e.jsxs(_,{onClick:()=>j(!0),children:[e.jsx(Xs,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),d?e.jsx(Te,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Lt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(_,{onClick:M,children:"重新加载"})]})}):e.jsxs(Te,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"状态"}),e.jsx(ns,{children:"名称"}),e.jsx(ns,{children:"ID"}),e.jsx(ns,{children:"优先级"}),e.jsx(ns,{className:"text-right",children:"操作"})]})}),e.jsx(Gl,{children:r.map(O=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})}),e.jsx(Ze,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:O.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",O.raw_prefix]})]})}),e.jsx(Ze,{children:e.jsx(Ce,{variant:"outline",children:O.id})}),e.jsx(Ze,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:O.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Xr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"down"),children:e.jsx(Ba,{className:"h-3 w-3"})})]})]})}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>R(O),children:e.jsx(Zn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>E(O.id),children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(O=>e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:O.name}),O.enabled&&e.jsx(Ce,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Ce,{variant:"outline",className:"mt-1 text-xs",children:O.id})]}),e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:O.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:O.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>R(O),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Xr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"down"),children:e.jsx(Ba,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>E(O.id),children:e.jsx(os,{className:"h-4 w-4"})})]})]})},O.id))})]}),e.jsx(Qs,{open:N,onOpenChange:j,children:e.jsxs(Hs,{className:"max-w-lg",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"添加镜像源"}),e.jsx(at,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(ne,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:O=>z({...w,id:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ne,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:O=>z({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ne,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:O=>z({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ne,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:O=>z({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ne,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:O=>z({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"add-enabled",checked:w.enabled,onCheckedChange:O=>z({...w,enabled:O})}),e.jsx(T,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"取消"}),e.jsx(_,{onClick:S,children:"添加"})]})]})}),e.jsx(Qs,{open:b,onOpenChange:y,children:e.jsxs(Hs,{className:"max-w-lg",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"编辑镜像源"}),e.jsx(at,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"镜像源 ID"}),e.jsx(ne,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ne,{id:"edit-name",value:w.name,onChange:O=>z({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ne,{id:"edit-raw",value:w.raw_prefix,onChange:O=>z({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ne,{id:"edit-clone",value:w.clone_prefix,onChange:O=>z({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ne,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:O=>z({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit-enabled",checked:w.enabled,onCheckedChange:O=>z({...w,enabled:O})}),e.jsx(T,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>y(!1),children:"取消"}),e.jsx(_,{onClick:F,children:"保存"})]})]})})]})})}function TC({pluginId:a,compact:l=!1}){const[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(0),[p,g]=u.useState(""),[N,j]=u.useState(!1),{toast:b}=nt(),y=async()=>{m(!0);const S=await bN(a);S&&c(S),m(!1)};u.useEffect(()=>{y()},[a]);const w=async()=>{const S=await fC(a);S.success?(b({title:"已点赞",description:"感谢你的支持!"}),y()):b({title:"点赞失败",description:S.error||"未知错误",variant:"destructive"})},z=async()=>{const S=await pC(a);S.success?(b({title:"已反馈",description:"感谢你的反馈!"}),y()):b({title:"操作失败",description:S.error||"未知错误",variant:"destructive"})},M=async()=>{if(h===0){b({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const S=await gC(a,h,p||void 0);S.success?(b({title:"评分成功",description:"感谢你的评价!"}),j(!1),f(0),g(""),y()):b({title:"评分失败",description:S.error||"未知错误",variant:"destructive"})};return d?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?l?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${r.downloads.toLocaleString()}`,children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${r.rating.toFixed(1)} (${r.rating_count} 条评价)`,children:[e.jsx(vn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${r.likes}`,children:[e.jsx(Mm,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(na,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(vn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Mm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Ag,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(Mm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:z,children:[e.jsx(Ag,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Qs,{open:N,onOpenChange:j,children:[e.jsx(dd,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(vn,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"为插件评分"}),e.jsx(at,{children:"分享你的使用体验,帮助其他用户"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(S=>e.jsx("button",{onClick:()=>f(S),className:"focus:outline-none",children:e.jsx(vn,{className:`h-8 w-8 transition-colors ${S<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},S))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h===0&&"点击星星进行评分",h===1&&"很差",h===2&&"一般",h===3&&"还行",h===4&&"不错",h===5&&"非常好"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),e.jsx(pt,{value:p,onChange:S=>g(S.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"取消"}),e.jsx(_,{onClick:M,disabled:h===0,children:"提交评分"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((S,F)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(E=>e.jsx(vn,{className:`h-3 w-3 ${E<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},E))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(S.created_at).toLocaleDateString()})]}),S.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:S.comment})]},F))})]})]}):null}const EC={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function MC(){const a=ha(),l=lw({strict:!1}),{toast:r}=nt(),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState(!0),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(null),[z,M]=u.useState(null),[S,F]=u.useState(!1),[E,C]=u.useState(),[R,H]=u.useState(!1);u.useEffect(()=>{(async()=>{if(!l.pluginId){b("缺少插件 ID"),p(!1);return}try{p(!0),b(null);const ge=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:"Mai-with-u",repo:"plugin-repo",branch:"main",file_path:"plugin_details.json"})});if(!ge.ok)throw new Error("获取插件列表失败");const pe=await ge.json();if(!pe.success||!pe.data)throw new Error(pe.error||"获取插件列表失败");const Q=JSON.parse(pe.data).find(fe=>fe.id===l.pluginId);if(!Q)throw new Error("未找到该插件");const B={id:Q.id,manifest:Q.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};d(B);const[ue,Y,we]=await Promise.all([fN(),pN(),Il()]);w(ue),M(Y),F(bn(l.pluginId,we)),C(yn(l.pluginId,we))}catch(ge){b(ge instanceof Error?ge.message:"加载失败")}finally{p(!1)}})()},[l.pluginId]),u.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{if(N(!0),S&&l.pluginId)try{const Y=await ke(`/api/webui/plugins/local-readme/${l.pluginId}`);if(Y.ok){const we=await Y.json();if(we.success&&we.data){h(we.data),N(!1);return}}}catch(Y){console.log("本地 README 获取失败,尝试远程获取:",Y)}const ge=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!ge){h("无法解析仓库地址");return}const[,pe,D]=ge,Q=D.replace(/\.git$/,""),B=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:pe,repo:Q,branch:"main",file_path:"README.md"})});if(!B.ok)throw new Error("获取 README 失败");const ue=await B.json();ue.success&&ue.data?h(ue.data):h("该插件暂无 README 文档")}catch(ge){console.error("加载 README 失败:",ge),h("加载 README 失败")}finally{N(!1)}})()},[c,S,l.pluginId]);const O=()=>!c||!S||!E?!1:E!==c.manifest.version,X=()=>!c||!z?!0:gN(c.manifest.host_application.min_version,c.manifest.host_application.max_version,z),L=async()=>{if(!(!c||!y?.installed))try{H(!0),await jN(c.id,c.manifest.repository_url||"","main"),yN(c.id).catch(ge=>{console.warn("Failed to record download:",ge)}),r({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const ce=await Il();F(bn(c.id,ce)),C(yn(c.id,ce))}catch(ce){r({title:"安装失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{H(!1)}},me=async()=>{if(c)try{H(!0),await vN(c.id),r({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const ce=await Il();F(bn(c.id,ce)),C(yn(c.id,ce))}catch(ce){r({title:"卸载失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{H(!1)}},Ne=async()=>{if(!(!c||!y?.installed))try{H(!0);const ce=await NN(c.id,c.manifest.repository_url||"","main");r({title:"更新成功",description:`${c.manifest.name} 已从 ${ce.old_version} 更新到 ${ce.new_version}`});const ge=await Il();F(bn(c.id,ge)),C(yn(c.id,ge))}catch(ce){r({title:"更新失败",description:ce instanceof Error?ce.message:"未知错误",variant:"destructive"})}finally{H(!1)}};if(f)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(j||!c)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ut,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:j}),e.jsx(_,{onClick:()=>a({to:"/plugins"}),children:"返回插件列表"})]})})]});const je=X();return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),className:"shrink-0",children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:c.manifest.name})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:S?e.jsxs(e.Fragment,{children:[O()?e.jsx(_,{disabled:!y?.installed||R,onClick:Ne,title:y?.installed?void 0:"Git 未安装",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(_,{variant:"destructive",disabled:!y?.installed||R,onClick:me,title:y?.installed?void 0:"Git 未安装",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"卸载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"卸载"]})})]}):e.jsx(_,{disabled:!y?.installed||!je||R,onClick:L,title:y?.installed?je?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${z?.version})`:"Git 未安装",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(ts,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(Te,{children:e.jsx(Oe,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(Ue,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),S&&e.jsxs(Ce,{variant:"default",className:"text-sm",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"已安装 ",E&&`(v${E})`]}),O()&&e.jsxs(Ce,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(dt,{className:"h-3 w-3 mr-1"}),"可更新"]}),!je&&e.jsxs(Ce,{variant:"destructive",className:"text-sm",children:[e.jsx(Ut,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(Ns,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"统计信息"})}),e.jsx(ze,{children:e.jsx(TC,{pluginId:c.id})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"基本信息"})}),e.jsx(ze,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Fl,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"作者:"}),e.jsx("span",{className:"font-medium",children:c.manifest.author?.name||"Unknown"}),c.manifest.author?.url&&e.jsx("a",{href:c.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.jsx(Io,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(xa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"版本:"}),e.jsxs("span",{className:"font-medium",children:["v",c.manifest.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ov,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"许可证:"}),e.jsx("span",{className:"font-medium",children:c.manifest.license})]}),c.manifest.homepage_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Go,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"主页:"}),e.jsxs("a",{href:c.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["访问",e.jsx(Io,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Q1,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"仓库:"}),e.jsxs("a",{href:c.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["GitHub",e.jsx(Io,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm mb-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"支持版本:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - 最新版本"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"分类与标签"})}),e.jsxs(ze,{className:"space-y-4",children:[c.manifest.categories&&c.manifest.categories.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"分类"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.categories.map(ce=>e.jsx(Ce,{variant:"secondary",children:EC[ce]||ce},ce))})]}),c.manifest.keywords&&c.manifest.keywords.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"标签"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.keywords.map(ce=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(cd,{className:"h-3 w-3 mr-1"}),ce]},ce))})]})]})]})]}),e.jsxs(Te,{className:"lg:col-span-2",children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"插件说明"})}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载说明文档中..."})]}):m?e.jsx(bx,{content:m}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const ec=u.forwardRef(({className:a,...l},r)=>e.jsx(Aj,{ref:r,className:P("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...l}));ec.displayName=Aj.displayName;const AC=u.forwardRef(({className:a,...l},r)=>e.jsx(zj,{ref:r,className:P("aspect-square h-full w-full",a),...l}));AC.displayName=zj.displayName;const sc=u.forwardRef(({className:a,...l},r)=>e.jsx(Rj,{ref:r,className:P("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...l}));sc.displayName=Rj.displayName;function zC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function RC(){const a="maibot_webui_user_id";let l=localStorage.getItem(a);return l||(l=zC(),localStorage.setItem(a,l)),l}function DC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function OC(a){localStorage.setItem("maibot_webui_user_name",a)}const wN="maibot_webui_virtual_tabs";function LC(){try{const a=localStorage.getItem(wN);if(a)return JSON.parse(a)}catch(a){console.error("[Chat] 加载虚拟标签页失败:",a)}return[]}function nj(a){try{localStorage.setItem(wN,JSON.stringify(a))}catch(l){console.error("[Chat] 保存虚拟标签页失败:",l)}}function UC({segment:a}){switch(a.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(a.data)});case"image":case"emoji":return e.jsx("img",{src:String(a.data),alt:a.type==="emoji"?"表情包":"图片",className:P("rounded-lg max-w-full",a.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:l=>{const r=l.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${a.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(a.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(a.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(a.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(a.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",a.original_type||"未知消息","]"]})}}function $C({message:a,isBot:l}){return a.message_type==="rich"&&a.segments&&a.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:a.segments.map((r,c)=>e.jsx(UC,{segment:r},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:a.content})}function BC(){const a={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},l=()=>{const Ke=LC().map(He=>{const Je=He.virtualConfig;return!Je.groupId&&Je.platform&&Je.userId&&(Je.groupId=`webui_virtual_group_${Je.platform}_${Je.userId}`),{id:He.id,type:"virtual",label:He.label,virtualConfig:Je,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[a,...Ke]},[r,c]=u.useState(l),[d,m]=u.useState("webui-default"),h=r.find(V=>V.id===d)||r[0],[f,p]=u.useState(""),[g,N]=u.useState(!1),[j,b]=u.useState(!0),[y,w]=u.useState(DC()),[z,M]=u.useState(!1),[S,F]=u.useState(""),[E,C]=u.useState(!1),[R,H]=u.useState([]),[O,X]=u.useState([]),[L,me]=u.useState(!1),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(""),[pe,D]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Q=u.useRef(RC()),B=u.useRef(new Map),ue=u.useRef(null),Y=u.useRef(new Map),we=u.useRef(0),fe=u.useRef(new Map),{toast:Ee}=nt(),G=V=>(we.current+=1,`${V}-${Date.now()}-${we.current}-${Math.random().toString(36).substr(2,9)}`),$=u.useCallback((V,Ke)=>{c(He=>He.map(Je=>Je.id===V?{...Je,...Ke}:Je))},[]),A=u.useCallback((V,Ke)=>{c(He=>He.map(Je=>Je.id===V?{...Je,messages:[...Je.messages,Ke]}:Je))},[]),K=u.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{K()},[h?.messages,K]);const Re=u.useCallback(async()=>{me(!0);try{const V=await ke("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",V.status,V.headers.get("content-type")),V.ok){const Ke=V.headers.get("content-type");if(Ke&&Ke.includes("application/json")){const He=await V.json();console.log("[Chat] 平台列表数据:",He),H(He.platforms||[])}else{const He=await V.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",He.substring(0,200)),Ee({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",V.status),Ee({title:"获取平台失败",description:`服务器返回错误: ${V.status}`,variant:"destructive"})}catch(V){console.error("[Chat] 获取平台列表失败:",V),Ee({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{me(!1)}},[Ee]),se=u.useCallback(async(V,Ke)=>{je(!0);try{const He=new URLSearchParams;V&&He.append("platform",V),Ke&&He.append("search",Ke),He.append("limit","50");const Je=await ke(`/api/chat/persons?${He.toString()}`);if(Je.ok){const Es=Je.headers.get("content-type");if(Es&&Es.includes("application/json")){const ms=await Je.json();X(ms.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(He){console.error("[Chat] 获取用户列表失败:",He)}finally{je(!1)}},[]);u.useEffect(()=>{pe.platform&&se(pe.platform,ce)},[pe.platform,ce,se]);const $e=u.useCallback(async(V,Ke)=>{b(!0);try{const He=new URLSearchParams;He.append("user_id",Q.current),He.append("limit","50"),Ke&&He.append("group_id",Ke);const Je=`/api/chat/history?${He.toString()}`;console.log("[Chat] 正在加载历史消息:",Je);const Es=await ke(Je);if(Es.ok){const ms=await Es.text();try{const Ms=JSON.parse(ms);if(Ms.messages&&Ms.messages.length>0){const We=Ms.messages.map(rs=>({id:rs.id,type:rs.type,content:rs.content,timestamp:rs.timestamp,sender:{name:rs.sender_name||(rs.is_bot?"麦麦":"WebUI用户"),user_id:rs.user_id,is_bot:rs.is_bot}}));$(V,{messages:We});const Cs=fe.current.get(V)||new Set;We.forEach(rs=>{if(rs.type==="bot"){const is=`bot-${rs.content}-${Math.floor(rs.timestamp*1e3)}`;Cs.add(is)}}),fe.current.set(V,Cs)}}catch(Ms){console.error("[Chat] JSON 解析失败:",Ms)}}}catch(He){console.error("[Chat] 加载历史消息失败:",He)}finally{b(!1)}},[$]),cs=u.useCallback(async(V,Ke,He)=>{const Je=B.current.get(V);if(Je?.readyState===WebSocket.OPEN||Je?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${V}] WebSocket 已存在,跳过连接`);return}N(!0);let Es=null;try{const Cs=await ke("/api/webui/ws-token");if(Cs.ok){const rs=await Cs.json();if(rs.success&&rs.token)Es=rs.token;else{console.warn(`[Tab ${V}] 获取 WebSocket token 失败: ${rs.message||"未登录"}`),N(!1);return}}}catch(Cs){console.error(`[Tab ${V}] 获取 WebSocket token 失败:`,Cs),N(!1);return}if(!Es){N(!1);return}const ms=window.location.protocol==="https:"?"wss:":"ws:",Ms=new URLSearchParams;Ms.append("token",Es),Ke==="virtual"&&He?(Ms.append("user_id",He.userId),Ms.append("user_name",He.userName),Ms.append("platform",He.platform),Ms.append("person_id",He.personId),Ms.append("group_name",He.groupName||"WebUI虚拟群聊"),He.groupId&&Ms.append("group_id",He.groupId)):(Ms.append("user_id",Q.current),Ms.append("user_name",y));const We=`${ms}//${window.location.host}/api/chat/ws?${Ms.toString()}`;console.log(`[Tab ${V}] 正在连接 WebSocket:`,We);try{const Cs=new WebSocket(We);B.current.set(V,Cs),Cs.onopen=()=>{$(V,{isConnected:!0}),N(!1),console.log(`[Tab ${V}] WebSocket 已连接`)},Cs.onmessage=rs=>{try{const is=JSON.parse(rs.data);switch(is.type){case"session_info":$(V,{sessionInfo:{session_id:is.session_id,user_id:is.user_id,user_name:is.user_name,bot_name:is.bot_name}});break;case"system":A(V,{id:G("sys"),type:"system",content:is.content||"",timestamp:is.timestamp||Date.now()/1e3});break;case"user_message":{const ys=is.sender?.user_id,rt=Ke==="virtual"&&He?He.userId:Q.current;console.log(`[Tab ${V}] 收到 user_message, sender: ${ys}, current: ${rt}`);const jt=ys?ys.replace(/^webui_user_/,""):"",Ae=rt?rt.replace(/^webui_user_/,""):"";if(jt&&Ae&&jt===Ae){console.log(`[Tab ${V}] 跳过自己的消息(user_id 匹配)`);break}const Qe=fe.current.get(V)||new Set,As=`user-${is.content}-${Math.floor((is.timestamp||0)*1e3)}`;if(Qe.has(As)){console.log(`[Tab ${V}] 跳过自己的消息(内容去重)`);break}if(Qe.add(As),fe.current.set(V,Qe),Qe.size>100){const mt=Qe.values().next().value;mt&&Qe.delete(mt)}A(V,{id:is.message_id||G("user"),type:"user",content:is.content||"",timestamp:is.timestamp||Date.now()/1e3,sender:is.sender});break}case"bot_message":{$(V,{isTyping:!1});const ys=fe.current.get(V)||new Set,rt=`bot-${is.content}-${Math.floor((is.timestamp||0)*1e3)}`;if(ys.has(rt))break;if(ys.add(rt),fe.current.set(V,ys),ys.size>100){const jt=ys.values().next().value;jt&&ys.delete(jt)}c(jt=>jt.map(Ae=>{if(Ae.id!==V)return Ae;const Qe=Ae.messages.filter(mt=>mt.type!=="thinking"),As={id:G("bot"),type:"bot",content:is.content||"",message_type:is.message_type==="rich"?"rich":"text",segments:is.segments,timestamp:is.timestamp||Date.now()/1e3,sender:is.sender};return{...Ae,messages:[...Qe,As]}}));break}case"typing":$(V,{isTyping:is.is_typing||!1});break;case"error":c(ys=>ys.map(rt=>{if(rt.id!==V)return rt;const jt=rt.messages.filter(Ae=>Ae.type!=="thinking");return{...rt,messages:[...jt,{id:G("error"),type:"error",content:is.content||"发生错误",timestamp:is.timestamp||Date.now()/1e3}]}})),Ee({title:"错误",description:is.content,variant:"destructive"});break;case"pong":break;case"history":{const ys=is.messages||[];if(ys.length>0){const rt=fe.current.get(V)||new Set,jt=ys.map(Ae=>{const Qe=Ae.is_bot||!1,As=Ae.id||G(Qe?"bot":"user"),mt=`${Qe?"bot":"user"}-${Ae.content}-${Math.floor(Ae.timestamp*1e3)}`;return rt.add(mt),{id:As,type:Qe?"bot":"user",content:Ae.content,timestamp:Ae.timestamp,sender:{name:Ae.sender_name||(Qe?"麦麦":"用户"),user_id:Ae.sender_id,is_bot:Qe}}});fe.current.set(V,rt),$(V,{messages:jt}),console.log(`[Tab ${V}] 已加载 ${jt.length} 条历史消息`)}break}default:console.log("未知消息类型:",is.type)}}catch(is){console.error("解析消息失败:",is)}},Cs.onclose=()=>{$(V,{isConnected:!1}),N(!1),B.current.delete(V),console.log(`[Tab ${V}] WebSocket 已断开`);const rs=Y.current.get(V);rs&&clearTimeout(rs);const is=window.setTimeout(()=>{if(!J.current){const ys=r.find(rt=>rt.id===V);ys&&cs(V,ys.type,ys.virtualConfig)}},5e3);Y.current.set(V,is)},Cs.onerror=rs=>{console.error(`[Tab ${V}] WebSocket 错误:`,rs),N(!1)}}catch(Cs){console.error(`[Tab ${V}] 创建 WebSocket 失败:`,Cs),N(!1)}},[y,$,A,Ee,r]),J=u.useRef(!1);u.useEffect(()=>{J.current=!1;const V=B.current,Ke=Y.current,He=fe.current;$e("webui-default");const Je=setTimeout(()=>{J.current||(cs("webui-default","webui"),r.forEach(ms=>{ms.type==="virtual"&&ms.virtualConfig&&(He.set(ms.id,new Set),setTimeout(()=>{J.current||cs(ms.id,"virtual",ms.virtualConfig)},200))}))},100),Es=setInterval(()=>{V.forEach(ms=>{ms.readyState===WebSocket.OPEN&&ms.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{J.current=!0,clearTimeout(Je),clearInterval(Es),Ke.forEach(ms=>{clearTimeout(ms)}),Ke.clear(),V.forEach(ms=>{ms.close()}),V.clear()}},[]);const Z=u.useCallback(()=>{const V=B.current.get(d);if(!f.trim()||!V||V.readyState!==WebSocket.OPEN)return;const Ke=h?.type==="virtual"&&h.virtualConfig?.userName||y,He=f.trim(),Je=Date.now()/1e3;V.send(JSON.stringify({type:"message",content:He,user_name:Ke}));const Es=fe.current.get(d)||new Set,ms=`user-${He}-${Math.floor(Je*1e3)}`;if(Es.add(ms),fe.current.set(d,Es),Es.size>100){const Cs=Es.values().next().value;Cs&&Es.delete(Cs)}const Ms={id:G("user"),type:"user",content:He,timestamp:Je,sender:{name:Ke,is_bot:!1}};A(d,Ms);const We={id:G("thinking"),type:"thinking",content:"",timestamp:Je+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};A(d,We),p("")},[f,y,d,h,A]),Le=V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Z())},le=()=>{F(y),M(!0)},De=()=>{const V=S.trim()||"WebUI用户";w(V),OC(V),M(!1);const Ke=B.current.get(d);Ke?.readyState===WebSocket.OPEN&&Ke.send(JSON.stringify({type:"update_nickname",user_name:V}))},xe=()=>{F(""),M(!1)},Me=V=>new Date(V*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),ds=()=>{const V=B.current.get(d);V&&(V.close(),B.current.delete(d)),cs(d,h?.type||"webui",h?.virtualConfig)},Ts=()=>{D({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ge(""),Re(),C(!0)},Ct=()=>{if(!pe.platform||!pe.personId){Ee({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const V=`webui_virtual_group_${pe.platform}_${pe.userId}`,Ke=`virtual-${pe.platform}-${pe.userId}-${Date.now()}`,He=pe.userName||pe.userId,Je={id:Ke,type:"virtual",label:He,virtualConfig:{...pe,groupId:V},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Es=>{const ms=[...Es,Je],Ms=ms.filter(We=>We.type==="virtual"&&We.virtualConfig).map(We=>({id:We.id,label:We.label,virtualConfig:We.virtualConfig,createdAt:Date.now()}));return nj(Ms),ms}),m(Ke),C(!1),fe.current.set(Ke,new Set),setTimeout(()=>{cs(Ke,"virtual",pe)},100),Ee({title:"虚拟身份标签页",description:`已创建 ${He} 的对话`})},ia=(V,Ke)=>{if(Ke?.stopPropagation(),V==="webui-default")return;const He=B.current.get(V);He&&(He.close(),B.current.delete(V));const Je=Y.current.get(V);Je&&(clearTimeout(Je),Y.current.delete(V)),fe.current.delete(V),c(Es=>{const ms=Es.filter(We=>We.id!==V),Ms=ms.filter(We=>We.type==="virtual"&&We.virtualConfig).map(We=>({id:We.id,label:We.label,virtualConfig:We.virtualConfig,createdAt:Date.now()}));return nj(Ms),ms}),d===V&&m("webui-default")},ut=V=>{m(V)},Is=V=>{D(Ke=>({...Ke,personId:V.person_id,userId:V.user_id,userName:V.nickname||V.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Qs,{open:E,onOpenChange:C,children:e.jsxs(Hs,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Am,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(at,{children:"选择一个麦麦已认识的用户,以该用户的身份与麦麦对话。麦麦将使用她对该用户的记忆和认知来回应。"})]}),e.jsxs("div",{className:"space-y-4 flex-1 overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(Go,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Pe,{value:pe.platform,onValueChange:V=>{D(Ke=>({...Ke,platform:V,personId:"",userId:"",userName:""})),X([])},children:[e.jsx(Be,{disabled:L,children:e.jsx(Fe,{placeholder:L?"加载中...":"选择平台"})}),e.jsx(Ie,{children:R.map(V=>e.jsxs(W,{value:V.platform,children:[V.platform," (",V.count," 人)"]},V.platform))})]})]}),pe.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(oc,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索用户名...",value:ce,onChange:V=>ge(V.target.value),className:"pl-9"})]}),e.jsx(ts,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:Ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):O.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(oc,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:O.map(V=>e.jsxs("button",{onClick:()=>Is(V),className:P("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",pe.personId===V.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(ec,{className:"h-8 w-8 shrink-0",children:e.jsx(sc,{className:P("text-xs",pe.personId===V.person_id?"bg-primary-foreground/20":"bg-muted"),children:(V.nickname||V.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:V.nickname||V.person_name}),e.jsxs("div",{className:P("text-xs truncate",pe.personId===V.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",V.user_id,V.is_known&&" · 已认识"]})]})]},V.person_id))})})})]}),pe.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"虚拟群名(可选)"}),e.jsx(ne,{placeholder:"WebUI虚拟群聊",value:pe.groupName,onChange:V=>D(Ke=>({...Ke,groupName:V.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(gt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>C(!1),children:"取消"}),e.jsx(_,{onClick:Ct,disabled:!pe.platform||!pe.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(V=>e.jsxs("div",{className:P("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",d===V.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>ut(V.id),children:[V.type==="webui"?e.jsx(Ia,{className:"h-3.5 w-3.5"}):e.jsx(Am,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:V.label}),e.jsx("span",{className:P("w-1.5 h-1.5 rounded-full",V.isConnected?"bg-green-500":"bg-muted-foreground/50")}),V.id!=="webui-default"&&e.jsx("span",{onClick:Ke=>ia(V.id,Ke),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&(Ke.preventDefault(),ia(V.id,Ke))},children:e.jsx(Sa,{className:"h-3 w-3"})})]},V.id)),e.jsx("button",{onClick:Ts,className:"flex items-center gap-1 px-2 py-1.5 rounded-md text-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"新建虚拟身份对话",children:e.jsx(Xs,{className:"h-3.5 w-3.5"})})]})})}),e.jsx("div",{className:"shrink-0 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(ec,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(sc,{className:"bg-primary/10 text-primary",children:e.jsx(Yn,{className:"h-4 w-4 sm:h-5 sm:w-5"})})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-base sm:text-lg font-semibold truncate",children:h?.sessionInfo.bot_name||"麦麦"}),e.jsx("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:h?.isConnected?e.jsxs(e.Fragment,{children:[e.jsx(Y1,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(J1,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"未连接"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j&&e.jsx(Fs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ds,disabled:g,title:"重新连接",children:e.jsx(dt,{className:P("h-4 w-4",g&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:h?.type==="virtual"&&h.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(Am,{className:"h-3 w-3 text-primary"}),e.jsx("span",{children:"虚拟身份:"}),e.jsx("span",{className:"font-medium text-primary",children:h.virtualConfig.userName}),e.jsxs("span",{className:"text-xs",children:["(",h.virtualConfig.platform,")"]}),h.virtualConfig.groupName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1",children:"·"}),e.jsxs("span",{className:"text-xs",children:["群:",h.virtualConfig.groupName]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Fl,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),z?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:S,onChange:V=>F(V.target.value),onKeyDown:V=>{V.key==="Enter"&&De(),V.key==="Escape"&&xe()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:De,children:"保存"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:xe,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:le,title:"修改昵称",children:e.jsx(X1,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!j&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Yn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(V=>e.jsxs("div",{className:P("flex gap-2 sm:gap-3",V.type==="user"&&"flex-row-reverse",V.type==="system"&&"justify-center",V.type==="error"&&"justify-center"),children:[V.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:V.content}),V.type==="error"&&e.jsx("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 px-3 py-1 rounded-full max-w-[90%]",children:V.content}),V.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(ec,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(sc,{className:"bg-primary/10 text-primary",children:e.jsx(Yn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:"flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",children:[e.jsx("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:e.jsx("span",{className:"hidden sm:inline",children:V.sender?.name||h?.sessionInfo.bot_name})}),e.jsx("div",{className:"bg-muted rounded-2xl rounded-tl-sm px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"思考中..."})]})})]})]}),(V.type==="user"||V.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(ec,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(sc,{className:P("text-xs",V.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:V.type==="bot"?e.jsx(Yn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Fl,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:P("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",V.type==="user"&&"items-end"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] sm:text-xs text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:V.sender?.name||(V.type==="bot"?h?.sessionInfo.bot_name:y)}),e.jsx("span",{children:Me(V.timestamp)})]}),e.jsx("div",{className:P("rounded-2xl px-3 py-2 text-sm break-words",V.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx($C,{message:V,isBot:V.type==="bot"})})]})]})]},V.id)),e.jsx("div",{ref:ue})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:f,onChange:V=>p(V.target.value),onKeyDown:Le,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:Z,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Z1,{className:"h-4 w-4"})})]})})})]})}var zx="Radio",[IC,_N]=ld(zx),[PC,FC]=IC(zx),SN=u.forwardRef((a,l)=>{const{__scopeRadio:r,name:c,checked:d=!1,required:m,disabled:h,value:f="on",onCheck:p,form:g,...N}=a,[j,b]=u.useState(null),y=nd(l,M=>b(M)),w=u.useRef(!1),z=j?g||!!j.closest("form"):!0;return e.jsxs(PC,{scope:r,checked:d,disabled:h,children:[e.jsx(ar.button,{type:"button",role:"radio","aria-checked":d,"data-state":EN(d),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:y,onClick:_n(a.onClick,M=>{d||p?.(),z&&(w.current=M.isPropagationStopped(),w.current||M.stopPropagation())})}),z&&e.jsx(TN,{control:j,bubbles:!w.current,name:c,value:f,checked:d,required:m,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});SN.displayName=zx;var kN="RadioIndicator",CN=u.forwardRef((a,l)=>{const{__scopeRadio:r,forceMount:c,...d}=a,m=FC(kN,r);return e.jsx(b1,{present:c||m.checked,children:e.jsx(ar.span,{"data-state":EN(m.checked),"data-disabled":m.disabled?"":void 0,...d,ref:l})})});CN.displayName=kN;var HC="RadioBubbleInput",TN=u.forwardRef(({__scopeRadio:a,control:l,checked:r,bubbles:c=!0,...d},m)=>{const h=u.useRef(null),f=nd(h,m),p=y1(r),g=w1(l);return u.useEffect(()=>{const N=h.current;if(!N)return;const j=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(j,"checked").set;if(p!==r&&y){const w=new Event("click",{bubbles:c});y.call(N,r),N.dispatchEvent(w)}},[p,r,c]),e.jsx(ar.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...d,tabIndex:-1,ref:f,style:{...d.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});TN.displayName=HC;function EN(a){return a?"checked":"unchecked"}var qC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gd="RadioGroup",[VC]=ld(gd,[Dj,_N]),MN=Dj(),AN=_N(),[GC,KC]=VC(gd),zN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,name:c,defaultValue:d,value:m,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:N=!0,onValueChange:j,...b}=a,y=MN(r),w=Wj(g),[z,M]=ad({prop:m,defaultProp:d??null,onChange:j,caller:gd});return e.jsx(GC,{scope:r,name:c,required:h,disabled:f,value:z,onValueChange:M,children:e.jsx(Rw,{asChild:!0,...y,orientation:p,dir:w,loop:N,children:e.jsx(ar.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:w,...b,ref:l})})})});zN.displayName=gd;var RN="RadioGroupItem",DN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,disabled:c,...d}=a,m=KC(RN,r),h=m.disabled||c,f=MN(r),p=AN(r),g=u.useRef(null),N=nd(l,g),j=m.value===d.value,b=u.useRef(!1);return u.useEffect(()=>{const y=z=>{qC.includes(z.key)&&(b.current=!0)},w=()=>b.current=!1;return document.addEventListener("keydown",y),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",y),document.removeEventListener("keyup",w)}},[]),e.jsx(Dw,{asChild:!0,...f,focusable:!h,active:j,children:e.jsx(SN,{disabled:h,required:m.required,checked:j,...p,...d,name:m.name,ref:N,onCheck:()=>m.onValueChange(d.value),onKeyDown:_n(y=>{y.key==="Enter"&&y.preventDefault()}),onFocus:_n(d.onFocus,()=>{b.current&&g.current?.click()})})})});DN.displayName=RN;var QC="RadioGroupIndicator",ON=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,...c}=a,d=AN(r);return e.jsx(CN,{...d,...c,ref:l})});ON.displayName=QC;var LN=zN,UN=DN,YC=ON;const Rx=u.forwardRef(({className:a,...l},r)=>e.jsx(LN,{className:P("grid gap-2",a),...l,ref:r}));Rx.displayName=LN.displayName;const Wo=u.forwardRef(({className:a,...l},r)=>e.jsx(UN,{ref:r,className:P("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...l,children:e.jsx(YC,{className:"flex items-center justify-center",children:e.jsx(Vo,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Wo.displayName=UN.displayName;function JC({question:a,value:l,onChange:r,error:c,disabled:d=!1}){const[m,h]=u.useState(null),f=d||a.readOnly,p=()=>{switch(a.type){case"single":return e.jsx(Rx,{value:l||"",onValueChange:r,disabled:f,className:"space-y-2",children:a.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{value:g.value,id:`${a.id}-${g.id}`}),e.jsx(T,{htmlFor:`${a.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=l||[];return e.jsxs("div",{className:"space-y-2",children:[a.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:`${a.id}-${N.id}`,checked:g.includes(N.value),disabled:f||a.maxSelections!==void 0&&g.length>=a.maxSelections&&!g.includes(N.value),onCheckedChange:j=>{r(j?[...g,N.value]:g.filter(b=>b!==N.value))}}),e.jsx(T,{htmlFor:`${a.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),a.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",a.maxSelections," 项"]})]})}case"text":return e.jsx(ne,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"请输入...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,className:P(a.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(pt,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"请输入...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,rows:4,className:P(a.readOnly&&"bg-muted cursor-not-allowed")}),a.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(l||"").length," / ",a.maxLength]})]});case"rating":{const g=l||0,N=m!==null?m:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(j=>e.jsx("button",{type:"button",disabled:f,className:P("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(j),onMouseLeave:()=>h(null),onClick:()=>!f&&r(j),children:e.jsx(vn,{className:P("h-6 w-6 transition-colors",j<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},j)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=a.min??1,N=a.max??10,j=a.step??1,b=l??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(el,{value:[b],onValueChange:([y])=>r(y),min:g,max:N,step:j,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:b}),e.jsx("span",{children:a.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Pe,{value:l||"",onValueChange:r,disabled:f,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder||"请选择..."})}),e.jsx(Ie,{children:a.options?.map(g=>e.jsx(W,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-base font-medium",children:[a.title,a.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const $N="https://maibot-plugin-stats.maibot-webui.workers.dev";function BN(){const a="maibot_user_id";let l=localStorage.getItem(a);if(!l){const r=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),d=Math.random().toString(36).substring(2,10);l=`fp_${r}_${c}_${d}`,localStorage.setItem(a,l)}return l}async function XC(a,l,r,c){try{const d=c?.userId||BN(),m={surveyId:a,surveyVersion:l,userId:d,answers:r,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${$N}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),f=await h.json();return h.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:h.status===409?{success:!1,error:f.error||"你已经提交过这份问卷了"}:h.ok?{success:!0,submissionId:f.submissionId,message:f.message}:{success:!1,error:f.error||"提交失败"}}catch(d){return console.error("Error submitting survey:",d),{success:!1,error:"网络错误"}}}async function ZC(a,l){try{const r=l||BN(),c=new URLSearchParams({user_id:r,survey_id:a}),d=await fetch(`${$N}/survey/check?${c}`);return d.ok?{success:!0,hasSubmitted:(await d.json()).hasSubmitted}:{success:!1,error:(await d.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function IN({config:a,initialAnswers:l,onSubmitSuccess:r,onSubmitError:c,showProgress:d=!0,paginateQuestions:m=!1,className:h}){const f=u.useCallback(()=>!l||l.length===0?{}:l.reduce((B,ue)=>(B[ue.questionId]=ue.value,B),{}),[l]),[p,g]=u.useState(()=>f()),[N,j]=u.useState({}),[b,y]=u.useState(0),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(null),[C,R]=u.useState(null),[H,O]=u.useState(!1),[X,L]=u.useState(!0);u.useEffect(()=>{l&&l.length>0&&g(B=>({...B,...f()}))},[l,f]),u.useEffect(()=>{(async()=>{if(!a.settings?.allowMultiple){const ue=await ZC(a.id);ue.success&&ue.hasSubmitted&&O(!0)}L(!1)})()},[a.id,a.settings?.allowMultiple]);const me=u.useCallback(()=>{const B=new Date;return!(a.settings?.startTime&&new Date(a.settings.startTime)>B||a.settings?.endTime&&new Date(a.settings.endTime){const ue=p[B.id];return ue==null?!1:Array.isArray(ue)?ue.length>0:typeof ue=="string"?ue.trim()!=="":!0}).length,je=Ne/a.questions.length*100,ce=u.useCallback((B,ue)=>{g(Y=>({...Y,[B]:ue})),j(Y=>{const we={...Y};return delete we[B],we})},[]),ge=u.useCallback(()=>{const B={};for(const ue of a.questions){if(ue.required){const Y=p[ue.id];if(Y==null){B[ue.id]="此题为必填项";continue}if(Array.isArray(Y)&&Y.length===0){B[ue.id]="请至少选择一项";continue}if(typeof Y=="string"&&Y.trim()===""){B[ue.id]="此题为必填项";continue}}ue.minLength&&typeof p[ue.id]=="string"&&p[ue.id].length{if(!ge()){if(m){const B=a.questions.findIndex(ue=>N[ue.id]);B>=0&&y(B)}return}z(!0),E(null);try{const B=a.questions.filter(Y=>p[Y.id]!==void 0).map(Y=>({questionId:Y.id,value:p[Y.id]})),ue=await XC(a.id,a.version,B,{allowMultiple:a.settings?.allowMultiple});if(ue.success&&ue.submissionId)S(!0),R(ue.submissionId),r?.(ue.submissionId);else{const Y=ue.error||"提交失败";E(Y),c?.(Y)}}catch(B){const ue=B instanceof Error?B.message:"提交失败";E(ue),c?.(ue)}finally{z(!1)}},[ge,m,a,p,N,r,c]),D=u.useCallback(B=>{B>=0&&Be.jsxs("div",{className:P("p-4 rounded-lg border bg-card",N[B.id]?"border-destructive bg-destructive/5":"border-border"),children:[m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",b+1," / ",a.questions.length]}),!m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[ue+1,"."]}),e.jsx(JC,{question:B,value:p[B.id],onChange:Y=>ce(B.id,Y),error:N[B.id],disabled:w})]},B.id)),F&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:F})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:m?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>D(b-1),disabled:b===0||w,children:[e.jsx(Pa,{className:"h-4 w-4 mr-1"}),"上一题"]}),b===a.questions.length-1?e.jsxs(_,{onClick:pe,disabled:w,children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>D(b+1),disabled:w,children:["下一题",e.jsx(ra,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(N).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(N).length," 个必填项未完成"]})}),e.jsxs(_,{onClick:pe,disabled:w,size:"lg",children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const WC={id:"webui-feedback-v1",version:"1.0.0",title:"麦麦 WebUI 使用反馈问卷",description:"感谢您使用麦麦 WebUI!您的反馈将帮助我们不断改进产品体验。",questions:[{id:"webui_version",type:"text",title:"你正在使用的 WebUI 版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"ui_design_satisfaction",type:"single",title:"你觉得当前的 WebUI 界面设计如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"problems_encountered",type:"multiple",title:"你在使用 WebUI 时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"lag",label:"界面卡顿",value:"lag"},{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"complex",label:"操作复杂",value:"complex"},{id:"bugs",label:"存在 Bug",value:"bugs"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"useful_features",type:"textarea",title:"你觉得哪些功能是最有用的?",required:!0,placeholder:"请分享你认为最有价值的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦 WebUI 的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦 WebUI 给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},e3={id:"maibot-feedback-v1",version:"1.0.0",title:"麦麦使用体验反馈问卷",description:"感谢您使用麦麦!您的反馈将帮助我们打造更好的 AI 伙伴。",questions:[{id:"maibot_version",type:"text",title:"你正在使用的麦麦版本",description:"此项由系统自动填写",required:!0,readOnly:!0,placeholder:"自动检测中..."},{id:"improvement_areas",type:"textarea",title:"你认为麦麦还有哪些部分可以改进?",required:!0,placeholder:"请分享你认为可以改进的方面...",maxLength:1e3},{id:"problems_encountered",type:"multiple",title:"你在使用麦麦时遇到过哪些问题?",description:"可多选",required:!0,options:[{id:"incomplete",label:"功能不完整",value:"incomplete"},{id:"slow_response",label:"响应速度慢",value:"slow_response"},{id:"complex",label:"操作复杂",value:"complex"},{id:"unstable",label:"运行不稳定",value:"unstable"},{id:"config_difficult",label:"配置困难",value:"config_difficult"},{id:"none",label:"没有遇到问题",value:"none"},{id:"other",label:"其他",value:"other"}]},{id:"problems_other",type:"text",title:'如选择"其他",请说明遇到的问题',required:!1,placeholder:"请描述你遇到的其他问题...",maxLength:500},{id:"helpful_features",type:"textarea",title:"你觉得麦麦的哪些功能对你最有帮助?",required:!0,placeholder:"请分享对你最有帮助的功能...",maxLength:1e3},{id:"feature_requests",type:"textarea",title:"你希望在未来的版本中增加哪些功能?",required:!0,placeholder:"请告诉我们你期望的新功能...",maxLength:1e3},{id:"overall_satisfaction",type:"single",title:"你对麦麦的整体满意度如何?",required:!0,options:[{id:"very_satisfied",label:"非常满意",value:"very_satisfied"},{id:"satisfied",label:"满意",value:"satisfied"},{id:"neutral",label:"一般",value:"neutral"},{id:"dissatisfied",label:"不满意",value:"dissatisfied"},{id:"very_dissatisfied",label:"非常不满意",value:"very_dissatisfied"}]},{id:"would_recommend",type:"single",title:"你愿意推荐麦麦给其他人使用吗?",required:!0,options:[{id:"yes",label:"是",value:"yes"},{id:"no",label:"否",value:"no"}]},{id:"other_suggestions",type:"textarea",title:"其他建议或意见",description:"此项为选填",required:!1,placeholder:"如果你有任何其他想法或建议,请在此分享...",maxLength:2e3}],settings:{allowMultiple:!1,thankYouMessage:"感谢你的反馈!你的意见对麦麦的成长非常重要,我们会认真考虑每一条建议。"}};function s3(){const[a,l]=u.useState(!0),r=u.useMemo(()=>JSON.parse(JSON.stringify(WC)),[]);u.useEffect(()=>{l(!1)},[]);const c=u.useMemo(()=>[{questionId:"webui_version",value:`v${ud}`}],[]),d=u.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),m=u.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(pv,{className:"h-8 w-8",strokeWidth:2}),"WebUI 使用反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们持续改进产品体验"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(IN,{config:r,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:d,onSubmitError:m})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ht,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function t3(){const[a,l]=u.useState(null),[r,c]=u.useState(!0),[d,m]=u.useState("未知版本");u.useEffect(()=>{(async()=>{try{const j=await V_();m(j.version||"未知版本")}catch(j){console.error("Failed to get MaiBot version:",j),m("获取失败")}const N=JSON.parse(JSON.stringify(e3));l(N),c(!1)})()},[]);const h=u.useMemo(()=>[{questionId:"maibot_version",value:d}],[d]),f=u.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=u.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(pv,{className:"h-8 w-8",strokeWidth:2}),"麦麦使用体验反馈问卷"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"感谢您的反馈,帮助我们打造更好的 AI 伙伴"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(IN,{config:a,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ht,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}async function a3(a=2025){const l=await ke(`/api/webui/annual-report/full?year=${a}`);if(!l.ok){const r=await l.json();throw new Error(r.detail||"获取年度报告失败")}return l.json()}function l3(a,l){if(a.match(/^[a-z]+:\/\//i))return a;if(a.match(/^\/\//))return window.location.protocol+a;if(a.match(/^[a-z]+:/i))return a;const r=document.implementation.createHTMLDocument(),c=r.createElement("base"),d=r.createElement("a");return r.head.appendChild(c),r.body.appendChild(d),l&&(c.href=l),d.href=a,d.href}const n3=(()=>{let a=0;const l=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(a+=1,`u${l()}${a}`)})();function wn(a){const l=[];for(let r=0,c=a.length;rOa||a.height>Oa)&&(a.width>Oa&&a.height>Oa?a.width>a.height?(a.height*=Oa/a.width,a.width=Oa):(a.width*=Oa/a.height,a.height=Oa):a.width>Oa?(a.height*=Oa/a.width,a.width=Oa):(a.width*=Oa/a.height,a.height=Oa))}function sd(a){return new Promise((l,r)=>{const c=new Image;c.onload=()=>{c.decode().then(()=>{requestAnimationFrame(()=>l(c))})},c.onerror=r,c.crossOrigin="anonymous",c.decoding="async",c.src=a})}async function d3(a){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(a)).then(encodeURIComponent).then(l=>`data:image/svg+xml;charset=utf-8,${l}`)}async function u3(a,l,r){const c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg"),m=document.createElementNS(c,"foreignObject");return d.setAttribute("width",`${l}`),d.setAttribute("height",`${r}`),d.setAttribute("viewBox",`0 0 ${l} ${r}`),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("x","0"),m.setAttribute("y","0"),m.setAttribute("externalResourcesRequired","true"),d.appendChild(m),m.appendChild(a),d3(d)}const _a=(a,l)=>{if(a instanceof l)return!0;const r=Object.getPrototypeOf(a);return r===null?!1:r.constructor.name===l.name||_a(r,l)};function m3(a){const l=a.getPropertyValue("content");return`${a.cssText} content: '${l.replace(/'|"/g,"")}';`}function x3(a,l){return PN(l).map(r=>{const c=a.getPropertyValue(r),d=a.getPropertyPriority(r);return`${r}: ${c}${d?" !important":""};`}).join(" ")}function h3(a,l,r,c){const d=`.${a}:${l}`,m=r.cssText?m3(r):x3(r,c);return document.createTextNode(`${d}{${m}}`)}function rj(a,l,r,c){const d=window.getComputedStyle(a,r),m=d.getPropertyValue("content");if(m===""||m==="none")return;const h=n3();try{l.className=`${l.className} ${h}`}catch{return}const f=document.createElement("style");f.appendChild(h3(h,r,d,c)),l.appendChild(f)}function f3(a,l,r){rj(a,l,":before",r),rj(a,l,":after",r)}const ij="application/font-woff",cj="image/jpeg",p3={woff:ij,woff2:ij,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:cj,jpeg:cj,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g3(a){const l=/\.([^./]*?)$/g.exec(a);return l?l[1]:""}function Dx(a){const l=g3(a).toLowerCase();return p3[l]||""}function j3(a){return a.split(/,/)[1]}function ax(a){return a.search(/^(data:)/)!==-1}function v3(a,l){return`data:${l};base64,${a}`}async function HN(a,l,r){const c=await fetch(a,l);if(c.status===404)throw new Error(`Resource "${c.url}" not found`);const d=await c.blob();return new Promise((m,h)=>{const f=new FileReader;f.onerror=h,f.onloadend=()=>{try{m(r({res:c,result:f.result}))}catch(p){h(p)}},f.readAsDataURL(d)})}const Km={};function N3(a,l,r){let c=a.replace(/\?.*/,"");return r&&(c=a),/ttf|otf|eot|woff2?/i.test(c)&&(c=c.replace(/.*\//,"")),l?`[${l}]${c}`:c}async function Ox(a,l,r){const c=N3(a,l,r.includeQueryParams);if(Km[c]!=null)return Km[c];r.cacheBust&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let d;try{const m=await HN(a,r.fetchRequestInit,({res:h,result:f})=>(l||(l=h.headers.get("Content-Type")||""),j3(f)));d=v3(m,l)}catch(m){d=r.imagePlaceholder||"";let h=`Failed to fetch resource: ${a}`;m&&(h=typeof m=="string"?m:m.message),h&&console.warn(h)}return Km[c]=d,d}async function b3(a){const l=a.toDataURL();return l==="data:,"?a.cloneNode(!1):sd(l)}async function y3(a,l){if(a.currentSrc){const m=document.createElement("canvas"),h=m.getContext("2d");m.width=a.clientWidth,m.height=a.clientHeight,h?.drawImage(a,0,0,m.width,m.height);const f=m.toDataURL();return sd(f)}const r=a.poster,c=Dx(r),d=await Ox(r,c,l);return sd(d)}async function w3(a,l){var r;try{if(!((r=a?.contentDocument)===null||r===void 0)&&r.body)return await jd(a.contentDocument.body,l,!0)}catch{}return a.cloneNode(!1)}async function _3(a,l){return _a(a,HTMLCanvasElement)?b3(a):_a(a,HTMLVideoElement)?y3(a,l):_a(a,HTMLIFrameElement)?w3(a,l):a.cloneNode(qN(a))}const S3=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SLOT",qN=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SVG";async function k3(a,l,r){var c,d;if(qN(l))return l;let m=[];return S3(a)&&a.assignedNodes?m=wn(a.assignedNodes()):_a(a,HTMLIFrameElement)&&(!((c=a.contentDocument)===null||c===void 0)&&c.body)?m=wn(a.contentDocument.body.childNodes):m=wn(((d=a.shadowRoot)!==null&&d!==void 0?d:a).childNodes),m.length===0||_a(a,HTMLVideoElement)||await m.reduce((h,f)=>h.then(()=>jd(f,r)).then(p=>{p&&l.appendChild(p)}),Promise.resolve()),l}function C3(a,l,r){const c=l.style;if(!c)return;const d=window.getComputedStyle(a);d.cssText?(c.cssText=d.cssText,c.transformOrigin=d.transformOrigin):PN(r).forEach(m=>{let h=d.getPropertyValue(m);m==="font-size"&&h.endsWith("px")&&(h=`${Math.floor(parseFloat(h.substring(0,h.length-2)))-.1}px`),_a(a,HTMLIFrameElement)&&m==="display"&&h==="inline"&&(h="block"),m==="d"&&l.getAttribute("d")&&(h=`path(${l.getAttribute("d")})`),c.setProperty(m,h,d.getPropertyPriority(m))})}function T3(a,l){_a(a,HTMLTextAreaElement)&&(l.innerHTML=a.value),_a(a,HTMLInputElement)&&l.setAttribute("value",a.value)}function E3(a,l){if(_a(a,HTMLSelectElement)){const c=Array.from(l.children).find(d=>a.value===d.getAttribute("value"));c&&c.setAttribute("selected","")}}function M3(a,l,r){return _a(l,Element)&&(C3(a,l,r),f3(a,l,r),T3(a,l),E3(a,l)),l}async function A3(a,l){const r=a.querySelectorAll?a.querySelectorAll("use"):[];if(r.length===0)return a;const c={};for(let m=0;m_3(c,l)).then(c=>k3(a,c,l)).then(c=>M3(a,c,l)).then(c=>A3(c,l))}const VN=/url\((['"]?)([^'"]+?)\1\)/g,z3=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,R3=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function D3(a){const l=a.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${l})(['"]?\\))`,"g")}function O3(a){const l=[];return a.replace(VN,(r,c,d)=>(l.push(d),r)),l.filter(r=>!ax(r))}async function L3(a,l,r,c,d){try{const m=r?l3(l,r):l,h=Dx(l);let f;return d||(f=await Ox(m,h,c)),a.replace(D3(l),`$1${f}$3`)}catch{}return a}function U3(a,{preferredFontFormat:l}){return l?a.replace(R3,r=>{for(;;){const[c,,d]=z3.exec(r)||[];if(!d)return"";if(d===l)return`src: ${c};`}}):a}function GN(a){return a.search(VN)!==-1}async function KN(a,l,r){if(!GN(a))return a;const c=U3(a,r);return O3(c).reduce((m,h)=>m.then(f=>L3(f,h,l,r)),Promise.resolve(c))}async function Vr(a,l,r){var c;const d=(c=l.style)===null||c===void 0?void 0:c.getPropertyValue(a);if(d){const m=await KN(d,null,r);return l.style.setProperty(a,m,l.style.getPropertyPriority(a)),!0}return!1}async function $3(a,l){await Vr("background",a,l)||await Vr("background-image",a,l),await Vr("mask",a,l)||await Vr("-webkit-mask",a,l)||await Vr("mask-image",a,l)||await Vr("-webkit-mask-image",a,l)}async function B3(a,l){const r=_a(a,HTMLImageElement);if(!(r&&!ax(a.src))&&!(_a(a,SVGImageElement)&&!ax(a.href.baseVal)))return;const c=r?a.src:a.href.baseVal,d=await Ox(c,Dx(c),l);await new Promise((m,h)=>{a.onload=m,a.onerror=l.onImageErrorHandler?(...p)=>{try{m(l.onImageErrorHandler(...p))}catch(g){h(g)}}:h;const f=a;f.decode&&(f.decode=m),f.loading==="lazy"&&(f.loading="eager"),r?(a.srcset="",a.src=d):a.href.baseVal=d})}async function I3(a,l){const c=wn(a.childNodes).map(d=>QN(d,l));await Promise.all(c).then(()=>a)}async function QN(a,l){_a(a,Element)&&(await $3(a,l),await B3(a,l),await I3(a,l))}function P3(a,l){const{style:r}=a;l.backgroundColor&&(r.backgroundColor=l.backgroundColor),l.width&&(r.width=`${l.width}px`),l.height&&(r.height=`${l.height}px`);const c=l.style;return c!=null&&Object.keys(c).forEach(d=>{r[d]=c[d]}),a}const oj={};async function dj(a){let l=oj[a];if(l!=null)return l;const c=await(await fetch(a)).text();return l={url:a,cssText:c},oj[a]=l,l}async function uj(a,l){let r=a.cssText;const c=/url\(["']?([^"')]+)["']?\)/g,m=(r.match(/url\([^)]+\)/g)||[]).map(async h=>{let f=h.replace(c,"$1");return f.startsWith("https://")||(f=new URL(f,a.url).href),HN(f,l.fetchRequestInit,({result:p})=>(r=r.replace(h,`url(${p})`),[h,p]))});return Promise.all(m).then(()=>r)}function mj(a){if(a==null)return[];const l=[],r=/(\/\*[\s\S]*?\*\/)/gi;let c=a.replace(r,"");const d=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const p=d.exec(c);if(p===null)break;l.push(p[0])}c=c.replace(d,"");const m=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,h="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(h,"gi");for(;;){let p=m.exec(c);if(p===null){if(p=f.exec(c),p===null)break;m.lastIndex=f.lastIndex}else f.lastIndex=m.lastIndex;l.push(p[0])}return l}async function F3(a,l){const r=[],c=[];return a.forEach(d=>{if("cssRules"in d)try{wn(d.cssRules||[]).forEach((m,h)=>{if(m.type===CSSRule.IMPORT_RULE){let f=h+1;const p=m.href,g=dj(p).then(N=>uj(N,l)).then(N=>mj(N).forEach(j=>{try{d.insertRule(j,j.startsWith("@import")?f+=1:d.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:j,error:b})}})).catch(N=>{console.error("Error loading remote css",N.toString())});c.push(g)}})}catch(m){const h=a.find(f=>f.href==null)||document.styleSheets[0];d.href!=null&&c.push(dj(d.href).then(f=>uj(f,l)).then(f=>mj(f).forEach(p=>{h.insertRule(p,h.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",m)}}),Promise.all(c).then(()=>(a.forEach(d=>{if("cssRules"in d)try{wn(d.cssRules||[]).forEach(m=>{r.push(m)})}catch(m){console.error(`Error while reading CSS rules from ${d.href}`,m)}}),r))}function H3(a){return a.filter(l=>l.type===CSSRule.FONT_FACE_RULE).filter(l=>GN(l.style.getPropertyValue("src")))}async function q3(a,l){if(a.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=wn(a.ownerDocument.styleSheets),c=await F3(r,l);return H3(c)}function YN(a){return a.trim().replace(/["']/g,"")}function V3(a){const l=new Set;function r(c){(c.style.fontFamily||getComputedStyle(c).fontFamily).split(",").forEach(m=>{l.add(YN(m))}),Array.from(c.children).forEach(m=>{m instanceof HTMLElement&&r(m)})}return r(a),l}async function G3(a,l){const r=await q3(a,l),c=V3(a);return(await Promise.all(r.filter(m=>c.has(YN(m.style.fontFamily))).map(m=>{const h=m.parentStyleSheet?m.parentStyleSheet.href:null;return KN(m.cssText,h,l)}))).join(` -`)}async function K3(a,l){const r=l.fontEmbedCSS!=null?l.fontEmbedCSS:l.skipFonts?null:await G3(a,l);if(r){const c=document.createElement("style"),d=document.createTextNode(r);c.appendChild(d),a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)}}async function Q3(a,l={}){const{width:r,height:c}=FN(a,l),d=await jd(a,l,!0);return await K3(d,l),await QN(d,l),P3(d,l),await u3(d,r,c)}async function Y3(a,l={}){const{width:r,height:c}=FN(a,l),d=await Q3(a,l),m=await sd(d),h=document.createElement("canvas"),f=h.getContext("2d"),p=l.pixelRatio||c3(),g=l.canvasWidth||r,N=l.canvasHeight||c;return h.width=g*p,h.height=N*p,l.skipAutoScale||o3(h),h.style.width=`${g}`,h.style.height=`${N}`,l.backgroundColor&&(f.fillStyle=l.backgroundColor,f.fillRect(0,0,h.width,h.height)),f.drawImage(m,0,0,h.width,h.height),h}async function J3(a,l={}){return(await Y3(a,l)).toDataURL()}const $o=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function X3(a){return a>=8760?"相当于全年无休,7x24小时在线!":a>=5e3?"相当于一位全职员工的年工作时长":a>=2e3?"相当于看完了 1000 部电影":a>=1e3?"相当于环球飞行 80 次":a>=500?"相当于读完了 100 本书":a>=100?"相当于马拉松跑了 25 次":"虽然不多,但每一刻都很珍贵"}function Z3(a){return a>=1e3?"夜深人静时的知心好友":a>=500?"午夜场的常客":a>=100?"偶尔熬夜的小伙伴":a>=50?"深夜有时也会陪你聊聊":"早睡早起,健康作息"}function W3(a){const l=a/1e6;return l>=100?"思考量堪比一座图书馆":l>=50?"相当于写了一部百科全书":l>=10?"脑细胞估计消耗了不少":l>=1?"也算是费了一番脑筋":"轻轻松松,游刃有余"}function e5(a){return a>=1e3?"这钱够吃一年的泡面了":a>=500?"相当于买了一台游戏机":a>=100?"够请大家喝几杯奶茶":a>=50?"一顿火锅的钱":a>=10?"几杯咖啡的价格":"省钱小能手"}function s5(a){return a>=80?"沉默是金,惜字如金":a>=60?"话不多但句句到位":a>=40?"该说的时候才开口":a>=20?"能聊的都聊了":"话痨本痨,有问必答"}function t5(a){return a>=1e4?"眼睛都快看花了":a>=5e3?"堪比专业摄影师的阅片量":a>=1e3?"看图小达人":a>=500?"图片鉴赏家":a>=100?"偶尔欣赏一下美图":"图片?有空再看"}function a5(a){return a>=500?"在不断的纠正中成长":a>=200?"学习永无止境":a>=100?"虚心接受,积极改正":a>=50?"偶尔也会犯错":a>=10?"表现还算不错":"完美表达,无需纠正"}function l5(a){return a>=1?"这次思考的价值堪比一顿大餐!":a>=.5?"为了这个问题,我可是认真思考了!":a>=.1?"下了点功夫,值得的!":a>=.01?"花了点小钱,但很值得":"小小思考,不足挂齿"}function n5(a,l){return a>=100?"这句话简直是万能钥匙!":a>=50?"百试不爽的经典回复":a>=20?`${l}的口头禅`:a>=10?"常用语录之一":"偶尔用用的小确幸"}function r5(a,l){return a?l>=1e3?"深夜的守护者,黑暗中的光芒":l>=500?"月亮是我的好朋友":l>=100?"越夜越精神,夜晚才是主场":"偶尔熬夜,享受宁静时光":l<=10?"作息规律,健康生活的典范":l<=50?"早睡早起,偶尔也会熬个夜":"虽然是早起鸟,但也会守候深夜"}function i5(a){return a>=1e3?"忙到飞起,键盘都要冒烟了":a>=500?"这天简直是话痨附体":a>=200?"社交达人上线":a>=100?"比平时活跃不少":a>=50?"小忙一下":"还算轻松的一天"}function c5(){const[a]=u.useState(2025),[l,r]=u.useState(null),[c,d]=u.useState(!0),[m,h]=u.useState(!1),[f,p]=u.useState(null),g=u.useRef(null),{toast:N}=nt(),j=u.useCallback(async()=>{try{d(!0),p(null);const y=await a3(a);r(y)}catch(y){p(y instanceof Error?y:new Error("获取年度报告失败"))}finally{d(!1)}},[a]),b=u.useCallback(async()=>{if(!(!g.current||!l)){h(!0),N({title:"正在生成图片",description:"请稍候..."});try{const y=g.current,w=getComputedStyle(document.documentElement),z=w.getPropertyValue("--background").trim()?`hsl(${w.getPropertyValue("--background").trim()})`:document.documentElement.classList.contains("dark")?"#0a0a0a":"#ffffff",M=y.style.width,S=y.style.maxWidth;y.style.width="1024px",y.style.maxWidth="1024px";const F=await J3(y,{quality:1,pixelRatio:2,backgroundColor:z,cacheBust:!0,filter:C=>!(C instanceof HTMLElement&&C.hasAttribute("data-export-btn"))});y.style.width=M,y.style.maxWidth=S;const E=document.createElement("a");E.download=`${l.bot_name}_${l.year}_年度总结.png`,E.href=F,E.click(),N({title:"导出成功",description:"年度报告已保存为图片"})}catch(y){console.error("导出图片失败:",y),N({title:"导出失败",description:"请重试",variant:"destructive"})}finally{h(!1)}}},[l,N]);return u.useEffect(()=>{j()},[j]),c?e.jsx(o5,{}):f?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["获取年度报告失败: ",f.message]}):l?e.jsx(ts,{className:"h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted/50 p-4 md:p-8 print:p-0",ref:g,children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",children:[e.jsxs("header",{className:"relative overflow-hidden rounded-3xl bg-primary p-8 text-primary-foreground shadow-2xl print:rounded-none print:shadow-none",children:[e.jsx("div",{className:"absolute right-4 top-4 z-20 print:hidden","data-export-btn":!0,children:e.jsx(_,{variant:"secondary",size:"sm",onClick:b,disabled:m,className:"gap-2 bg-white/20 hover:bg-white/30 text-white border-white/30",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"导出中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4"}),"保存图片"]})})}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Yn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:[l.bot_name," ",l.year," 年度总结"]}),e.jsx("p",{className:"mt-4 max-w-2xl text-lg opacity-90",children:"连接与成长 · Connection & Growth"}),e.jsxs("div",{className:"mt-6 flex items-center gap-2 text-sm opacity-75",children:[e.jsx(Ko,{className:"h-4 w-4"}),e.jsxs("span",{children:["生成时间: ",l.generated_at]})]})]}),e.jsx("div",{className:"absolute -right-20 -top-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-20 -left-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(da,{className:"h-8 w-8"}),e.jsx("h2",{children:"时光足迹"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(La,{title:"年度在线时长",value:`${l.time_footprint.total_online_hours} 小时`,description:X3(l.time_footprint.total_online_hours),icon:e.jsx(da,{className:"h-4 w-4"})}),e.jsx(La,{title:"最忙碌的一天",value:l.time_footprint.busiest_day||"N/A",description:i5(l.time_footprint.busiest_day_count),icon:e.jsx(Ko,{className:"h-4 w-4"})}),e.jsx(La,{title:"深夜互动 (0-4点)",value:`${l.time_footprint.midnight_chat_count} 次`,description:Z3(l.time_footprint.midnight_chat_count),icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(La,{title:"作息属性",value:l.time_footprint.is_night_owl?"夜猫子":"早起鸟",description:r5(l.time_footprint.is_night_owl,l.time_footprint.midnight_chat_count),icon:l.time_footprint.is_night_owl?e.jsx(tc,{className:"h-4 w-4"}):e.jsx(ix,{className:"h-4 w-4"})})]}),e.jsxs(Te,{className:"overflow-hidden",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"24小时活跃时钟"}),e.jsxs(Ns,{children:[l.bot_name,"在一天中各个时段的活跃程度"]})]}),e.jsx(ze,{className:"h-[300px]",children:e.jsx(Uj,{width:"100%",height:"100%",children:e.jsxs(Bo,{data:l.time_footprint.hourly_distribution.map((y,w)=>({hour:`${w}点`,count:y})),children:[e.jsx(Ji,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Xi,{dataKey:"hour"}),e.jsx(Gr,{}),e.jsx($j,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Zi,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),l.time_footprint.first_message_time&&e.jsx(Te,{className:"bg-muted/30 border-dashed",children:e.jsxs(ze,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-2",children:"2025年的故事开始于"}),e.jsx("div",{className:"text-xl font-bold text-primary mb-1",children:l.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:l.time_footprint.first_message_user})," 说:",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',l.time_footprint.first_message_content,'"']})]})]})})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(oc,{className:"h-8 w-8"}),e.jsx("h2",{children:"社交网络"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(La,{title:"社交圈子",value:`${l.social_network.total_groups} 个群组`,description:`${l.bot_name}加入的群组总数`,icon:e.jsx(oc,{className:"h-4 w-4"})}),e.jsx(La,{title:"被呼叫次数",value:`${l.social_network.at_count+l.social_network.mentioned_count} 次`,description:"我的名字被大家频繁提起",icon:e.jsx(W1,{className:"h-4 w-4"})}),e.jsx(La,{title:"最长情陪伴",value:l.social_network.longest_companion_user||"N/A",description:`始终都在,已陪伴 ${l.social_network.longest_companion_days} 天`,icon:e.jsx(ei,{className:"h-4 w-4 text-red-500"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"话痨群组 TOP5"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_groups.length>0?l.social_network.top_groups.map((y,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:y.group_name}),y.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[y.message_count," 条消息"]})]},y.group_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"暂无数据"})})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"年度最佳损友 TOP5"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_users.length>0?l.social_network.top_users.map((y,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:y.user_nickname}),y.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[y.message_count," 次互动"]})]},y.user_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"暂无数据"})})})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(hx,{className:"h-8 w-8"}),e.jsx("h2",{children:"最强大脑"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(La,{title:"年度 Token 消耗",value:(l.brain_power.total_tokens/1e6).toFixed(2)+" M",description:W3(l.brain_power.total_tokens),icon:e.jsx(sl,{className:"h-4 w-4"})}),e.jsx(La,{title:"年度总花费",value:`$${l.brain_power.total_cost.toFixed(2)}`,description:e5(l.brain_power.total_cost),icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(La,{title:"高冷指数",value:`${l.brain_power.silence_rate}%`,description:s5(l.brain_power.silence_rate),icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(La,{title:"最高兴趣值",value:l.brain_power.max_interest_value??"N/A",description:l.brain_power.max_interest_time?`出现在 ${l.brain_power.max_interest_time}`:"暂无数据",icon:e.jsx(ei,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"模型偏好分布"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.model_distribution.slice(0,5).map((y,w)=>{const z=l.brain_power.model_distribution[0]?.count||1,M=Math.round(y.count/z*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:y.model}),e.jsxs("span",{className:"text-muted-foreground",children:[y.count.toLocaleString()," 次"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:$o[w%$o.length]}})})]},y.model)})})})]}),l.brain_power.top_reply_models&&l.brain_power.top_reply_models.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"最喜欢的回复模型 TOP5"}),e.jsxs(Ns,{children:[l.bot_name,"用来回复消息的模型偏好"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.top_reply_models.map((y,w)=>{const z=l.brain_power.top_reply_models[0]?.count||1,M=Math.round(y.count/z*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:y.model}),e.jsxs("span",{className:"text-muted-foreground",children:[y.count.toLocaleString()," 次"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:$o[w%$o.length]}})})]},y.model)})})})]}),l.brain_power.top_token_consumers&&l.brain_power.top_token_consumers.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"烧钱大户 TOP3"}),e.jsx(Ns,{children:"谁消耗了最多的 API 额度"})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-6",children:l.brain_power.top_token_consumers.map(y=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["用户 ",y.user_id]}),e.jsxs("span",{children:["$",y.cost.toFixed(2)]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${y.cost/(l.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},y.user_id))})})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"💰"}),"最昂贵的一次思考"]})}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("div",{className:"text-4xl font-bold text-amber-600 dark:text-amber-400",children:["$",l.brain_power.most_expensive_cost.toFixed(4)]}),l.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["发生在 ",l.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:l5(l.brain_power.most_expensive_cost)})]})]}),e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-950/20 dark:to-blue-950/20",children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🧠"}),"思考深度"]})}),e.jsxs(ze,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-400",children:l.brain_power.avg_reasoning_length?.toFixed(0)||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"平均思考字数"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:l.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"最长思考字数"})]})]}),l.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["最深沉的思考发生在 ",l.brain_power.max_reasoning_time]})]})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(rd,{className:"h-8 w-8"}),e.jsx("h2",{children:"个性与表达"})]}),(l.expression_vibe.late_night_reply||l.expression_vibe.favorite_reply)&&e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.expression_vibe.late_night_reply&&e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-violet-50 dark:from-indigo-950/20 dark:to-violet-950/20",children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"🌙"}),"深夜还在回复"]}),e.jsxs(Ns,{children:["凌晨 ",l.expression_vibe.late_night_reply.time,",",l.bot_name,"还在回复..."]})]}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("p",{className:"text-lg italic text-muted-foreground",children:['"',l.expression_vibe.late_night_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"是有什么心事吗?"})]})]}),l.expression_vibe.favorite_reply&&e.jsxs(Te,{className:"bg-gradient-to-br from-rose-50 to-pink-50 dark:from-rose-950/20 dark:to-pink-950/20",children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"💬"}),"最喜欢的回复"]}),e.jsxs(Ns,{children:["使用了 ",l.expression_vibe.favorite_reply.count," 次"]})]}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("p",{className:"text-lg font-medium text-primary",children:['"',l.expression_vibe.favorite_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:n5(l.expression_vibe.favorite_reply.count,l.bot_name)})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-pink-50 to-purple-50 dark:from-pink-950/20 dark:to-purple-950/20",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"使用最多的表情包 TOP3"}),e.jsx(Ns,{children:"年度最爱的表情包们"})]}),e.jsx(ze,{children:l.expression_vibe.top_emojis&&l.expression_vibe.top_emojis.length>0?e.jsx("div",{className:"flex justify-center gap-4",children:l.expression_vibe.top_emojis.slice(0,3).map((y,w)=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:`/api/webui/emoji/${y.id}/thumbnail?original=true`,alt:`TOP ${w+1}`,className:"h-24 w-24 rounded-lg object-cover shadow-md transition-transform hover:scale-105"}),e.jsx(Ce,{className:P("absolute -top-2 -right-2",w===0?"bg-yellow-500":w===1?"bg-gray-400":"bg-amber-700"),children:w+1})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[y.usage_count," 次"]})]},y.id))}):e.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"暂无数据"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"印象最深刻的表达风格"}),e.jsxs(Ns,{children:[l.bot_name,"最常使用的表达方式"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.expression_vibe.top_expressions.map((y,w)=>e.jsxs(Ce,{variant:"outline",className:P("px-3 py-1 text-sm",w===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[y.style," (",y.count,")"]},y.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(La,{title:"图片鉴赏",value:`${l.expression_vibe.image_processed_count} 张`,description:t5(l.expression_vibe.image_processed_count),icon:e.jsx(xx,{className:"h-4 w-4"})}),e.jsx(La,{title:"成长的足迹",value:`${l.expression_vibe.rejected_expression_count} 次`,description:a5(l.expression_vibe.rejected_expression_count),icon:e.jsx(sl,{className:"h-4 w-4"})})]})]})]}),l.expression_vibe.action_types.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"⚡"}),"行动派"]}),e.jsx(Ns,{children:"除了聊天,我还帮大家做了这些事"})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.expression_vibe.action_types.map(y=>e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2",children:[e.jsx("span",{className:"font-medium text-primary",children:y.action}),e.jsxs(Ce,{variant:"secondary",children:[y.count," 次"]})]},y.action))})})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(e_,{className:"h-8 w-8"}),e.jsx("h2",{children:"趣味成就"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(Te,{className:"col-span-1 md:col-span-2",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:'新学到的"黑话"'}),e.jsxs(Ns,{children:["今年我学会了 ",l.achievements.new_jargon_count," 个新词"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.achievements.sample_jargons.map(y=>e.jsxs("div",{className:"group relative rounded-lg border bg-card p-3 shadow-sm transition-all hover:shadow-md",children:[e.jsx("div",{className:"font-bold text-primary",children:y.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:y.meaning||"暂无解释"})]},y.content))})})]}),e.jsx(Te,{className:"flex flex-col justify-center items-center bg-primary text-primary-foreground",children:e.jsxs(ze,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(Ia,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:l.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"年度总消息数"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["其中回复了 ",l.achievements.total_replies.toLocaleString()," 次"]})]})})]})]}),e.jsxs("footer",{className:"mt-12 text-center text-muted-foreground",children:[e.jsx("p",{children:"MaiBot 2025 Annual Report"}),e.jsx("p",{className:"text-sm",children:"Generated with ❤️ by MaiBot Team"})]})]})})}):null}function La({title:a,value:l,description:r,icon:c}){return e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:a}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})]})}function o5(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(ks,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((a,l)=>e.jsx(ks,{className:"h-32 w-full"},l))}),e.jsx(ks,{className:"h-96 w-full"})]})}var vd="DropdownMenu",[d5]=ld(vd,[Oj]),fa=Oj(),[u5,JN]=d5(vd),XN=a=>{const{__scopeDropdownMenu:l,children:r,dir:c,open:d,defaultOpen:m,onOpenChange:h,modal:f=!0}=a,p=fa(l),g=u.useRef(null),[N,j]=ad({prop:d,defaultProp:m??!1,onChange:h,caller:vd});return e.jsx(u5,{scope:l,triggerId:Ym(),triggerRef:g,contentId:Ym(),open:N,onOpenChange:j,onOpenToggle:u.useCallback(()=>j(b=>!b),[j]),modal:f,children:e.jsx(Vw,{...p,open:N,onOpenChange:j,dir:c,modal:f,children:r})})};XN.displayName=vd;var ZN="DropdownMenuTrigger",WN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,disabled:c=!1,...d}=a,m=JN(ZN,r),h=fa(r);return e.jsx(Gw,{asChild:!0,...h,children:e.jsx(ar.button,{type:"button",id:m.triggerId,"aria-haspopup":"menu","aria-expanded":m.open,"aria-controls":m.open?m.contentId:void 0,"data-state":m.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:_1(l,m.triggerRef),onPointerDown:_n(a.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(m.onOpenToggle(),m.open||f.preventDefault())}),onKeyDown:_n(a.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&m.onOpenToggle(),f.key==="ArrowDown"&&m.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});WN.displayName=ZN;var m5="DropdownMenuPortal",eb=a=>{const{__scopeDropdownMenu:l,...r}=a,c=fa(l);return e.jsx(Uw,{...c,...r})};eb.displayName=m5;var sb="DropdownMenuContent",tb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=JN(sb,r),m=fa(r),h=u.useRef(!1);return e.jsx($w,{id:d.contentId,"aria-labelledby":d.triggerId,...m,...c,ref:l,onCloseAutoFocus:_n(a.onCloseAutoFocus,f=>{h.current||d.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:_n(a.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,N=p.button===2||g;(!d.modal||N)&&(h.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tb.displayName=sb;var x5="DropdownMenuGroup",h5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Kw,{...d,...c,ref:l})});h5.displayName=x5;var f5="DropdownMenuLabel",ab=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Hw,{...d,...c,ref:l})});ab.displayName=f5;var p5="DropdownMenuItem",lb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Bw,{...d,...c,ref:l})});lb.displayName=p5;var g5="DropdownMenuCheckboxItem",nb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Iw,{...d,...c,ref:l})});nb.displayName=g5;var j5="DropdownMenuRadioGroup",v5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Qw,{...d,...c,ref:l})});v5.displayName=j5;var N5="DropdownMenuRadioItem",rb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Fw,{...d,...c,ref:l})});rb.displayName=N5;var b5="DropdownMenuItemIndicator",ib=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Pw,{...d,...c,ref:l})});ib.displayName=b5;var y5="DropdownMenuSeparator",cb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(qw,{...d,...c,ref:l})});cb.displayName=y5;var w5="DropdownMenuArrow",_5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Yw,{...d,...c,ref:l})});_5.displayName=w5;var S5="DropdownMenuSubTrigger",ob=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Ow,{...d,...c,ref:l})});ob.displayName=S5;var k5="DropdownMenuSubContent",db=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Lw,{...d,...c,ref:l,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});db.displayName=k5;var C5=XN,T5=WN,E5=eb,ub=tb,mb=ab,xb=lb,hb=nb,fb=rb,pb=ib,gb=cb,jb=ob,vb=db;const M5=C5,A5=T5,z5=u.forwardRef(({className:a,inset:l,children:r,...c},d)=>e.jsxs(jb,{ref:d,className:P("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",l&&"pl-8",a),...c,children:[r,e.jsx(ra,{className:"ml-auto h-4 w-4"})]}));z5.displayName=jb.displayName;const R5=u.forwardRef(({className:a,...l},r)=>e.jsx(vb,{ref:r,className:P("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...l}));R5.displayName=vb.displayName;const Nb=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(E5,{children:e.jsx(ub,{ref:c,sideOffset:l,className:P("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r})}));Nb.displayName=ub.displayName;const bb=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(xb,{ref:c,className:P("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",a),...r}));bb.displayName=xb.displayName;const D5=u.forwardRef(({className:a,children:l,checked:r,...c},d)=>e.jsxs(hb,{ref:d,className:P("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:r,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pb,{children:e.jsx(Ot,{className:"h-4 w-4"})})}),l]}));D5.displayName=hb.displayName;const O5=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(fb,{ref:c,className:P("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pb,{children:e.jsx(Vo,{className:"h-2 w-2 fill-current"})})}),l]}));O5.displayName=fb.displayName;const L5=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(mb,{ref:c,className:P("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",a),...r}));L5.displayName=mb.displayName;const U5=u.forwardRef(({className:a,...l},r)=>e.jsx(gb,{ref:r,className:P("-mx-1 my-1 h-px bg-muted",a),...l}));U5.displayName=gb.displayName;const Qm=[{value:"created_at",label:"最新发布",icon:da},{value:"downloads",label:"下载最多",icon:na},{value:"likes",label:"最受欢迎",icon:ei}];function $5(){const a=ha(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState("downloads"),[g,N]=u.useState(1),[j,b]=u.useState(1),[y,w]=u.useState(0),[z,M]=u.useState(new Set),[S,F]=u.useState(new Set),E=cN(),C=u.useCallback(async()=>{d(!0);try{const L=await m4({status:"approved",page:g,page_size:12,search:m||void 0,sort_by:f,sort_order:"desc"});r(L.packs),b(L.total_pages),w(L.total);const me=new Set;for(const Ne of L.packs)await iN(Ne.id,E)&&me.add(Ne.id);M(me)}catch(L){console.error("加载 Pack 列表失败:",L),aa({title:"加载 Pack 列表失败",variant:"destructive"})}finally{d(!1)}},[g,m,f,E]);u.useEffect(()=>{C()},[C]);const R=L=>{L.preventDefault(),N(1),C()},H=async L=>{if(!S.has(L)){F(me=>new Set(me).add(L));try{const me=await rN(L,E);M(Ne=>{const je=new Set(Ne);return me.liked?je.add(L):je.delete(L),je}),r(Ne=>Ne.map(je=>je.id===L?{...je,likes:me.likes}:je))}catch(me){console.error("点赞失败:",me),aa({title:"点赞失败",variant:"destructive"})}finally{F(me=>{const Ne=new Set(me);return Ne.delete(L),Ne})}}},O=L=>{a({to:"/config/pack-market/$packId",params:{packId:L}})},X=Qm.find(L=>L.value===f)||Qm[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(xa,{className:"h-8 w-8",strokeWidth:2}),"配置模板市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和应用社区分享的模型配置模板,快速配置你的 MaiBot"})]}),e.jsxs(_,{variant:"outline",onClick:C,disabled:c,className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:R,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索模板名称、描述...",value:m,onChange:L=>h(L.target.value),className:"pl-10"})]})}),e.jsxs(M5,{children:[e.jsx(A5,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(s_,{className:"w-4 h-4"}),X.label,e.jsx(Ba,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(Nb,{align:"end",children:Qm.map(L=>e.jsxs(bb,{onClick:()=>{p(L.value),N(1)},children:[e.jsx(L.icon,{className:"w-4 h-4 mr-2"}),L.label]},L.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:y})," 个模板"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((L,me)=>e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(ks,{className:"h-6 w-3/4"}),e.jsx(ks,{className:"h-4 w-full mt-2"})]}),e.jsx(ze,{children:e.jsx(ks,{className:"h-20 w-full"})}),e.jsx(od,{children:e.jsx(ks,{className:"h-9 w-full"})})]},me))}):l.length===0?e.jsx(Te,{className:"py-12",children:e.jsxs(ze,{className:"text-center text-muted-foreground",children:[e.jsx(xa,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"暂无模板"}),e.jsx("p",{className:"mt-1",children:"还没有人分享配置模板,快来分享第一个吧!"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(L=>e.jsx(B5,{pack:L,liked:z.has(L.id),liking:S.has(L.id),onLike:()=>H(L.id),onView:()=>O(L.id)},L.id))}),j>1&&e.jsx(fx,{children:e.jsxs(px,{children:[e.jsx(Xn,{children:e.jsx($v,{onClick:()=>N(L=>Math.max(1,L-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:j},(L,me)=>me+1).filter(L=>L===1||L===j||Math.abs(L-g)<=1).map((L,me,Ne)=>{const je=me>0&&L-Ne[me-1]>1;return e.jsxs(Xn,{children:[je&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(jc,{onClick:()=>N(L),isActive:L===g,className:"cursor-pointer",children:L})]},L)}),e.jsx(Xn,{children:e.jsx(Bv,{onClick:()=>N(L=>Math.min(j,L+1)),className:g===j?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function B5({pack:a,liked:l,liking:r,onLike:c,onView:d}){const m=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(Te,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Ue,{className:"text-lg line-clamp-1",children:a.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:["v",a.version]})]}),e.jsx(Ns,{className:"line-clamp-2 min-h-[40px]",children:a.description})]}),e.jsxs(ze,{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fl,{className:"w-3.5 h-3.5"}),a.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"w-3.5 h-3.5"}),m(a.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"提供商数量",children:[e.jsx(Hl,{className:"w-3.5 h-3.5"}),a.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(Wn,{className:"w-3.5 h-3.5"}),a.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"任务配置数",children:[e.jsx(er,{className:"w-3.5 h-3.5"}),a.task_count]})]}),a.tags&&a.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map(h=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(cd,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),a.tags.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",a.tags.length-3]})]})]}),e.jsx(od,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),a.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:r,className:`flex items-center gap-1 transition-colors ${l?"text-red-500":"hover:text-red-500"} ${r?"opacity-50":""}`,children:[e.jsx(ei,{className:`w-4 h-4 ${l?"fill-current":""}`}),a.likes]})]}),e.jsx(_,{size:"sm",onClick:d,children:"查看详情"})]})})]})}var ul="Accordion",I5=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lx,P5,F5]=S1(ul),[Nd]=ld(ul,[F5,Lj]),Ux=Lj(),yb=Bs.forwardRef((a,l)=>{const{type:r,...c}=a,d=c,m=c;return e.jsx(Lx.Provider,{scope:a.__scopeAccordion,children:r==="multiple"?e.jsx(G5,{...m,ref:l}):e.jsx(V5,{...d,ref:l})})});yb.displayName=ul;var[wb,H5]=Nd(ul),[_b,q5]=Nd(ul,{collapsible:!1}),V5=Bs.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},collapsible:m=!1,...h}=a,[f,p]=ad({prop:r,defaultProp:c??"",onChange:d,caller:ul});return e.jsx(wb,{scope:a.__scopeAccordion,value:Bs.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Bs.useCallback(()=>m&&p(""),[m,p]),children:e.jsx(_b,{scope:a.__scopeAccordion,collapsible:m,children:e.jsx(Sb,{...h,ref:l})})})}),G5=Bs.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},...m}=a,[h,f]=ad({prop:r,defaultProp:c??[],onChange:d,caller:ul}),p=Bs.useCallback(N=>f((j=[])=>[...j,N]),[f]),g=Bs.useCallback(N=>f((j=[])=>j.filter(b=>b!==N)),[f]);return e.jsx(wb,{scope:a.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(_b,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(Sb,{...m,ref:l})})})}),[K5,bd]=Nd(ul),Sb=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,disabled:c,dir:d,orientation:m="vertical",...h}=a,f=Bs.useRef(null),p=nd(f,l),g=P5(r),j=Wj(d)==="ltr",b=_n(a.onKeyDown,y=>{if(!I5.includes(y.key))return;const w=y.target,z=g().filter(X=>!X.ref.current?.disabled),M=z.findIndex(X=>X.ref.current===w),S=z.length;if(M===-1)return;y.preventDefault();let F=M;const E=0,C=S-1,R=()=>{F=M+1,F>C&&(F=E)},H=()=>{F=M-1,F{const{__scopeAccordion:r,value:c,...d}=a,m=bd(td,r),h=H5(td,r),f=Ux(r),p=Ym(),g=c&&h.value.includes(c)||!1,N=m.disabled||a.disabled;return e.jsx(Q5,{scope:r,open:g,disabled:N,triggerId:p,children:e.jsx(Mj,{"data-orientation":m.orientation,"data-state":zb(g),...f,...d,ref:l,disabled:N,open:g,onOpenChange:j=>{j?h.onItemOpen(c):h.onItemClose(c)}})})});kb.displayName=td;var Cb="AccordionHeader",Tb=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(Cb,r);return e.jsx(ar.h3,{"data-orientation":d.orientation,"data-state":zb(m.open),"data-disabled":m.disabled?"":void 0,...c,ref:l})});Tb.displayName=Cb;var lx="AccordionTrigger",Eb=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(lx,r),h=q5(lx,r),f=Ux(r);return e.jsx(Lx.ItemSlot,{scope:r,children:e.jsx(Jw,{"aria-disabled":m.open&&!h.collapsible||void 0,"data-orientation":d.orientation,id:m.triggerId,...f,...c,ref:l})})});Eb.displayName=lx;var Mb="AccordionContent",Ab=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(Mb,r),h=Ux(r);return e.jsx(Xw,{role:"region","aria-labelledby":m.triggerId,"data-orientation":d.orientation,...h,...c,ref:l,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Ab.displayName=Mb;function zb(a){return a?"open":"closed"}var Y5=yb,J5=kb,X5=Tb,Rb=Eb,Db=Ab;const Z5=Y5,Ob=u.forwardRef(({className:a,...l},r)=>e.jsx(J5,{ref:r,className:P("border-b",a),...l}));Ob.displayName="AccordionItem";const Lb=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(X5,{className:"flex",children:e.jsxs(Rb,{ref:c,className:P("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...r,children:[l,e.jsx(Ba,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Lb.displayName=Rb.displayName;const Ub=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(Db,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:P("pb-4 pt-0",a),children:l})}));Ub.displayName=Db.displayName;const W5={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function eT(){const{packId:a}=Pb.useParams(),l=ha(),[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[b,y]=u.useState(1),[w,z]=u.useState(null),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[H,O]=u.useState({}),[X,L]=u.useState({}),me=cN(),Ne=u.useCallback(async()=>{if(a){m(!0);try{const D=await x4(a);c(D);const Q=await iN(a,me);f(Q)}catch(D){console.error("加载 Pack 失败:",D),aa({title:"加载模板失败",variant:"destructive"})}finally{m(!1)}}},[a,me]);u.useEffect(()=>{Ne()},[Ne]);const je=async()=>{if(!(!a||p)){g(!0);try{const D=await rN(a,me);f(D.liked),r&&c({...r,likes:D.likes})}catch(D){console.error("点赞失败:",D),aa({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},ce=async()=>{if(r){j(!0),y(1),S(!0);try{const D=await p4(r);z(D);const Q={};for(const ue of D.existing_providers)Q[ue.pack_provider.name]=ue.local_providers[0].name;O(Q);const B={};for(const ue of D.new_providers)B[ue.name]="";L(B)}catch(D){console.error("检测冲突失败:",D),aa({title:"检测配置冲突失败",variant:"destructive"}),j(!1)}finally{S(!1)}}},ge=async()=>{if(r){if(C.apply_providers&&w){for(const D of w.new_providers)if(!X[D.name]){aa({title:`请填写提供商 "${D.name}" 的 API Key`,variant:"destructive"});return}}E(!0);try{await g4(r,C,H,X),await f4(r.id,me),c({...r,downloads:r.downloads+1}),aa({title:"配置模板应用成功!"}),j(!1)}catch(D){console.error("应用 Pack 失败:",D),aa({title:D instanceof Error?D.message:"应用配置失败",variant:"destructive"})}finally{E(!1)}}},pe=D=>new Date(D).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return d?e.jsx(tT,{}):r?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>l({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx($a,{className:"w-4 h-4"}),"返回市场"]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(xa,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.name,e.jsxs(Ce,{variant:"secondary",children:["v",r.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fl,{className:"w-4 h-4"}),r.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"w-4 h-4"}),pe(r.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),r.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ei,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),r.likes," 赞"]})]}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:r.tags.map(D=>e.jsxs(Ce,{variant:"outline",children:[e.jsx(cd,{className:"w-3 h-3 mr-1"}),D]},D))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:ce,children:[e.jsx(na,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(_,{variant:"outline",onClick:je,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(ei,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(Hl,{className:"w-8 h-8 text-blue-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API 提供商"})]})]})}),e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(Wn,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"模型配置"})]})]})}),e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(er,{className:"w-8 h-8 text-purple-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(r.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(Jt,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Gt,{className:"w-full sm:w-auto grid grid-cols-3 sm:flex",children:[e.jsxs(Xe,{value:"providers",className:"gap-1 sm:gap-2",children:[e.jsx(Hl,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"提供商"}),e.jsx("span",{className:"sm:hidden",children:"提供商"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.providers.length,")"]})]}),e.jsxs(Xe,{value:"models",className:"gap-1 sm:gap-2",children:[e.jsx(Wn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"模型"}),e.jsx("span",{className:"sm:hidden",children:"模型"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.models.length,")"]})]}),e.jsxs(Xe,{value:"tasks",className:"gap-1 sm:gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"任务配置"}),e.jsx("span",{className:"sm:hidden",children:"任务"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",Object.keys(r.task_config).length,")"]})]})]}),e.jsx(Ss,{value:"providers",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"API 提供商"}),e.jsx(Ns,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"名称"}),e.jsx(ns,{children:"Base URL"}),e.jsx(ns,{children:"类型"})]})}),e.jsx(Gl,{children:r.providers.map(D=>e.jsxs(_t,{children:[e.jsx(Ze,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Ze,{className:"text-muted-foreground font-mono text-sm max-w-[200px] truncate",children:D.base_url}),e.jsx(Ze,{children:e.jsx(Ce,{variant:"outline",children:D.client_type})})]},D.name))})]})})})]})}),e.jsx(Ss,{value:"models",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"模型配置"}),e.jsx(Ns,{children:"模板中包含的模型配置"})]}),e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"模型名称"}),e.jsx(ns,{children:"标识符"}),e.jsx(ns,{children:"提供商"}),e.jsx(ns,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Gl,{children:r.models.map(D=>e.jsxs(_t,{children:[e.jsx(Ze,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Ze,{className:"text-muted-foreground font-mono text-sm max-w-[150px] truncate",children:D.model_identifier}),e.jsx(Ze,{className:"whitespace-nowrap",children:D.api_provider}),e.jsxs(Ze,{className:"text-right text-muted-foreground whitespace-nowrap",children:["¥",D.price_in," / ¥",D.price_out]})]},D.name))})]})})})]})}),e.jsx(Ss,{value:"tasks",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"任务配置"}),e.jsx(Ns,{children:"模板中各任务类型的模型分配"})]}),e.jsx(ze,{children:e.jsx(Z5,{type:"multiple",className:"w-full",children:Object.entries(r.task_config).map(([D,Q])=>e.jsxs(Ob,{value:D,children:[e.jsx(Lb,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sn,{className:"w-4 h-4"}),W5[D]||D,e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[Q.model_list.length," 个模型"]})]})}),e.jsx(Ub,{children:e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"分配的模型:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Q.model_list.map(B=>e.jsx(Ce,{variant:"outline",children:B},B))}),Q.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:Q.temperature})]}),Q.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:Q.max_tokens})]})]})})]},D))})})]})})]}),e.jsx(sT,{open:N,onOpenChange:j,pack:r,step:b,setStep:y,conflicts:w,detectingConflicts:M,applying:F,options:C,setOptions:R,_providerMapping:H,_setProviderMapping:O,newProviderApiKeys:X,setNewProviderApiKeys:L,onApply:ge})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(xa,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"模板不存在"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"该配置模板可能已被删除或尚未通过审核"}),e.jsxs(_,{className:"mt-4",onClick:()=>l({to:"/config/pack-market"}),children:[e.jsx($a,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function sT({open:a,onOpenChange:l,pack:r,step:c,setStep:d,conflicts:m,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:N,_setProviderMapping:j,newProviderApiKeys:b,setNewProviderApiKeys:y,onApply:w}){return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(xa,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(at,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在检测配置冲突..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:M=>g({...p,apply_providers:M})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Hl,{className:"w-4 h-4"}),"应用提供商配置 (",r.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_models",checked:p.apply_models,onCheckedChange:M=>g({...p,apply_models:M})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"w-4 h-4"}),"应用模型配置 (",r.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:M=>g({...p,apply_task_config:M})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(r.task_config).length," 个)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(T,{className:"text-sm font-medium",children:"任务配置应用模式"}),e.jsxs(Rx,{value:p.task_mode,onValueChange:M=>g({...p,task_mode:M}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{value:"append",id:"mode_append"}),e.jsx(T,{htmlFor:"mode_append",className:"font-normal",children:"追加模式 - 将模板中的模型添加到现有配置"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&m&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&m.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"发现已有的提供商"}),e.jsx(ft,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:m.existing_providers.map(({pack_provider:M,local_providers:S})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:M.name}),e.jsx(ra,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),S.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:S[0].name}),e.jsx(Ce,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:N[M.name]||S[0].name,onValueChange:F=>j({...N,[M.name]:F}),children:[e.jsx(Be,{className:"w-[200px]",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:S.map(F=>e.jsx(W,{value:F.name,children:F.name},F.name))})]}),e.jsxs(Ce,{variant:"outline",className:"ml-auto",children:[S.length," 个匹配"]})]})]},M.name))})]}),p.apply_providers&&m.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"需要配置 API Key"}),e.jsx(ft,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:m.new_providers.map(M=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cx,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:M.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.base_url,")"]})]}),e.jsx(ne,{type:"password",placeholder:`输入 ${M.name} 的 API Key`,value:b[M.name]||"",onChange:S=>y({...b,[M.name]:S.target.value})})]},M.name))})]}),(!p.apply_providers||m.existing_providers.length===0&&m.new_providers.length===0)&&e.jsxs(ht,{children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx(Jn,{children:"无需配置"}),e.jsx(ft,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"确认应用"}),e.jsx(ft,{children:"请确认以下将要应用的内容:"})]}),e.jsxs("div",{className:"space-y-2",children:[p.apply_providers&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(Hl,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",r.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(Wn,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",r.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(er,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(r.task_config).length," 个任务配置"]})]})]}),m&&m.new_providers.length>0&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["将添加 ",m.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(gt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),disabled:f,children:"取消"}),c<3?e.jsx(_,{onClick:()=>d(c+1),disabled:h,children:"下一步"}):e.jsxs(_,{onClick:w,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function tT(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(ks,{className:"h-9 w-24"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ks,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ks,{className:"h-8 w-2/3"}),e.jsx(ks,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(ks,{className:"h-4 w-24"}),e.jsx(ks,{className:"h-4 w-32"}),e.jsx(ks,{className:"h-4 w-28"}),e.jsx(ks,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ks,{className:"h-6 w-20"}),e.jsx(ks,{className:"h-6 w-24"}),e.jsx(ks,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(ks,{className:"h-10 w-full"}),e.jsx(ks,{className:"h-10 w-full"})]})]}),e.jsx(ks,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(ks,{className:"h-24"}),e.jsx(ks,{className:"h-24"}),e.jsx(ks,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ks,{className:"h-10 w-32"}),e.jsx(ks,{className:"h-10 w-32"}),e.jsx(ks,{className:"h-10 w-32"})]}),e.jsx(ks,{className:"h-96 w-full"})]})]})})})}function aT(){const a=ha(),[l,r]=u.useState(!0);return u.useEffect(()=>{let c=!1;return(async()=>{try{const m=await dc();!c&&!m&&a({to:"/auth"})}catch{c||a({to:"/auth"})}finally{c||r(!1)}})(),()=>{c=!0}},[a]),{checking:l}}async function lT(){return await dc()}const nT=ti("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),$b=u.forwardRef(({className:a,size:l,abbrTitle:r,children:c,...d},m)=>e.jsx("kbd",{className:P(nT({size:l,className:a})),ref:m,...d,children:r?e.jsx("abbr",{title:r,children:c}):c}));$b.displayName="Kbd";const rT=[{icon:id,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ua,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Hl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:gv,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:rd,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Ia,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:jv,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Wr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:t_,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:xa,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:ux,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:Sn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function iT({open:a,onOpenChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(0),h=ha(),f=rT.filter(N=>N.title.toLowerCase().includes(r.toLowerCase())||N.description.toLowerCase().includes(r.toLowerCase())||N.category.toLowerCase().includes(r.toLowerCase())),p=u.useCallback(N=>{h({to:N}),l(!1),c(""),m(0)},[h,l]),g=u.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),m(j=>(j+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),m(j=>(j-1+f.length)%f.length)):N.key==="Enter"&&f[d]&&(N.preventDefault(),p(f[d].path))},[f,d,p]);return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(qs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Vs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ne,{value:r,onChange:N=>{c(N.target.value),m(0)},onKeyDown:g,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(ts,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((N,j)=>{const b=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>m(j),className:P("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",j===d?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(b,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:N.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:N.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:N.category})]},N.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx($t,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function cT(){const a=window.location.protocol==="http:",l=window.location.hostname.toLowerCase(),r=l==="localhost"||l==="127.0.0.1"||l==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[d,m]=u.useState(a&&!r&&!c),[h,f]=u.useState(!1),p=()=>{f(!0),m(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!d||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(Lt,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"安全警告:"}),"您正在使用 ",e.jsx("strong",{children:"HTTP"})," 访问 MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"如果这是公网服务器,您的数据(包括 Token、聊天记录等)可能在传输过程中被窃取。强烈建议使用 HTTPS 访问或仅在本地网络使用。"})]})]}),e.jsx(_,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(Sa,{className:"h-4 w-4"})})]})})})}function oT(){const[a,l]=u.useState(0),[r,c]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const g=N=>{const j=N.target;if(j.scrollHeight>j.clientHeight+100){d.current=j;const b=j.scrollTop,y=j.scrollHeight-j.clientHeight,w=y>0?b/y*100:0;l(w),c(b>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const m=()=>{d.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-a/100*f;return e.jsx("div",{className:P("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",r?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:P("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:m,"aria-label":"回到顶部",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(a_,{className:"h-5 w-5 text-primary transition-transform duration-300 group-hover:-translate-y-1 group-hover:scale-110",strokeWidth:2.5}),e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})})}function dT({children:a}){const{checking:l}=aT(),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),{theme:N,setTheme:j}=vx(),b=nw();if(u.useEffect(()=>{if(r)g(!1);else{const S=setTimeout(()=>{g(!0)},350);return()=>clearTimeout(S)}},[r]),u.useEffect(()=>{const S=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),f(!0))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),l)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const y=[{title:"概览",items:[{icon:id,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ua,label:"麦麦主程序配置",path:"/config/bot"},{icon:Hl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:gv,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:zg,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:rd,label:"表情包管理",path:"/resource/emoji"},{icon:Ia,label:"表达方式管理",path:"/resource/expression"},{icon:Wr,label:"黑话管理",path:"/resource/jargon"},{icon:jv,label:"人物信息管理",path:"/resource/person"},{icon:xv,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Zr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:xa,label:"插件市场",path:"/plugins"},{icon:fv,label:"配置模板市场",path:"/config/pack-market"},{icon:zg,label:"插件配置",path:"/plugin-config"},{icon:ux,label:"日志查看器",path:"/logs"},{icon:nx,label:"计划器&回复器监控",path:"/planner-monitor"},{icon:Ia,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:Sn,label:"系统设置",path:"/settings"}]}],z=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,M=async()=>{await B_()};return e.jsx(Zv,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:P("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",d?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:P("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:P("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:v2()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(ts,{className:P("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:P("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:P("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:y.map((S,F)=>e.jsxs("li",{children:[e.jsx("div",{className:P("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:S.title})}),!r&&F>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:S.items.map(E=>{const C=b({to:E.path}),R=E.icon,H=e.jsxs(e.Fragment,{children:[C&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:P("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(R,{className:P("h-5 w-5 flex-shrink-0",C&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:P("text-sm font-medium whitespace-nowrap transition-all duration-300",C&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:E.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(Wv,{children:[e.jsx(eN,{asChild:!0,children:e.jsx(Kn,{to:E.path,"data-tour":E.tourId,className:P("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",C?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>m(!1),children:H})}),p&&e.jsx(Tx,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:E.label})})]})},E.path)})})]},S.title))})})})]}),d&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>m(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(cT,{}),e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>m(!d),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(l_,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(Pa,{className:P("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kn,{to:"/annual-report",children:e.jsxs(_,{variant:"ghost",size:"sm",className:"gap-2 bg-gradient-to-r from-pink-500/10 to-purple-500/10 hover:from-pink-500/20 hover:to-purple-500/20 border border-pink-500/20",title:"查看年度总结",children:[e.jsx(n_,{className:"h-4 w-4 text-pink-500"}),e.jsx("span",{className:"hidden sm:inline bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent font-medium",children:"2025 年度总结"})]})}),e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx($t,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),e.jsxs($b,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(iT,{open:h,onOpenChange:f}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(r_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:S=>{h2(z==="dark"?"light":"dark",j,S)},className:"rounded-lg p-2 hover:bg-accent",title:z==="dark"?"切换到浅色模式":"切换到深色模式",children:z==="dark"?e.jsx(ix,{className:"h-5 w-5"}):e.jsx(tc,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:M,className:"gap-2",title:"登出系统",children:[e.jsx(i_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:a}),e.jsx(oT,{})]})]})})}function uT(a){const l=a.split(` -`).slice(1),r=[];for(const c of l){const d=c.trim();if(!d.startsWith("at "))continue;const m=d.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);m?r.push({functionName:m[1]||"",fileName:m[2],lineNumber:m[3],columnNumber:m[4],raw:d}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:d})}return r}function mT({error:a,errorInfo:l}){const[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),p=a.stack?uT(a.stack):[],g=async()=>{const N=` -Error: ${a.name} -Message: ${a.message} - -Stack Trace: -${a.stack||"No stack trace available"} - -Component Stack: -${l?.componentStack||"No component stack available"} - -URL: ${window.location.href} -User Agent: ${navigator.userAgent} -Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(N),f(!0),setTimeout(()=>f(!1),2e3)}catch(j){console.error("Failed to copy:",j)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[a.name,":"]})," ",a.message]})]}),p.length>0&&e.jsxs(xc,{open:r,onOpenChange:c,children:[e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(c_,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),r?e.jsx(Xr,{className:"h-4 w-4"}):e.jsx(Ba,{className:"h-4 w-4"})]})}),e.jsx(fc,{children:e.jsx(ts,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,j)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[j+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:N.functionName}),N.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[N.fileName,N.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",N.lineNumber,":",N.columnNumber]})]})]})]})},j))})})})]}),l?.componentStack&&e.jsxs(xc,{open:d,onOpenChange:m,children:[e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"Component Stack"]}),d?e.jsx(Xr,{className:"h-4 w-4"}):e.jsx(Ba,{className:"h-4 w-4"})]})}),e.jsx(fc,{children:e.jsx(ts,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:l.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(qo,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function Bb({error:a,errorInfo:l}){const r=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Te,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Oe,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Lt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Ue,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(Ns,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(ze,{className:"space-y-4",children:[e.jsx(mT,{error:a,errorInfo:l}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:c,className:"flex-1",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(id,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class xT extends u.Component{constructor(l){super(l),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}componentDidCatch(l,r){console.error("ErrorBoundary caught an error:",l,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(Bb,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function Ib({error:a}){return e.jsx(Bb,{error:a,errorInfo:null})}const bc=rw({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(xj,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!lT())throw cw({to:"/auth"})}}),hT=lt({getParentRoute:()=>bc,path:"/auth",component:O2}),fT=lt({getParentRoute:()=>bc,path:"/setup",component:X2}),Nt=lt({getParentRoute:()=>bc,id:"protected",component:()=>e.jsx(dT,{children:e.jsx(xj,{})}),errorComponent:({error:a})=>e.jsx(Ib,{error:a})}),pT=lt({getParentRoute:()=>Nt,path:"/",component:d2}),gT=lt({getParentRoute:()=>Nt,path:"/config/bot",component:YS}),jT=lt({getParentRoute:()=>Nt,path:"/config/modelProvider",component:i4}),vT=lt({getParentRoute:()=>Nt,path:"/config/model",component:z4}),NT=lt({getParentRoute:()=>Nt,path:"/config/adapter",component:L4}),bT=lt({getParentRoute:()=>Nt,path:"/resource/emoji",component:nk}),yT=lt({getParentRoute:()=>Nt,path:"/resource/expression",component:ok}),wT=lt({getParentRoute:()=>Nt,path:"/resource/person",component:Rk}),_T=lt({getParentRoute:()=>Nt,path:"/resource/jargon",component:wk}),ST=lt({getParentRoute:()=>Nt,path:"/resource/knowledge-graph",component:Fk}),kT=lt({getParentRoute:()=>Nt,path:"/resource/knowledge-base",component:Hk}),CT=lt({getParentRoute:()=>Nt,path:"/logs",component:Vk}),TT=lt({getParentRoute:()=>Nt,path:"/planner-monitor",component:eC}),ET=lt({getParentRoute:()=>Nt,path:"/chat",component:BC}),MT=lt({getParentRoute:()=>Nt,path:"/plugins",component:NC}),AT=lt({getParentRoute:()=>Nt,path:"/plugin-detail",component:MC}),zT=lt({getParentRoute:()=>Nt,path:"/model-presets",component:yC}),RT=lt({getParentRoute:()=>Nt,path:"/plugin-config",component:SC}),DT=lt({getParentRoute:()=>Nt,path:"/plugin-mirrors",component:CC}),OT=lt({getParentRoute:()=>Nt,path:"/settings",component:T2}),LT=lt({getParentRoute:()=>Nt,path:"/config/pack-market",component:$5}),Pb=lt({getParentRoute:()=>Nt,path:"/config/pack-market/$packId",component:eT}),UT=lt({getParentRoute:()=>Nt,path:"/survey/webui-feedback",component:s3}),$T=lt({getParentRoute:()=>Nt,path:"/survey/maibot-feedback",component:t3}),BT=lt({getParentRoute:()=>Nt,path:"/annual-report",component:c5}),IT=lt({getParentRoute:()=>bc,path:"*",component:Kv}),PT=bc.addChildren([hT,fT,Nt.addChildren([pT,gT,jT,vT,NT,bT,yT,_T,wT,ST,kT,MT,AT,zT,RT,DT,CT,TT,ET,OT,LT,Pb,UT,$T,BT]),IT]),FT=iw({routeTree:PT,defaultNotFoundComponent:Kv,defaultErrorComponent:({error:a})=>e.jsx(Ib,{error:a})});function HT({children:a,defaultTheme:l="system",storageKey:r="ui-theme",...c}){const[d,m]=u.useState(()=>localStorage.getItem(r)||l);u.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),d==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(d)},[d]),u.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,N={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[f];N&&(p.style.setProperty("--primary",N.hsl),N.gradient?(p.style.setProperty("--primary-gradient",N.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:d,setTheme:f=>{localStorage.setItem(r,f),m(f)}};return e.jsx(Fv.Provider,{...c,value:h,children:a})}function qT({children:a,defaultEnabled:l=!0,defaultWavesEnabled:r=!0,storageKey:c="enable-animations",wavesStorageKey:d="enable-waves-background"}){const[m,h]=u.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":l}),[f,p]=u.useState(()=>{const N=localStorage.getItem(d);return N!==null?N==="true":r});u.useEffect(()=>{const N=document.documentElement;m?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(m))},[m,c]),u.useEffect(()=>{localStorage.setItem(d,String(f))},[f,d]);const g={enableAnimations:m,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Hv.Provider,{value:g,children:a})}function VT(a){const[l,r]=u.useState(()=>typeof window<"u"?window.matchMedia(a).matches:!1);return u.useEffect(()=>{if(typeof window>"u")return;const c=window.matchMedia(a),d=m=>{r(m.matches)};return r(c.matches),c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}},[a]),l}function Bx(){return VT("(max-width: 768px)")}const GT=k1,Fb=u.forwardRef(({className:a,...l},r)=>{const c=Bx();return e.jsx(ev,{ref:r,className:P("fixed z-[100] flex max-h-screen w-full gap-2 p-4",c?"top-0 left-0 right-0 flex-col items-center":"bottom-0 right-0 flex-col-reverse sm:max-w-[420px]",a),...l})});Fb.displayName=ev.displayName;const KT=ti("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"},position:{desktop:"data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",mobile:"data-[swipe=cancel]:translate-y-0 data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-y)] data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-top data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-top data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-top"}},defaultVariants:{variant:"default",position:"desktop"}}),Hb=u.forwardRef(({className:a,variant:l,...r},c)=>{const m=Bx()?"mobile":"desktop";return e.jsx(sv,{ref:c,className:P(KT({variant:l,position:m}),a),...r})});Hb.displayName=sv.displayName;const QT=u.forwardRef(({className:a,...l},r)=>e.jsx(tv,{ref:r,className:P("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...l}));QT.displayName=tv.displayName;const qb=u.forwardRef(({className:a,...l},r)=>e.jsx(av,{ref:r,className:P("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...l,children:e.jsx(Sa,{className:"h-4 w-4"})}));qb.displayName=av.displayName;const Vb=u.forwardRef(({className:a,...l},r)=>e.jsx(lv,{ref:r,className:P("text-sm font-semibold [&+div]:text-xs",a),...l}));Vb.displayName=lv.displayName;const Gb=u.forwardRef(({className:a,...l},r)=>e.jsx(nv,{ref:r,className:P("text-sm opacity-90",a),...l}));Gb.displayName=nv.displayName;function YT(){const{toasts:a}=nt(),l=Bx();return e.jsxs(GT,{swipeDirection:l?"up":"right",children:[a.map(function({id:r,title:c,description:d,action:m,...h}){return e.jsxs(Hb,{...h,children:[e.jsxs("div",{className:"grid gap-1",children:[c&&e.jsx(Vb,{children:c}),d&&e.jsx(Gb,{children:d})]}),m,e.jsx(qb,{})]},r)}),e.jsx(Fb,{})]})}$_.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(xT,{children:e.jsx(HT,{defaultTheme:"system",children:e.jsx(qT,{children:e.jsxs(s4,{children:[e.jsx(ow,{router:FT}),e.jsx(l4,{}),e.jsx(YT,{})]})})})})})); diff --git a/webui/dist/assets/index-RB5cYCSR.css b/webui/dist/assets/index-RB5cYCSR.css deleted file mode 100644 index 39537543..00000000 --- a/webui/dist/assets/index-RB5cYCSR.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";*,: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}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-16{inset:4rem}.inset-8{inset:2rem}.inset-x-0{left:0;right:0}.inset-x-4{left:1rem;right:1rem}.inset-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-2{right:-.5rem}.-right-20{right:-5rem}.-top-2{top:-.5rem}.-top-20{top:-5rem}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-0{margin-left:0;margin-right:0}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mb-\[1px\]{margin-bottom:1px}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.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}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[2px\]{height:2px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[70vh\]{height:70vh}.h-\[90vh\]{height:90vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[xxx\]{min-height:xxx}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-\[var\(--max-width\)\]{max-width:var(--max-width)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.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))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@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-default{cursor:default}.cursor-grab{cursor:grab}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.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))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-500{--tw-border-opacity: 1;border-color:rgb(249 115 22 / var(--tw-border-opacity, 1))}.border-orange-500\/20{border-color:#f9731633}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-pink-500\/20{border-color:#ec489933}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-700{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-50\/10{background-color:#fff7ed1a}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.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-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-background{--tw-gradient-from: hsl(var(--background)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--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)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-50{--tw-gradient-from: #fdf2f8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 242 248 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500{--tw-gradient-from: #ec4899 var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500\/10{--tw-gradient-from: rgb(236 72 153 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-rose-50{--tw-gradient-from: #fff1f2 var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 241 242 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-50{--tw-gradient-to: #eff6ff var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-muted\/50{--tw-gradient-to: hsl(var(--muted) / .5) var(--tw-gradient-to-position)}.to-orange-50{--tw-gradient-to: #fff7ed var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-50{--tw-gradient-to: #fdf2f8 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-purple-500\/10{--tw-gradient-to: rgb(168 85 247 / .1) var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.to-violet-50{--tw-gradient-to: #f5f3ff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.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-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.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-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-4{--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(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-border\/50{--tw-ring-color: hsl(var(--border) / .5)}.ring-orange-500\/50{--tw-ring-color: rgb(249 115 22 / .5)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.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{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.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)}.backdrop-filter{-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-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;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}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Medium.ttf) format("truetype");font-weight:500;font-style:normal;font-display:swap}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:hsl(var(--border)) transparent}.custom-scrollbar::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:4px;border:2px solid transparent;background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5);background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-corner{background:transparent}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-green-200:hover{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-red-200:hover{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-background\/50:hover{background-color:hsl(var(--background) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-pink-500\/20:hover{--tw-gradient-from: rgb(236 72 153 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-purple-500\/20:hover{--tw-gradient-to: rgb(168 85 247 / .2) var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--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)}.hover\:shadow-lg:hover{--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)}.hover\:shadow-md:hover{--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)}.hover\:ring-2:hover{--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)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(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-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=inactive\]\:h-0[data-state=inactive]{height:0px}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=cancel\]\:translate-y-0[data-swipe=cancel]{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-y-\[var\(--radix-toast-swipe-end-y\)\][data-swipe=end]{--tw-translate-y: var(--radix-toast-swipe-end-y);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-y-\[var\(--radix-toast-swipe-move-y\)\][data-swipe=move]{--tw-translate-y: var(--radix-toast-swipe-move-y);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 fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-top[data-state=closed]{animation:slide-out-to-top .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.data-\[state\=open\]\:animate-slide-in-from-top[data-state=open]{animation:slide-in-from-top .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-top[data-swipe=end]{animation:slide-out-to-top .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--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)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(20 83 45 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/20:is(.dark *){background-color:#450a0a33}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:from-amber-950\/20:is(.dark *){--tw-gradient-from: rgb(69 26 3 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(69 26 3 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-indigo-950\/20:is(.dark *){--tw-gradient-from: rgb(30 27 75 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 27 75 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-pink-950\/20:is(.dark *){--tw-gradient-from: rgb(80 7 36 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(80 7 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-rose-950\/20:is(.dark *){--tw-gradient-from: rgb(76 5 25 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(76 5 25 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-blue-950\/20:is(.dark *){--tw-gradient-to: rgb(23 37 84 / .2) var(--tw-gradient-to-position)}.dark\:to-orange-950\/20:is(.dark *){--tw-gradient-to: rgb(67 20 7 / .2) var(--tw-gradient-to-position)}.dark\:to-pink-950\/20:is(.dark *){--tw-gradient-to: rgb(80 7 36 / .2) var(--tw-gradient-to-position)}.dark\:to-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .2) var(--tw-gradient-to-position)}.dark\:to-violet-950\/20:is(.dark *){--tw-gradient-to: rgb(46 16 101 / .2) var(--tw-gradient-to-position)}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[85vh\]{height:85vh}.sm\:h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-32{width:8rem}.sm\:w-4{width:1rem}.sm\:w-48{width:12rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-32{max-width:8rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.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\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\: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))}.sm\: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))}.sm\: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))}.sm\: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))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:p-8{padding:2rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:pt-6{padding-top:1.5rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:col-span-2{grid-column:span 2 / span 2}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\: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))}.md\: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))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:inline{display:inline}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\: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))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\: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))}.print\:rounded-none{border-radius:0}.print\:p-0{padding:0}.print\:shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;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))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-0>svg+div{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.27"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.uppy-Root{box-sizing:border-box;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1;position:relative;text-align:left;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.uppy-Root[dir=rtl],[dir=rtl] .uppy-Root{text-align:right}.uppy-Root *,.uppy-Root :after,.uppy-Root :before{box-sizing:inherit}.uppy-Root [hidden]{display:none}.uppy-u-reset{all:initial;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;line-height:1}[dir=rtl] .uppy-u-reset{text-align:right}.uppy-truncate-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-c-textInput{background-color:#fff;border:1px solid #ddd;border-radius:4px;font-family:inherit;font-size:14px;line-height:1.5;padding:6px 8px}.uppy-size--md .uppy-c-textInput{padding:8px 10px}.uppy-c-textInput:focus{border-color:#1269cf99;box-shadow:0 0 0 3px #1269cf26;outline:none}[data-uppy-theme=dark] .uppy-c-textInput{background-color:#333;border-color:#333;color:#eaeaea}[data-uppy-theme=dark] .uppy-c-textInput:focus{border-color:#525252;box-shadow:none}.uppy-c-icon{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;fill:currentColor}.uppy-c-btn{align-items:center;color:inherit;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:500;justify-content:center;line-height:1;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.uppy-c-btn,[dir=rtl] .uppy-c-btn{text-align:center}.uppy-c-btn:not(:disabled):not(.disabled){cursor:pointer}.uppy-c-btn::-moz-focus-inner{border:0}.uppy-c-btn-primary{background-color:#1269cf;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.uppy-c-btn-primary:not(:disabled):hover{background-color:#0e51a0}.uppy-c-btn-primary:focus{box-shadow:0 0 0 3px #1269cf66;outline:none}.uppy-size--md .uppy-c-btn-primary{padding:13px 22px}[data-uppy-theme=dark] .uppy-c-btn-primary{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-primary::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-primary:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-c-btn-primary.uppy-c-btn--disabled{background-color:#8eb2db}.uppy-c-btn-link{background-color:initial;border-radius:4px;color:#525252;font-size:14px;line-height:1;padding:10px 15px}.uppy-c-btn-link:hover{color:#333}.uppy-c-btn-link:focus{box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-size--md .uppy-c-btn-link{padding:13px 18px}[data-uppy-theme=dark] .uppy-c-btn-link{color:#eaeaea}[data-uppy-theme=dark] .uppy-c-btn-link:focus{outline:none}[data-uppy-theme=dark] .uppy-c-btn-link::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-c-btn-link:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-c-btn-link:hover{color:#939393}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:6px}.uppy-ProviderBrowser-viewType--grid ul.uppy-ProviderBrowser-list:after,.uppy-ProviderBrowser-viewType--unsplash ul.uppy-ProviderBrowser-list:after{content:"";flex:auto}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{margin:0;position:relative;width:50%}.uppy-size--md .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--md .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:33.3333%}.uppy-size--lg .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem,.uppy-size--lg .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem{width:25%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem:before,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem:before{content:"";display:block;padding-top:100%}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--selected svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected img,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--selected svg{opacity:.85}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--disabled,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--disabled{opacity:.5}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#93939333}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview .uppy-ProviderBrowserItem-inner{background-color:#eaeaea33}.uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,.uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{height:30%;width:30%;fill:#000000b3}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid li.uppy-ProviderBrowserItem--noPreview svg,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash li.uppy-ProviderBrowserItem--noPreview svg{fill:#fffc}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{border-radius:4px;height:calc(100% - 14px);inset:7px;overflow:hidden;position:absolute;text-align:center;width:calc(100% - 14px)}@media(hover:none){.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner .uppy-ProviderBrowserItem-author{display:block}}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner,[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner{box-shadow:0 0 0 3px #aae1ffb3}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-inner img{border-radius:4px;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author{background:#0000004d;bottom:0;color:#fff;display:none;font-size:12px;font-weight:500;left:0;margin:0;padding:5px;position:absolute;text-decoration:none;width:100%}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-author:hover,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-author:hover{background:#0006;text-decoration:underline}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-radius:50%;height:26px;opacity:0;position:absolute;right:16px;top:16px;width:26px;z-index:1002}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox:after{height:7px;inset-inline-start:7px;top:8px;width:12px}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{opacity:1}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label .uppy-ProviderBrowserItem-author,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:hover+label .uppy-ProviderBrowserItem-author{display:block}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label:focus{outline:none}.uppy-ProviderBrowser-viewType--grid .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner,.uppy-ProviderBrowser-viewType--unsplash .uppy-ProviderBrowserItem-checkbox--grid:focus+label::-moz-focus-inner{border:0}.uppy-ProviderBrowser-viewType--list{background-color:#fff}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list{background-color:#1f1f1f}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{align-items:center;display:flex;margin:0;padding:7px 15px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem{color:#eaeaea}.uppy-ProviderBrowser-viewType--list li.uppy-ProviderBrowserItem--disabled{opacity:.6}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox{background-color:#fff;border:1px solid #cfcfcf;border-radius:3px;height:17px;margin-inline-end:15px;width:17px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border:1px solid #1269cf;box-shadow:0 0 0 3px #1269cf40;outline:none}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:after{height:5px;inset-inline-start:3px;opacity:0;top:4px;width:9px}[data-uppy-theme=dark] .uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-checkbox:focus{border-color:#02baf2b3;box-shadow:0 0 0 3px #02baf233}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox{background-color:#1269cf;border-color:#1269cf}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{opacity:1}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner{align-items:center;color:inherit;display:flex;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;overflow:hidden;padding:2px;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner:focus{outline:none;text-decoration:underline}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner img,.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner svg{margin-inline-end:8px}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-inner span{line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem--disabled .uppy-ProviderBrowserItem-inner{cursor:default}.uppy-ProviderBrowser-viewType--list .uppy-ProviderBrowserItem-iconWrap{margin-inline-end:7px;width:20px}.uppy-ProviderBrowserItem-checkbox{cursor:pointer;flex-shrink:0;position:relative}.uppy-ProviderBrowserItem-checkbox:disabled,.uppy-ProviderBrowserItem-checkbox:disabled:after{cursor:default}[data-uppy-theme=dark] .uppy-ProviderBrowserItem-checkbox{background-color:#1f1f1f;border-color:#939393}[data-uppy-theme=dark] .uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox{background-color:#333}.uppy-ProviderBrowserItem--is-checked .uppy-ProviderBrowserItem-checkbox:after{border-bottom:2px solid #eaeaea;border-left:2px solid #eaeaea;content:"";cursor:pointer;position:absolute;transform:rotate(-45deg)}.uppy-ProviderBrowserItem--is-partial .uppy-ProviderBrowserItem-checkbox:after{background-color:#eaeaea!important;content:""!important;height:2px!important;left:20%!important;position:absolute!important;right:20%!important;top:50%!important;transform:translateY(-50%)!important}.uppy-SearchProvider{align-items:center;display:flex;flex:1;flex-direction:column;height:100%;justify-content:center;width:100%}[data-uppy-theme=dark] .uppy-SearchProvider{background-color:#1f1f1f}.uppy-SearchProvider-input{margin-bottom:15px;max-width:650px;width:90%}.uppy-size--md .uppy-SearchProvider-input{margin-bottom:20px}.uppy-SearchProvider-input::-webkit-search-cancel-button{display:none}.uppy-SearchProvider-searchButton{padding:13px 25px}.uppy-size--md .uppy-SearchProvider-searchButton{padding:13px 30px}.uppy-DashboardContent-panelBody{align-items:center;display:flex;flex:1;justify-content:center}[data-uppy-theme=dark] .uppy-DashboardContent-panelBody{background-color:#1f1f1f}.uppy-Provider-auth,.uppy-Provider-empty,.uppy-Provider-error,.uppy-Provider-loading{align-items:center;color:#939393;display:flex;flex:1;flex-flow:column wrap;justify-content:center}.uppy-Provider-empty{color:#939393}.uppy-Provider-authIcon svg{height:75px;width:100px}.uppy-Provider-authTitle{color:#757575;font-size:17px;font-weight:400;line-height:1.4;margin-bottom:30px;max-width:500px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Provider-authTitle{font-size:20px}[data-uppy-theme=dark] .uppy-Provider-authTitle{color:#cfcfcf}.uppy-Provider-btn-google{align-items:center;background:#4285f4;display:flex;padding:8px 12px!important}.uppy-Provider-btn-google:hover{background-color:#1266f1}.uppy-Provider-btn-google:focus{box-shadow:0 0 0 3px #4285f466;outline:none}.uppy-Provider-btn-google svg{margin-right:8px}.uppy-Provider-breadcrumbs{color:#525252;flex:1;font-size:12px;margin-bottom:10px;text-align:start}.uppy-size--md .uppy-Provider-breadcrumbs{margin-bottom:0}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs{color:#eaeaea}.uppy-Provider-breadcrumbsIcon{color:#525252;display:inline-block;line-height:1;margin-inline-end:4px;vertical-align:middle}.uppy-Provider-breadcrumbsIcon svg{height:13px;width:13px;fill:#525252}.uppy-Provider-breadcrumbs button{border-radius:3px;display:inline-block;line-height:inherit;padding:4px}.uppy-Provider-breadcrumbs button:focus{outline:none}.uppy-Provider-breadcrumbs button::-moz-focus-inner{border:0}.uppy-Provider-breadcrumbs button:hover{color:#0e51a0}.uppy-Provider-breadcrumbs button:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button:focus{background-color:#333}.uppy-Provider-breadcrumbs button:not(:last-of-type){text-decoration:underline}.uppy-Provider-breadcrumbs button:last-of-type{color:#333;cursor:normal;font-weight:500;pointer-events:none}.uppy-Provider-breadcrumbs button:hover{cursor:pointer}[data-uppy-theme=dark] .uppy-Provider-breadcrumbs button{color:#eaeaea}.uppy-ProviderBrowser{display:flex;flex:1;flex-direction:column;font-size:14px;font-weight:400;height:100%}.uppy-ProviderBrowser-user{color:#333;font-weight:500;margin:0 8px 0 0}[data-uppy-theme=dark] .uppy-ProviderBrowser-user{color:#eaeaea}.uppy-ProviderBrowser-user:after{color:#939393;content:"·";font-weight:400;inset-inline-start:4px;position:relative}.uppy-ProviderBrowser-header{border-bottom:1px solid #eaeaea;position:relative;z-index:1001}[data-uppy-theme=dark] .uppy-ProviderBrowser-header{border-bottom:1px solid #333}.uppy-ProviderBrowser-headerBar{background-color:#fafafa;color:#757575;font-size:12px;line-height:1.4;padding:7px 15px;z-index:1001}.uppy-size--md .uppy-ProviderBrowser-headerBar{align-items:center;display:flex}[data-uppy-theme=dark] .uppy-ProviderBrowser-headerBar{background-color:#1f1f1f}.uppy-ProviderBrowser-headerBar--simple{display:block;justify-content:center;text-align:center}.uppy-ProviderBrowser-headerBar--simple .uppy-Provider-breadcrumbsWrap{display:inline-block;flex:none;vertical-align:middle}.uppy-ProviderBrowser-searchFilter{align-items:center;display:flex;height:30px;margin-bottom:15px;margin-top:15px;padding-left:8px;padding-right:8px;position:relative;width:100%}.uppy-ProviderBrowser-searchFilterInput{background-color:#eaeaea;border:0;border-radius:4px;color:#333;font-family:-apple-system,system-ui,BlinkMacSystemFont,Segoe UI,Segoe UI Symbol,Segoe UI Emoji,Apple Color Emoji,Roboto,Helvetica,Arial,sans-serif;font-size:13px;height:30px;line-height:1.4;outline:0;padding-inline-end:30px;padding-inline-start:30px;width:100%;z-index:1001}.uppy-ProviderBrowser-searchFilterInput::-webkit-search-cancel-button{display:none}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput{background-color:#1f1f1f;color:#eaeaea}.uppy-ProviderBrowser-searchFilterInput:focus{background-color:#cfcfcf;border:0}[data-uppy-theme=dark] .uppy-ProviderBrowser-searchFilterInput:focus{background-color:#333}.uppy-ProviderBrowser-searchFilterIcon{color:#757575;height:12px;inset-inline-start:16px;position:absolute;width:12px;z-index:1002}.uppy-ProviderBrowser-searchFilterInput::-moz-placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterInput::placeholder{color:#939393;opacity:1}.uppy-ProviderBrowser-searchFilterReset{border-radius:3px;color:#939393;cursor:pointer;height:22px;inset-inline-end:16px;padding:6px;position:absolute;width:22px;z-index:1002}.uppy-ProviderBrowser-searchFilterReset:focus{outline:none}.uppy-ProviderBrowser-searchFilterReset::-moz-focus-inner{border:0}.uppy-ProviderBrowser-searchFilterReset:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-ProviderBrowser-searchFilterReset:hover{color:#757575}.uppy-ProviderBrowser-searchFilterReset svg{vertical-align:text-top}.uppy-ProviderBrowser-userLogout{border-radius:3px;color:#1269cf;cursor:pointer;line-height:inherit;padding:4px}.uppy-ProviderBrowser-userLogout:focus{outline:none}.uppy-ProviderBrowser-userLogout::-moz-focus-inner{border:0}.uppy-ProviderBrowser-userLogout:hover{color:#0e51a0}.uppy-ProviderBrowser-userLogout:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout:focus{background-color:#333}.uppy-ProviderBrowser-userLogout:hover{text-decoration:underline}[data-uppy-theme=dark] .uppy-ProviderBrowser-userLogout{color:#eaeaea}.uppy-ProviderBrowser-body{flex:1;position:relative}.uppy-ProviderBrowser-list{background-color:#fff;border-spacing:0;display:block;flex:1;height:100%;inset:0;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;width:100%;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-ProviderBrowser-list{background-color:#1f1f1f}.uppy-ProviderBrowser-list:focus{outline:none}.uppy-ProviderBrowserItem-inner{cursor:pointer;font-size:13px;font-weight:500}.uppy-ProviderBrowser-footer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;justify-content:space-between;padding:15px}.uppy-ProviderBrowser-footer button{margin-inline-end:8px}[data-uppy-theme=dark] .uppy-ProviderBrowser-footer{background-color:#1f1f1f;border-top:1px solid #333}.uppy-ProviderBrowser-footer-buttons{flex-shrink:0}.uppy-ProviderBrowser-footer-error{color:#e32437;line-height:18px}@media(max-width:426px){.uppy-ProviderBrowser-footer{align-items:stretch;flex-direction:column-reverse}.uppy-ProviderBrowser-footer-error{padding-bottom:10px}}.picker-dialog-bg{z-index:20000!important}.picker-dialog{z-index:20001!important}.uppy-Dashboard-Item-previewInnerWrap{align-items:center;border-radius:3px;box-shadow:0 0 2px #0006;display:flex;flex-direction:column;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.uppy-size--md .uppy-Dashboard-Item-previewInnerWrap{box-shadow:0 1px 2px #00000026}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewInnerWrap{box-shadow:none}.uppy-Dashboard-Item-previewInnerWrap:after{background-color:#000000a6;content:"";display:none;inset:0;position:absolute;z-index:1001}.uppy-Dashboard-Item-previewLink{inset:0;position:absolute;z-index:1002}.uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #579df0}[data-uppy-theme=dark] .uppy-Dashboard-Item-previewLink:focus{box-shadow:inset 0 0 0 3px #016c8d}.uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;height:100%;-o-object-fit:cover;object-fit:cover;transform:translateZ(0);width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview img.uppy-Dashboard-Item-previewImg{height:auto;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;padding:10px;width:auto}.uppy-Dashboard-Item-progress{color:#fff;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:all .35 ease;width:120px;z-index:1002}.uppy-Dashboard-Item-progressIndicator{color:#fff;display:inline-block;height:38px;opacity:.9;width:38px}.uppy-size--md .uppy-Dashboard-Item-progressIndicator{height:55px;width:55px}button.uppy-Dashboard-Item-progressIndicator{cursor:pointer}button.uppy-Dashboard-Item-progressIndicator:focus{outline:none}button.uppy-Dashboard-Item-progressIndicator::-moz-focus-inner{border:0}button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--bg,button.uppy-Dashboard-Item-progressIndicator:focus .uppy-Dashboard-Item-progressIcon--retry{fill:#579df0}.uppy-Dashboard-Item-progressIcon--circle{height:100%;width:100%}.uppy-Dashboard-Item-progressIcon--bg{stroke:#fff6}.uppy-Dashboard-Item-progressIcon--progress{transition:stroke-dashoffset .5s ease-out;stroke:#fff}.uppy-Dashboard-Item-progressIcon--play{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--cancel{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--pause{transition:all .2s;fill:#fff;stroke:#fff}.uppy-Dashboard-Item-progressIcon--check{transition:all .2s;fill:#fff}.uppy-Dashboard-Item-progressIcon--retry{fill:#fff}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{inset-inline-end:-8px;inset-inline-start:auto;top:-9px;transform:none;width:auto}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:18px;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progressIndicator{height:28px;width:28px}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:18px;opacity:1;width:18px}.uppy-size--md .uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progressIndicator{height:22px;width:22px}.uppy-Dashboard-Item.is-processing .uppy-Dashboard-Item-progress{opacity:0}.uppy-Dashboard-Item-fileInfo{padding-inline-end:5px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:10px}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfo{padding-inline-end:15px}.uppy-Dashboard-Item-name{font-size:12px;font-weight:500;line-height:1.3;margin-bottom:5px;word-wrap:anywhere;word-break:break-all}[data-uppy-theme=dark] .uppy-Dashboard-Item-name{color:#eaeaea}.uppy-size--md.uppy-Dashboard--singleFile .uppy-Dashboard-Item-name{font-size:14px;line-height:1.4}.uppy-Dashboard-Item-fileName{align-items:baseline;display:flex}.uppy-Dashboard-Item-fileName button{margin-left:5px}.uppy-Dashboard-Item-author{color:#757575;display:inline-block;font-size:11px;font-weight:400;line-height:1;margin-bottom:5px;vertical-align:bottom}.uppy-Dashboard-Item-author a{color:#757575}.uppy-Dashboard-Item-status{color:#757575;font-size:11px;font-weight:400;line-height:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-status{color:#bbb}.uppy-Dashboard-Item-statusSize{display:inline-block;margin-bottom:5px;text-transform:uppercase;vertical-align:bottom}.uppy-Dashboard-Item-reSelect{color:#1269cf;font-family:inherit;font-size:inherit;font-weight:600}.uppy-Dashboard-Item-errorMessage{background-color:#fdeff1;color:#a51523;font-size:11px;font-weight:500;line-height:1.3;padding:5px 6px}.uppy-Dashboard-Item-errorMessageBtn{color:#a51523;cursor:pointer;font-size:11px;font-weight:500;text-decoration:underline}.uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{display:none}.uppy-size--md .uppy-Dashboard-Item-preview .uppy-Dashboard-Item-errorMessage{border-bottom-left-radius:3px;border-bottom-right-radius:3px;border-top:1px solid #f7c2c8;bottom:0;display:block;left:0;line-height:1.4;padding:6px 8px;position:absolute;right:0}.uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{border:1px solid #f7c2c8;border-radius:3px;display:inline-block;position:static}.uppy-size--md .uppy-Dashboard-Item-fileInfo .uppy-Dashboard-Item-errorMessage{display:none}.uppy-Dashboard-Item-action{color:#939393;cursor:pointer}.uppy-Dashboard-Item-action:focus{outline:none}.uppy-Dashboard-Item-action::-moz-focus-inner{border:0}.uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-Item-action:hover{color:#1f1f1f;opacity:1}[data-uppy-theme=dark] .uppy-Dashboard-Item-action{color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{outline:none}[data-uppy-theme=dark] .uppy-Dashboard-Item-action::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:focus{box-shadow:0 0 0 2px #aae1ffd9}[data-uppy-theme=dark] .uppy-Dashboard-Item-action:hover{color:#eaeaea}.uppy-Dashboard-Item-action--remove{color:#1f1f1f;opacity:.95}.uppy-Dashboard-Item-action--remove:hover{color:#000;opacity:1}.uppy-size--md .uppy-Dashboard-Item-action--remove{height:18px;inset-inline-end:-8px;padding:0;position:absolute;top:-8px;width:18px;z-index:1002}.uppy-size--md .uppy-Dashboard-Item-action--remove:focus{border-radius:50%}.uppy-Dashboard--singleFile.uppy-size--height-md .uppy-Dashboard-Item-action--remove{inset-inline-end:8px;position:absolute;top:8px}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove{color:#525252}[data-uppy-theme=dark] .uppy-Dashboard-Item-action--remove:hover{color:#333}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-actionWrapper{align-items:center;display:flex}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action{height:22px;margin-left:3px;padding:3px;width:22px}.uppy-Dashboard:not(.uppy-size--md):not(.uppy-Dashboard--singleFile.uppy-size--height-md) .uppy-Dashboard-Item-action:focus{border-radius:3px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink,.uppy-size--md .uppy-Dashboard-Item-action--edit{height:16px;padding:0;width:16px}.uppy-size--md .uppy-Dashboard-Item-action--copyLink:focus,.uppy-size--md .uppy-Dashboard-Item-action--edit:focus{border-radius:3px}.uppy-Dashboard-Item{align-items:center;border-bottom:1px solid #eaeaea;display:flex;padding:10px}.uppy-Dashboard:not(.uppy-Dashboard--singleFile) .uppy-Dashboard-Item{padding-inline-end:0}[data-uppy-theme=dark] .uppy-Dashboard-Item{border-bottom:1px solid #333}.uppy-size--md .uppy-Dashboard-Item{border-bottom:0;display:block;float:inline-start;height:215px;margin:5px 15px;padding:0;position:relative;width:calc(33.333% - 30px)}.uppy-size--lg .uppy-Dashboard-Item{height:190px;margin:5px 15px;padding:0;width:calc(25% - 30px)}.uppy-size--xl .uppy-Dashboard-Item{height:210px;padding:0;width:calc(20% - 30px)}.uppy-Dashboard--singleFile .uppy-Dashboard-Item{border-bottom:0;display:flex;flex-direction:column;height:100%;max-width:400px;padding:15px;position:relative;width:100%}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-previewInnerWrap{opacity:.2}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-name{opacity:.7}.uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='35' height='39' viewBox='0 0 35 39'%3E%3Cpath fill='%2523000' d='M1.708 38.66c1.709 0 3.417-3.417 6.834-3.417s5.125 3.417 8.61 3.417c3.348 0 5.056-3.417 8.473-3.417 4.305 0 5.125 3.417 6.833 3.417.889 0 1.709-.889 1.709-1.709v-19.68C34.167-5.757 0-5.757 0 17.271v19.68c0 .82.888 1.709 1.708 1.709m8.542-17.084a3.383 3.383 0 0 1-3.417-3.416 3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.417 3.417 3.383 3.383 0 0 1-3.417 3.416m13.667 0A3.383 3.383 0 0 1 20.5 18.16a3.383 3.383 0 0 1 3.417-3.417 3.383 3.383 0 0 1 3.416 3.417 3.383 3.383 0 0 1-3.416 3.416'/%3E%3C/svg%3E");background-position:50% 10px;background-repeat:no-repeat;background-size:25px;content:"";inset:0;opacity:.5;position:absolute;z-index:1005}.uppy-size--md .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:40px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item.is-ghost .uppy-Dashboard-Item-preview:before{background-position:50% 50%;background-size:30%}.uppy-Dashboard-Item-preview{flex-grow:0;flex-shrink:0;height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-Item-preview{height:140px;width:100%}.uppy-size--lg .uppy-Dashboard-Item-preview{height:120px}.uppy-size--xl .uppy-Dashboard-Item-preview{height:140px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-preview{flex-grow:1;max-height:75%;width:100%}.uppy-Dashboard--singleFile.uppy-size--md .uppy-Dashboard-Item-preview{max-height:100%}.uppy-Dashboard-Item-fileInfoAndButtons{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-inline-end:8px;padding-inline-start:12px}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons,.uppy-size--md .uppy-Dashboard-Item-fileInfoAndButtons{align-items:flex-start;padding:9px 0 0}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-fileInfoAndButtons{flex-grow:0;width:100%}.uppy-Dashboard-Item-fileInfo{flex-grow:1;flex-shrink:1}.uppy-Dashboard-Item-actionWrapper{flex-grow:0;flex-shrink:0}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-previewInnerWrap:after,.uppy-Dashboard-Item.is-inprogress .uppy-Dashboard-Item-previewInnerWrap:after{display:block}.uppy-Dashboard-Item-errorDetails{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border:none;border-radius:50%;color:#fff;cursor:help;flex-shrink:0;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;width:13px}.uppy-Dashboard-Item-errorDetails:after{line-height:1.3;word-wrap:break-word}.uppy-Dashboard-FileCard{background-color:#fff;border-radius:5px;box-shadow:0 0 10px 4px #0000001a;display:flex;flex-direction:column;height:100%;inset:0;position:absolute;width:100%;z-index:1005}.uppy-Dashboard-FileCard .uppy-DashboardContent-bar{border-top-left-radius:5px;border-top-right-radius:5px}.uppy-Dashboard-FileCard .uppy-Dashboard-FileCard-actions{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.uppy-Dashboard-FileCard-inner{display:flex;flex-direction:column;flex-grow:1;flex-shrink:1;height:100%;min-height:0}.uppy-Dashboard-FileCard-preview{align-items:center;border-bottom:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:1;height:60%;justify-content:center;min-height:0;position:relative}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-preview{background-color:#333;border-bottom:0}.uppy-Dashboard-FileCard-preview img.uppy-Dashboard-Item-previewImg{border-radius:3px;box-shadow:0 3px 20px #00000026;flex:0 0 auto;max-height:90%;max-width:90%;-o-object-fit:cover;object-fit:cover}.uppy-Dashboard-FileCard-edit{background-color:#00000080;border-radius:50px;color:#fff;font-size:13px;inset-inline-end:10px;padding:7px 15px;position:absolute;top:10px}.uppy-Dashboard-FileCard-edit:focus{outline:none}.uppy-Dashboard-FileCard-edit::-moz-focus-inner{border:0}.uppy-Dashboard-FileCard-edit:focus{box-shadow:0 0 0 3px #1269cf80}.uppy-Dashboard-FileCard-edit:hover{background-color:#000c}.uppy-Dashboard-FileCard-info{flex-grow:0;flex-shrink:0;height:40%;overflow-y:auto;padding:30px 20px 20px;-webkit-overflow-scrolling:touch}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-info{background-color:#1f1f1f}.uppy-Dashboard-FileCard-fieldset{border:0;font-size:0;margin:auto auto 12px;max-width:640px;padding:0}.uppy-Dashboard-FileCard-label{color:#525252;display:inline-block;font-size:12px;vertical-align:middle;width:22%}.uppy-size--md .uppy-Dashboard-FileCard-label{font-size:14px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-label{color:#eaeaea}.uppy-Dashboard-FileCard-input{display:inline-block;vertical-align:middle;width:78%}.uppy-Dashboard-FileCard-actions{align-items:center;background-color:#fafafa;border-top:1px solid #eaeaea;display:flex;flex-grow:0;flex-shrink:0;height:55px;padding:0 15px}.uppy-size--md .uppy-Dashboard-FileCard-actions{height:65px}[data-uppy-theme=dark] .uppy-Dashboard-FileCard-actions{background-color:#1f1f1f;border-top:1px solid #333}.uppy-Dashboard-FileCard-actionsBtn{margin-inline-end:10px}.uppy-Informer{bottom:60px;left:0;position:absolute;right:0;text-align:center;z-index:1005}.uppy-Informer span>div{margin-bottom:6px}.uppy-Informer-animated{opacity:0;transform:translateY(350%);transition:all .3s ease-in;z-index:-1000}.uppy-Informer p{background-color:#757575;border-radius:18px;color:#fff;display:inline-block;font-size:12px;font-weight:400;line-height:1.4;margin:0;max-width:90%;padding:6px 15px}.uppy-size--md .uppy-Informer p{font-size:14px;line-height:1.3;max-width:500px;padding:10px 20px}[data-uppy-theme=dark] .uppy-Informer p{background-color:#333}.uppy-Informer p span{background-color:#fff;border-radius:50%;color:#525252;display:inline-block;font-size:10px;height:13px;inset-inline-start:3px;line-height:12px;margin-inline-start:-1px;position:relative;top:-1px;vertical-align:middle;width:13px}.uppy-Informer p span:hover{cursor:help}.uppy-Informer p span:after{line-height:1.3;word-wrap:break-word}.uppy-Root [aria-label][role~=tooltip]{position:relative}.uppy-Root [aria-label][role~=tooltip]:after,.uppy-Root [aria-label][role~=tooltip]:before{backface-visibility:hidden;box-sizing:border-box;opacity:0;pointer-events:none;position:absolute;transform:translateZ(0);transform-origin:top;transition:all var(--microtip-transition-duration,.18s) var(--microtip-transition-easing,ease-in-out) var(--microtip-transition-delay,0s);will-change:transform;z-index:10}.uppy-Root [aria-label][role~=tooltip]:before{background-size:100% auto!important;content:""}.uppy-Root [aria-label][role~=tooltip]:after{background:#111111e6;border-radius:4px;box-sizing:initial;color:#fff;content:attr(aria-label);font-size:var(--microtip-font-size,13px);font-weight:var(--microtip-font-weight,normal);padding:.5em 1em;text-transform:var(--microtip-text-transform,none);white-space:nowrap}.uppy-Root [aria-label][role~=tooltip]:focus:after,.uppy-Root [aria-label][role~=tooltip]:focus:before,.uppy-Root [aria-label][role~=tooltip]:hover:after,.uppy-Root [aria-label][role~=tooltip]:hover:before{opacity:1;pointer-events:auto}.uppy-Root [role~=tooltip][data-microtip-position|=top]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M2.658 0h32.004c-6 0-11.627 12.002-16.002 12.002S8.594 0 2.658 0'/%3E%3C/svg%3E") no-repeat;bottom:100%;height:6px;left:50%;margin-bottom:5px;transform:translate3d(-50%,0,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=top]:after{bottom:100%;left:50%;margin-bottom:11px;transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=top]:hover:before{transform:translate3d(-50%,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:after{bottom:100%;transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-left]:hover:after{transform:translate3d(calc(-100% + 16px),-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:after{bottom:100%;transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=top-right]:hover:after{transform:translate3d(-16px,-5px,0)}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M33.342 12H1.338c6 0 11.627-12.002 16.002-12.002S27.406 12 33.342 12'/%3E%3C/svg%3E") no-repeat;bottom:auto;height:6px;left:50%;margin-bottom:0;margin-top:5px;top:100%;transform:translate3d(-50%,-10px,0);width:18px}.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:after{left:50%;margin-top:11px;top:100%;transform:translate3d(-50%,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position|=bottom]:hover:before{transform:translate3d(-50%,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:after{top:100%;transform:translate3d(calc(-100% + 16px),-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-left]:hover:after{transform:translate3d(calc(-100% + 16px),0,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:after{top:100%;transform:translate3d(-16px,-10px,0)}.uppy-Root [role~=tooltip][data-microtip-position=bottom-right]:hover:after{transform:translate3d(-16px,0,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:before{inset:50% 100% auto auto;transform:translate3d(10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=left]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M0 33.342V1.338c0 6 12.002 11.627 12.002 16.002S0 27.406 0 33.342'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-right:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=left]:after{margin-right:11px}.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=left]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:before{bottom:auto;left:100%;top:50%;transform:translate3d(-10px,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-position=right]:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='36'%3E%3Cpath fill='rgba(17, 17, 17, 0.9)' d='M12 2.658v32.004c0-6-12.002-11.627-12.002-16.002S12 8.594 12 2.658'/%3E%3C/svg%3E") no-repeat;height:18px;margin-bottom:0;margin-left:5px;width:6px}.uppy-Root [role~=tooltip][data-microtip-position=right]:after{margin-left:11px}.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:after,.uppy-Root [role~=tooltip][data-microtip-position=right]:hover:before{transform:translate3d(0,-50%,0)}.uppy-Root [role~=tooltip][data-microtip-size=small]:after{white-space:normal;width:80px}.uppy-Root [role~=tooltip][data-microtip-size=medium]:after{white-space:normal;width:150px}.uppy-Root [role~=tooltip][data-microtip-size=large]:after{white-space:normal;width:260px}.uppy-StatusBar{background-color:#fff;color:#fff;display:flex;font-size:12px;font-weight:400;height:46px;line-height:40px;position:relative;transition:height .2s;z-index:1001}[data-uppy-theme=dark] .uppy-StatusBar{background-color:#1f1f1f}.uppy-StatusBar:before{background-color:#eaeaea;content:"";height:2px;inset:0;position:absolute;width:100%}[data-uppy-theme=dark] .uppy-StatusBar:before{background-color:#757575}.uppy-StatusBar[aria-hidden=true]{height:0;overflow-y:hidden}.uppy-StatusBar.is-complete .uppy-StatusBar-progress{background-color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-progress{background-color:#e32437}.uppy-StatusBar.is-complete .uppy-StatusBar-statusIndicator{color:#1bb240}.uppy-StatusBar.is-error .uppy-StatusBar-statusIndicator{color:#e32437}.uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#fff;border-top:1px solid #eaeaea;height:65px}[data-uppy-theme=dark] .uppy-StatusBar:not([aria-hidden=true]).is-waiting{background-color:#1f1f1f;border-top:1px solid #333}.uppy-StatusBar-progress{background-color:#1269cf;height:2px;position:absolute;transition:background-color,width .3s ease-out;z-index:1001}.uppy-StatusBar-progress.is-indeterminate{animation:uppy-StatusBar-ProgressStripes 1s linear infinite;background-image:linear-gradient(45deg,#0000004d 25%,#0000 0 50%,#0000004d 0 75%,#0000 0,#0000);background-size:64px 64px}@keyframes uppy-StatusBar-ProgressStripes{0%{background-position:0 0}to{background-position:64px 0}}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-progress,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-progress{background-color:#f6a623}.uppy-StatusBar.is-waiting .uppy-StatusBar-progress{display:none}.uppy-StatusBar-content{align-items:center;color:#333;display:flex;height:100%;padding-inline-start:10px;position:relative;text-overflow:ellipsis;white-space:nowrap;z-index:1002}.uppy-size--md .uppy-StatusBar-content{padding-inline-start:15px}[data-uppy-theme=dark] .uppy-StatusBar-content{color:#eaeaea}.uppy-StatusBar-status{display:flex;flex-direction:column;font-weight:400;justify-content:center;line-height:1.4;padding-inline-end:.3em}.uppy-StatusBar-statusPrimary{display:flex;font-weight:500;line-height:1}.uppy-StatusBar-statusPrimary button.uppy-StatusBar-details{margin-left:5px}[data-uppy-theme=dark] .uppy-StatusBar-statusPrimary{color:#eaeaea}.uppy-StatusBar-statusSecondary{color:#757575;display:inline-block;font-size:11px;line-height:1.2;margin-top:1px;white-space:nowrap}[data-uppy-theme=dark] .uppy-StatusBar-statusSecondary{color:#bbb}.uppy-StatusBar-statusSecondaryHint{display:inline-block;line-height:1;margin-inline-end:5px;vertical-align:middle}.uppy-size--md .uppy-StatusBar-statusSecondaryHint{margin-inline-end:8px}.uppy-StatusBar-statusIndicator{color:#525252;margin-inline-end:7px;position:relative;top:1px}.uppy-StatusBar-statusIndicator svg{vertical-align:text-bottom}.uppy-StatusBar-actions{align-items:center;bottom:0;display:flex;inset-inline-end:10px;position:absolute;top:0;z-index:1004}.uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#fafafa;height:100%;padding:0 15px;position:static;width:100%}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actions{background-color:#1f1f1f}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:column;height:90px}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts{flex-direction:row;height:65px}.uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:column;justify-content:center}.uppy-size--md .uppy-StatusBar:not([aria-hidden=true]).is-waiting.has-ghosts .uppy-StatusBar-actions{flex-direction:row;justify-content:normal}.uppy-StatusBar-actionCircleBtn{cursor:pointer;line-height:1;margin:3px;opacity:.9}.uppy-StatusBar-actionCircleBtn:focus{outline:none}.uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}.uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionCircleBtn:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionCircleBtn:hover{opacity:1}.uppy-StatusBar-actionCircleBtn:focus{border-radius:50%}.uppy-StatusBar-actionCircleBtn svg{vertical-align:bottom}.uppy-StatusBar-actionBtn{color:#1269cf;display:inline-block;font-size:10px;line-height:inherit;vertical-align:middle}.uppy-size--md .uppy-StatusBar-actionBtn{font-size:11px}.uppy-StatusBar-actionBtn--disabled{opacity:.4}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--disabled{opacity:.7}.uppy-StatusBar-actionBtn--retry{background-color:#ff4b23;border-radius:8px;color:#fff;height:16px;line-height:1;margin-inline-end:6px;padding:1px 6px 3px 18px;position:relative}.uppy-StatusBar-actionBtn--retry:focus{outline:none}.uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--retry:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar-actionBtn--retry:hover{background-color:#f92d00}.uppy-StatusBar-actionBtn--retry svg{inset-inline-start:6px;position:absolute;top:3px}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1bb240;color:#fff;font-size:14px;line-height:1;padding:15px 10px;width:100%}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#189c38}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{background-color:#1c8b37}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload:hover{background-color:#18762f}.uppy-size--md .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload{padding:13px 22px;width:auto}.uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1bb240;cursor:not-allowed}[data-uppy-theme=dark] .uppy-StatusBar.is-waiting .uppy-StatusBar-actionBtn--upload.uppy-StatusBar-actionBtn--disabled:hover{background-color:#1c8b37}.uppy-StatusBar:not(.is-waiting) .uppy-StatusBar-actionBtn--upload{background-color:initial;color:#1269cf}.uppy-StatusBar-actionBtn--uploadNewlyAdded{border-radius:3px;padding-inline-end:3px;padding-bottom:1px;padding-inline-start:3px}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}.uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 3px #1269cf80}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{outline:none}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded::-moz-focus-inner{border:0}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--uploadNewlyAdded:focus{box-shadow:0 0 0 2px #aae1ffd9}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-actionBtn--uploadNewlyAdded{display:none}.uppy-StatusBar-actionBtn--done{border-radius:3px;line-height:1;padding:7px 8px}.uppy-StatusBar-actionBtn--done:focus{outline:none}.uppy-StatusBar-actionBtn--done::-moz-focus-inner{border:0}.uppy-StatusBar-actionBtn--done:hover{color:#0e51a0}.uppy-StatusBar-actionBtn--done:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done:focus{background-color:#333}[data-uppy-theme=dark] .uppy-StatusBar-actionBtn--done{color:#02baf2}.uppy-size--md .uppy-StatusBar-actionBtn--done{font-size:14px}.uppy-StatusBar-serviceMsg{color:#000;font-size:11px;line-height:1.1;padding-left:10px}.uppy-size--md .uppy-StatusBar-serviceMsg{font-size:14px;padding-left:15px}[data-uppy-theme=dark] .uppy-StatusBar-serviceMsg{color:#eaeaea}.uppy-StatusBar-serviceMsg-ghostsIcon{left:6px;opacity:.5;position:relative;top:2px;vertical-align:text-bottom;width:10px}.uppy-size--md .uppy-StatusBar-serviceMsg-ghostsIcon{left:10px;top:1px;width:15px}.uppy-StatusBar-details{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#939393;border-radius:50%;color:#fff;cursor:help;display:inline-block;font-size:10px;font-weight:600;height:13px;inset-inline-start:2px;line-height:12px;position:relative;text-align:center;top:0;vertical-align:middle;width:13px}.uppy-StatusBar-details:after{line-height:1.3;word-wrap:break-word}.uppy-StatusBar-spinner{animation-duration:1s;animation-iteration-count:infinite;animation-name:uppy-StatusBar-spinnerAnimation;animation-timing-function:linear;fill:#1269cf;margin-inline-end:10px}.uppy-StatusBar.is-postprocessing .uppy-StatusBar-spinner,.uppy-StatusBar.is-preprocessing .uppy-StatusBar-spinner{fill:#f6a623}@keyframes uppy-StatusBar-spinnerAnimation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.uppy-transition-slideDownUp-enter{opacity:.01;transform:translate3d(0,-105%,0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-enter.uppy-transition-slideDownUp-enter-active{opacity:1;transform:translateZ(0)}.uppy-transition-slideDownUp-leave{opacity:1;transform:translateZ(0);transition:transform .25s ease-in-out,opacity .25s ease-in-out}.uppy-transition-slideDownUp-leave.uppy-transition-slideDownUp-leave-active{opacity:.01;transform:translate3d(0,-105%,0)}@keyframes uppy-Dashboard-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes uppy-Dashboard-fadeOut{0%{opacity:1}to{opacity:0}}@keyframes uppy-Dashboard-slideDownAndFadeIn{0%{opacity:0;transform:translate3d(-50%,-70%,0)}to{opacity:1;transform:translate3d(-50%,-50%,0)}}@keyframes uppy-Dashboard-slideDownAndFadeIn--small{0%{opacity:0;transform:translate3d(0,-20%,0)}to{opacity:1;transform:translateZ(0)}}@keyframes uppy-Dashboard-slideUpFadeOut{0%{opacity:1;transform:translate3d(-50%,-50%,0)}to{opacity:0;transform:translate3d(-50%,-70%,0)}}@keyframes uppy-Dashboard-slideUpFadeOut--small{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20%,0)}}.uppy-Dashboard--modal{z-index:1001}.uppy-Dashboard--modal[aria-hidden=true]{display:none}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideDownAndFadeIn .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeIn .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut--small .3s cubic-bezier(0,0,.2,1)}@media only screen and (min-width:820px){.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-inner{animation:uppy-Dashboard-slideUpFadeOut .3s cubic-bezier(0,0,.2,1)}}.uppy-Dashboard--modal.uppy-Dashboard--animateOpenClose.uppy-Dashboard--isClosing>.uppy-Dashboard-overlay{animation:uppy-Dashboard-fadeOut .3s cubic-bezier(0,0,.2,1)}.uppy-Dashboard-isFixed{height:100vh;overflow:hidden}.uppy-Dashboard--modal .uppy-Dashboard-overlay{background-color:#00000080;inset:0;position:fixed;z-index:1001}.uppy-Dashboard-inner{background-color:#f4f4f4;border:1px solid #eaeaea;border-radius:5px;max-height:100%;max-width:100%;outline:none;position:relative}.uppy-size--md .uppy-Dashboard-inner{min-height:auto}@media only screen and (min-width:820px){.uppy-Dashboard-inner{height:500px;width:650px}}.uppy-Dashboard--modal .uppy-Dashboard-inner{z-index:1002}[data-uppy-theme=dark] .uppy-Dashboard-inner{background-color:#1f1f1f}.uppy-Dashboard--isDisabled .uppy-Dashboard-inner{cursor:not-allowed}.uppy-Dashboard-innerWrap{border-radius:5px;display:flex;flex-direction:column;height:100%;opacity:0;overflow:hidden;position:relative}.uppy-Dashboard--isInnerWrapVisible .uppy-Dashboard-innerWrap{opacity:1}.uppy-Dashboard--isDisabled .uppy-Dashboard-innerWrap{cursor:not-allowed;filter:grayscale(100%);opacity:.6;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uppy-Dashboard--isDisabled .uppy-ProviderIconBg{fill:#9f9f9f}.uppy-Dashboard--isDisabled [aria-disabled],.uppy-Dashboard--isDisabled [disabled]{cursor:not-allowed;pointer-events:none}.uppy-Dashboard--modal .uppy-Dashboard-inner{border:none;inset:35px 15px 15px;position:fixed}@media only screen and (min-width:820px){.uppy-Dashboard--modal .uppy-Dashboard-inner{box-shadow:0 5px 15px 4px #00000026;left:50%;right:auto;top:50%;transform:translate(-50%,-50%)}}.uppy-Dashboard-close{color:#ffffffe6;cursor:pointer;display:block;font-size:27px;inset-inline-end:-2px;position:absolute;top:-33px;z-index:1005}.uppy-Dashboard-close:focus{outline:none}.uppy-Dashboard-close::-moz-focus-inner{border:0}.uppy-Dashboard-close:focus{color:#6eabf2}@media only screen and (min-width:820px){.uppy-Dashboard-close{font-size:35px;inset-inline-end:-35px;top:-10px}}.uppy-Dashboard-serviceMsg{background-color:#fffbf7;border-bottom:1px solid #edd4b9;border-top:1px solid #edd4b9;font-size:12px;font-weight:500;line-height:1.3;padding:12px 0;position:relative;top:-1px;z-index:1004}.uppy-size--md .uppy-Dashboard-serviceMsg{font-size:14px;line-height:1.4}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg{background-color:#1f1f1f;border-bottom:1px solid #333;border-top:1px solid #333;color:#eaeaea}.uppy-Dashboard-serviceMsg-title{display:block;line-height:1;margin-bottom:4px;padding-left:42px}.uppy-Dashboard-serviceMsg-text{padding:0 15px}.uppy-Dashboard-serviceMsg-actionBtn{color:#1269cf;font-size:inherit;font-weight:inherit;vertical-align:initial}[data-uppy-theme=dark] .uppy-Dashboard-serviceMsg-actionBtn{color:#02baf2e6}.uppy-Dashboard-serviceMsg-icon{left:15px;position:absolute;top:10px}.uppy-Dashboard-AddFiles{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;position:relative;text-align:center}[data-uppy-drag-drop-supported=true] .uppy-Dashboard-AddFiles{border:1px dashed #dfdfdf;border-radius:3px;height:calc(100% - 14px);margin:7px}.uppy-Dashboard-AddFilesPanel .uppy-Dashboard-AddFiles{border:none;height:calc(100% - 54px)}.uppy-Dashboard--modal .uppy-Dashboard-AddFiles{border-color:#cfcfcf}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles{border-color:#757575}.uppy-Dashboard-AddFiles-info{display:none;margin-top:auto;padding-bottom:15px;padding-top:15px}.uppy-size--height-md .uppy-Dashboard-AddFiles-info{display:block}.uppy-size--md .uppy-Dashboard-AddFiles-info{bottom:25px;left:0;padding-bottom:0;padding-top:30px;position:absolute;right:0}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-info{margin-top:0}.uppy-Dashboard-browse{color:#1269cf;cursor:pointer}.uppy-Dashboard-browse:focus{outline:none}.uppy-Dashboard-browse::-moz-focus-inner{border:0}.uppy-Dashboard-browse:focus,.uppy-Dashboard-browse:hover{border-bottom:1px solid #1269cf}[data-uppy-theme=dark] .uppy-Dashboard-browse{color:#02baf2e6}[data-uppy-theme=dark] .uppy-Dashboard-browse:focus,[data-uppy-theme=dark] .uppy-Dashboard-browse:hover{border-bottom:1px solid #02baf2}.uppy-Dashboard-browseBtn{display:block;font-size:14px;font-weight:500;margin-bottom:5px;margin-top:8px;width:100%}.uppy-size--md .uppy-Dashboard-browseBtn{font-size:15px;margin:15px auto;padding:13px 44px;width:auto}.uppy-Dashboard-AddFiles-list{display:flex;flex:1;flex-direction:column;margin-top:2px;overflow-y:auto;padding:2px 0;width:100%;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-AddFiles-list{flex:none;flex-direction:row;flex-wrap:wrap;justify-content:center;margin-top:15px;max-width:600px;overflow-y:visible;padding-top:0}.uppy-DashboardTab{border-bottom:1px solid #eaeaea;text-align:center;width:100%}[data-uppy-theme=dark] .uppy-DashboardTab{border-bottom:1px solid #333}.uppy-size--md .uppy-DashboardTab{border-bottom:none;display:inline-block;margin-bottom:10px;width:auto}.uppy-DashboardTab-btn{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:initial;color:#525252;cursor:pointer;flex-direction:row;height:100%;justify-content:left;padding:12px 15px;width:100%}.uppy-DashboardTab-btn:focus{outline:none}.uppy-size--md .uppy-DashboardTab-btn{border-radius:5px;flex-direction:column;margin-inline-end:1px;padding:10px 3px;width:86px}[data-uppy-theme=dark] .uppy-DashboardTab-btn{color:#eaeaea}.uppy-DashboardTab-btn::-moz-focus-inner{border:0}.uppy-DashboardTab-btn:hover{background-color:#e9ecef}[data-uppy-theme=dark] .uppy-DashboardTab-btn:hover{background-color:#333}.uppy-DashboardTab-btn:active,.uppy-DashboardTab-btn:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardTab-btn:active,[data-uppy-theme=dark] .uppy-DashboardTab-btn:focus{background-color:#525252}.uppy-DashboardTab-btn svg{display:inline-block;max-height:100%;max-width:100%;overflow:hidden;transition:transform .15s ease-in-out;vertical-align:text-top}.uppy-DashboardTab-inner{align-items:center;background-color:#fff;border-radius:8px;box-shadow:0 1px 1px #0000001a,0 1px 2px #0000001a,0 2px 3px #00000005;display:flex;height:32px;justify-content:center;margin-inline-end:10px;width:32px}.uppy-size--md .uppy-DashboardTab-inner{margin-inline-end:0}[data-uppy-theme=dark] .uppy-DashboardTab-inner{background-color:#323232;box-shadow:0 1px 1px #0003,0 1px 2px #0003,0 2px 3px #00000014}.uppy-DashboardTab-name{font-size:14px;font-weight:400}.uppy-size--md .uppy-DashboardTab-name{font-size:12px;line-height:15px;margin-bottom:0;margin-top:8px}.uppy-DashboardTab-iconMyDevice{color:#1269cf}[data-uppy-theme=dark] .uppy-DashboardTab-iconMyDevice{color:#02baf2}.uppy-DashboardTab-iconBox{color:#0061d5}[data-uppy-theme=dark] .uppy-DashboardTab-iconBox{color:#eaeaea}.uppy-DashboardTab-iconDropbox{color:#0061fe}[data-uppy-theme=dark] .uppy-DashboardTab-iconDropbox{color:#eaeaea}.uppy-DashboardTab-iconUnsplash{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconUnsplash{color:#eaeaea}.uppy-DashboardTab-iconWebdav{color:#111}[data-uppy-theme=dark] .uppy-DashboardTab-iconWebdav{color:#eaeaea}.uppy-DashboardTab-iconScreenRec{color:#2c3e50}[data-uppy-theme=dark] .uppy-DashboardTab-iconScreenRec{color:#eaeaea}.uppy-DashboardTab-iconAudio{color:#8030a3}[data-uppy-theme=dark] .uppy-DashboardTab-iconAudio{color:#bf6ee3}.uppy-Dashboard-input{height:.1px;opacity:0;overflow:hidden;position:absolute;width:.1px;z-index:-1}.uppy-DashboardContent-bar{align-items:center;background-color:#fafafa;border-bottom:1px solid #eaeaea;display:flex;flex-shrink:0;height:40px;justify-content:space-between;padding:0 10px;position:relative;width:100%;z-index:1004}.uppy-size--md .uppy-DashboardContent-bar{height:50px;padding:0 15px}[data-uppy-theme=dark] .uppy-DashboardContent-bar{background-color:#1f1f1f;border-bottom:1px solid #333}.uppy-DashboardContent-title{font-size:12px;font-weight:500;left:0;line-height:40px;margin:auto;max-width:170px;overflow-x:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0;white-space:nowrap;width:100%}.uppy-size--md .uppy-DashboardContent-title{font-size:14px;line-height:50px;max-width:300px}[data-uppy-theme=dark] .uppy-DashboardContent-title{color:#eaeaea}.uppy-DashboardContent-back,.uppy-DashboardContent-save{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-size:12px;font-weight:400;line-height:1;margin:0;margin-inline-start:-6px;padding:7px 6px}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{outline:none}.uppy-DashboardContent-back::-moz-focus-inner,.uppy-DashboardContent-save::-moz-focus-inner{border:0}.uppy-DashboardContent-back:hover,.uppy-DashboardContent-save:hover{color:#0e51a0}.uppy-DashboardContent-back:focus,.uppy-DashboardContent-save:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-back:focus,[data-uppy-theme=dark] .uppy-DashboardContent-save:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-back,.uppy-size--md .uppy-DashboardContent-save{font-size:14px}[data-uppy-theme=dark] .uppy-DashboardContent-back,[data-uppy-theme=dark] .uppy-DashboardContent-save{color:#02baf2}.uppy-DashboardContent-addMore{-webkit-appearance:none;background:none;border:0;border-radius:3px;color:inherit;color:#1269cf;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:500;height:29px;line-height:1;margin:0;margin-inline-end:-5px;padding:7px 8px;width:29px}.uppy-DashboardContent-addMore:focus{outline:none}.uppy-DashboardContent-addMore::-moz-focus-inner{border:0}.uppy-DashboardContent-addMore:hover{color:#0e51a0}.uppy-DashboardContent-addMore:focus{background-color:#dfe6f1}[data-uppy-theme=dark] .uppy-DashboardContent-addMore:focus{background-color:#333}.uppy-size--md .uppy-DashboardContent-addMore{font-size:14px;height:auto;margin-inline-end:-8px;width:auto}[data-uppy-theme=dark] .uppy-DashboardContent-addMore{color:#02baf2}.uppy-DashboardContent-addMore svg{margin-inline-end:4px;vertical-align:initial}.uppy-size--md .uppy-DashboardContent-addMore svg{height:11px;width:11px}.uppy-DashboardContent-addMoreCaption{display:none}.uppy-size--md .uppy-DashboardContent-addMoreCaption{display:inline}.uppy-DashboardContent-panel{background-color:#f5f5f5;flex:1}.uppy-Dashboard-AddFilesPanel,.uppy-DashboardContent-panel{border-radius:5px;display:flex;flex-direction:column;inset:0;overflow:hidden;position:absolute;z-index:1005}.uppy-Dashboard-AddFilesPanel{background:#fafafa;background:linear-gradient(0deg,#fafafa 35%,#fafafad9);box-shadow:0 0 10px 5px #00000026}[data-uppy-theme=dark] .uppy-Dashboard-AddFilesPanel{background-color:#333;background-image:linear-gradient(0deg,#1f1f1f 35%,#1f1f1fd9)}.uppy-Dashboard--isAddFilesPanelVisible .uppy-Dashboard-files{filter:blur(2px)}.uppy-Dashboard-progress{bottom:0;height:12%;left:0;position:absolute;width:100%}.uppy-Dashboard-progressBarContainer.is-active{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1004}.uppy-Dashboard-filesContainer{flex:1;margin:0;overflow-y:hidden;position:relative}.uppy-Dashboard-filesContainer:after{clear:both;content:"";display:table}.uppy-Dashboard-files{flex:1;margin:0;overflow-y:auto;padding:0 0 10px;-webkit-overflow-scrolling:touch}.uppy-size--md .uppy-Dashboard-files{padding-top:10px}.uppy-Dashboard--singleFile .uppy-Dashboard-filesInner{align-items:center;display:flex;height:100%;justify-content:center}.uppy-Dashboard-dropFilesHereHint{align-items:center;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%231269CF' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");background-position:50% 50%;background-repeat:no-repeat;border:1px dashed #1269cf;border-radius:3px;color:#757575;display:flex;font-size:16px;justify-content:center;inset:7px;padding-top:90px;position:absolute;text-align:center;visibility:hidden;z-index:2000}[data-uppy-theme=dark] .uppy-Dashboard-dropFilesHereHint{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath fill='%2302BAF2' d='M24 1v1C11.85 2 2 11.85 2 24s9.85 22 22 22 22-9.85 22-22S36.15 2 24 2zm0 0V0c13.254 0 24 10.746 24 24S37.254 48 24 48 0 37.254 0 24 10.746 0 24 0zm7.707 19.293a.999.999 0 1 1-1.414 1.414L25 16.414V34a1 1 0 1 1-2 0V16.414l-5.293 5.293a.999.999 0 1 1-1.414-1.414l7-7a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E");border-color:#02baf2;color:#bbb}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-dropFilesHereHint{pointer-events:none;visibility:visible}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-files,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-progressindicators,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-serviceMsg,.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-DashboardContent-bar{opacity:.15}.uppy-Dashboard.uppy-Dashboard--isDraggingOver .uppy-Dashboard-AddFiles{opacity:.03}.uppy-Dashboard-AddFiles-title{color:#000;font-size:17px;font-weight:500;line-height:1.35;margin-bottom:5px;margin-top:15px;padding:0 15px;text-align:inline-start;width:100%}.uppy-size--md .uppy-Dashboard-AddFiles-title{font-size:21px;font-weight:400;margin-top:5px;max-width:480px;padding:0 35px;text-align:center}[data-uppy-num-acquirers="0"] .uppy-Dashboard-AddFiles-title{text-align:center}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title{color:#eaeaea}.uppy-Dashboard-AddFiles-title button{font-weight:500}.uppy-size--md .uppy-Dashboard-AddFiles-title button{font-weight:400}.uppy-Dashboard-note{color:#757575;font-size:14px;line-height:1.25;margin:auto;max-width:350px;padding:0 15px;text-align:center}.uppy-size--md .uppy-Dashboard-note{line-height:1.35;max-width:600px}[data-uppy-theme=dark] .uppy-Dashboard-note{color:#cfcfcf}a.uppy-Dashboard-poweredBy{color:#939393;display:inline-block;font-size:11px;margin-top:8px;text-align:center;text-decoration:none}.uppy-Dashboard-poweredByIcon{margin-left:1px;margin-right:1px;opacity:.9;position:relative;top:1px;vertical-align:text-top;fill:none;stroke:#939393}.uppy-Dashboard-Item-previewIcon{height:25px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:25px;z-index:100}.uppy-size--md .uppy-Dashboard-Item-previewIcon{height:38px;width:38px}.uppy-Dashboard-Item-previewIcon svg{height:100%;width:100%}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIcon{height:100%;max-height:60%;max-width:60%;width:100%}.uppy-Dashboard-Item-previewIconWrap{height:76px;max-height:75%;position:relative}.uppy-Dashboard--singleFile .uppy-Dashboard-Item-previewIconWrap{height:100%;width:100%}.uppy-Dashboard-Item-previewIconBg{filter:drop-shadow(rgba(0,0,0,.1) 0 1px 1px);height:100%;width:100%}.uppy-Dashboard-upload{height:50px;position:relative;width:50px}.uppy-size--md .uppy-Dashboard-upload{height:60px;width:60px}.uppy-Dashboard-upload .uppy-c-icon{position:relative;top:1px;width:50%}.uppy-Dashboard-uploadCount{background-color:#1bb240;border-radius:50%;color:#fff;font-size:8px;height:16px;inset-inline-end:-12px;line-height:16px;position:absolute;top:-12px;width:16px}.uppy-size--md .uppy-Dashboard-uploadCount{font-size:9px;height:18px;line-height:18px;width:18px}.uppy-Dashboard-inner{border:none!important;background:transparent!important}.uppy-Dashboard-innerWrap{border-radius:.5rem;overflow:hidden}.uppy-Dashboard-AddFiles{border:2px dashed hsl(var(--border))!important;border-radius:.5rem!important;background:hsl(var(--muted) / .3)!important;transition:all .2s ease}.uppy-Dashboard-AddFiles:hover{border-color:hsl(var(--primary))!important;background:hsl(var(--muted) / .5)!important}.uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important;font-weight:500!important}.uppy-Dashboard-AddFiles-info{color:hsl(var(--muted-foreground))!important}.uppy-Dashboard-browse{color:hsl(var(--primary))!important;font-weight:500!important}.uppy-Dashboard-browse:hover{text-decoration:underline!important}.uppy-Dashboard-files{background:transparent!important}.uppy-Dashboard-Item{border-bottom-color:hsl(var(--border))!important}.uppy-Dashboard-Item-name{color:hsl(var(--foreground))!important}.uppy-Dashboard-Item-status{color:hsl(var(--muted-foreground))!important}.uppy-StatusBar{background:hsl(var(--muted))!important;border-top:1px solid hsl(var(--border))!important}.uppy-StatusBar-progress{background:hsl(var(--primary))!important}.uppy-StatusBar-content{color:hsl(var(--foreground))!important}.uppy-StatusBar-actionBtn--upload{background:hsl(var(--primary))!important;color:hsl(var(--primary-foreground))!important;border-radius:.375rem!important;font-weight:500!important;padding:.5rem 1rem!important}.uppy-StatusBar-actionBtn--upload:hover{background:hsl(var(--primary) / .9)!important}.uppy-Dashboard-note{color:hsl(var(--muted-foreground))!important;font-size:.75rem!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles,.dark .uppy-Dashboard-AddFiles{background:hsl(var(--muted) / .2)!important}[data-uppy-theme=dark] .uppy-Dashboard-AddFiles-title,.dark .uppy-Dashboard-AddFiles-title{color:hsl(var(--foreground))!important}[data-uppy-theme=dark] .uppy-StatusBar,.dark .uppy-StatusBar{background:hsl(var(--muted) / .5)!important}.uppy-Dashboard{font-family:inherit!important}.uppy-Dashboard-Item-preview{border-radius:.375rem!important;overflow:hidden}.uppy-Dashboard-Item-action--remove{color:hsl(var(--destructive))!important}.uppy-Dashboard-Item-action--remove:hover{opacity:.8}.uppy-Dashboard-Item.is-complete .uppy-Dashboard-Item-progress{color:hsl(var(--success, 142 76% 36%))!important}.uppy-Dashboard-Item.is-error .uppy-Dashboard-Item-progress{color:hsl(var(--destructive))!important}.uppy-Dashboard-files::-webkit-scrollbar{width:6px}.uppy-Dashboard-files::-webkit-scrollbar-track{background:transparent}.uppy-Dashboard-files::-webkit-scrollbar-thumb{background:hsl(var(--muted-foreground) / .3);border-radius:3px}.uppy-Dashboard-files::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5)}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/markdown-CKA5gBQ9.js b/webui/dist/assets/markdown-CKA5gBQ9.js deleted file mode 100644 index 1d7c44dc..00000000 --- a/webui/dist/assets/markdown-CKA5gBQ9.js +++ /dev/null @@ -1,295 +0,0 @@ -import{j as gn}from"./router-9vIXuQkh.js";import{g as Oa}from"./react-vendor-BmxF9s7Q.js";function ni(e){const t=[],r=String(e||"");let n=r.indexOf(","),i=0,a=!1;for(;!a;){n===-1&&(n=r.length,a=!0);const l=r.slice(i,n).trim();(l||!a)&&t.push(l),i=n+1,n=r.indexOf(",",i)}return t}function Js(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const eo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,to=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ro={};function ii(e,t){return(ro.jsx?to:eo).test(e)}const no=/[ \t\n\f\r]/g;function io(e){return typeof e=="object"?e.type==="text"?ai(e.value):!1:ai(e)}function ai(e){return e.replace(no,"")===""}class Sr{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}Sr.prototype.normal={};Sr.prototype.property={};Sr.prototype.space=void 0;function qa(e,t){const r={},n={};for(const i of e)Object.assign(r,i.property),Object.assign(n,i.normal);return new Sr(r,n,t)}function yr(e){return e.toLowerCase()}class He{constructor(t,r){this.attribute=r,this.property=t}}He.prototype.attribute="";He.prototype.booleanish=!1;He.prototype.boolean=!1;He.prototype.commaOrSpaceSeparated=!1;He.prototype.commaSeparated=!1;He.prototype.defined=!1;He.prototype.mustUseProperty=!1;He.prototype.number=!1;He.prototype.overloadedBoolean=!1;He.prototype.property="";He.prototype.spaceSeparated=!1;He.prototype.space=void 0;let ao=0;const te=qt(),Ae=qt(),Kn=qt(),R=qt(),pe=qt(),Kt=qt(),Ue=qt();function qt(){return 2**++ao}const Zn=Object.freeze(Object.defineProperty({__proto__:null,boolean:te,booleanish:Ae,commaOrSpaceSeparated:Ue,commaSeparated:Kt,number:R,overloadedBoolean:Kn,spaceSeparated:pe},Symbol.toStringTag,{value:"Module"})),vn=Object.keys(Zn);class v0 extends He{constructor(t,r,n,i){let a=-1;if(super(t,r),li(this,"space",i),typeof n=="number")for(;++a4&&r.slice(0,4)==="data"&&co.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(si,mo);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!si.test(a)){let l=a.replace(uo,ho);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=v0}return new i(n,t)}function ho(e){return"-"+e.toLowerCase()}function mo(e){return e.charAt(1).toUpperCase()}const Wa=qa([Ha,lo,$a,Ua,_a],"html"),tn=qa([Ha,so,$a,Ua,_a],"svg");function oi(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function fo(e){return e.join(" ").trim()}var Gt={},yn,ui;function po(){if(ui)return yn;ui=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,s=/^\s+|\s+$/g,o=` -`,u="/",h="*",m="",d="comment",p="declaration";function y(M,S){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];S=S||{};var z=1,I=1;function V(Y){var q=Y.match(t);q&&(z+=q.length);var ae=Y.lastIndexOf(o);I=~ae?Y.length-ae:I+Y.length}function O(){var Y={line:z,column:I};return function(q){return q.position=new E(Y),U(),q}}function E(Y){this.start=Y,this.end={line:z,column:I},this.source=S.source}E.prototype.content=M;function G(Y){var q=new Error(S.source+":"+z+":"+I+": "+Y);if(q.reason=Y,q.filename=S.source,q.line=z,q.column=I,q.source=M,!S.silent)throw q}function K(Y){var q=Y.exec(M);if(q){var ae=q[0];return V(ae),M=M.slice(ae.length),q}}function U(){K(r)}function D(Y){var q;for(Y=Y||[];q=$();)q!==!1&&Y.push(q);return Y}function $(){var Y=O();if(!(u!=M.charAt(0)||h!=M.charAt(1))){for(var q=2;m!=M.charAt(q)&&(h!=M.charAt(q)||u!=M.charAt(q+1));)++q;if(q+=2,m===M.charAt(q-1))return G("End of comment missing");var ae=M.slice(2,q-2);return I+=2,V(ae),M=M.slice(q),I+=2,Y({type:d,comment:ae})}}function j(){var Y=O(),q=K(n);if(q){if($(),!K(i))return G("property missing ':'");var ae=K(a),fe=Y({type:p,property:w(q[0].replace(e,m)),value:ae?w(ae[0].replace(e,m)):m});return K(l),fe}}function ie(){var Y=[];D(Y);for(var q;q=j();)q!==!1&&(Y.push(q),D(Y));return Y}return U(),ie()}function w(M){return M?M.replace(s,m):m}return yn=y,yn}var ci;function go(){if(ci)return Gt;ci=1;var e=Gt&&Gt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.default=r;const t=e(po());function r(n,i){let a=null;if(!n||typeof n!="string")return a;const l=(0,t.default)(n),s=typeof i=="function";return l.forEach(o=>{if(o.type!=="declaration")return;const{property:u,value:h}=o;s?i(u,h,o):h&&(a=a||{},a[u]=h)}),a}return Gt}var ur={},hi;function vo(){if(hi)return ur;hi=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||r.test(u)||e.test(u)},l=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},o=function(u,h){return h===void 0&&(h={}),a(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(n,s),u.replace(t,l))};return ur.camelCase=o,ur}var cr,mi;function yo(){if(mi)return cr;mi=1;var e=cr&&cr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(go()),r=vo();function n(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(s,o){s&&o&&(l[(0,r.camelCase)(s,a)]=o)}),l}return n.default=n,cr=n,cr}var bo=yo();const xo=Oa(bo),Ya=Xa("end"),y0=Xa("start");function Xa(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function wo(e){const t=y0(e),r=Ya(e);if(t&&r)return{start:t,end:r}}function pr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fi(e.position):"start"in e||"end"in e?fi(e):"line"in e||"column"in e?Qn(e):""}function Qn(e){return pi(e&&e.line)+":"+pi(e&&e.column)}function fi(e){return Qn(e&&e.start)+"-"+Qn(e&&e.end)}function pi(e){return e&&typeof e=="number"?e:1}class Ee extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},l=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){const o=n.indexOf(":");o===-1?a.ruleId=n:(a.source=n.slice(0,o),a.ruleId=n.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=pr(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ee.prototype.file="";Ee.prototype.name="";Ee.prototype.reason="";Ee.prototype.message="";Ee.prototype.stack="";Ee.prototype.column=void 0;Ee.prototype.line=void 0;Ee.prototype.ancestors=void 0;Ee.prototype.cause=void 0;Ee.prototype.fatal=void 0;Ee.prototype.place=void 0;Ee.prototype.ruleId=void 0;Ee.prototype.source=void 0;const b0={}.hasOwnProperty,ko=new Map,So=/[A-Z]/g,Ao=new Set(["table","tbody","thead","tfoot","tr"]),To=new Set(["td","th"]),Ka="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function zo(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=Fo(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=No(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tn:Wa,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Za(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Za(e,t,r){if(t.type==="element")return Mo(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Co(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Do(e,t,r);if(t.type==="mdxjsEsm")return Eo(e,t);if(t.type==="root")return Io(e,t,r);if(t.type==="text")return Bo(e,t)}function Mo(e,t,r){const n=e.schema;let i=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(i=tn,e.schema=i),e.ancestors.push(t);const a=Ja(e,t.tagName,!1),l=Lo(e,t);let s=w0(e,t);return Ao.has(t.tagName)&&(s=s.filter(function(o){return typeof o=="string"?!io(o):!0})),Qa(e,l,a,t),x0(l,s),e.ancestors.pop(),e.schema=n,e.create(t,a,l,r)}function Co(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}br(e,t.position)}function Eo(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);br(e,t.position)}function Do(e,t,r){const n=e.schema;let i=n;t.name==="svg"&&n.space==="html"&&(i=tn,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:Ja(e,t.name,!0),l=Ro(e,t),s=w0(e,t);return Qa(e,l,a,t),x0(l,s),e.ancestors.pop(),e.schema=n,e.create(t,a,l,r)}function Io(e,t,r){const n={};return x0(n,w0(e,t)),e.create(t,e.Fragment,n,r)}function Bo(e,t){return t.value}function Qa(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function x0(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function No(e,t,r){return n;function n(i,a,l,s){const u=Array.isArray(l.children)?r:t;return s?u(a,l,s):u(a,l)}}function Fo(e,t){return r;function r(n,i,a,l){const s=Array.isArray(a.children),o=y0(n);return t(i,a,l,s,{columnNumber:o?o.column-1:void 0,fileName:e,lineNumber:o?o.line:void 0},void 0)}}function Lo(e,t){const r={};let n,i;for(i in t.properties)if(i!=="children"&&b0.call(t.properties,i)){const a=Po(e,i,t.properties[i]);if(a){const[l,s]=a;e.tableCellAlignToStyle&&l==="align"&&typeof s=="string"&&To.has(t.tagName)?n=s:r[l]=s}}if(n){const a=r.style||(r.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function Ro(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];a.type;const l=a.expression;l.type;const s=l.properties[0];s.type,Object.assign(r,e.evaluater.evaluateExpression(s.argument))}else br(e,t.position);else{const i=n.name;let a;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const s=n.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else br(e,t.position);else a=n.value===null?!0:n.value;r[i]=a}return r}function w0(e,t){const r=[];let n=-1;const i=e.passKeys?new Map:ko;for(;++ni?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)l=Array.from(n),l.unshift(t,r),e.splice(...l);else for(r&&e.splice(t,r);a0?(Ge(e,e.length,0,t),e):t}const vi={}.hasOwnProperty;function tl(e){const t={};let r=-1;for(;++r13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function it(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ne=It(/[A-Za-z]/),Ce=It(/[\dA-Za-z]/),Go=It(/[#-'*+\--9=?A-Z^-~]/);function Gr(e){return e!==null&&(e<32||e===127)}const Jn=It(/\d/),Wo=It(/[\dA-Fa-f]/),Yo=It(/[!-/:-@[-`{-~]/);function X(e){return e!==null&&e<-2}function he(e){return e!==null&&(e<0||e===32)}function le(e){return e===-2||e===-1||e===32}const rn=It(new RegExp("\\p{P}|\\p{S}","u")),Ot=It(/\s/);function It(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function tr(e){const t=[];let r=-1,n=0,i=0;for(;++r55295&&a<57344){const s=e.charCodeAt(r+1);a<56320&&s>56319&&s<57344?(l=String.fromCharCode(a,s),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(n,r),encodeURIComponent(l)),n=r+i+1,l=""),i&&(r+=i,i=0)}return t.join("")+e.slice(n)}function ne(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(o){return le(o)?(e.enter(r),s(o)):t(o)}function s(o){return le(o)&&a++l))return;const G=t.events.length;let K=G,U,D;for(;K--;)if(t.events[K][0]==="exit"&&t.events[K][1].type==="chunkFlow"){if(U){D=t.events[K][1].end;break}U=!0}for(S(n),E=G;EI;){const O=r[V];t.containerState=O[1],O[0].exit.call(t,e)}r.length=I}function z(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Jo(e,t,r){return ne(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qt(e){if(e===null||he(e)||Ot(e))return 1;if(rn(e))return 2}function nn(e,t,r){const n=[];let i=-1;for(;++i1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const m={...e[n][1].end},d={...e[r][1].start};bi(m,-o),bi(d,o),l={type:o>1?"strongSequence":"emphasisSequence",start:m,end:{...e[n][1].end}},s={type:o>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:d},a={type:o>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},i={type:o>1?"strong":"emphasis",start:{...l.start},end:{...s.end}},e[n][1].end={...l.start},e[r][1].start={...s.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Ke(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Ke(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),u=Ke(u,nn(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=Ke(u,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(h=2,u=Ke(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):h=0,Ge(e,n-1,r-n+3,u),r=n+u.length-h-2;break}}for(r=-1;++r0&&le(E)?ne(e,z,"linePrefix",a+1)(E):z(E)}function z(E){return E===null||X(E)?e.check(xi,w,V)(E):(e.enter("codeFlowValue"),I(E))}function I(E){return E===null||X(E)?(e.exit("codeFlowValue"),z(E)):(e.consume(E),I)}function V(E){return e.exit("codeFenced"),t(E)}function O(E,G,K){let U=0;return D;function D(q){return E.enter("lineEnding"),E.consume(q),E.exit("lineEnding"),$}function $(q){return E.enter("codeFencedFence"),le(q)?ne(E,j,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):j(q)}function j(q){return q===s?(E.enter("codeFencedFenceSequence"),ie(q)):K(q)}function ie(q){return q===s?(U++,E.consume(q),ie):U>=l?(E.exit("codeFencedFenceSequence"),le(q)?ne(E,Y,"whitespace")(q):Y(q)):K(q)}function Y(q){return q===null||X(q)?(E.exit("codeFencedFence"),G(q)):K(q)}}}function hu(e,t,r){const n=this;return i;function i(l){return l===null?r(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return n.parser.lazy[n.now().line]?r(l):t(l)}}const xn={name:"codeIndented",tokenize:fu},mu={partial:!0,tokenize:pu};function fu(e,t,r){const n=this;return i;function i(u){return e.enter("codeIndented"),ne(e,a,"linePrefix",5)(u)}function a(u){const h=n.events[n.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(u):r(u)}function l(u){return u===null?o(u):X(u)?e.attempt(mu,l,o)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||X(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),s)}function o(u){return e.exit("codeIndented"),t(u)}}function pu(e,t,r){const n=this;return i;function i(l){return n.parser.lazy[n.now().line]?r(l):X(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):ne(e,a,"linePrefix",5)(l)}function a(l){const s=n.events[n.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(l):X(l)?i(l):r(l)}}const du={name:"codeText",previous:vu,resolve:gu,tokenize:yu};function gu(e){let t=e.length-4,r=3,n,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const i=r||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&hr(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),hr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),hr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(l):e.interrupt(n.parser.constructs.flow,r,t)(l)}}function sl(e,t,r,n,i,a,l,s,o){const u=o||Number.POSITIVE_INFINITY;let h=0;return m;function m(S){return S===60?(e.enter(n),e.enter(i),e.enter(a),e.consume(S),e.exit(a),d):S===null||S===32||S===41||Gr(S)?r(S):(e.enter(n),e.enter(l),e.enter(s),e.enter("chunkString",{contentType:"string"}),w(S))}function d(S){return S===62?(e.enter(a),e.consume(S),e.exit(a),e.exit(i),e.exit(n),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===62?(e.exit("chunkString"),e.exit(s),d(S)):S===null||S===60||X(S)?r(S):(e.consume(S),S===92?y:p)}function y(S){return S===60||S===62||S===92?(e.consume(S),p):p(S)}function w(S){return!h&&(S===null||S===41||he(S))?(e.exit("chunkString"),e.exit(s),e.exit(l),e.exit(n),t(S)):h999||p===null||p===91||p===93&&!o||p===94&&!s&&"_hiddenFootnoteSupport"in l.parser.constructs?r(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(n),t):X(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||X(p)||s++>999?(e.exit("chunkString"),h(p)):(e.consume(p),o||(o=!le(p)),p===92?d:m)}function d(p){return p===91||p===92||p===93?(e.consume(p),s++,m):m(p)}}function ul(e,t,r,n,i,a){let l;return s;function s(d){return d===34||d===39||d===40?(e.enter(n),e.enter(i),e.consume(d),e.exit(i),l=d===40?41:d,o):r(d)}function o(d){return d===l?(e.enter(i),e.consume(d),e.exit(i),e.exit(n),t):(e.enter(a),u(d))}function u(d){return d===l?(e.exit(a),o(l)):d===null?r(d):X(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(d))}function h(d){return d===l||d===null||X(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?m:h)}function m(d){return d===l||d===92?(e.consume(d),h):h(d)}}function dr(e,t){let r;return n;function n(i){return X(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,n):le(i)?ne(e,n,r?"linePrefix":"lineSuffix")(i):t(i)}}const zu={name:"definition",tokenize:Cu},Mu={partial:!0,tokenize:Eu};function Cu(e,t,r){const n=this;let i;return a;function a(p){return e.enter("definition"),l(p)}function l(p){return ol.call(n,e,s,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=it(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),o):r(p)}function o(p){return he(p)?dr(e,u)(p):u(p)}function u(p){return sl(e,h,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return e.attempt(Mu,m,m)(p)}function m(p){return le(p)?ne(e,d,"whitespace")(p):d(p)}function d(p){return p===null||X(p)?(e.exit("definition"),n.parser.defined.push(i),t(p)):r(p)}}function Eu(e,t,r){return n;function n(s){return he(s)?dr(e,i)(s):r(s)}function i(s){return ul(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return le(s)?ne(e,l,"whitespace")(s):l(s)}function l(s){return s===null||X(s)?t(s):r(s)}}const Du={name:"hardBreakEscape",tokenize:Iu};function Iu(e,t,r){return n;function n(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return X(a)?(e.exit("hardBreakEscape"),t(a)):r(a)}}const Bu={name:"headingAtx",resolve:Nu,tokenize:Fu};function Nu(e,t){let r=e.length-2,n=3,i,a;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(i={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},a={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Ge(e,n,r-n+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Fu(e,t,r){let n=0;return i;function i(h){return e.enter("atxHeading"),a(h)}function a(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&n++<6?(e.consume(h),l):h===null||he(h)?(e.exit("atxHeadingSequence"),s(h)):r(h)}function s(h){return h===35?(e.enter("atxHeadingSequence"),o(h)):h===null||X(h)?(e.exit("atxHeading"),t(h)):le(h)?ne(e,s,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function o(h){return h===35?(e.consume(h),o):(e.exit("atxHeadingSequence"),s(h))}function u(h){return h===null||h===35||he(h)?(e.exit("atxHeadingText"),s(h)):(e.consume(h),u)}}const Lu=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ki=["pre","script","style","textarea"],Ru={concrete:!0,name:"htmlFlow",resolveTo:qu,tokenize:Hu},Pu={partial:!0,tokenize:ju},Ou={partial:!0,tokenize:Vu};function qu(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Hu(e,t,r){const n=this;let i,a,l,s,o;return u;function u(A){return h(A)}function h(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),d):A===47?(e.consume(A),a=!0,w):A===63?(e.consume(A),i=3,n.interrupt?t:k):Ne(A)?(e.consume(A),l=String.fromCharCode(A),M):r(A)}function d(A){return A===45?(e.consume(A),i=2,p):A===91?(e.consume(A),i=5,s=0,y):Ne(A)?(e.consume(A),i=4,n.interrupt?t:k):r(A)}function p(A){return A===45?(e.consume(A),n.interrupt?t:k):r(A)}function y(A){const De="CDATA[";return A===De.charCodeAt(s++)?(e.consume(A),s===De.length?n.interrupt?t:j:y):r(A)}function w(A){return Ne(A)?(e.consume(A),l=String.fromCharCode(A),M):r(A)}function M(A){if(A===null||A===47||A===62||he(A)){const De=A===47,Re=l.toLowerCase();return!De&&!a&&ki.includes(Re)?(i=1,n.interrupt?t(A):j(A)):Lu.includes(l.toLowerCase())?(i=6,De?(e.consume(A),S):n.interrupt?t(A):j(A)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):a?z(A):I(A))}return A===45||Ce(A)?(e.consume(A),l+=String.fromCharCode(A),M):r(A)}function S(A){return A===62?(e.consume(A),n.interrupt?t:j):r(A)}function z(A){return le(A)?(e.consume(A),z):D(A)}function I(A){return A===47?(e.consume(A),D):A===58||A===95||Ne(A)?(e.consume(A),V):le(A)?(e.consume(A),I):D(A)}function V(A){return A===45||A===46||A===58||A===95||Ce(A)?(e.consume(A),V):O(A)}function O(A){return A===61?(e.consume(A),E):le(A)?(e.consume(A),O):I(A)}function E(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),o=A,G):le(A)?(e.consume(A),E):K(A)}function G(A){return A===o?(e.consume(A),o=null,U):A===null||X(A)?r(A):(e.consume(A),G)}function K(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||he(A)?O(A):(e.consume(A),K)}function U(A){return A===47||A===62||le(A)?I(A):r(A)}function D(A){return A===62?(e.consume(A),$):r(A)}function $(A){return A===null||X(A)?j(A):le(A)?(e.consume(A),$):r(A)}function j(A){return A===45&&i===2?(e.consume(A),ae):A===60&&i===1?(e.consume(A),fe):A===62&&i===4?(e.consume(A),ke):A===63&&i===3?(e.consume(A),k):A===93&&i===5?(e.consume(A),je):X(A)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Pu,be,ie)(A)):A===null||X(A)?(e.exit("htmlFlowData"),ie(A)):(e.consume(A),j)}function ie(A){return e.check(Ou,Y,be)(A)}function Y(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return A===null||X(A)?ie(A):(e.enter("htmlFlowData"),j(A))}function ae(A){return A===45?(e.consume(A),k):j(A)}function fe(A){return A===47?(e.consume(A),l="",Me):j(A)}function Me(A){if(A===62){const De=l.toLowerCase();return ki.includes(De)?(e.consume(A),ke):j(A)}return Ne(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),Me):j(A)}function je(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?(e.consume(A),ke):A===45&&i===2?(e.consume(A),k):j(A)}function ke(A){return A===null||X(A)?(e.exit("htmlFlowData"),be(A)):(e.consume(A),ke)}function be(A){return e.exit("htmlFlow"),t(A)}}function Vu(e,t,r){const n=this;return i;function i(l){return X(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):r(l)}function a(l){return n.parser.lazy[n.now().line]?r(l):t(l)}}function ju(e,t,r){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ar,t,r)}}const $u={name:"htmlText",tokenize:Uu};function Uu(e,t,r){const n=this;let i,a,l;return s;function s(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),o}function o(k){return k===33?(e.consume(k),u):k===47?(e.consume(k),O):k===63?(e.consume(k),I):Ne(k)?(e.consume(k),K):r(k)}function u(k){return k===45?(e.consume(k),h):k===91?(e.consume(k),a=0,y):Ne(k)?(e.consume(k),z):r(k)}function h(k){return k===45?(e.consume(k),p):r(k)}function m(k){return k===null?r(k):k===45?(e.consume(k),d):X(k)?(l=m,fe(k)):(e.consume(k),m)}function d(k){return k===45?(e.consume(k),p):m(k)}function p(k){return k===62?ae(k):k===45?d(k):m(k)}function y(k){const ke="CDATA[";return k===ke.charCodeAt(a++)?(e.consume(k),a===ke.length?w:y):r(k)}function w(k){return k===null?r(k):k===93?(e.consume(k),M):X(k)?(l=w,fe(k)):(e.consume(k),w)}function M(k){return k===93?(e.consume(k),S):w(k)}function S(k){return k===62?ae(k):k===93?(e.consume(k),S):w(k)}function z(k){return k===null||k===62?ae(k):X(k)?(l=z,fe(k)):(e.consume(k),z)}function I(k){return k===null?r(k):k===63?(e.consume(k),V):X(k)?(l=I,fe(k)):(e.consume(k),I)}function V(k){return k===62?ae(k):I(k)}function O(k){return Ne(k)?(e.consume(k),E):r(k)}function E(k){return k===45||Ce(k)?(e.consume(k),E):G(k)}function G(k){return X(k)?(l=G,fe(k)):le(k)?(e.consume(k),G):ae(k)}function K(k){return k===45||Ce(k)?(e.consume(k),K):k===47||k===62||he(k)?U(k):r(k)}function U(k){return k===47?(e.consume(k),ae):k===58||k===95||Ne(k)?(e.consume(k),D):X(k)?(l=U,fe(k)):le(k)?(e.consume(k),U):ae(k)}function D(k){return k===45||k===46||k===58||k===95||Ce(k)?(e.consume(k),D):$(k)}function $(k){return k===61?(e.consume(k),j):X(k)?(l=$,fe(k)):le(k)?(e.consume(k),$):U(k)}function j(k){return k===null||k===60||k===61||k===62||k===96?r(k):k===34||k===39?(e.consume(k),i=k,ie):X(k)?(l=j,fe(k)):le(k)?(e.consume(k),j):(e.consume(k),Y)}function ie(k){return k===i?(e.consume(k),i=void 0,q):k===null?r(k):X(k)?(l=ie,fe(k)):(e.consume(k),ie)}function Y(k){return k===null||k===34||k===39||k===60||k===61||k===96?r(k):k===47||k===62||he(k)?U(k):(e.consume(k),Y)}function q(k){return k===47||k===62||he(k)?U(k):r(k)}function ae(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):r(k)}function fe(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),Me}function Me(k){return le(k)?ne(e,je,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):je(k)}function je(k){return e.enter("htmlTextData"),l(k)}}const A0={name:"labelEnd",resolveAll:Yu,resolveTo:Xu,tokenize:Ku},_u={tokenize:Zu},Gu={tokenize:Qu},Wu={tokenize:Ju};function Yu(e){let t=-1;const r=[];for(;++t=3&&(u===null||X(u))?(e.exit("thematicBreak"),t(u)):r(u)}function o(u){return u===i?(e.consume(u),n++,o):(e.exit("thematicBreakSequence"),le(u)?ne(e,s,"whitespace")(u):s(u))}}const Pe={continuation:{tokenize:u1},exit:h1,name:"list",tokenize:o1},l1={partial:!0,tokenize:m1},s1={partial:!0,tokenize:c1};function o1(e,t,r){const n=this,i=n.events[n.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return s;function s(p){const y=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:Jn(p)){if(n.containerState.type||(n.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check($r,r,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),o(p)}return r(p)}function o(p){return Jn(p)&&++l<10?(e.consume(p),o):(!n.interrupt||l<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):r(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(Ar,n.interrupt?r:h,e.attempt(l1,d,m))}function h(p){return n.containerState.initialBlankLine=!0,a++,d(p)}function m(p){return le(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),d):r(p)}function d(p){return n.containerState.size=a+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function u1(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(Ar,i,a);function i(s){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ne(e,t,"listItemIndent",n.containerState.size+1)(s)}function a(s){return n.containerState.furtherBlankLines||!le(s)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,l(s)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(s1,t,l)(s))}function l(s){return n.containerState._closeFlow=!0,n.interrupt=void 0,ne(e,e.attempt(Pe,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function c1(e,t,r){const n=this;return ne(e,i,"listItemIndent",n.containerState.size+1);function i(a){const l=n.events[n.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===n.containerState.size?t(a):r(a)}}function h1(e){e.exit(this.containerState.type)}function m1(e,t,r){const n=this;return ne(e,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=n.events[n.events.length-1];return!le(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):r(a)}}const Si={name:"setextUnderline",resolveTo:f1,tokenize:p1};function f1(e,t){let r=e.length,n,i,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);const l={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=l,e.push(["exit",l,t]),e}function p1(e,t,r){const n=this;let i;return a;function a(u){let h=n.events.length,m;for(;h--;)if(n.events[h][1].type!=="lineEnding"&&n.events[h][1].type!=="linePrefix"&&n.events[h][1].type!=="content"){m=n.events[h][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||m)?(e.enter("setextHeadingLine"),i=u,l(u)):r(u)}function l(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),le(u)?ne(e,o,"lineSuffix")(u):o(u))}function o(u){return u===null||X(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}const d1={tokenize:g1};function g1(e){const t=this,r=e.attempt(Ar,n,e.attempt(this.parser.constructs.flowInitial,i,ne(e,e.attempt(this.parser.constructs.flow,i,e.attempt(wu,i)),"linePrefix")));return r;function n(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const v1={resolveAll:hl()},y1=cl("string"),b1=cl("text");function cl(e){return{resolveAll:hl(e==="text"?x1:void 0),tokenize:t};function t(r){const n=this,i=this.parser.constructs[e],a=r.attempt(i,l,s);return l;function l(h){return u(h)?a(h):s(h)}function s(h){if(h===null){r.consume(h);return}return r.enter("data"),r.consume(h),o}function o(h){return u(h)?(r.exit("data"),a(h)):(r.consume(h),o)}function u(h){if(h===null)return!0;const m=i[h];let d=-1;if(m)for(;++d-1){const s=l[0];typeof s=="string"?l[0]=s.slice(n):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function N1(e,t){let r=-1;const n=[];let i;for(;++r0){const rt=ee.tokenStack[ee.tokenStack.length-1];(rt[1]||Ti).call(ee,void 0,rt[0])}for(H.position={start:At(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:At(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,o);const u={type:"element",tagName:"sup",properties:{},children:[o]};return e.patch(t,u),e.applyData(t,u)}function K1(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z1(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function pl(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=n:i.push({type:"text",value:n}),i}function Q1(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return pl(e,t);const i={src:tr(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function J1(e,t){const r={src:tr(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function ec(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function tc(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return pl(e,t);const i={href:tr(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function rc(e,t){const r={href:tr(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nc(e,t,r){const n=e.all(t),i=r?ic(r):dl(t),a={},l=[];if(typeof t.checked=="boolean"){const h=n[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},n.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s1}function ac(e,t){const r={},n=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},s=y0(t.children[1]),o=Ya(t.children[t.children.length-1]);s&&o&&(l.position={start:s,end:o}),i.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function cc(e,t,r){const n=r?r.children:void 0,a=(n?n.indexOf(t):1)===0?"th":"td",l=r&&r.type==="table"?r.align:void 0,s=l?l.length:t.children.length;let o=-1;const u=[];for(;++o0,!0),n[0]),i=n.index+n[0].length,n=r.exec(t);return a.push(Ci(t.slice(i),i>0,!1)),a.join("")}function Ci(e,t,r){let n=0,i=e.length;if(t){let a=e.codePointAt(n);for(;a===zi||a===Mi;)n++,a=e.codePointAt(n)}if(r){let a=e.codePointAt(i-1);for(;a===zi||a===Mi;)i--,a=e.codePointAt(i-1)}return i>n?e.slice(n,i):""}function fc(e,t){const r={type:"text",value:mc(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function pc(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const dc={blockquote:U1,break:_1,code:G1,delete:W1,emphasis:Y1,footnoteReference:X1,heading:K1,html:Z1,imageReference:Q1,image:J1,inlineCode:ec,linkReference:tc,link:rc,listItem:nc,list:ac,paragraph:lc,root:sc,strong:oc,table:uc,tableCell:hc,tableRow:cc,text:fc,thematicBreak:pc,toml:Dr,yaml:Dr,definition:Dr,footnoteDefinition:Dr};function Dr(){}const gl=-1,an=0,gr=1,Wr=2,T0=3,z0=4,M0=5,C0=6,vl=7,yl=8,Ei=typeof self=="object"?self:globalThis,gc=(e,t)=>{const r=(i,a)=>(e.set(a,i),i),n=i=>{if(e.has(i))return e.get(i);const[a,l]=t[i];switch(a){case an:case gl:return r(l,i);case gr:{const s=r([],i);for(const o of l)s.push(n(o));return s}case Wr:{const s=r({},i);for(const[o,u]of l)s[n(o)]=n(u);return s}case T0:return r(new Date(l),i);case z0:{const{source:s,flags:o}=l;return r(new RegExp(s,o),i)}case M0:{const s=r(new Map,i);for(const[o,u]of l)s.set(n(o),n(u));return s}case C0:{const s=r(new Set,i);for(const o of l)s.add(n(o));return s}case vl:{const{name:s,message:o}=l;return r(new Ei[s](o),i)}case yl:return r(BigInt(l),i);case"BigInt":return r(Object(BigInt(l)),i);case"ArrayBuffer":return r(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:s}=new Uint8Array(l);return r(new DataView(s),l)}}return r(new Ei[a](l),i)};return n},Di=e=>gc(new Map,e)(0),Wt="",{toString:vc}={},{keys:yc}=Object,mr=e=>{const t=typeof e;if(t!=="object"||!e)return[an,t];const r=vc.call(e).slice(8,-1);switch(r){case"Array":return[gr,Wt];case"Object":return[Wr,Wt];case"Date":return[T0,Wt];case"RegExp":return[z0,Wt];case"Map":return[M0,Wt];case"Set":return[C0,Wt];case"DataView":return[gr,r]}return r.includes("Array")?[gr,r]:r.includes("Error")?[vl,r]:[Wr,r]},Ir=([e,t])=>e===an&&(t==="function"||t==="symbol"),bc=(e,t,r,n)=>{const i=(l,s)=>{const o=n.push(l)-1;return r.set(s,o),o},a=l=>{if(r.has(l))return r.get(l);let[s,o]=mr(l);switch(s){case an:{let h=l;switch(o){case"bigint":s=yl,h=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+o);h=null;break;case"undefined":return i([gl],l)}return i([s,h],l)}case gr:{if(o){let d=l;return o==="DataView"?d=new Uint8Array(l.buffer):o==="ArrayBuffer"&&(d=new Uint8Array(l)),i([o,[...d]],l)}const h=[],m=i([s,h],l);for(const d of l)h.push(a(d));return m}case Wr:{if(o)switch(o){case"BigInt":return i([o,l.toString()],l);case"Boolean":case"Number":case"String":return i([o,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const h=[],m=i([s,h],l);for(const d of yc(l))(e||!Ir(mr(l[d])))&&h.push([a(d),a(l[d])]);return m}case T0:return i([s,l.toISOString()],l);case z0:{const{source:h,flags:m}=l;return i([s,{source:h,flags:m}],l)}case M0:{const h=[],m=i([s,h],l);for(const[d,p]of l)(e||!(Ir(mr(d))||Ir(mr(p))))&&h.push([a(d),a(p)]);return m}case C0:{const h=[],m=i([s,h],l);for(const d of l)(e||!Ir(mr(d)))&&h.push(a(d));return m}}const{message:u}=l;return i([s,{name:o,message:u}],l)};return a},Ii=(e,{json:t,lossy:r}={})=>{const n=[];return bc(!(t||r),!!t,new Map,n)(e),n},Yr=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Di(Ii(e,t)):structuredClone(e):(e,t)=>Di(Ii(e,t));function xc(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function wc(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function kc(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||xc,n=e.options.footnoteBackLabel||wc,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let o=-1;for(;++o0&&y.push({type:"text",value:" "});let z=typeof r=="string"?r:r(o,p);typeof z=="string"&&(z={type:"text",value:z}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(o,p),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const M=h[h.length-1];if(M&&M.type==="element"&&M.tagName==="p"){const z=M.children[M.children.length-1];z&&z.type==="text"?z.value+=" ":M.children.push({type:"text",value:" "}),M.children.push(...y)}else h.push(...y);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(h,!0)};e.patch(u,S),s.push(S)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Yr(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:` -`}]}}const Tr=(function(e){if(e==null)return zc;if(typeof e=="function")return ln(e);if(typeof e=="object")return Array.isArray(e)?Sc(e):Ac(e);if(typeof e=="string")return Tc(e);throw new Error("Expected function, string, or object as test")});function Sc(e){const t=[];let r=-1;for(;++r":""))+")"})}return d;function d(){let p=bl,y,w,M;if((!t||a(o,u,h[h.length-1]||void 0))&&(p=Ec(r(o,h)),p[0]===t0))return p;if("children"in o&&o.children){const S=o;if(S.children&&p[0]!==xl)for(w=(n?S.children.length:-1)+l,M=h.concat(S);w>-1&&w0&&r.push({type:"text",value:` -`}),r}function Bi(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function Ni(e,t){const r=Ic(e,t),n=r.one(e,void 0),i=kc(r),a=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&a.children.push({type:"text",value:` -`},i),a}function Rc(e,t){return e&&"run"in e?async function(r,n){const i=Ni(r,{file:n,...t});await e.run(i,n)}:function(r,n){return Ni(r,{file:n,...e||t})}}function Fi(e){if(e)throw e}var kn,Li;function Pc(){if(Li)return kn;Li=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var h=e.call(u,"constructor"),m=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!m)return!1;var d;for(d in u);return typeof d>"u"||e.call(u,d)},l=function(u,h){r&&h.name==="__proto__"?r(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},s=function(u,h){if(h==="__proto__")if(e.call(u,h)){if(n)return n(u,h).value}else return;return u[h]};return kn=function o(){var u,h,m,d,p,y,w=arguments[0],M=1,S=arguments.length,z=!1;for(typeof w=="boolean"&&(z=w,w=arguments[1]||{},M=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Ml.length;let o;s&&l.push(i);try{o=e.apply(this,l)}catch(u){const h=u;if(s&&r)throw h;return i(h)}s||(o&&o.then&&typeof o.then=="function"?o.then(a,i):o instanceof Error?i(o):a(o))}function i(l,...s){r||(r=!0,t(l,...s))}function a(l){i(null,l)}}const at={basename:Vc,dirname:jc,extname:$c,join:Uc,sep:"/"};function Vc(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zr(e);let r=0,n=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let l=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else l<0&&(a=!0,l=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(n=i):(s=-1,n=l));return r===n?n=l:n<0&&(n=e.length),e.slice(r,n)}function jc(e){if(zr(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function $c(e){zr(e);let t=e.length,r=-1,n=0,i=-1,a=0,l;for(;t--;){const s=e.codePointAt(t);if(s===47){if(l){n=t+1;break}continue}r<0&&(l=!0,r=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function Uc(...e){let t=-1,r;for(;++t0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Gc(e,t){let r="",n=0,i=-1,a=0,l=-1,s,o;for(;++l<=e.length;){if(l2){if(o=r.lastIndexOf("/"),o!==r.length-1){o<0?(r="",n=0):(r=r.slice(0,o),n=r.length-1-r.lastIndexOf("/")),i=l,a=0;continue}}else if(r.length>0){r="",n=0,i=l,a=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,l):r=e.slice(i+1,l),n=l-i-1;i=l,a=0}else s===46&&a>-1?a++:a=-1}return r}function zr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Wc={cwd:Yc};function Yc(){return"/"}function i0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Xc(e){if(typeof e=="string")e=new URL(e);else if(!i0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Kc(e)}function Kc(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r0){let[p,...y]=h;const w=n[d][1];n0(w)&&n0(p)&&(p=Sn(!0,w,p)),n[d]=[u,p,...y]}}}}const eh=new I0().freeze();function Mn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cn(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function En(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pi(e){if(!n0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Oi(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Br(e){return th(e)?e:new wl(e)}function th(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function rh(e){return typeof e=="string"||nh(e)}function nh(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ih="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qi=[],Hi={allowDangerousHtml:!0},ah=/^(https?|ircs?|mailto|xmpp)$/i,lh=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function s5(e){const t=sh(e),r=oh(e);return uh(t.runSync(t.parse(r),r),e)}function sh(e){const t=e.rehypePlugins||qi,r=e.remarkPlugins||qi,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hi}:Hi;return eh().use($1).use(r).use(Rc,n).use(t)}function oh(e){const t=e.children||"",r=new wl;return typeof t=="string"&&(r.value=t),r}function uh(e,t){const r=t.allowedElements,n=t.allowElement,i=t.components,a=t.disallowedElements,l=t.skipHtml,s=t.unwrapDisallowed,o=t.urlTransform||ch;for(const h of lh)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+ih+h.id,void 0);return D0(e,u),zo(e,{Fragment:gn.Fragment,components:i,ignoreInvalidStyle:!0,jsx:gn.jsx,jsxs:gn.jsxs,passKeys:!0,passNode:!0});function u(h,m,d){if(h.type==="raw"&&d&&typeof m=="number")return l?d.children.splice(m,1):d.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let p;for(p in bn)if(Object.hasOwn(bn,p)&&Object.hasOwn(h.properties,p)){const y=h.properties[p],w=bn[p];(w===null||w.includes(h.tagName))&&(h.properties[p]=o(String(y||""),p,h))}}if(h.type==="element"){let p=r?!r.includes(h.tagName):a?a.includes(h.tagName):!1;if(!p&&n&&typeof m=="number"&&(p=!n(h,m,d)),p&&d&&typeof m=="number")return s&&h.children?d.children.splice(m,1,...h.children):d.children.splice(m,1),m}}}function ch(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||n!==-1&&t>n||ah.test(e.slice(0,t))?e:""}function Vi(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}function hh(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mh(e,t,r){const i=Tr((r||{}).ignore||[]),a=fh(t);let l=-1;for(;++l0?{type:"text",value:E}:void 0),E===!1?d.lastIndex=V+1:(y!==V&&z.push({type:"text",value:u.value.slice(y,V)}),Array.isArray(E)?z.push(...E):E&&z.push(E),y=V+I[0].length,S=!0),!d.global)break;I=d.exec(u.value)}return S?(y?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")");const i=Vi(e,"(");let a=Vi(e,")");for(;n!==-1&&i>a;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),a++;return[e,r]}function kl(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Ot(r)||rn(r))&&(!t||r!==47)}Sl.peek=Rh;function Ch(){this.buffer()}function Eh(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Dh(){this.buffer()}function Ih(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Bh(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=it(this.sliceSerialize(e)).toLowerCase(),r.label=t}function Nh(e){this.exit(e)}function Fh(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=it(this.sliceSerialize(e)).toLowerCase(),r.label=t}function Lh(e){this.exit(e)}function Rh(){return"["}function Sl(e,t,r,n){const i=r.createTracker(n);let a=i.move("[^");const l=r.enter("footnoteReference"),s=r.enter("reference");return a+=i.move(r.safe(r.associationId(e),{after:"]",before:a})),s(),l(),a+=i.move("]"),a}function Ph(){return{enter:{gfmFootnoteCallString:Ch,gfmFootnoteCall:Eh,gfmFootnoteDefinitionLabelString:Dh,gfmFootnoteDefinition:Ih},exit:{gfmFootnoteCallString:Bh,gfmFootnoteCall:Nh,gfmFootnoteDefinitionLabelString:Fh,gfmFootnoteDefinition:Lh}}}function Oh(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:Sl},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,a,l){const s=a.createTracker(l);let o=s.move("[^");const u=a.enter("footnoteDefinition"),h=a.enter("label");return o+=s.move(a.safe(a.associationId(n),{before:o,after:"]"})),h(),o+=s.move("]:"),n.children&&n.children.length>0&&(s.shift(4),o+=s.move((t?` -`:" ")+a.indentLines(a.containerFlow(n,s.current()),t?Al:qh))),u(),o}}function qh(e,t,r){return t===0?e:Al(e,t,r)}function Al(e,t,r){return(r?"":" ")+e}const Hh=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Tl.peek=_h;function Vh(){return{canContainEols:["delete"],enter:{strikethrough:$h},exit:{strikethrough:Uh}}}function jh(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Hh}],handlers:{delete:Tl}}}function $h(e){this.enter({type:"delete",children:[]},e)}function Uh(e){this.exit(e)}function Tl(e,t,r,n){const i=r.createTracker(n),a=r.enter("strikethrough");let l=i.move("~~");return l+=r.containerPhrasing(e,{...i.current(),before:l,after:"~"}),l+=i.move("~~"),a(),l}function _h(){return"~"}function Gh(e){return e.length}function Wh(e,t){const r=t||{},n=(r.align||[]).concat(),i=r.stringLength||Gh,a=[],l=[],s=[],o=[];let u=0,h=-1;for(;++hu&&(u=e[h].length);++So[S])&&(o[S]=I)}w.push(z)}l[h]=w,s[h]=M}let m=-1;if(typeof n=="object"&&"length"in n)for(;++mo[m]&&(o[m]=z),p[m]=z),d[m]=I}l.splice(1,0,d),s.splice(1,0,p),h=-1;const y=[];for(;++h "),a.shift(2);const l=r.indentLines(r.containerFlow(e,a.current()),Kh);return i(),l}function Kh(e,t,r){return">"+(r?"":" ")+e}function Zh(e,t){return $i(e,t.inConstruct,!0)&&!$i(e,t.notInConstruct,!1)}function $i(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let n=-1;for(;++nl&&(l=a):a=1,i=n+t.length,n=r.indexOf(t,i);return l}function Qh(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Jh(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function e4(e,t,r,n){const i=Jh(r),a=e.value||"",l=i==="`"?"GraveAccent":"Tilde";if(Qh(e,r)){const m=r.enter("codeIndented"),d=r.indentLines(a,t4);return m(),d}const s=r.createTracker(n),o=i.repeat(Math.max(zl(a,i)+1,3)),u=r.enter("codeFenced");let h=s.move(o);if(e.lang){const m=r.enter(`codeFencedLang${l}`);h+=s.move(r.safe(e.lang,{before:h,after:" ",encode:["`"],...s.current()})),m()}if(e.lang&&e.meta){const m=r.enter(`codeFencedMeta${l}`);h+=s.move(" "),h+=s.move(r.safe(e.meta,{before:h,after:` -`,encode:["`"],...s.current()})),m()}return h+=s.move(` -`),a&&(h+=s.move(a+` -`)),h+=s.move(o),u(),h}function t4(e,t,r){return(r?"":" ")+e}function B0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function r4(e,t,r,n){const i=B0(r),a=i==='"'?"Quote":"Apostrophe",l=r.enter("definition");let s=r.enter("label");const o=r.createTracker(n);let u=o.move("[");return u+=o.move(r.safe(r.associationId(e),{before:u,after:"]",...o.current()})),u+=o.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=r.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(r.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(s=r.enter("destinationRaw"),u+=o.move(r.safe(e.url,{before:u,after:e.title?" ":` -`,...o.current()}))),s(),e.title&&(s=r.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(r.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),s()),l(),u}function n4(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function xr(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Xr(e,t,r){const n=Qt(e),i=Qt(t);return n===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:n===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Ml.peek=i4;function Ml(e,t,r,n){const i=n4(r),a=r.enter("emphasis"),l=r.createTracker(n),s=l.move(i);let o=l.move(r.containerPhrasing(e,{after:i,before:s,...l.current()}));const u=o.charCodeAt(0),h=Xr(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(o=xr(u)+o.slice(1));const m=o.charCodeAt(o.length-1),d=Xr(n.after.charCodeAt(0),m,i);d.inside&&(o=o.slice(0,-1)+xr(m));const p=l.move(i);return a(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},s+o+p}function i4(e,t,r){return r.options.emphasis||"*"}function a4(e,t){let r=!1;return D0(e,function(n){if("value"in n&&/\r?\n|\r/.test(n.value)||n.type==="break")return r=!0,t0}),!!((!e.depth||e.depth<3)&&k0(e)&&(t.options.setext||r))}function l4(e,t,r,n){const i=Math.max(Math.min(6,e.depth||1),1),a=r.createTracker(n);if(a4(e,r)){const h=r.enter("headingSetext"),m=r.enter("phrasing"),d=r.containerPhrasing(e,{...a.current(),before:` -`,after:` -`});return m(),h(),d+` -`+(i===1?"=":"-").repeat(d.length-(Math.max(d.lastIndexOf("\r"),d.lastIndexOf(` -`))+1))}const l="#".repeat(i),s=r.enter("headingAtx"),o=r.enter("phrasing");a.move(l+" ");let u=r.containerPhrasing(e,{before:"# ",after:` -`,...a.current()});return/^[\t ]/.test(u)&&(u=xr(u.charCodeAt(0))+u.slice(1)),u=u?l+" "+u:l,r.options.closeAtx&&(u+=" "+l),o(),s(),u}Cl.peek=s4;function Cl(e){return e.value||""}function s4(){return"<"}El.peek=o4;function El(e,t,r,n){const i=B0(r),a=i==='"'?"Quote":"Apostrophe",l=r.enter("image");let s=r.enter("label");const o=r.createTracker(n);let u=o.move("![");return u+=o.move(r.safe(e.alt,{before:u,after:"]",...o.current()})),u+=o.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=r.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(r.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(s=r.enter("destinationRaw"),u+=o.move(r.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),s(),e.title&&(s=r.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(r.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),s()),u+=o.move(")"),l(),u}function o4(){return"!"}Dl.peek=u4;function Dl(e,t,r,n){const i=e.referenceType,a=r.enter("imageReference");let l=r.enter("label");const s=r.createTracker(n);let o=s.move("![");const u=r.safe(e.alt,{before:o,after:"]",...s.current()});o+=s.move(u+"]["),l();const h=r.stack;r.stack=[],l=r.enter("reference");const m=r.safe(r.associationId(e),{before:o,after:"]",...s.current()});return l(),r.stack=h,a(),i==="full"||!u||u!==m?o+=s.move(m+"]"):i==="shortcut"?o=o.slice(0,-1):o+=s.move("]"),o}function u4(){return"!"}Il.peek=c4;function Il(e,t,r){let n=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(n);)i+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++a\u007F]/.test(e.url))}Nl.peek=h4;function Nl(e,t,r,n){const i=B0(r),a=i==='"'?"Quote":"Apostrophe",l=r.createTracker(n);let s,o;if(Bl(e,r)){const h=r.stack;r.stack=[],s=r.enter("autolink");let m=l.move("<");return m+=l.move(r.containerPhrasing(e,{before:m,after:">",...l.current()})),m+=l.move(">"),s(),r.stack=h,m}s=r.enter("link"),o=r.enter("label");let u=l.move("[");return u+=l.move(r.containerPhrasing(e,{before:u,after:"](",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=r.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(r.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=r.enter("destinationRaw"),u+=l.move(r.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=r.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(r.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),u+=l.move(")"),s(),u}function h4(e,t,r){return Bl(e,r)?"<":"["}Fl.peek=m4;function Fl(e,t,r,n){const i=e.referenceType,a=r.enter("linkReference");let l=r.enter("label");const s=r.createTracker(n);let o=s.move("[");const u=r.containerPhrasing(e,{before:o,after:"]",...s.current()});o+=s.move(u+"]["),l();const h=r.stack;r.stack=[],l=r.enter("reference");const m=r.safe(r.associationId(e),{before:o,after:"]",...s.current()});return l(),r.stack=h,a(),i==="full"||!u||u!==m?o+=s.move(m+"]"):i==="shortcut"?o=o.slice(0,-1):o+=s.move("]"),o}function m4(){return"["}function N0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function f4(e){const t=N0(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function p4(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ll(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function d4(e,t,r,n){const i=r.enter("list"),a=r.bulletCurrent;let l=e.ordered?p4(r):N0(r);const s=e.ordered?l==="."?")":".":f4(r);let o=t&&r.bulletLastUsed?l===r.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&h&&(!h.children||!h.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(o=!0),Ll(r)===l&&h){let m=-1;for(;++m-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let l=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const s=r.createTracker(n);s.move(a+" ".repeat(l-a.length)),s.shift(l);const o=r.enter("listItem"),u=r.indentLines(r.containerFlow(e,s.current()),h);return o(),u;function h(m,d,p){return d?(p?"":" ".repeat(l))+m:(p?a:a+" ".repeat(l-a.length))+m}}function y4(e,t,r,n){const i=r.enter("paragraph"),a=r.enter("phrasing"),l=r.containerPhrasing(e,n);return a(),i(),l}const b4=Tr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function x4(e,t,r,n){return(e.children.some(function(l){return b4(l)})?r.containerPhrasing:r.containerFlow).call(r,e,n)}function w4(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Rl.peek=k4;function Rl(e,t,r,n){const i=w4(r),a=r.enter("strong"),l=r.createTracker(n),s=l.move(i+i);let o=l.move(r.containerPhrasing(e,{after:i,before:s,...l.current()}));const u=o.charCodeAt(0),h=Xr(n.before.charCodeAt(n.before.length-1),u,i);h.inside&&(o=xr(u)+o.slice(1));const m=o.charCodeAt(o.length-1),d=Xr(n.after.charCodeAt(0),m,i);d.inside&&(o=o.slice(0,-1)+xr(m));const p=l.move(i+i);return a(),r.attentionEncodeSurroundingInfo={after:d.outside,before:h.outside},s+o+p}function k4(e,t,r){return r.options.strong||"*"}function S4(e,t,r,n){return r.safe(e.value,n)}function A4(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function T4(e,t,r){const n=(Ll(r)+(r.options.ruleSpaces?" ":"")).repeat(A4(r));return r.options.ruleSpaces?n.slice(0,-1):n}const Pl={blockquote:Xh,break:Ui,code:e4,definition:r4,emphasis:Ml,hardBreak:Ui,heading:l4,html:Cl,image:El,imageReference:Dl,inlineCode:Il,link:Nl,linkReference:Fl,list:d4,listItem:v4,paragraph:y4,root:x4,strong:Rl,text:S4,thematicBreak:T4};function z4(){return{enter:{table:M4,tableData:_i,tableHeader:_i,tableRow:E4},exit:{codeText:D4,table:C4,tableData:Nn,tableHeader:Nn,tableRow:Nn}}}function M4(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function C4(e){this.exit(e),this.data.inTable=void 0}function E4(e){this.enter({type:"tableRow",children:[]},e)}function Nn(e){this.exit(e)}function _i(e){this.enter({type:"tableCell",children:[]},e)}function D4(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,I4));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function I4(e,t){return t==="|"?t:e}function B4(e){const t=e||{},r=t.tableCellPadding,n=t.tablePipeAlign,i=t.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:l,tableCell:o,tableRow:s}};function l(p,y,w,M){return u(h(p,w,M),p.align)}function s(p,y,w,M){const S=m(p,w,M),z=u([S]);return z.slice(0,z.indexOf(` -`))}function o(p,y,w,M){const S=w.enter("tableCell"),z=w.enter("phrasing"),I=w.containerPhrasing(p,{...M,before:a,after:a});return z(),S(),I}function u(p,y){return Wh(p,{align:y,alignDelimiters:n,padding:r,stringLength:i})}function h(p,y,w){const M=p.children;let S=-1;const z=[],I=y.enter("table");for(;++S0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const K4={tokenize:im,partial:!0};function Z4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:tm,continuation:{tokenize:rm},exit:nm}},text:{91:{name:"gfmFootnoteCall",tokenize:em},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Q4,resolveTo:J4}}}}function Q4(e,t,r){const n=this;let i=n.events.length;const a=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let l;for(;i--;){const o=n.events[i][1];if(o.type==="labelImage"){l=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return s;function s(o){if(!l||!l._balanced)return r(o);const u=it(n.sliceSerialize({start:l.end,end:n.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?r(o):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),t(o))}}function J4(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[r+1],e[r+2],["enter",n,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(r,e.length-r+1,...s),e}function em(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a=0,l;return s;function s(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),o}function o(m){return m!==94?r(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(m){if(a>999||m===93&&!l||m===null||m===91||he(m))return r(m);if(m===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(it(n.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(m)}return he(m)||(l=!0),a++,e.consume(m),m===92?h:u}function h(m){return m===91||m===92||m===93?(e.consume(m),a++,u):u(m)}}function tm(e,t,r){const n=this,i=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let a,l=0,s;return o;function o(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):r(y)}function h(y){if(l>999||y===93&&!s||y===null||y===91||he(y))return r(y);if(y===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return a=it(n.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return he(y)||(s=!0),l++,e.consume(y),y===92?m:h}function m(y){return y===91||y===92||y===93?(e.consume(y),l++,h):h(y)}function d(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),i.includes(a)||i.push(a),ne(e,p,"gfmFootnoteDefinitionWhitespace")):r(y)}function p(y){return t(y)}}function rm(e,t,r){return e.check(Ar,t,e.attempt(K4,t,r))}function nm(e){e.exit("gfmFootnoteDefinition")}function im(e,t,r){const n=this;return ne(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const l=n.events[n.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):r(a)}}function am(e){let r=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:a,resolveAll:i};return r==null&&(r=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function i(l,s){let o=-1;for(;++o1?o(y):(l.consume(y),m++,p);if(m<2&&!r)return o(y);const M=l.exit("strikethroughSequenceTemporary"),S=Qt(y);return M._open=!S||S===2&&!!w,M._close=!w||w===2&&!!S,s(y)}}}class lm{constructor(){this.map=[]}add(t,r,n){sm(this,t,r,n)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let r=this.map.length;const n=[];for(;r>0;)r-=1,n.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];n.push(t.slice()),t.length=0;let i=n.pop();for(;i;){for(const a of i)t.push(a);i=n.pop()}this.map.length=0}}function sm(e,t,r,n){let i=0;if(!(r===0&&n.length===0)){for(;i-1;){const Y=n.events[$][1].type;if(Y==="lineEnding"||Y==="linePrefix")$--;else break}const j=$>-1?n.events[$][1].type:null,ie=j==="tableHead"||j==="tableRow"?E:o;return ie===E&&n.parser.lazy[n.now().line]?r(D):ie(D)}function o(D){return e.enter("tableHead"),e.enter("tableRow"),u(D)}function u(D){return D===124||(l=!0,a+=1),h(D)}function h(D){return D===null?r(D):X(D)?a>1?(a=0,n.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),p):r(D):le(D)?ne(e,h,"whitespace")(D):(a+=1,l&&(l=!1,i+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),l=!0,h):(e.enter("data"),m(D)))}function m(D){return D===null||D===124||he(D)?(e.exit("data"),h(D)):(e.consume(D),D===92?d:m)}function d(D){return D===92||D===124?(e.consume(D),m):m(D)}function p(D){return n.interrupt=!1,n.parser.lazy[n.now().line]?r(D):(e.enter("tableDelimiterRow"),l=!1,le(D)?ne(e,y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):y(D))}function y(D){return D===45||D===58?M(D):D===124?(l=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),w):O(D)}function w(D){return le(D)?ne(e,M,"whitespace")(D):M(D)}function M(D){return D===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),S):D===45?(a+=1,S(D)):D===null||X(D)?V(D):O(D)}function S(D){return D===45?(e.enter("tableDelimiterFiller"),z(D)):O(D)}function z(D){return D===45?(e.consume(D),z):D===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(D))}function I(D){return le(D)?ne(e,V,"whitespace")(D):V(D)}function V(D){return D===124?y(D):D===null||X(D)?!l||i!==a?O(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):O(D)}function O(D){return r(D)}function E(D){return e.enter("tableRow"),G(D)}function G(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),G):D===null||X(D)?(e.exit("tableRow"),t(D)):le(D)?ne(e,G,"whitespace")(D):(e.enter("data"),K(D))}function K(D){return D===null||D===124||he(D)?(e.exit("data"),G(D)):(e.consume(D),D===92?U:K)}function U(D){return D===92||D===124?(e.consume(D),K):K(D)}}function hm(e,t){let r=-1,n=!0,i=0,a=[0,0,0,0],l=[0,0,0,0],s=!1,o=0,u,h,m;const d=new lm;for(;++rr[2]+1){const y=r[2]+1,w=r[3]-r[2]-1;e.add(y,w,[])}}e.add(r[3]+1,0,[["exit",m,t]])}return i!==void 0&&(a.end=Object.assign({},Xt(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function Wi(e,t,r,n,i){const a=[],l=Xt(t.events,r);i&&(i.end=Object.assign({},l),a.push(["exit",i,t])),n.end=Object.assign({},l),a.push(["exit",n,t]),e.add(r+1,0,a)}function Xt(e,t){const r=e[t],n=r[0]==="enter"?"start":"end";return r[1][n]}const mm={name:"tasklistCheck",tokenize:pm};function fm(){return{text:{91:mm}}}function pm(e,t,r){const n=this;return i;function i(o){return n.previous!==null||!n._gfmTasklistFirstContentOfListItem?r(o):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(o),e.exit("taskListCheckMarker"),a)}function a(o){return he(o)?(e.enter("taskListCheckValueUnchecked"),e.consume(o),e.exit("taskListCheckValueUnchecked"),l):o===88||o===120?(e.enter("taskListCheckValueChecked"),e.consume(o),e.exit("taskListCheckValueChecked"),l):r(o)}function l(o){return o===93?(e.enter("taskListCheckMarker"),e.consume(o),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):r(o)}function s(o){return X(o)?t(o):le(o)?e.check({tokenize:dm},t,r)(o):r(o)}}function dm(e,t,r){return ne(e,n,"whitespace");function n(i){return i===null?r(i):t(i)}}function gm(e){return tl([V4(),Z4(),am(e),um(),fm()])}const vm={};function o5(e){const t=this,r=e||vm,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),l=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(gm(r)),a.push(P4()),l.push(O4(r))}function ym(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:s,mathText:l,mathTextData:s}};function e(o){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},o)}function t(){this.buffer()}function r(){const o=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=o}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(o){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),h=this.stack[this.stack.length-1];h.type,this.exit(o),h.value=u;const m=h.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function a(o){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},o),this.buffer()}function l(o){const u=this.resume(),h=this.stack[this.stack.length-1];h.type,this.exit(o),h.value=u,h.data.hChildren.push({type:"text",value:u})}function s(o){this.config.enter.data.call(this,o),this.config.exit.data.call(this,o)}}function bm(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),n.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` -`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(a,l,s,o){const u=a.value||"",h=s.createTracker(o),m="$".repeat(Math.max(zl(u,"$")+1,2)),d=s.enter("mathFlow");let p=h.move(m);if(a.meta){const y=s.enter("mathFlowMeta");p+=h.move(s.safe(a.meta,{after:` -`,before:p,encode:["$"],...h.current()})),y()}return p+=h.move(` -`),u&&(p+=h.move(u+` -`)),p+=h.move(m),d(),p}function n(a,l,s){let o=a.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(o);)u++;const h="$".repeat(u);/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^\$|\$$/.test(o))&&(o=" "+o+" ");let m=-1;for(;++mu&&(u=h):h&&(u!==void 0&&u>-1&&o.push(` -`.repeat(u)||" "),u=-1,o.push(h))}return o.join("")}function Kl(e,t,r){return e.type==="element"?Zm(e,t,r):e.type==="text"?r.whitespace==="normal"?Zl(e,r):Qm(e):[]}function Zm(e,t,r){const n=Ql(e,r),i=e.children||[];let a=-1,l=[];if(Xm(e))return l;let s,o;for(s0(e)||ra(e)&&Qi(t,e,ra)?o=` -`:Ym(e)?(s=2,o=2):Xl(e)&&(s=1,o=1);++a15?u="…"+s.slice(i-15,i):u=s.slice(0,i);var h;a+15":">","<":"<",'"':""","'":"'"},of=/[&><"']/g;function uf(e){return String(e).replace(of,t=>sf[t])}var Jl=function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},cf=function(t){var r=Jl(t);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},hf=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},mf=function(t){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},ue={deflt:nf,escape:uf,hyphenate:lf,getBaseElem:Jl,isCharacterBox:cf,protocolFromUrl:mf},Ur={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function ff(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class R0{constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r in Ur)if(Ur.hasOwnProperty(r)){var n=Ur[r];this[r]=t[r]!==void 0?n.processor?n.processor(t[r]):t[r]:ff(n)}}reportNonstrict(t,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(t,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new L("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,n){var i=this.strict;if(typeof i=="function")try{i=i(t,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var r=ue.protocolFromUrl(t.url);if(r==null)return!1;t.protocol=r}var n=typeof this.trust=="function"?this.trust(t):this.trust;return!!n}}class Tt{constructor(t,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=n}sup(){return lt[pf[this.id]]}sub(){return lt[df[this.id]]}fracNum(){return lt[gf[this.id]]}fracDen(){return lt[vf[this.id]]}cramp(){return lt[yf[this.id]]}text(){return lt[bf[this.id]]}isTight(){return this.size>=2}}var P0=0,Kr=1,Zt=2,vt=3,wr=4,Ze=5,Jt=6,Fe=7,lt=[new Tt(P0,0,!1),new Tt(Kr,0,!0),new Tt(Zt,1,!1),new Tt(vt,1,!0),new Tt(wr,2,!1),new Tt(Ze,2,!0),new Tt(Jt,3,!1),new Tt(Fe,3,!0)],pf=[wr,Ze,wr,Ze,Jt,Fe,Jt,Fe],df=[Ze,Ze,Ze,Ze,Fe,Fe,Fe,Fe],gf=[Zt,vt,wr,Ze,Jt,Fe,Jt,Fe],vf=[vt,vt,Ze,Ze,Fe,Fe,Fe,Fe],yf=[Kr,Kr,vt,vt,Ze,Ze,Fe,Fe],bf=[P0,Kr,Zt,vt,Zt,vt,Zt,vt],Q={DISPLAY:lt[P0],TEXT:lt[Zt],SCRIPT:lt[wr],SCRIPTSCRIPT:lt[Jt]},o0=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function xf(e){for(var t=0;t=i[0]&&e<=i[1])return r.name}return null}var _r=[];o0.forEach(e=>e.blocks.forEach(t=>_r.push(...t)));function es(e){for(var t=0;t<_r.length;t+=2)if(e>=_r[t]&&e<=_r[t+1])return!0;return!1}var Yt=80,wf=function(t,r){return"M95,"+(622+t+r)+` -c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 -c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 -c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 -s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 -c69,-144,104.5,-217.7,106.5,-221 -l`+t/2.075+" -"+t+` -c5.3,-9.3,12,-14,20,-14 -H400000v`+(40+t)+`H845.2724 -s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 -c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},kf=function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 -c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 -c340,-704.7,510.7,-1060.3,512,-1067 -l`+t/2.084+" -"+t+` -c4.7,-7.3,11,-11,19,-11 -H40000v`+(40+t)+`H1012.3 -s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 -c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 -s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 -c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Sf=function(t,r){return"M983 "+(10+t+r)+` -l`+t/3.13+" -"+t+` -c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` -H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 -s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 -c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 -c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 -c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 -c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},Af=function(t,r){return"M424,"+(2398+t+r)+` -c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 -c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 -s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 -s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 -l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000 -v`+(40+t)+`H1014.6 -s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 -c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+r+` -h400000v`+(40+t)+"h-400000z"},Tf=function(t,r){return"M473,"+(2713+t+r)+` -c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` -c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 -s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 -c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 -c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 -s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},zf=function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},Mf=function(t,r,n){var i=n-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` -H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 -h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 -c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},Cf=function(t,r,n){r=1e3*r;var i="";switch(t){case"sqrtMain":i=wf(r,Yt);break;case"sqrtSize1":i=kf(r,Yt);break;case"sqrtSize2":i=Sf(r,Yt);break;case"sqrtSize3":i=Af(r,Yt);break;case"sqrtSize4":i=Tf(r,Yt);break;case"sqrtTall":i=Mf(r,Yt,n)}return i},Ef=function(t,r){switch(t){case"⎜":return"M291 0 H417 V"+r+" H291z M291 0 H417 V"+r+" H291z";case"∣":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z";case"∥":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z"+("M367 0 H410 V"+r+" H367z M367 0 H410 V"+r+" H367z");case"⎟":return"M457 0 H583 V"+r+" H457z M457 0 H583 V"+r+" H457z";case"⎢":return"M319 0 H403 V"+r+" H319z M319 0 H403 V"+r+" H319z";case"⎥":return"M263 0 H347 V"+r+" H263z M263 0 H347 V"+r+" H263z";case"⎪":return"M384 0 H504 V"+r+" H384z M384 0 H504 V"+r+" H384z";case"⏐":return"M312 0 H355 V"+r+" H312z M312 0 H355 V"+r+" H312z";case"‖":return"M257 0 H300 V"+r+" H257z M257 0 H300 V"+r+" H257z"+("M478 0 H521 V"+r+" H478z M478 0 H521 V"+r+" H478z");default:return""}},na={doubleleftarrow:`M262 157 -l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 - 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 - 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 -c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 - 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 --86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 --2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z -m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l --10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 - 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 --33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 --17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 --13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 -c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 --107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 - 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 --5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 -c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 - 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 - 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 - l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 --45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 - 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 - 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 - 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 --331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 -H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 - 435 0h399565z`,leftgroupunder:`M400000 262 -H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 - 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 --3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 --18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 --196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 - 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 --4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 --10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z -m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 - 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 - 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 --152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 - 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 --2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 -v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 --83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 --68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 - 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z -M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z -M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 --.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 -c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 - 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z -M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 -c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 --53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 - 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 - 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 -c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 - 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 - 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 --5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 --320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z -m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 -60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 --451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z -m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 -c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 --480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z -m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 -85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 --707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z -m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 -c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 --16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 - 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 - 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 --40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 --12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 - 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l --6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 -s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 -c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 - 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 --174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 - 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 - 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 --3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 --10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 - 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 --18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 - 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z -m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 - 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 --7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 --27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 - 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 - 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 --64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z -m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 - 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 --13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 - 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z -M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 - 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 --52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 --167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 - 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 --70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 --40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 --37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 - 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 -c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 - 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 - 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 --19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 - 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 --2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 - 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 - 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 --68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 --8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 - 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 -c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 - 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 --11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 - 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 - 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 - -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 --11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 - 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 - 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 - -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 -3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 -10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 --1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 --7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 -H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 -c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 -c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 --11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, --5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, --11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 -c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 -c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 -s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 -121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 -s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 -c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z -M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 --27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 -13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 --84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 --119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 --12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 -151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 -c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 -c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 -c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z -M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 -c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, -1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, --152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z -M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 -c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, --231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 -c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Df=function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84 -H403z M403 1759 V0 H319 V1759 v`+r+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z -M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+" v585 h43z";case"doublevert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+` v585 h43z -M367 15 v585 v`+r+` v585 c2.667,10,9.667,15,21,15 -c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 -c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+r+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+r+` v1715 h263 v84 H319z -MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+r+` v1799 H0 v-84 H319z -MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v602 h84z -M403 1759 V0 H319 V1759 v`+r+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v602 h84z -M347 1759 V0 h-84 V1759 v`+r+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 -c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, --36,557 l0,`+(r+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, -949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 -c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, --544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 -l0,-`+(r+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, --210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, -63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 -c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(r+9)+` -c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 -c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 -c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 -c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 -l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Mr{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;rr.toText();return this.children.map(t).join("")}}var st={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Fr={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},ia={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function If(e,t){st[e]=t}function O0(e,t,r){if(!st[t])throw new Error("Font metrics not found for font: "+t+".");var n=e.charCodeAt(0),i=st[t][n];if(!i&&e[0]in ia&&(n=ia[e[0]].charCodeAt(0),i=st[t][n]),!i&&r==="text"&&es(n)&&(i=st[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Ln={};function Bf(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!Ln[t]){var r=Ln[t]={cssEmPerMu:Fr.quad[t]/18};for(var n in Fr)Fr.hasOwnProperty(n)&&(r[n]=Fr[n][t])}return Ln[t]}var Nf=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],aa=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],la=function(t,r){return r.size<2?t:Nf[t-1][r.size-1]};class gt{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||gt.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=aa[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return new gt(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:la(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:aa[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=la(gt.BASESIZE,t);return this.size===r&&this.textSize===gt.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==gt.BASESIZE?["sizing","reset-size"+this.size,"size"+gt.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Bf(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}gt.BASESIZE=6;var u0={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Ff={ex:!0,em:!0,mu:!0},ts=function(t){return typeof t!="string"&&(t=t.unit),t in u0||t in Ff||t==="ex"},ye=function(t,r){var n;if(t.unit in u0)n=u0[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,t.unit==="ex")n=i.fontMetrics().xHeight;else if(t.unit==="em")n=i.fontMetrics().quad;else throw new L("Invalid unit: '"+t.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*n,r.maxSize)},P=function(t){return+t.toFixed(4)+"em"},Ct=function(t){return t.filter(r=>r).join(" ")},rs=function(t,r,n){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},ns=function(t){var r=document.createElement(t);r.className=Ct(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(r.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&r.setAttribute(i,this.attributes[i]);for(var a=0;a/=\x00-\x1f]/,is=function(t){var r="<"+t;this.classes.length&&(r+=' class="'+ue.escape(Ct(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ue.hyphenate(i)+":"+this.style[i]+";");n&&(r+=' style="'+ue.escape(n)+'"');for(var a in this.attributes)if(this.attributes.hasOwnProperty(a)){if(Lf.test(a))throw new L("Invalid attribute name '"+a+"'");r+=" "+a+'="'+ue.escape(this.attributes[a])+'"'}r+=">";for(var l=0;l",r};class Cr{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,rs.call(this,t,n,i),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return ns.call(this,"span")}toMarkup(){return is.call(this,"span")}}class q0{constructor(t,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,rs.call(this,r,i),this.children=n||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return ns.call(this,"a")}toMarkup(){return is.call(this,"a")}}class Rf{constructor(t,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.style=n}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);return t}toMarkup(){var t=''+ue.escape(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=P(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=Ct(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(r=r||document.createElement("span"),r.style[n]=this.style[n]);return r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ue.hyphenate(i)+":"+this.style[i]+";");n&&(t=!0,r+=' style="'+ue.escape(n)+'"');var a=ue.escape(this.text);return t?(r+=">",r+=a,r+="",r):a}}class bt{constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);for(var i=0;i':''}}class c0{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var t=" but got "+String(e)+".")}var qf={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Hf={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},de={math:{},text:{}};function c(e,t,r,n,i,a){de[e][i]={font:t,group:r,replace:n},a&&n&&(de[e][n]=de[e][i])}var f="math",N="text",g="main",b="ams",ge="accent-token",W="bin",Le="close",rr="inner",Z="mathord",Te="op-token",Ye="open",sn="punct",x="rel",St="spacing",T="textord";c(f,g,x,"≡","\\equiv",!0);c(f,g,x,"≺","\\prec",!0);c(f,g,x,"≻","\\succ",!0);c(f,g,x,"∼","\\sim",!0);c(f,g,x,"⊥","\\perp");c(f,g,x,"⪯","\\preceq",!0);c(f,g,x,"⪰","\\succeq",!0);c(f,g,x,"≃","\\simeq",!0);c(f,g,x,"∣","\\mid",!0);c(f,g,x,"≪","\\ll",!0);c(f,g,x,"≫","\\gg",!0);c(f,g,x,"≍","\\asymp",!0);c(f,g,x,"∥","\\parallel");c(f,g,x,"⋈","\\bowtie",!0);c(f,g,x,"⌣","\\smile",!0);c(f,g,x,"⊑","\\sqsubseteq",!0);c(f,g,x,"⊒","\\sqsupseteq",!0);c(f,g,x,"≐","\\doteq",!0);c(f,g,x,"⌢","\\frown",!0);c(f,g,x,"∋","\\ni",!0);c(f,g,x,"∝","\\propto",!0);c(f,g,x,"⊢","\\vdash",!0);c(f,g,x,"⊣","\\dashv",!0);c(f,g,x,"∋","\\owns");c(f,g,sn,".","\\ldotp");c(f,g,sn,"⋅","\\cdotp");c(f,g,T,"#","\\#");c(N,g,T,"#","\\#");c(f,g,T,"&","\\&");c(N,g,T,"&","\\&");c(f,g,T,"ℵ","\\aleph",!0);c(f,g,T,"∀","\\forall",!0);c(f,g,T,"ℏ","\\hbar",!0);c(f,g,T,"∃","\\exists",!0);c(f,g,T,"∇","\\nabla",!0);c(f,g,T,"♭","\\flat",!0);c(f,g,T,"ℓ","\\ell",!0);c(f,g,T,"♮","\\natural",!0);c(f,g,T,"♣","\\clubsuit",!0);c(f,g,T,"℘","\\wp",!0);c(f,g,T,"♯","\\sharp",!0);c(f,g,T,"♢","\\diamondsuit",!0);c(f,g,T,"ℜ","\\Re",!0);c(f,g,T,"♡","\\heartsuit",!0);c(f,g,T,"ℑ","\\Im",!0);c(f,g,T,"♠","\\spadesuit",!0);c(f,g,T,"§","\\S",!0);c(N,g,T,"§","\\S");c(f,g,T,"¶","\\P",!0);c(N,g,T,"¶","\\P");c(f,g,T,"†","\\dag");c(N,g,T,"†","\\dag");c(N,g,T,"†","\\textdagger");c(f,g,T,"‡","\\ddag");c(N,g,T,"‡","\\ddag");c(N,g,T,"‡","\\textdaggerdbl");c(f,g,Le,"⎱","\\rmoustache",!0);c(f,g,Ye,"⎰","\\lmoustache",!0);c(f,g,Le,"⟯","\\rgroup",!0);c(f,g,Ye,"⟮","\\lgroup",!0);c(f,g,W,"∓","\\mp",!0);c(f,g,W,"⊖","\\ominus",!0);c(f,g,W,"⊎","\\uplus",!0);c(f,g,W,"⊓","\\sqcap",!0);c(f,g,W,"∗","\\ast");c(f,g,W,"⊔","\\sqcup",!0);c(f,g,W,"◯","\\bigcirc",!0);c(f,g,W,"∙","\\bullet",!0);c(f,g,W,"‡","\\ddagger");c(f,g,W,"≀","\\wr",!0);c(f,g,W,"⨿","\\amalg");c(f,g,W,"&","\\And");c(f,g,x,"⟵","\\longleftarrow",!0);c(f,g,x,"⇐","\\Leftarrow",!0);c(f,g,x,"⟸","\\Longleftarrow",!0);c(f,g,x,"⟶","\\longrightarrow",!0);c(f,g,x,"⇒","\\Rightarrow",!0);c(f,g,x,"⟹","\\Longrightarrow",!0);c(f,g,x,"↔","\\leftrightarrow",!0);c(f,g,x,"⟷","\\longleftrightarrow",!0);c(f,g,x,"⇔","\\Leftrightarrow",!0);c(f,g,x,"⟺","\\Longleftrightarrow",!0);c(f,g,x,"↦","\\mapsto",!0);c(f,g,x,"⟼","\\longmapsto",!0);c(f,g,x,"↗","\\nearrow",!0);c(f,g,x,"↩","\\hookleftarrow",!0);c(f,g,x,"↪","\\hookrightarrow",!0);c(f,g,x,"↘","\\searrow",!0);c(f,g,x,"↼","\\leftharpoonup",!0);c(f,g,x,"⇀","\\rightharpoonup",!0);c(f,g,x,"↙","\\swarrow",!0);c(f,g,x,"↽","\\leftharpoondown",!0);c(f,g,x,"⇁","\\rightharpoondown",!0);c(f,g,x,"↖","\\nwarrow",!0);c(f,g,x,"⇌","\\rightleftharpoons",!0);c(f,b,x,"≮","\\nless",!0);c(f,b,x,"","\\@nleqslant");c(f,b,x,"","\\@nleqq");c(f,b,x,"⪇","\\lneq",!0);c(f,b,x,"≨","\\lneqq",!0);c(f,b,x,"","\\@lvertneqq");c(f,b,x,"⋦","\\lnsim",!0);c(f,b,x,"⪉","\\lnapprox",!0);c(f,b,x,"⊀","\\nprec",!0);c(f,b,x,"⋠","\\npreceq",!0);c(f,b,x,"⋨","\\precnsim",!0);c(f,b,x,"⪹","\\precnapprox",!0);c(f,b,x,"≁","\\nsim",!0);c(f,b,x,"","\\@nshortmid");c(f,b,x,"∤","\\nmid",!0);c(f,b,x,"⊬","\\nvdash",!0);c(f,b,x,"⊭","\\nvDash",!0);c(f,b,x,"⋪","\\ntriangleleft");c(f,b,x,"⋬","\\ntrianglelefteq",!0);c(f,b,x,"⊊","\\subsetneq",!0);c(f,b,x,"","\\@varsubsetneq");c(f,b,x,"⫋","\\subsetneqq",!0);c(f,b,x,"","\\@varsubsetneqq");c(f,b,x,"≯","\\ngtr",!0);c(f,b,x,"","\\@ngeqslant");c(f,b,x,"","\\@ngeqq");c(f,b,x,"⪈","\\gneq",!0);c(f,b,x,"≩","\\gneqq",!0);c(f,b,x,"","\\@gvertneqq");c(f,b,x,"⋧","\\gnsim",!0);c(f,b,x,"⪊","\\gnapprox",!0);c(f,b,x,"⊁","\\nsucc",!0);c(f,b,x,"⋡","\\nsucceq",!0);c(f,b,x,"⋩","\\succnsim",!0);c(f,b,x,"⪺","\\succnapprox",!0);c(f,b,x,"≆","\\ncong",!0);c(f,b,x,"","\\@nshortparallel");c(f,b,x,"∦","\\nparallel",!0);c(f,b,x,"⊯","\\nVDash",!0);c(f,b,x,"⋫","\\ntriangleright");c(f,b,x,"⋭","\\ntrianglerighteq",!0);c(f,b,x,"","\\@nsupseteqq");c(f,b,x,"⊋","\\supsetneq",!0);c(f,b,x,"","\\@varsupsetneq");c(f,b,x,"⫌","\\supsetneqq",!0);c(f,b,x,"","\\@varsupsetneqq");c(f,b,x,"⊮","\\nVdash",!0);c(f,b,x,"⪵","\\precneqq",!0);c(f,b,x,"⪶","\\succneqq",!0);c(f,b,x,"","\\@nsubseteqq");c(f,b,W,"⊴","\\unlhd");c(f,b,W,"⊵","\\unrhd");c(f,b,x,"↚","\\nleftarrow",!0);c(f,b,x,"↛","\\nrightarrow",!0);c(f,b,x,"⇍","\\nLeftarrow",!0);c(f,b,x,"⇏","\\nRightarrow",!0);c(f,b,x,"↮","\\nleftrightarrow",!0);c(f,b,x,"⇎","\\nLeftrightarrow",!0);c(f,b,x,"△","\\vartriangle");c(f,b,T,"ℏ","\\hslash");c(f,b,T,"▽","\\triangledown");c(f,b,T,"◊","\\lozenge");c(f,b,T,"Ⓢ","\\circledS");c(f,b,T,"®","\\circledR");c(N,b,T,"®","\\circledR");c(f,b,T,"∡","\\measuredangle",!0);c(f,b,T,"∄","\\nexists");c(f,b,T,"℧","\\mho");c(f,b,T,"Ⅎ","\\Finv",!0);c(f,b,T,"⅁","\\Game",!0);c(f,b,T,"‵","\\backprime");c(f,b,T,"▲","\\blacktriangle");c(f,b,T,"▼","\\blacktriangledown");c(f,b,T,"■","\\blacksquare");c(f,b,T,"⧫","\\blacklozenge");c(f,b,T,"★","\\bigstar");c(f,b,T,"∢","\\sphericalangle",!0);c(f,b,T,"∁","\\complement",!0);c(f,b,T,"ð","\\eth",!0);c(N,g,T,"ð","ð");c(f,b,T,"╱","\\diagup");c(f,b,T,"╲","\\diagdown");c(f,b,T,"□","\\square");c(f,b,T,"□","\\Box");c(f,b,T,"◊","\\Diamond");c(f,b,T,"¥","\\yen",!0);c(N,b,T,"¥","\\yen",!0);c(f,b,T,"✓","\\checkmark",!0);c(N,b,T,"✓","\\checkmark");c(f,b,T,"ℶ","\\beth",!0);c(f,b,T,"ℸ","\\daleth",!0);c(f,b,T,"ℷ","\\gimel",!0);c(f,b,T,"ϝ","\\digamma",!0);c(f,b,T,"ϰ","\\varkappa");c(f,b,Ye,"┌","\\@ulcorner",!0);c(f,b,Le,"┐","\\@urcorner",!0);c(f,b,Ye,"└","\\@llcorner",!0);c(f,b,Le,"┘","\\@lrcorner",!0);c(f,b,x,"≦","\\leqq",!0);c(f,b,x,"⩽","\\leqslant",!0);c(f,b,x,"⪕","\\eqslantless",!0);c(f,b,x,"≲","\\lesssim",!0);c(f,b,x,"⪅","\\lessapprox",!0);c(f,b,x,"≊","\\approxeq",!0);c(f,b,W,"⋖","\\lessdot");c(f,b,x,"⋘","\\lll",!0);c(f,b,x,"≶","\\lessgtr",!0);c(f,b,x,"⋚","\\lesseqgtr",!0);c(f,b,x,"⪋","\\lesseqqgtr",!0);c(f,b,x,"≑","\\doteqdot");c(f,b,x,"≓","\\risingdotseq",!0);c(f,b,x,"≒","\\fallingdotseq",!0);c(f,b,x,"∽","\\backsim",!0);c(f,b,x,"⋍","\\backsimeq",!0);c(f,b,x,"⫅","\\subseteqq",!0);c(f,b,x,"⋐","\\Subset",!0);c(f,b,x,"⊏","\\sqsubset",!0);c(f,b,x,"≼","\\preccurlyeq",!0);c(f,b,x,"⋞","\\curlyeqprec",!0);c(f,b,x,"≾","\\precsim",!0);c(f,b,x,"⪷","\\precapprox",!0);c(f,b,x,"⊲","\\vartriangleleft");c(f,b,x,"⊴","\\trianglelefteq");c(f,b,x,"⊨","\\vDash",!0);c(f,b,x,"⊪","\\Vvdash",!0);c(f,b,x,"⌣","\\smallsmile");c(f,b,x,"⌢","\\smallfrown");c(f,b,x,"≏","\\bumpeq",!0);c(f,b,x,"≎","\\Bumpeq",!0);c(f,b,x,"≧","\\geqq",!0);c(f,b,x,"⩾","\\geqslant",!0);c(f,b,x,"⪖","\\eqslantgtr",!0);c(f,b,x,"≳","\\gtrsim",!0);c(f,b,x,"⪆","\\gtrapprox",!0);c(f,b,W,"⋗","\\gtrdot");c(f,b,x,"⋙","\\ggg",!0);c(f,b,x,"≷","\\gtrless",!0);c(f,b,x,"⋛","\\gtreqless",!0);c(f,b,x,"⪌","\\gtreqqless",!0);c(f,b,x,"≖","\\eqcirc",!0);c(f,b,x,"≗","\\circeq",!0);c(f,b,x,"≜","\\triangleq",!0);c(f,b,x,"∼","\\thicksim");c(f,b,x,"≈","\\thickapprox");c(f,b,x,"⫆","\\supseteqq",!0);c(f,b,x,"⋑","\\Supset",!0);c(f,b,x,"⊐","\\sqsupset",!0);c(f,b,x,"≽","\\succcurlyeq",!0);c(f,b,x,"⋟","\\curlyeqsucc",!0);c(f,b,x,"≿","\\succsim",!0);c(f,b,x,"⪸","\\succapprox",!0);c(f,b,x,"⊳","\\vartriangleright");c(f,b,x,"⊵","\\trianglerighteq");c(f,b,x,"⊩","\\Vdash",!0);c(f,b,x,"∣","\\shortmid");c(f,b,x,"∥","\\shortparallel");c(f,b,x,"≬","\\between",!0);c(f,b,x,"⋔","\\pitchfork",!0);c(f,b,x,"∝","\\varpropto");c(f,b,x,"◀","\\blacktriangleleft");c(f,b,x,"∴","\\therefore",!0);c(f,b,x,"∍","\\backepsilon");c(f,b,x,"▶","\\blacktriangleright");c(f,b,x,"∵","\\because",!0);c(f,b,x,"⋘","\\llless");c(f,b,x,"⋙","\\gggtr");c(f,b,W,"⊲","\\lhd");c(f,b,W,"⊳","\\rhd");c(f,b,x,"≂","\\eqsim",!0);c(f,g,x,"⋈","\\Join");c(f,b,x,"≑","\\Doteq",!0);c(f,b,W,"∔","\\dotplus",!0);c(f,b,W,"∖","\\smallsetminus");c(f,b,W,"⋒","\\Cap",!0);c(f,b,W,"⋓","\\Cup",!0);c(f,b,W,"⩞","\\doublebarwedge",!0);c(f,b,W,"⊟","\\boxminus",!0);c(f,b,W,"⊞","\\boxplus",!0);c(f,b,W,"⋇","\\divideontimes",!0);c(f,b,W,"⋉","\\ltimes",!0);c(f,b,W,"⋊","\\rtimes",!0);c(f,b,W,"⋋","\\leftthreetimes",!0);c(f,b,W,"⋌","\\rightthreetimes",!0);c(f,b,W,"⋏","\\curlywedge",!0);c(f,b,W,"⋎","\\curlyvee",!0);c(f,b,W,"⊝","\\circleddash",!0);c(f,b,W,"⊛","\\circledast",!0);c(f,b,W,"⋅","\\centerdot");c(f,b,W,"⊺","\\intercal",!0);c(f,b,W,"⋒","\\doublecap");c(f,b,W,"⋓","\\doublecup");c(f,b,W,"⊠","\\boxtimes",!0);c(f,b,x,"⇢","\\dashrightarrow",!0);c(f,b,x,"⇠","\\dashleftarrow",!0);c(f,b,x,"⇇","\\leftleftarrows",!0);c(f,b,x,"⇆","\\leftrightarrows",!0);c(f,b,x,"⇚","\\Lleftarrow",!0);c(f,b,x,"↞","\\twoheadleftarrow",!0);c(f,b,x,"↢","\\leftarrowtail",!0);c(f,b,x,"↫","\\looparrowleft",!0);c(f,b,x,"⇋","\\leftrightharpoons",!0);c(f,b,x,"↶","\\curvearrowleft",!0);c(f,b,x,"↺","\\circlearrowleft",!0);c(f,b,x,"↰","\\Lsh",!0);c(f,b,x,"⇈","\\upuparrows",!0);c(f,b,x,"↿","\\upharpoonleft",!0);c(f,b,x,"⇃","\\downharpoonleft",!0);c(f,g,x,"⊶","\\origof",!0);c(f,g,x,"⊷","\\imageof",!0);c(f,b,x,"⊸","\\multimap",!0);c(f,b,x,"↭","\\leftrightsquigarrow",!0);c(f,b,x,"⇉","\\rightrightarrows",!0);c(f,b,x,"⇄","\\rightleftarrows",!0);c(f,b,x,"↠","\\twoheadrightarrow",!0);c(f,b,x,"↣","\\rightarrowtail",!0);c(f,b,x,"↬","\\looparrowright",!0);c(f,b,x,"↷","\\curvearrowright",!0);c(f,b,x,"↻","\\circlearrowright",!0);c(f,b,x,"↱","\\Rsh",!0);c(f,b,x,"⇊","\\downdownarrows",!0);c(f,b,x,"↾","\\upharpoonright",!0);c(f,b,x,"⇂","\\downharpoonright",!0);c(f,b,x,"⇝","\\rightsquigarrow",!0);c(f,b,x,"⇝","\\leadsto");c(f,b,x,"⇛","\\Rrightarrow",!0);c(f,b,x,"↾","\\restriction");c(f,g,T,"‘","`");c(f,g,T,"$","\\$");c(N,g,T,"$","\\$");c(N,g,T,"$","\\textdollar");c(f,g,T,"%","\\%");c(N,g,T,"%","\\%");c(f,g,T,"_","\\_");c(N,g,T,"_","\\_");c(N,g,T,"_","\\textunderscore");c(f,g,T,"∠","\\angle",!0);c(f,g,T,"∞","\\infty",!0);c(f,g,T,"′","\\prime");c(f,g,T,"△","\\triangle");c(f,g,T,"Γ","\\Gamma",!0);c(f,g,T,"Δ","\\Delta",!0);c(f,g,T,"Θ","\\Theta",!0);c(f,g,T,"Λ","\\Lambda",!0);c(f,g,T,"Ξ","\\Xi",!0);c(f,g,T,"Π","\\Pi",!0);c(f,g,T,"Σ","\\Sigma",!0);c(f,g,T,"Υ","\\Upsilon",!0);c(f,g,T,"Φ","\\Phi",!0);c(f,g,T,"Ψ","\\Psi",!0);c(f,g,T,"Ω","\\Omega",!0);c(f,g,T,"A","Α");c(f,g,T,"B","Β");c(f,g,T,"E","Ε");c(f,g,T,"Z","Ζ");c(f,g,T,"H","Η");c(f,g,T,"I","Ι");c(f,g,T,"K","Κ");c(f,g,T,"M","Μ");c(f,g,T,"N","Ν");c(f,g,T,"O","Ο");c(f,g,T,"P","Ρ");c(f,g,T,"T","Τ");c(f,g,T,"X","Χ");c(f,g,T,"¬","\\neg",!0);c(f,g,T,"¬","\\lnot");c(f,g,T,"⊤","\\top");c(f,g,T,"⊥","\\bot");c(f,g,T,"∅","\\emptyset");c(f,b,T,"∅","\\varnothing");c(f,g,Z,"α","\\alpha",!0);c(f,g,Z,"β","\\beta",!0);c(f,g,Z,"γ","\\gamma",!0);c(f,g,Z,"δ","\\delta",!0);c(f,g,Z,"ϵ","\\epsilon",!0);c(f,g,Z,"ζ","\\zeta",!0);c(f,g,Z,"η","\\eta",!0);c(f,g,Z,"θ","\\theta",!0);c(f,g,Z,"ι","\\iota",!0);c(f,g,Z,"κ","\\kappa",!0);c(f,g,Z,"λ","\\lambda",!0);c(f,g,Z,"μ","\\mu",!0);c(f,g,Z,"ν","\\nu",!0);c(f,g,Z,"ξ","\\xi",!0);c(f,g,Z,"ο","\\omicron",!0);c(f,g,Z,"π","\\pi",!0);c(f,g,Z,"ρ","\\rho",!0);c(f,g,Z,"σ","\\sigma",!0);c(f,g,Z,"τ","\\tau",!0);c(f,g,Z,"υ","\\upsilon",!0);c(f,g,Z,"ϕ","\\phi",!0);c(f,g,Z,"χ","\\chi",!0);c(f,g,Z,"ψ","\\psi",!0);c(f,g,Z,"ω","\\omega",!0);c(f,g,Z,"ε","\\varepsilon",!0);c(f,g,Z,"ϑ","\\vartheta",!0);c(f,g,Z,"ϖ","\\varpi",!0);c(f,g,Z,"ϱ","\\varrho",!0);c(f,g,Z,"ς","\\varsigma",!0);c(f,g,Z,"φ","\\varphi",!0);c(f,g,W,"∗","*",!0);c(f,g,W,"+","+");c(f,g,W,"−","-",!0);c(f,g,W,"⋅","\\cdot",!0);c(f,g,W,"∘","\\circ",!0);c(f,g,W,"÷","\\div",!0);c(f,g,W,"±","\\pm",!0);c(f,g,W,"×","\\times",!0);c(f,g,W,"∩","\\cap",!0);c(f,g,W,"∪","\\cup",!0);c(f,g,W,"∖","\\setminus",!0);c(f,g,W,"∧","\\land");c(f,g,W,"∨","\\lor");c(f,g,W,"∧","\\wedge",!0);c(f,g,W,"∨","\\vee",!0);c(f,g,T,"√","\\surd");c(f,g,Ye,"⟨","\\langle",!0);c(f,g,Ye,"∣","\\lvert");c(f,g,Ye,"∥","\\lVert");c(f,g,Le,"?","?");c(f,g,Le,"!","!");c(f,g,Le,"⟩","\\rangle",!0);c(f,g,Le,"∣","\\rvert");c(f,g,Le,"∥","\\rVert");c(f,g,x,"=","=");c(f,g,x,":",":");c(f,g,x,"≈","\\approx",!0);c(f,g,x,"≅","\\cong",!0);c(f,g,x,"≥","\\ge");c(f,g,x,"≥","\\geq",!0);c(f,g,x,"←","\\gets");c(f,g,x,">","\\gt",!0);c(f,g,x,"∈","\\in",!0);c(f,g,x,"","\\@not");c(f,g,x,"⊂","\\subset",!0);c(f,g,x,"⊃","\\supset",!0);c(f,g,x,"⊆","\\subseteq",!0);c(f,g,x,"⊇","\\supseteq",!0);c(f,b,x,"⊈","\\nsubseteq",!0);c(f,b,x,"⊉","\\nsupseteq",!0);c(f,g,x,"⊨","\\models");c(f,g,x,"←","\\leftarrow",!0);c(f,g,x,"≤","\\le");c(f,g,x,"≤","\\leq",!0);c(f,g,x,"<","\\lt",!0);c(f,g,x,"→","\\rightarrow",!0);c(f,g,x,"→","\\to");c(f,b,x,"≱","\\ngeq",!0);c(f,b,x,"≰","\\nleq",!0);c(f,g,St," ","\\ ");c(f,g,St," ","\\space");c(f,g,St," ","\\nobreakspace");c(N,g,St," ","\\ ");c(N,g,St," "," ");c(N,g,St," ","\\space");c(N,g,St," ","\\nobreakspace");c(f,g,St,null,"\\nobreak");c(f,g,St,null,"\\allowbreak");c(f,g,sn,",",",");c(f,g,sn,";",";");c(f,b,W,"⊼","\\barwedge",!0);c(f,b,W,"⊻","\\veebar",!0);c(f,g,W,"⊙","\\odot",!0);c(f,g,W,"⊕","\\oplus",!0);c(f,g,W,"⊗","\\otimes",!0);c(f,g,T,"∂","\\partial",!0);c(f,g,W,"⊘","\\oslash",!0);c(f,b,W,"⊚","\\circledcirc",!0);c(f,b,W,"⊡","\\boxdot",!0);c(f,g,W,"△","\\bigtriangleup");c(f,g,W,"▽","\\bigtriangledown");c(f,g,W,"†","\\dagger");c(f,g,W,"⋄","\\diamond");c(f,g,W,"⋆","\\star");c(f,g,W,"◃","\\triangleleft");c(f,g,W,"▹","\\triangleright");c(f,g,Ye,"{","\\{");c(N,g,T,"{","\\{");c(N,g,T,"{","\\textbraceleft");c(f,g,Le,"}","\\}");c(N,g,T,"}","\\}");c(N,g,T,"}","\\textbraceright");c(f,g,Ye,"{","\\lbrace");c(f,g,Le,"}","\\rbrace");c(f,g,Ye,"[","\\lbrack",!0);c(N,g,T,"[","\\lbrack",!0);c(f,g,Le,"]","\\rbrack",!0);c(N,g,T,"]","\\rbrack",!0);c(f,g,Ye,"(","\\lparen",!0);c(f,g,Le,")","\\rparen",!0);c(N,g,T,"<","\\textless",!0);c(N,g,T,">","\\textgreater",!0);c(f,g,Ye,"⌊","\\lfloor",!0);c(f,g,Le,"⌋","\\rfloor",!0);c(f,g,Ye,"⌈","\\lceil",!0);c(f,g,Le,"⌉","\\rceil",!0);c(f,g,T,"\\","\\backslash");c(f,g,T,"∣","|");c(f,g,T,"∣","\\vert");c(N,g,T,"|","\\textbar",!0);c(f,g,T,"∥","\\|");c(f,g,T,"∥","\\Vert");c(N,g,T,"∥","\\textbardbl");c(N,g,T,"~","\\textasciitilde");c(N,g,T,"\\","\\textbackslash");c(N,g,T,"^","\\textasciicircum");c(f,g,x,"↑","\\uparrow",!0);c(f,g,x,"⇑","\\Uparrow",!0);c(f,g,x,"↓","\\downarrow",!0);c(f,g,x,"⇓","\\Downarrow",!0);c(f,g,x,"↕","\\updownarrow",!0);c(f,g,x,"⇕","\\Updownarrow",!0);c(f,g,Te,"∐","\\coprod");c(f,g,Te,"⋁","\\bigvee");c(f,g,Te,"⋀","\\bigwedge");c(f,g,Te,"⨄","\\biguplus");c(f,g,Te,"⋂","\\bigcap");c(f,g,Te,"⋃","\\bigcup");c(f,g,Te,"∫","\\int");c(f,g,Te,"∫","\\intop");c(f,g,Te,"∬","\\iint");c(f,g,Te,"∭","\\iiint");c(f,g,Te,"∏","\\prod");c(f,g,Te,"∑","\\sum");c(f,g,Te,"⨂","\\bigotimes");c(f,g,Te,"⨁","\\bigoplus");c(f,g,Te,"⨀","\\bigodot");c(f,g,Te,"∮","\\oint");c(f,g,Te,"∯","\\oiint");c(f,g,Te,"∰","\\oiiint");c(f,g,Te,"⨆","\\bigsqcup");c(f,g,Te,"∫","\\smallint");c(N,g,rr,"…","\\textellipsis");c(f,g,rr,"…","\\mathellipsis");c(N,g,rr,"…","\\ldots",!0);c(f,g,rr,"…","\\ldots",!0);c(f,g,rr,"⋯","\\@cdots",!0);c(f,g,rr,"⋱","\\ddots",!0);c(f,g,T,"⋮","\\varvdots");c(N,g,T,"⋮","\\varvdots");c(f,g,ge,"ˊ","\\acute");c(f,g,ge,"ˋ","\\grave");c(f,g,ge,"¨","\\ddot");c(f,g,ge,"~","\\tilde");c(f,g,ge,"ˉ","\\bar");c(f,g,ge,"˘","\\breve");c(f,g,ge,"ˇ","\\check");c(f,g,ge,"^","\\hat");c(f,g,ge,"⃗","\\vec");c(f,g,ge,"˙","\\dot");c(f,g,ge,"˚","\\mathring");c(f,g,Z,"","\\@imath");c(f,g,Z,"","\\@jmath");c(f,g,T,"ı","ı");c(f,g,T,"ȷ","ȷ");c(N,g,T,"ı","\\i",!0);c(N,g,T,"ȷ","\\j",!0);c(N,g,T,"ß","\\ss",!0);c(N,g,T,"æ","\\ae",!0);c(N,g,T,"œ","\\oe",!0);c(N,g,T,"ø","\\o",!0);c(N,g,T,"Æ","\\AE",!0);c(N,g,T,"Œ","\\OE",!0);c(N,g,T,"Ø","\\O",!0);c(N,g,ge,"ˊ","\\'");c(N,g,ge,"ˋ","\\`");c(N,g,ge,"ˆ","\\^");c(N,g,ge,"˜","\\~");c(N,g,ge,"ˉ","\\=");c(N,g,ge,"˘","\\u");c(N,g,ge,"˙","\\.");c(N,g,ge,"¸","\\c");c(N,g,ge,"˚","\\r");c(N,g,ge,"ˇ","\\v");c(N,g,ge,"¨",'\\"');c(N,g,ge,"˝","\\H");c(N,g,ge,"◯","\\textcircled");var as={"--":!0,"---":!0,"``":!0,"''":!0};c(N,g,T,"–","--",!0);c(N,g,T,"–","\\textendash");c(N,g,T,"—","---",!0);c(N,g,T,"—","\\textemdash");c(N,g,T,"‘","`",!0);c(N,g,T,"‘","\\textquoteleft");c(N,g,T,"’","'",!0);c(N,g,T,"’","\\textquoteright");c(N,g,T,"“","``",!0);c(N,g,T,"“","\\textquotedblleft");c(N,g,T,"”","''",!0);c(N,g,T,"”","\\textquotedblright");c(f,g,T,"°","\\degree",!0);c(N,g,T,"°","\\degree");c(N,g,T,"°","\\textdegree",!0);c(f,g,T,"£","\\pounds");c(f,g,T,"£","\\mathsterling",!0);c(N,g,T,"£","\\pounds");c(N,g,T,"£","\\textsterling",!0);c(f,b,T,"✠","\\maltese");c(N,b,T,"✠","\\maltese");var oa='0123456789/@."';for(var Rn=0;Rn0)return nt(a,u,i,r,l.concat(h));if(o){var m,d;if(o==="boldsymbol"){var p=$f(a,i,r,l,n);m=p.fontName,d=[p.fontClass]}else s?(m=os[o].fontName,d=[o]):(m=Or(o,r.fontWeight,r.fontShape),d=[o,r.fontWeight,r.fontShape]);if(on(a,m,i).metrics)return nt(a,m,i,r,l.concat(d));if(as.hasOwnProperty(a)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Ct(e.classes)!==Ct(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n in e.style)if(e.style.hasOwnProperty(n)&&e.style[n]!==t.style[n])return!1;for(var i in t.style)if(t.style.hasOwnProperty(i)&&e.style[i]!==t.style[i])return!1;return!0},Gf=e=>{for(var t=0;tr&&(r=l.height),l.depth>n&&(n=l.depth),l.maxFontSize>i&&(i=l.maxFontSize)}t.height=r,t.depth=n,t.maxFontSize=i},Oe=function(t,r,n,i){var a=new Cr(t,r,n,i);return H0(a),a},ls=(e,t,r,n)=>new Cr(e,t,r,n),Wf=function(t,r,n){var i=Oe([t],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=P(i.height),i.maxFontSize=1,i},Yf=function(t,r,n,i){var a=new q0(t,r,n,i);return H0(a),a},ss=function(t){var r=new Mr(t);return H0(r),r},Xf=function(t,r){return t instanceof Mr?Oe([],[t],r):t},Kf=function(t){if(t.positionType==="individualShift"){for(var r=t.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,l=1;l{var r=Oe(["mspace"],[],t),n=ye(e,t);return r.style.marginRight=P(n),r},Or=function(t,r,n){var i="";switch(t){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=t}var a;return r==="textbf"&&n==="textit"?a="BoldItalic":r==="textbf"?a="Bold":r==="textit"?a="Italic":a="Regular",i+"-"+a},os={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},us={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Jf=function(t,r){var[n,i,a]=us[t],l=new Et(n),s=new bt([l],{width:P(i),height:P(a),style:"width:"+P(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),o=ls(["overlay"],[s],r);return o.height=a,o.style.height=P(a),o.style.width=P(i),o},C={fontMap:os,makeSymbol:nt,mathsym:jf,makeSpan:Oe,makeSvgSpan:ls,makeLineSpan:Wf,makeAnchor:Yf,makeFragment:ss,wrapFragment:Xf,makeVList:Zf,makeOrd:Uf,makeGlue:Qf,staticSvg:Jf,svgData:us,tryCombineChars:Gf},ve={number:3,unit:"mu"},Pt={number:4,unit:"mu"},dt={number:5,unit:"mu"},e2={mord:{mop:ve,mbin:Pt,mrel:dt,minner:ve},mop:{mord:ve,mop:ve,mrel:dt,minner:ve},mbin:{mord:Pt,mop:Pt,mopen:Pt,minner:Pt},mrel:{mord:dt,mop:dt,mopen:dt,minner:dt},mopen:{},mclose:{mop:ve,mbin:Pt,mrel:dt,minner:ve},mpunct:{mord:ve,mop:ve,mrel:dt,mopen:ve,mclose:ve,mpunct:ve,minner:ve},minner:{mord:ve,mop:ve,mbin:Pt,mrel:dt,mopen:ve,mpunct:ve,minner:ve}},t2={mord:{mop:ve},mop:{mord:ve,mop:ve},mbin:{},mrel:{},mopen:{},mclose:{mop:ve},mpunct:{},minner:{mop:ve}},cs={},Qr={},Jr={};function _(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:l}=e,s={type:t,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},o=0;o{var M=w.classes[0],S=y.classes[0];M==="mbin"&&n2.includes(S)?w.classes[0]="mord":S==="mbin"&&r2.includes(M)&&(y.classes[0]="mord")},{node:m},d,p),fa(a,(y,w)=>{var M=m0(w),S=m0(y),z=M&&S?y.hasClass("mtight")?t2[M][S]:e2[M][S]:null;if(z)return C.makeGlue(z,u)},{node:m},d,p),a},fa=function e(t,r,n,i,a){i&&t.push(i);for(var l=0;ld=>{t.splice(m+1,0,d),l++})(l)}i&&t.pop()},hs=function(t){return t instanceof Mr||t instanceof q0||t instanceof Cr&&t.hasClass("enclosing")?t:null},l2=function e(t,r){var n=hs(t);if(n){var i=n.children;if(i.length){if(r==="right")return e(i[i.length-1],"right");if(r==="left")return e(i[0],"left")}}return t},m0=function(t,r){return t?(r&&(t=l2(t,r)),a2[t.classes[0]]||null):null},kr=function(t,r){var n=["nulldelimiter"].concat(t.baseSizingClasses());return xt(r.concat(n))},oe=function(t,r,n){if(!t)return xt();if(Qr[t.type]){var i=Qr[t.type](t,r);if(n&&r.size!==n.size){i=xt(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new L("Got group of unknown type: '"+t.type+"'")};function qr(e,t){var r=xt(["base"],e,t),n=xt(["strut"]);return n.style.height=P(r.height+r.depth),r.depth&&(n.style.verticalAlign=P(-r.depth)),r.children.unshift(n),r}function f0(e,t){var r=null;e.length===1&&e[0].type==="tag"&&(r=e[0].tag,e=e[0].body);var n=ze(e,t,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var a=[],l=[],s=0;s0&&(a.push(qr(l,t)),l=[]),a.push(n[s]));l.length>0&&a.push(qr(l,t));var u;r?(u=qr(ze(r,t,!0)),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=xt(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var m=u.children[0];m.style.height=P(h.height+h.depth),h.depth&&(m.style.verticalAlign=P(-h.depth))}return h}function ms(e){return new Mr(e)}class _e{constructor(t,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=Ct(this.classes));for(var n=0;n0&&(t+=' class ="'+ue.escape(Ct(this.classes))+'"'),t+=">";for(var n=0;n",t}toText(){return this.children.map(t=>t.toText()).join("")}}class ot{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ue.escape(this.toText())}toText(){return this.text}}class s2{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",P(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var F={MathNode:_e,TextNode:ot,SpaceNode:s2,newDocumentFragment:ms},Je=function(t,r,n){return de[r][t]&&de[r][t].replace&&t.charCodeAt(0)!==55349&&!(as.hasOwnProperty(t)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(t=de[r][t].replace),new F.TextNode(t)},V0=function(t){return t.length===1?t[0]:new F.MathNode("mrow",t)},j0=function(t,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var n=r.font;if(!n||n==="mathnormal")return null;var i=t.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var a=t.text;if(["\\imath","\\jmath"].includes(a))return null;de[i][a]&&de[i][a].replace&&(a=de[i][a].replace);var l=C.fontMap[n].fontName;return O0(a,l,i)?C.fontMap[n].variant:null};function Hn(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof ot&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof ot&&r.text===","}else return!1}var Ve=function(t,r,n){if(t.length===1){var i=me(t[0],r);return n&&i instanceof _e&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],l,s=0;s=1&&(l.type==="mn"||Hn(l))){var u=o.children[0];u instanceof _e&&u.type==="mn"&&(u.children=[...l.children,...u.children],a.pop())}else if(l.type==="mi"&&l.children.length===1){var h=l.children[0];if(h instanceof ot&&h.text==="̸"&&(o.type==="mo"||o.type==="mi"||o.type==="mn")){var m=o.children[0];m instanceof ot&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),a.pop())}}}a.push(o),l=o}return a},Dt=function(t,r,n){return V0(Ve(t,r,n))},me=function(t,r){if(!t)return new F.MathNode("mrow");if(Jr[t.type]){var n=Jr[t.type](t,r);return n}else throw new L("Got group of unknown type: '"+t.type+"'")};function pa(e,t,r,n,i){var a=Ve(e,r),l;a.length===1&&a[0]instanceof _e&&["mrow","mtable"].includes(a[0].type)?l=a[0]:l=new F.MathNode("mrow",a);var s=new F.MathNode("annotation",[new F.TextNode(t)]);s.setAttribute("encoding","application/x-tex");var o=new F.MathNode("semantics",[l,s]),u=new F.MathNode("math",[o]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return C.makeSpan([h],[u])}var fs=function(t){return new gt({style:t.displayMode?Q.DISPLAY:Q.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},ps=function(t,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),t=C.makeSpan(n,[t])}return t},o2=function(t,r,n){var i=fs(n),a;if(n.output==="mathml")return pa(t,r,i,n.displayMode,!0);if(n.output==="html"){var l=f0(t,i);a=C.makeSpan(["katex"],[l])}else{var s=pa(t,r,i,n.displayMode,!1),o=f0(t,i);a=C.makeSpan(["katex"],[s,o])}return ps(a,n)},u2=function(t,r,n){var i=fs(n),a=f0(t,i),l=C.makeSpan(["katex"],[a]);return ps(l,n)},c2={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},h2=function(t){var r=new F.MathNode("mo",[new F.TextNode(c2[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},m2={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},f2=function(t){return t.type==="ordgroup"?t.body.length:1},p2=function(t,r){function n(){var s=4e5,o=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(o)){var u=t,h=f2(u.base),m,d,p;if(h>5)o==="widehat"||o==="widecheck"?(m=420,s=2364,p=.42,d=o+"4"):(m=312,s=2340,p=.34,d="tilde4");else{var y=[1,1,2,2,3,3][h];o==="widehat"||o==="widecheck"?(s=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],p=[0,.24,.3,.3,.36,.42][y],d=o+y):(s=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],p=[0,.26,.286,.3,.306,.34][y],d="tilde"+y)}var w=new Et(d),M=new bt([w],{width:"100%",height:P(p),viewBox:"0 0 "+s+" "+m,preserveAspectRatio:"none"});return{span:C.makeSvgSpan([],[M],r),minWidth:0,height:p}}else{var S=[],z=m2[o],[I,V,O]=z,E=O/1e3,G=I.length,K,U;if(G===1){var D=z[3];K=["hide-tail"],U=[D]}else if(G===2)K=["halfarrow-left","halfarrow-right"],U=["xMinYMin","xMaxYMin"];else if(G===3)K=["brace-left","brace-center","brace-right"],U=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+G+" children.");for(var $=0;$0&&(i.style.minWidth=P(a)),i},d2=function(t,r,n,i,a){var l,s=t.height+t.depth+n+i;if(/fbox|color|angl/.test(r)){if(l=C.makeSpan(["stretchy",r],[],a),r==="fbox"){var o=a.color&&a.getColor();o&&(l.style.borderColor=o)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new c0({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new c0({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new bt(u,{width:"100%",height:P(s)});l=C.makeSvgSpan([],[h],a)}return l.height=s,l.style.height=P(s),l},wt={encloseSpan:d2,mathMLnode:h2,svgSpan:p2};function re(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function $0(e){var t=un(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function un(e){return e&&(e.type==="atom"||Hf.hasOwnProperty(e.type))?e:null}var U0=(e,t)=>{var r,n,i;e&&e.type==="supsub"?(n=re(e.base,"accent"),r=n.base,e.base=r,i=Of(oe(e,t)),e.base=n):(n=re(e,"accent"),r=n.base);var a=oe(r,t.havingCrampedStyle()),l=n.isShifty&&ue.isCharacterBox(r),s=0;if(l){var o=ue.getBaseElem(r),u=oe(o,t.havingCrampedStyle());s=sa(u).skew}var h=n.label==="\\c",m=h?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),d;if(n.isStretchy)d=wt.svgSpan(n,t),d=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+P(2*s)+")",marginLeft:P(2*s)}:void 0}]},t);else{var p,y;n.label==="\\vec"?(p=C.staticSvg("vec",t),y=C.svgData.vec[1]):(p=C.makeOrd({mode:n.mode,text:n.label},t,"textord"),p=sa(p),p.italic=0,y=p.width,h&&(m+=p.depth)),d=C.makeSpan(["accent-body"],[p]);var w=n.label==="\\textcircled";w&&(d.classes.push("accent-full"),m=a.height);var M=s;w||(M-=y/2),d.style.left=P(M),n.label==="\\textcircled"&&(d.style.top=".2em"),d=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-m},{type:"elem",elem:d}]},t)}var S=C.makeSpan(["mord","accent"],[d],t);return i?(i.children[0]=S,i.height=Math.max(S.height,i.height),i.classes[0]="mord",i):S},ds=(e,t)=>{var r=e.isStretchy?wt.mathMLnode(e.label):new F.MathNode("mo",[Je(e.label,e.mode)]),n=new F.MathNode("mover",[me(e.base,t),r]);return n.setAttribute("accent","true"),n},g2=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));_({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var r=en(t[0]),n=!g2.test(e.funcName),i=!n||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:U0,mathmlBuilder:ds});_({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var r=t[0],n=e.parser.mode;return n==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:U0,mathmlBuilder:ds});_({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(e,t)=>{var r=oe(e.base,t),n=wt.svgSpan(e,t),i=e.label==="\\utilde"?.12:0,a=C.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]},t);return C.makeSpan(["mord","accentunder"],[a],t)},mathmlBuilder:(e,t)=>{var r=wt.mathMLnode(e.label),n=new F.MathNode("munder",[me(e.base,t),r]);return n.setAttribute("accentunder","true"),n}});var Hr=e=>{var t=new F.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};_({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n,funcName:i}=e;return{type:"xArrow",mode:n.mode,label:i,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,n=t.havingStyle(r.sup()),i=C.wrapFragment(oe(e.body,n,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var l;e.below&&(n=t.havingStyle(r.sub()),l=C.wrapFragment(oe(e.below,n,t),t),l.classes.push(a+"-arrow-pad"));var s=wt.svgSpan(e,t),o=-t.fontMetrics().axisHeight+.5*s.height,u=-t.fontMetrics().axisHeight-.5*s.height-.111;(i.depth>.25||e.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(l){var m=-t.fontMetrics().axisHeight+l.height+.5*s.height+.111;h=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:s,shift:o},{type:"elem",elem:l,shift:m}]},t)}else h=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:s,shift:o}]},t);return h.children[0].children[0].children[1].classes.push("svg-align"),C.makeSpan(["mrel","x-arrow"],[h],t)},mathmlBuilder(e,t){var r=wt.mathMLnode(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(e.body){var i=Hr(me(e.body,t));if(e.below){var a=Hr(me(e.below,t));n=new F.MathNode("munderover",[r,a,i])}else n=new F.MathNode("mover",[r,i])}else if(e.below){var l=Hr(me(e.below,t));n=new F.MathNode("munder",[r,l])}else n=Hr(),n=new F.MathNode("mover",[r,n]);return n}});var v2=C.makeSpan;function gs(e,t){var r=ze(e.body,t,!0);return v2([e.mclass],r,t)}function vs(e,t){var r,n=Ve(e.body,t);return e.mclass==="minner"?r=new F.MathNode("mpadded",n):e.mclass==="mord"?e.isCharacterBox?(r=n[0],r.type="mi"):r=new F.MathNode("mi",n):(e.isCharacterBox?(r=n[0],r.type="mo"):r=new F.MathNode("mo",n),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}_({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:we(i),isCharacterBox:ue.isCharacterBox(i)}},htmlBuilder:gs,mathmlBuilder:vs});var cn=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};_({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:cn(t[0]),body:we(t[1]),isCharacterBox:ue.isCharacterBox(t[1])}}});_({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:n}=e,i=t[1],a=t[0],l;n!=="\\stackrel"?l=cn(i):l="mrel";var s={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:we(i)},o={type:"supsub",mode:a.mode,base:s,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:l,body:[o],isCharacterBox:ue.isCharacterBox(o)}},htmlBuilder:gs,mathmlBuilder:vs});_({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:cn(t[0]),body:we(t[0])}},htmlBuilder(e,t){var r=ze(e.body,t,!0),n=C.makeSpan([e.mclass],r,t);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(e,t){var r=Ve(e.body,t),n=new F.MathNode("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var y2={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},da=()=>({type:"styling",body:[],mode:"math",style:"display"}),ga=e=>e.type==="textord"&&e.text==="@",b2=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function x2(e,t,r){var n=y2[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},l=r.callFunction("\\Big",[a],[]),s=r.callFunction("\\\\cdright",[t[1]],[]),o={type:"ordgroup",mode:"math",body:[i,l,s]};return r.callFunction("\\\\cdparent",[o],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function w2(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new L("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var n=[],i=[n],a=0;a-1))if("<>AV".indexOf(u)>-1)for(var m=0;m<2;m++){for(var d=!0,p=o+1;pAV=|." after @',l[o]);var y=x2(u,h,e),w={type:"styling",body:[y],mode:"math",style:"display"};n.push(w),s=da()}a%2===0?n.push(s):n.shift(),n=[],i.push(n)}e.gullet.endGroup(),e.gullet.endGroup();var M=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:M,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}_({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),n=C.wrapFragment(oe(e.label,r,t),t);return n.classes.push("cd-label-"+e.side),n.style.bottom=P(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(e,t){var r=new F.MathNode("mrow",[me(e.label,t)]);return r=new F.MathNode("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new F.MathNode("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});_({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=C.wrapFragment(oe(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new F.MathNode("mrow",[me(e.fragment,t)])}});_({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,n=re(t[0],"ordgroup"),i=n.body,a="",l=0;l=1114111)throw new L("\\@char with invalid code point "+a);return o<=65535?u=String.fromCharCode(o):(o-=65536,u=String.fromCharCode((o>>10)+55296,(o&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});var ys=(e,t)=>{var r=ze(e.body,t.withColor(e.color),!1);return C.makeFragment(r)},bs=(e,t)=>{var r=Ve(e.body,t.withColor(e.color)),n=new F.MathNode("mstyle",r);return n.setAttribute("mathcolor",e.color),n};_({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,n=re(t[0],"color-token").color,i=t[1];return{type:"color",mode:r.mode,color:n,body:we(i)}},htmlBuilder:ys,mathmlBuilder:bs});_({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:n}=e,i=re(t[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:ys,mathmlBuilder:bs});_({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:n}=e,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&re(i,"size").value}},htmlBuilder(e,t){var r=C.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=P(ye(e.size,t)))),r},mathmlBuilder(e,t){var r=new F.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",P(ye(e.size,t)))),r}});var p0={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},xs=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new L("Expected a control sequence",e);return t},k2=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},ws=(e,t,r,n)=>{var i=e.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,i,n)};_({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var n=t.fetch();if(p0[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=p0[n.text]),re(t.parseFunction(),"internal");throw new L("Invalid token after macro prefix",n)}});_({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=t.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new L("Expected a control sequence",n);for(var a=0,l,s=[[]];t.gullet.future().text!=="{";)if(n=t.gullet.popToken(),n.text==="#"){if(t.gullet.future().text==="{"){l=t.gullet.future(),s[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new L('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new L('Argument number "'+n.text+'" out of order');a++,s.push([])}else{if(n.text==="EOF")throw new L("Expected a macro definition");s[a].push(n.text)}var{tokens:o}=t.gullet.consumeArg();return l&&o.unshift(l),(r==="\\edef"||r==="\\xdef")&&(o=t.gullet.expandTokens(o),o.reverse()),t.gullet.macros.set(i,{tokens:o,numArgs:a,delimiters:s},r===p0[r]),{type:"internal",mode:t.mode}}});_({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=xs(t.gullet.popToken());t.gullet.consumeSpaces();var i=k2(t);return ws(t,n,i,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});_({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,n=xs(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return ws(t,n,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:"internal",mode:t.mode}}});var fr=function(t,r,n){var i=de.math[t]&&de.math[t].replace,a=O0(i||t,r,n);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},_0=function(t,r,n,i){var a=n.havingBaseStyle(r),l=C.makeSpan(i.concat(a.sizingClasses(n)),[t],n),s=a.sizeMultiplier/n.sizeMultiplier;return l.height*=s,l.depth*=s,l.maxFontSize=a.sizeMultiplier,l},ks=function(t,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=P(a),t.height-=a,t.depth+=a},S2=function(t,r,n,i,a,l){var s=C.makeSymbol(t,"Main-Regular",a,i),o=_0(s,r,i,l);return n&&ks(o,i,r),o},A2=function(t,r,n,i){return C.makeSymbol(t,"Size"+r+"-Regular",n,i)},Ss=function(t,r,n,i,a,l){var s=A2(t,r,a,i),o=_0(C.makeSpan(["delimsizing","size"+r],[s],i),Q.TEXT,i,l);return n&&ks(o,i,Q.TEXT),o},Vn=function(t,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=C.makeSpan(["delimsizinginner",i],[C.makeSpan([],[C.makeSymbol(t,r,n)])]);return{type:"elem",elem:a}},jn=function(t,r,n){var i=st["Size4-Regular"][t.charCodeAt(0)]?st["Size4-Regular"][t.charCodeAt(0)][4]:st["Size1-Regular"][t.charCodeAt(0)][4],a=new Et("inner",Ef(t,Math.round(1e3*r))),l=new bt([a],{width:P(i),height:P(r),style:"width:"+P(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),s=C.makeSvgSpan([],[l],n);return s.height=r,s.style.height=P(r),s.style.width=P(i),{type:"elem",elem:s}},d0=.008,Vr={type:"kern",size:-1*d0},T2=["|","\\lvert","\\rvert","\\vert"],z2=["\\|","\\lVert","\\rVert","\\Vert"],As=function(t,r,n,i,a,l){var s,o,u,h,m="",d=0;s=u=h=t,o=null;var p="Size1-Regular";t==="\\uparrow"?u=h="⏐":t==="\\Uparrow"?u=h="‖":t==="\\downarrow"?s=u="⏐":t==="\\Downarrow"?s=u="‖":t==="\\updownarrow"?(s="\\uparrow",u="⏐",h="\\downarrow"):t==="\\Updownarrow"?(s="\\Uparrow",u="‖",h="\\Downarrow"):T2.includes(t)?(u="∣",m="vert",d=333):z2.includes(t)?(u="∥",m="doublevert",d=556):t==="["||t==="\\lbrack"?(s="⎡",u="⎢",h="⎣",p="Size4-Regular",m="lbrack",d=667):t==="]"||t==="\\rbrack"?(s="⎤",u="⎥",h="⎦",p="Size4-Regular",m="rbrack",d=667):t==="\\lfloor"||t==="⌊"?(u=s="⎢",h="⎣",p="Size4-Regular",m="lfloor",d=667):t==="\\lceil"||t==="⌈"?(s="⎡",u=h="⎢",p="Size4-Regular",m="lceil",d=667):t==="\\rfloor"||t==="⌋"?(u=s="⎥",h="⎦",p="Size4-Regular",m="rfloor",d=667):t==="\\rceil"||t==="⌉"?(s="⎤",u=h="⎥",p="Size4-Regular",m="rceil",d=667):t==="("||t==="\\lparen"?(s="⎛",u="⎜",h="⎝",p="Size4-Regular",m="lparen",d=875):t===")"||t==="\\rparen"?(s="⎞",u="⎟",h="⎠",p="Size4-Regular",m="rparen",d=875):t==="\\{"||t==="\\lbrace"?(s="⎧",o="⎨",h="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(s="⎫",o="⎬",h="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(s="⎧",h="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(s="⎫",h="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(s="⎧",h="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(s="⎫",h="⎩",u="⎪",p="Size4-Regular");var y=fr(s,p,a),w=y.height+y.depth,M=fr(u,p,a),S=M.height+M.depth,z=fr(h,p,a),I=z.height+z.depth,V=0,O=1;if(o!==null){var E=fr(o,p,a);V=E.height+E.depth,O=2}var G=w+I+V,K=Math.max(0,Math.ceil((r-G)/(O*S))),U=G+K*O*S,D=i.fontMetrics().axisHeight;n&&(D*=i.sizeMultiplier);var $=U/2-D,j=[];if(m.length>0){var ie=U-w-I,Y=Math.round(U*1e3),q=Df(m,Math.round(ie*1e3)),ae=new Et(m,q),fe=(d/1e3).toFixed(3)+"em",Me=(Y/1e3).toFixed(3)+"em",je=new bt([ae],{width:fe,height:Me,viewBox:"0 0 "+d+" "+Y}),k=C.makeSvgSpan([],[je],i);k.height=Y/1e3,k.style.width=fe,k.style.height=Me,j.push({type:"elem",elem:k})}else{if(j.push(Vn(h,p,a)),j.push(Vr),o===null){var ke=U-w-I+2*d0;j.push(jn(u,ke,i))}else{var be=(U-w-I-V)/2+2*d0;j.push(jn(u,be,i)),j.push(Vr),j.push(Vn(o,p,a)),j.push(Vr),j.push(jn(u,be,i))}j.push(Vr),j.push(Vn(s,p,a))}var A=i.havingBaseStyle(Q.TEXT),De=C.makeVList({positionType:"bottom",positionData:$,children:j},A);return _0(C.makeSpan(["delimsizing","mult"],[De],A),Q.TEXT,i,l)},$n=80,Un=.08,_n=function(t,r,n,i,a){var l=Cf(t,i,n),s=new Et(t,l),o=new bt([s],{width:"400em",height:P(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return C.makeSvgSpan(["hide-tail"],[o],a)},M2=function(t,r){var n=r.havingBaseSizing(),i=Cs("\\surd",t*n.sizeMultiplier,Ms,n),a=n.sizeMultiplier,l=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),s,o=0,u=0,h=0,m;return i.type==="small"?(h=1e3+1e3*l+$n,t<1?a=1:t<1.4&&(a=.7),o=(1+l+Un)/a,u=(1+l)/a,s=_n("sqrtMain",o,h,l,r),s.style.minWidth="0.853em",m=.833/a):i.type==="large"?(h=(1e3+$n)*vr[i.size],u=(vr[i.size]+l)/a,o=(vr[i.size]+l+Un)/a,s=_n("sqrtSize"+i.size,o,h,l,r),s.style.minWidth="1.02em",m=1/a):(o=t+l+Un,u=t+l,h=Math.floor(1e3*t+l)+$n,s=_n("sqrtTall",o,h,l,r),s.style.minWidth="0.742em",m=1.056),s.height=u,s.style.height=P(o),{span:s,advanceWidth:m,ruleWidth:(r.fontMetrics().sqrtRuleThickness+l)*a}},Ts=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],C2=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],zs=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],vr=[0,1.2,1.8,2.4,3],E2=function(t,r,n,i,a){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),Ts.includes(t)||zs.includes(t))return Ss(t,r,!1,n,i,a);if(C2.includes(t))return As(t,vr[r],!1,n,i,a);throw new L("Illegal delimiter: '"+t+"'")},D2=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],I2=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"stack"}],Ms=[{type:"small",style:Q.SCRIPTSCRIPT},{type:"small",style:Q.SCRIPT},{type:"small",style:Q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],B2=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},Cs=function(t,r,n,i){for(var a=Math.min(2,3-i.style.size),l=a;lr)return n[l]}return n[n.length-1]},Es=function(t,r,n,i,a,l){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var s;zs.includes(t)?s=D2:Ts.includes(t)?s=Ms:s=I2;var o=Cs(t,r,s,i);return o.type==="small"?S2(t,o.style,n,i,a,l):o.type==="large"?Ss(t,o.size,n,i,a,l):As(t,r,n,i,a,l)},N2=function(t,r,n,i,a,l){var s=i.fontMetrics().axisHeight*i.sizeMultiplier,o=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-s,n+s),m=Math.max(h/500*o,2*h-u);return Es(t,m,!0,i,a,l)},yt={sqrtImage:M2,sizedDelim:E2,sizeToMaxHeight:vr,customSizedDelim:Es,leftRightDelim:N2},va={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},F2=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function hn(e,t){var r=un(e);if(r&&F2.includes(r.text))return r;throw r?new L("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new L("Invalid delimiter type '"+e.type+"'",e)}_({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var r=hn(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:va[e.funcName].size,mclass:va[e.funcName].mclass,delim:r.text}},htmlBuilder:(e,t)=>e.delim==="."?C.makeSpan([e.mclass]):yt.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Je(e.delim,e.mode));var r=new F.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=P(yt.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});function ya(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}_({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new L("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:hn(t[0],e).text,color:r}}});_({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=hn(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=re(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{ya(e);for(var r=ze(e.body,t,!0,["mopen","mclose"]),n=0,i=0,a=!1,l=0;l{ya(e);var r=Ve(e.body,t);if(e.left!=="."){var n=new F.MathNode("mo",[Je(e.left,e.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(e.right!=="."){var i=new F.MathNode("mo",[Je(e.right,e.mode)]);i.setAttribute("fence","true"),e.rightColor&&i.setAttribute("mathcolor",e.rightColor),r.push(i)}return V0(r)}});_({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var r=hn(t[0],e);if(!e.parser.leftrightDepth)throw new L("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},htmlBuilder:(e,t)=>{var r;if(e.delim===".")r=kr(t,[]);else{r=yt.sizedDelim(e.delim,1,t,e.mode,[]);var n={delim:e.delim,options:t};r.isMiddle=n}return r},mathmlBuilder:(e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?Je("|","text"):Je(e.delim,e.mode),n=new F.MathNode("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var G0=(e,t)=>{var r=C.wrapFragment(oe(e.body,t),t),n=e.label.slice(1),i=t.sizeMultiplier,a,l=0,s=ue.isCharacterBox(e.body);if(n==="sout")a=C.makeSpan(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/i,l=-.5*t.fontMetrics().xHeight;else if(n==="phase"){var o=ye({number:.6,unit:"pt"},t),u=ye({number:.35,unit:"ex"},t),h=t.havingBaseSizing();i=i/h.sizeMultiplier;var m=r.height+r.depth+o+u;r.style.paddingLeft=P(m/2+o);var d=Math.floor(1e3*m*i),p=zf(d),y=new bt([new Et("phase",p)],{width:"400em",height:P(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=C.makeSvgSpan(["hide-tail"],[y],t),a.style.height=P(m),l=r.depth+o+u}else{/cancel/.test(n)?s||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var w=0,M=0,S=0;/box/.test(n)?(S=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),w=t.fontMetrics().fboxsep+(n==="colorbox"?0:S),M=w):n==="angl"?(S=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),w=4*S,M=Math.max(0,.25-r.depth)):(w=s?.2:0,M=w),a=wt.encloseSpan(r,n,w,M,t),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=P(S)):n==="angl"&&S!==.049&&(a.style.borderTopWidth=P(S),a.style.borderRightWidth=P(S)),l=r.depth+M,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var z;if(e.backgroundColor)z=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:l},{type:"elem",elem:r,shift:0}]},t);else{var I=/cancel|phase/.test(n)?["svg-align"]:[];z=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:l,wrapperClasses:I}]},t)}return/cancel/.test(n)&&(z.height=r.height,z.depth=r.depth),/cancel/.test(n)&&!s?C.makeSpan(["mord","cancel-lap"],[z],t):C.makeSpan(["mord"],[z],t)},W0=(e,t)=>{var r=0,n=new F.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[me(e.body,t)]);switch(e.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(e.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&n.setAttribute("mathbackground",e.backgroundColor),n};_({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=re(t[0],"color-token").color,l=t[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:l}},htmlBuilder:G0,mathmlBuilder:W0});_({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,r){var{parser:n,funcName:i}=e,a=re(t[0],"color-token").color,l=re(t[1],"color-token").color,s=t[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:l,borderColor:a,body:s}},htmlBuilder:G0,mathmlBuilder:W0});_({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});_({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:G0,mathmlBuilder:W0});_({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});var Ds={};function ct(e){for(var{type:t,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:l}=e,s={type:t,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},o=0;o{var t=e.parser.settings;if(!t.displayMode)throw new L("{"+e.envName+"} can be used only in display mode.")};function Y0(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Bt(e,t,r){var{hskipBeforeAndAfter:n,addJot:i,cols:a,arraystretch:l,colSeparationType:s,autoTag:o,singleRow:u,emptySingleRow:h,maxNumCols:m,leqno:d}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!l){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)l=1;else if(l=parseFloat(p),!l||l<0)throw new L("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var y=[],w=[y],M=[],S=[],z=o!=null?[]:void 0;function I(){o&&e.gullet.macros.set("\\@eqnsw","1",!0)}function V(){z&&(e.gullet.macros.get("\\df@tag")?(z.push(e.subparse([new We("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):z.push(!!o&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(I(),S.push(ba(e));;){var O=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),O={type:"ordgroup",mode:e.mode,body:O},r&&(O={type:"styling",mode:e.mode,style:r,body:[O]}),y.push(O);var E=e.fetch().text;if(E==="&"){if(m&&y.length===m){if(u||s)throw new L("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(E==="\\end"){V(),y.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(w.length>1||!h)&&w.pop(),S.length0&&(I+=.25),u.push({pos:I,isDashed:Ut[Nt]})}for(V(l[0]),n=0;n0&&($+=z,G<$&&(G=$),$=0)),t.addJot&&(G+=w),K.height=E,K.depth=G,I+=E,K.pos=I,I+=G+$,o[n]=K,V(l[n+1])}var j=I/2+r.fontMetrics().axisHeight,ie=t.cols||[],Y=[],q,ae,fe=[];if(t.tags&&t.tags.some(Ut=>Ut))for(n=0;n=s)){var Xe=void 0;(i>0||t.hskipBeforeAndAfter)&&(Xe=ue.deflt(be.pregap,d),Xe!==0&&(q=C.makeSpan(["arraycolsep"],[]),q.style.width=P(Xe),Y.push(q)));var Ie=[];for(n=0;n0){for(var pn=C.makeLineSpan("hline",r,h),dn=C.makeLineSpan("hdashline",r,h),ir=[{type:"elem",elem:o,shift:0}];u.length>0;){var ar=u.pop(),lr=ar.pos-j;ar.isDashed?ir.push({type:"elem",elem:dn,shift:lr}):ir.push({type:"elem",elem:pn,shift:lr})}o=C.makeVList({positionType:"individualShift",children:ir},r)}if(fe.length===0)return C.makeSpan(["mord"],[o],r);var $t=C.makeVList({positionType:"individualShift",children:fe},r);return $t=C.makeSpan(["tag"],[$t],r),C.makeFragment([o,$t])},L2={c:"center ",l:"left ",r:"right "},mt=function(t,r){for(var n=[],i=new F.MathNode("mtd",[],["mtr-glue"]),a=new F.MathNode("mtd",[],["mml-eqn-num"]),l=0;l0){var y=t.cols,w="",M=!1,S=0,z=y.length;y[0].type==="separator"&&(d+="top ",S=1),y[y.length-1].type==="separator"&&(d+="bottom ",z-=1);for(var I=S;I0?"left ":"",d+=K[K.length-1].length>0?"right ":"";for(var U=1;U-1?"alignat":"align",a=t.envName==="split",l=Bt(t.parser,{cols:n,addJot:!0,autoTag:a?void 0:Y0(t.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:a?2:void 0,leqno:t.parser.settings.leqno},"display"),s,o=0,u={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var h="",m=0;m0&&p&&(M=1),n[y]={type:"align",align:w,pregap:M,postgap:0}}return l.colSeparationType=p?"align":"alignat",l};ct({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=un(t[0]),n=r?[t[0]]:re(t[0],"ordgroup").body,i=n.map(function(l){var s=$0(l),o=s.text;if("lcr".indexOf(o)!==-1)return{type:"align",align:o};if(o==="|")return{type:"separator",separator:"|"};if(o===":")return{type:"separator",separator:":"};throw new L("Unknown column alignment: "+o,l)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Bt(e.parser,a,X0(e.envName))},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var i=e.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,"lcr".indexOf(r)===-1)throw new L("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=Bt(e.parser,n,X0(e.envName)),l=Math.max(0,...a.body.map(s=>s.length));return a.cols=new Array(l).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Bt(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=un(t[0]),n=r?[t[0]]:re(t[0],"ordgroup").body,i=n.map(function(l){var s=$0(l),o=s.text;if("lc".indexOf(o)!==-1)return{type:"align",align:o};throw new L("Unknown column alignment: "+o,l)});if(i.length>1)throw new L("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(a=Bt(e.parser,a,"script"),a.body.length>0&&a.body[0].length>1)throw new L("{subarray} can contain only one column");return a},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Bt(e.parser,t,X0(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Bs,htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&mn(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Y0(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Bs,htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){mn(e);var t={autoTag:Y0(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Bt(e.parser,t,"display")},htmlBuilder:ht,mathmlBuilder:mt});ct({type:"array",names:["CD"],props:{numArgs:0},handler(e){return mn(e),w2(e.parser)},htmlBuilder:ht,mathmlBuilder:mt});v("\\nonumber","\\gdef\\@eqnsw{0}");v("\\notag","\\nonumber");_({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new L(e.funcName+" valid only within array environment")}});var xa=Ds;_({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];if(i.type!=="ordgroup")throw new L("Invalid environment name",i);for(var a="",l=0;l{var r=e.font,n=t.withFont(r);return oe(e.body,n)},Fs=(e,t)=>{var r=e.font,n=t.withFont(r);return me(e.body,n)},wa={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};_({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=en(t[0]),a=n;return a in wa&&(a=wa[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:Ns,mathmlBuilder:Fs});_({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:r}=e,n=t[0],i=ue.isCharacterBox(n);return{type:"mclass",mode:r.mode,mclass:cn(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}});_({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n,breakOnTokenText:i}=e,{mode:a}=r,l=r.parseExpression(!0,i),s="math"+n.slice(1);return{type:"font",mode:a,font:s,body:{type:"ordgroup",mode:r.mode,body:l}}},htmlBuilder:Ns,mathmlBuilder:Fs});var Ls=(e,t)=>{var r=t;return e==="display"?r=r.id>=Q.SCRIPT.id?r.text():Q.DISPLAY:e==="text"&&r.size===Q.DISPLAY.size?r=Q.TEXT:e==="script"?r=Q.SCRIPT:e==="scriptscript"&&(r=Q.SCRIPTSCRIPT),r},K0=(e,t)=>{var r=Ls(e.size,t.style),n=r.fracNum(),i=r.fracDen(),a;a=t.havingStyle(n);var l=oe(e.numer,a,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,o=3.5/t.fontMetrics().ptPerEm;l.height=l.height0?y=3*d:y=7*d,w=t.fontMetrics().denom1):(m>0?(p=t.fontMetrics().num2,y=d):(p=t.fontMetrics().num3,y=3*d),w=t.fontMetrics().denom2);var M;if(h){var z=t.fontMetrics().axisHeight;p-l.depth-(z+.5*m){var r=new F.MathNode("mfrac",[me(e.numer,t),me(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var n=ye(e.barSize,t);r.setAttribute("linethickness",P(n))}var i=Ls(e.size,t.style);if(i.size!==t.style.size){r=new F.MathNode("mstyle",[r]);var a=i.size===Q.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",a),r.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var l=[];if(e.leftDelim!=null){var s=new F.MathNode("mo",[new F.TextNode(e.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),l.push(s)}if(l.push(r),e.rightDelim!=null){var o=new F.MathNode("mo",[new F.TextNode(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),l.push(o)}return V0(l)}return r};_({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1],l,s=null,o=null,u="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":l=!0;break;case"\\\\atopfrac":l=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l=!1,s="(",o=")";break;case"\\\\bracefrac":l=!1,s="\\{",o="\\}";break;case"\\\\brackfrac":l=!1,s="[",o="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":u="display";break;case"\\tfrac":case"\\tbinom":u="text";break}return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:l,leftDelim:s,rightDelim:o,size:u,barSize:null}},htmlBuilder:K0,mathmlBuilder:Z0});_({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=t[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:i,denom:a,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});_({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:n}=e,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:i,token:n}}});var ka=["display","text","script","scriptscript"],Sa=function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r};_({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,n=t[4],i=t[5],a=en(t[0]),l=a.type==="atom"&&a.family==="open"?Sa(a.text):null,s=en(t[1]),o=s.type==="atom"&&s.family==="close"?Sa(s.text):null,u=re(t[2],"size"),h,m=null;u.isBlank?h=!0:(m=u.value,h=m.number>0);var d="auto",p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var y=re(p.body[0],"textord");d=ka[Number(y.text)]}}else p=re(p,"textord"),d=ka[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:m,leftDelim:l,rightDelim:o,size:d}},htmlBuilder:K0,mathmlBuilder:Z0});_({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:n,token:i}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:re(t[0],"size").value,token:i}}});_({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0],a=hf(re(t[1],"infix").size),l=t[2],s=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:l,continued:!1,hasBarLine:s,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:K0,mathmlBuilder:Z0});var Rs=(e,t)=>{var r=t.style,n,i;e.type==="supsub"?(n=e.sup?oe(e.sup,t.havingStyle(r.sup()),t):oe(e.sub,t.havingStyle(r.sub()),t),i=re(e.base,"horizBrace")):i=re(e,"horizBrace");var a=oe(i.base,t.havingBaseStyle(Q.DISPLAY)),l=wt.svgSpan(i,t),s;if(i.isOver?(s=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:l}]},t),s.children[0].children[0].children[1].classes.push("svg-align")):(s=C.makeVList({positionType:"bottom",positionData:a.depth+.1+l.height,children:[{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:a}]},t),s.children[0].children[0].children[0].classes.push("svg-align")),n){var o=C.makeSpan(["mord",i.isOver?"mover":"munder"],[s],t);i.isOver?s=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:.2},{type:"elem",elem:n}]},t):s=C.makeVList({positionType:"bottom",positionData:o.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:o}]},t)}return C.makeSpan(["mord",i.isOver?"mover":"munder"],[s],t)},R2=(e,t)=>{var r=wt.mathMLnode(e.label);return new F.MathNode(e.isOver?"mover":"munder",[me(e.base,t),r])};_({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:n}=e;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:t[0]}},htmlBuilder:Rs,mathmlBuilder:R2});_({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[1],i=re(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:we(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var r=ze(e.body,t,!1);return C.makeAnchor(e.href,[],r,t)},mathmlBuilder:(e,t)=>{var r=Dt(e.body,t);return r instanceof _e||(r=new _e("mrow",[r])),r.setAttribute("href",e.href),r}});_({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=re(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a{var{parser:r,funcName:n,token:i}=e,a=re(t[0],"raw").string,l=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var s,o={};switch(n){case"\\htmlClass":o.class=a,s={command:"\\htmlClass",class:a};break;case"\\htmlId":o.id=a,s={command:"\\htmlId",id:a};break;case"\\htmlStyle":o.style=a,s={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h{var r=ze(e.body,t,!1),n=["enclosing"];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/));var i=C.makeSpan(n,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&i.setAttribute(a,e.attributes[a]);return i},mathmlBuilder:(e,t)=>Dt(e.body,t)});_({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:we(t[0]),mathml:we(t[1])}},htmlBuilder:(e,t)=>{var r=ze(e.html,t,!1);return C.makeFragment(r)},mathmlBuilder:(e,t)=>Dt(e.mathml,t)});var Gn=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new L("Invalid size: '"+t+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!ts(n))throw new L("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};_({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,r)=>{var{parser:n}=e,i={number:0,unit:"em"},a={number:.9,unit:"em"},l={number:0,unit:"em"},s="";if(r[0])for(var o=re(r[0],"raw").string,u=o.split(","),h=0;h{var r=ye(e.height,t),n=0;e.totalheight.number>0&&(n=ye(e.totalheight,t)-r);var i=0;e.width.number>0&&(i=ye(e.width,t));var a={height:P(r+n)};i>0&&(a.width=P(i)),n>0&&(a.verticalAlign=P(-n));var l=new Rf(e.src,e.alt,a);return l.height=r,l.depth=n,l},mathmlBuilder:(e,t)=>{var r=new F.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var n=ye(e.height,t),i=0;if(e.totalheight.number>0&&(i=ye(e.totalheight,t)-n,r.setAttribute("valign",P(-i))),r.setAttribute("height",P(n+i)),e.width.number>0){var a=ye(e.width,t);r.setAttribute("width",P(a))}return r.setAttribute("src",e.src),r}});_({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=re(t[0],"size");if(r.settings.strict){var a=n[1]==="m",l=i.value.unit==="mu";a?(l||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):l&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(e,t){return C.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var r=ye(e.dimension,t);return new F.SpaceNode(r)}});_({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(e,t)=>{var r;e.alignment==="clap"?(r=C.makeSpan([],[oe(e.body,t)]),r=C.makeSpan(["inner"],[r],t)):r=C.makeSpan(["inner"],[oe(e.body,t)]);var n=C.makeSpan(["fix"],[]),i=C.makeSpan([e.alignment],[r,n],t),a=C.makeSpan(["strut"]);return a.style.height=P(i.height+i.depth),i.depth&&(a.style.verticalAlign=P(-i.depth)),i.children.unshift(a),i=C.makeSpan(["thinbox"],[i],t),C.makeSpan(["mord","vbox"],[i],t)},mathmlBuilder:(e,t)=>{var r=new F.MathNode("mpadded",[me(e.body,t)]);if(e.alignment!=="rlap"){var n=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});_({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:n}=e,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",l=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:l}}});_({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new L("Mismatched "+e.funcName)}});var Aa=(e,t)=>{switch(t.style.size){case Q.DISPLAY.size:return e.display;case Q.TEXT.size:return e.text;case Q.SCRIPT.size:return e.script;case Q.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};_({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:we(t[0]),text:we(t[1]),script:we(t[2]),scriptscript:we(t[3])}},htmlBuilder:(e,t)=>{var r=Aa(e,t),n=ze(r,t,!1);return C.makeFragment(n)},mathmlBuilder:(e,t)=>{var r=Aa(e,t);return Dt(r,t)}});var Ps=(e,t,r,n,i,a,l)=>{e=C.makeSpan([],[e]);var s=r&&ue.isCharacterBox(r),o,u;if(t){var h=oe(t,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var m=oe(r,n.havingStyle(i.sub()),n);o={elem:m,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-m.height)}}var d;if(u&&o){var p=n.fontMetrics().bigOpSpacing5+o.elem.height+o.elem.depth+o.kern+e.depth+l;d=C.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:o.elem,marginLeft:P(-a)},{type:"kern",size:o.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:P(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(o){var y=e.height-l;d=C.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:o.elem,marginLeft:P(-a)},{type:"kern",size:o.kern},{type:"elem",elem:e}]},n)}else if(u){var w=e.depth+l;d=C.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:P(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return e;var M=[d];if(o&&a!==0&&!s){var S=C.makeSpan(["mspace"],[],n);S.style.marginRight=P(a),M.unshift(S)}return C.makeSpan(["mop","op-limits"],M,n)},Os=["\\smallint"],nr=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=re(e.base,"op"),i=!0):a=re(e,"op");var l=t.style,s=!1;l.size===Q.DISPLAY.size&&a.symbol&&!Os.includes(a.name)&&(s=!0);var o;if(a.symbol){var u=s?"Size2-Regular":"Size1-Regular",h="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(h=a.name.slice(1),a.name=h==="oiint"?"\\iint":"\\iiint"),o=C.makeSymbol(a.name,u,"math",t,["mop","op-symbol",s?"large-op":"small-op"]),h.length>0){var m=o.italic,d=C.staticSvg(h+"Size"+(s?"2":"1"),t);o=C.makeVList({positionType:"individualShift",children:[{type:"elem",elem:o,shift:0},{type:"elem",elem:d,shift:s?.08:0}]},t),a.name="\\"+h,o.classes.unshift("mop"),o.italic=m}}else if(a.body){var p=ze(a.body,t,!0);p.length===1&&p[0]instanceof Qe?(o=p[0],o.classes[0]="mop"):o=C.makeSpan(["mop"],p,t)}else{for(var y=[],w=1;w{var r;if(e.symbol)r=new _e("mo",[Je(e.name,e.mode)]),Os.includes(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new _e("mo",Ve(e.body,t));else{r=new _e("mi",[new ot(e.name.slice(1))]);var n=new _e("mo",[Je("⁡","text")]);e.parentIsSupSub?r=new _e("mrow",[r,n]):r=ms([r,n])}return r},P2={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};_({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=n;return i.length===1&&(i=P2[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:we(n)}},htmlBuilder:nr,mathmlBuilder:Er});var O2={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};_({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:nr,mathmlBuilder:Er});_({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e,n=r;return n.length===1&&(n=O2[n]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:nr,mathmlBuilder:Er});var qs=(e,t)=>{var r,n,i=!1,a;e.type==="supsub"?(r=e.sup,n=e.sub,a=re(e.base,"operatorname"),i=!0):a=re(e,"operatorname");var l;if(a.body.length>0){for(var s=a.body.map(m=>{var d=m.text;return typeof d=="string"?{type:"textord",mode:m.mode,text:d}:m}),o=ze(s,t.withFont("mathrm"),!0),u=0;u{for(var r=Ve(e.body,t.withFont("mathrm")),n=!0,i=0;ih.toText()).join("");r=[new F.TextNode(s)]}var o=new F.MathNode("mi",r);o.setAttribute("mathvariant","normal");var u=new F.MathNode("mo",[Je("⁡","text")]);return e.parentIsSupSub?new F.MathNode("mrow",[o,u]):F.newDocumentFragment([o,u])};_({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:r,funcName:n}=e,i=t[0];return{type:"operatorname",mode:r.mode,body:we(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:qs,mathmlBuilder:q2});v("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Vt({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?C.makeFragment(ze(e.body,t,!1)):C.makeSpan(["mord"],ze(e.body,t,!0),t)},mathmlBuilder(e,t){return Dt(e.body,t,!0)}});_({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,n=t[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(e,t){var r=oe(e.body,t.havingCrampedStyle()),n=C.makeLineSpan("overline-line",t),i=t.fontMetrics().defaultRuleThickness,a=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},t);return C.makeSpan(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new F.MathNode("mo",[new F.TextNode("‾")]);r.setAttribute("stretchy","true");var n=new F.MathNode("mover",[me(e.body,t),r]);return n.setAttribute("accent","true"),n}});_({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"phantom",mode:r.mode,body:we(n)}},htmlBuilder:(e,t)=>{var r=ze(e.body,t.withPhantom(),!1);return C.makeFragment(r)},mathmlBuilder:(e,t)=>{var r=Ve(e.body,t);return new F.MathNode("mphantom",r)}});_({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"hphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=C.makeSpan([],[oe(e.body,t.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var n=0;n{var r=Ve(we(e.body),t),n=new F.MathNode("mphantom",r),i=new F.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});_({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:r}=e,n=t[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(e,t)=>{var r=C.makeSpan(["inner"],[oe(e.body,t.withPhantom())]),n=C.makeSpan(["fix"],[]);return C.makeSpan(["mord","rlap"],[r,n],t)},mathmlBuilder:(e,t)=>{var r=Ve(we(e.body),t),n=new F.MathNode("mphantom",r),i=new F.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}});_({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,n=re(t[0],"size").value,i=t[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(e,t){var r=oe(e.body,t),n=ye(e.dy,t);return C.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){var r=new F.MathNode("mpadded",[me(e.body,t)]),n=e.dy.number+e.dy.unit;return r.setAttribute("voffset",n),r}});_({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});_({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:n}=e,i=r[0],a=re(t[0],"size"),l=re(t[1],"size");return{type:"rule",mode:n.mode,shift:i&&re(i,"size").value,width:a.value,height:l.value}},htmlBuilder(e,t){var r=C.makeSpan(["mord","rule"],[],t),n=ye(e.width,t),i=ye(e.height,t),a=e.shift?ye(e.shift,t):0;return r.style.borderRightWidth=P(n),r.style.borderTopWidth=P(i),r.style.bottom=P(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=ye(e.width,t),n=ye(e.height,t),i=e.shift?ye(e.shift,t):0,a=t.color&&t.getColor()||"black",l=new F.MathNode("mspace");l.setAttribute("mathbackground",a),l.setAttribute("width",P(r)),l.setAttribute("height",P(n));var s=new F.MathNode("mpadded",[l]);return i>=0?s.setAttribute("height",P(i)):(s.setAttribute("height",P(i)),s.setAttribute("depth",P(-i))),s.setAttribute("voffset",P(i)),s}});function Hs(e,t,r){for(var n=ze(e,t,!1),i=t.sizeMultiplier/r.sizeMultiplier,a=0;a{var r=t.havingSize(e.size);return Hs(e.body,r,t)};_({type:"sizing",names:Ta,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:Ta.indexOf(n)+1,body:a}},htmlBuilder:H2,mathmlBuilder:(e,t)=>{var r=t.havingSize(e.size),n=Ve(e.body,r),i=new F.MathNode("mstyle",n);return i.setAttribute("mathsize",P(r.sizeMultiplier)),i}});_({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,r)=>{var{parser:n}=e,i=!1,a=!1,l=r[0]&&re(r[0],"ordgroup");if(l)for(var s="",o=0;o{var r=C.makeSpan([],[oe(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0,r.children))for(var n=0;n{var r=new F.MathNode("mpadded",[me(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});_({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:n}=e,i=r[0],a=t[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(e,t){var r=oe(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=C.wrapFragment(r,t);var n=t.fontMetrics(),i=n.defaultRuleThickness,a=i;t.style.idr.height+r.depth+l&&(l=(l+m-r.height-r.depth)/2);var d=o.height-r.height-l-u;r.style.paddingLeft=P(h);var p=C.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:o},{type:"kern",size:u}]},t);if(e.index){var y=t.havingStyle(Q.SCRIPTSCRIPT),w=oe(e.index,y,t),M=.6*(p.height-p.depth),S=C.makeVList({positionType:"shift",positionData:-M,children:[{type:"elem",elem:w}]},t),z=C.makeSpan(["root"],[S]);return C.makeSpan(["mord","sqrt"],[z,p],t)}else return C.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:r,index:n}=e;return n?new F.MathNode("mroot",[me(r,t),me(n,t)]):new F.MathNode("msqrt",[me(r,t)])}});var za={display:Q.DISPLAY,text:Q.TEXT,script:Q.SCRIPT,scriptscript:Q.SCRIPTSCRIPT};_({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:n,parser:i}=e,a=i.parseExpression(!0,r),l=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:l,body:a}},htmlBuilder(e,t){var r=za[e.style],n=t.havingStyle(r).withFont("");return Hs(e.body,n,t)},mathmlBuilder(e,t){var r=za[e.style],n=t.havingStyle(r),i=Ve(e.body,n),a=new F.MathNode("mstyle",i),l={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},s=l[e.style];return a.setAttribute("scriptlevel",s[0]),a.setAttribute("displaystyle",s[1]),a}});var V2=function(t,r){var n=t.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===Q.DISPLAY.size||n.alwaysHandleSupSub);return i?nr:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===Q.DISPLAY.size||n.limits);return a?qs:null}else{if(n.type==="accent")return ue.isCharacterBox(n.base)?U0:null;if(n.type==="horizBrace"){var l=!t.sub;return l===n.isOver?Rs:null}else return null}else return null};Vt({type:"supsub",htmlBuilder(e,t){var r=V2(e,t);if(r)return r(e,t);var{base:n,sup:i,sub:a}=e,l=oe(n,t),s,o,u=t.fontMetrics(),h=0,m=0,d=n&&ue.isCharacterBox(n);if(i){var p=t.havingStyle(t.style.sup());s=oe(i,p,t),d||(h=l.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var y=t.havingStyle(t.style.sub());o=oe(a,y,t),d||(m=l.depth+y.fontMetrics().subDrop*y.sizeMultiplier/t.sizeMultiplier)}var w;t.style===Q.DISPLAY?w=u.sup1:t.style.cramped?w=u.sup3:w=u.sup2;var M=t.sizeMultiplier,S=P(.5/u.ptPerEm/M),z=null;if(o){var I=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(l instanceof Qe||I)&&(z=P(-l.italic))}var V;if(s&&o){h=Math.max(h,w,s.depth+.25*u.xHeight),m=Math.max(m,u.sub2);var O=u.defaultRuleThickness,E=4*O;if(h-s.depth-(o.height-m)0&&(h+=G,m-=G)}var K=[{type:"elem",elem:o,shift:m,marginRight:S,marginLeft:z},{type:"elem",elem:s,shift:-h,marginRight:S}];V=C.makeVList({positionType:"individualShift",children:K},t)}else if(o){m=Math.max(m,u.sub1,o.height-.8*u.xHeight);var U=[{type:"elem",elem:o,marginLeft:z,marginRight:S}];V=C.makeVList({positionType:"shift",positionData:m,children:U},t)}else if(s)h=Math.max(h,w,s.depth+.25*u.xHeight),V=C.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:s,marginRight:S}]},t);else throw new Error("supsub must have either sup or sub.");var D=m0(l,"right")||"mord";return C.makeSpan([D],[l,C.makeSpan(["msupsub"],[V])],t)},mathmlBuilder(e,t){var r=!1,n,i;e.base&&e.base.type==="horizBrace"&&(i=!!e.sup,i===e.base.isOver&&(r=!0,n=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[me(e.base,t)];e.sub&&a.push(me(e.sub,t)),e.sup&&a.push(me(e.sup,t));var l;if(r)l=n?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===Q.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===Q.DISPLAY||u.limits)?l="munderover":l="msubsup"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(t.style===Q.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||t.style===Q.DISPLAY)?l="munder":l="msub"}else{var s=e.base;s&&s.type==="op"&&s.limits&&(t.style===Q.DISPLAY||s.alwaysHandleSupSub)||s&&s.type==="operatorname"&&s.alwaysHandleSupSub&&(s.limits||t.style===Q.DISPLAY)?l="mover":l="msup"}return new F.MathNode(l,a)}});Vt({type:"atom",htmlBuilder(e,t){return C.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new F.MathNode("mo",[Je(e.text,e.mode)]);if(e.family==="bin"){var n=j0(e,t);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});var Vs={mi:"italic",mn:"normal",mtext:"normal"};Vt({type:"mathord",htmlBuilder(e,t){return C.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var r=new F.MathNode("mi",[Je(e.text,e.mode,t)]),n=j0(e,t)||"italic";return n!==Vs[r.type]&&r.setAttribute("mathvariant",n),r}});Vt({type:"textord",htmlBuilder(e,t){return C.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var r=Je(e.text,e.mode,t),n=j0(e,t)||"normal",i;return e.mode==="text"?i=new F.MathNode("mtext",[r]):/[0-9]/.test(e.text)?i=new F.MathNode("mn",[r]):e.text==="\\prime"?i=new F.MathNode("mo",[r]):i=new F.MathNode("mi",[r]),n!==Vs[i.type]&&i.setAttribute("mathvariant",n),i}});var Wn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Yn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Vt({type:"spacing",htmlBuilder(e,t){if(Yn.hasOwnProperty(e.text)){var r=Yn[e.text].className||"";if(e.mode==="text"){var n=C.makeOrd(e,t,"textord");return n.classes.push(r),n}else return C.makeSpan(["mspace",r],[C.mathsym(e.text,e.mode,t)],t)}else{if(Wn.hasOwnProperty(e.text))return C.makeSpan(["mspace",Wn[e.text]],[],t);throw new L('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(Yn.hasOwnProperty(e.text))r=new F.MathNode("mtext",[new F.TextNode(" ")]);else{if(Wn.hasOwnProperty(e.text))return new F.MathNode("mspace");throw new L('Unknown type of space "'+e.text+'"')}return r}});var Ma=()=>{var e=new F.MathNode("mtd",[]);return e.setAttribute("width","50%"),e};Vt({type:"tag",mathmlBuilder(e,t){var r=new F.MathNode("mtable",[new F.MathNode("mtr",[Ma(),new F.MathNode("mtd",[Dt(e.body,t)]),Ma(),new F.MathNode("mtd",[Dt(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});var Ca={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Ea={"\\textbf":"textbf","\\textmd":"textmd"},j2={"\\textit":"textit","\\textup":"textup"},Da=(e,t)=>{var r=e.font;if(r){if(Ca[r])return t.withTextFontFamily(Ca[r]);if(Ea[r])return t.withTextFontWeight(Ea[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(j2[r])};_({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:n}=e,i=t[0];return{type:"text",mode:r.mode,body:we(i),font:n}},htmlBuilder(e,t){var r=Da(e,t),n=ze(e.body,r,!0);return C.makeSpan(["mord","text"],n,r)},mathmlBuilder(e,t){var r=Da(e,t);return Dt(e.body,r)}});_({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=oe(e.body,t),n=C.makeLineSpan("underline-line",t),i=t.fontMetrics().defaultRuleThickness,a=C.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]},t);return C.makeSpan(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new F.MathNode("mo",[new F.TextNode("‾")]);r.setAttribute("stretchy","true");var n=new F.MathNode("munder",[me(e.body,t),r]);return n.setAttribute("accentunder","true"),n}});_({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=oe(e.body,t),n=t.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return C.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){return new F.MathNode("mpadded",[me(e.body,t)],["vcenter"])}});_({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new L("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=Ia(e),n=[],i=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?"␣":" "),Mt=cs,js=`[ \r - ]`,$2="\\\\[a-zA-Z@]+",U2="\\\\[^\uD800-\uDFFF]",_2="("+$2+")"+js+"*",G2=`\\\\( -|[ \r ]+ -?)[ \r ]*`,g0="[̀-ͯ]",W2=new RegExp(g0+"+$"),Y2="("+js+"+)|"+(G2+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(g0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(g0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+_2)+("|"+U2+")");class Ba{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(Y2,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new We("EOF",new qe(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new L("Unexpected character: '"+t[r]+"'",new We(t[r],new qe(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(` -`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new We(i,new qe(this,r,this.tokenRegex.lastIndex))}}class X2{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new L("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}}var K2=Is;v("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});v("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});v("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});v("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});v("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});v("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");v("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var Na={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};v("\\char",function(e){var t=e.popToken(),r,n="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new L("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=Na[t.text],n==null||n>=r)throw new L("Invalid base-"+r+" digit "+t.text);for(var i;(i=Na[e.future().text])!=null&&i{var i=e.consumeArg().tokens;if(i.length!==1)throw new L("\\newcommand's first argument must be a macro name");var a=i[0].text,l=e.isDefined(a);if(l&&!t)throw new L("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!l&&!r)throw new L("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var o="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)o+=u.text,u=e.expandNextToken();if(!o.match(/^\s*[0-9]+\s*$/))throw new L("Invalid number of arguments: "+o);s=parseInt(o),i=e.consumeArg().tokens}return l&&n||e.macros.set(a,{tokens:i,numArgs:s}),""};v("\\newcommand",e=>Q0(e,!1,!0,!1));v("\\renewcommand",e=>Q0(e,!0,!1,!1));v("\\providecommand",e=>Q0(e,!0,!0,!0));v("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});v("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});v("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),Mt[r],de.math[r],de.text[r]),""});v("\\bgroup","{");v("\\egroup","}");v("~","\\nobreakspace");v("\\lq","`");v("\\rq","'");v("\\aa","\\r a");v("\\AA","\\r A");v("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");v("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");v("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");v("ℬ","\\mathscr{B}");v("ℰ","\\mathscr{E}");v("ℱ","\\mathscr{F}");v("ℋ","\\mathscr{H}");v("ℐ","\\mathscr{I}");v("ℒ","\\mathscr{L}");v("ℳ","\\mathscr{M}");v("ℛ","\\mathscr{R}");v("ℭ","\\mathfrak{C}");v("ℌ","\\mathfrak{H}");v("ℨ","\\mathfrak{Z}");v("\\Bbbk","\\Bbb{k}");v("·","\\cdotp");v("\\llap","\\mathllap{\\textrm{#1}}");v("\\rlap","\\mathrlap{\\textrm{#1}}");v("\\clap","\\mathclap{\\textrm{#1}}");v("\\mathstrut","\\vphantom{(}");v("\\underbar","\\underline{\\text{#1}}");v("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');v("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");v("\\ne","\\neq");v("≠","\\neq");v("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");v("∉","\\notin");v("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");v("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");v("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");v("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");v("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");v("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");v("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");v("⟂","\\perp");v("‼","\\mathclose{!\\mkern-0.8mu!}");v("∌","\\notni");v("⌜","\\ulcorner");v("⌝","\\urcorner");v("⌞","\\llcorner");v("⌟","\\lrcorner");v("©","\\copyright");v("®","\\textregistered");v("️","\\textregistered");v("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');v("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');v("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');v("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');v("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");v("⋮","\\vdots");v("\\varGamma","\\mathit{\\Gamma}");v("\\varDelta","\\mathit{\\Delta}");v("\\varTheta","\\mathit{\\Theta}");v("\\varLambda","\\mathit{\\Lambda}");v("\\varXi","\\mathit{\\Xi}");v("\\varPi","\\mathit{\\Pi}");v("\\varSigma","\\mathit{\\Sigma}");v("\\varUpsilon","\\mathit{\\Upsilon}");v("\\varPhi","\\mathit{\\Phi}");v("\\varPsi","\\mathit{\\Psi}");v("\\varOmega","\\mathit{\\Omega}");v("\\substack","\\begin{subarray}{c}#1\\end{subarray}");v("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");v("\\boxed","\\fbox{$\\displaystyle{#1}$}");v("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");v("\\implies","\\DOTSB\\;\\Longrightarrow\\;");v("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");v("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");v("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Fa={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};v("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in Fa?t=Fa[r]:(r.slice(0,4)==="\\not"||r in de.math&&["bin","rel"].includes(de.math[r].group))&&(t="\\dotsb"),t});var J0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};v("\\dotso",function(e){var t=e.future().text;return t in J0?"\\ldots\\,":"\\ldots"});v("\\dotsc",function(e){var t=e.future().text;return t in J0&&t!==","?"\\ldots\\,":"\\ldots"});v("\\cdots",function(e){var t=e.future().text;return t in J0?"\\@cdots\\,":"\\@cdots"});v("\\dotsb","\\cdots");v("\\dotsm","\\cdots");v("\\dotsi","\\!\\cdots");v("\\dotsx","\\ldots\\,");v("\\DOTSI","\\relax");v("\\DOTSB","\\relax");v("\\DOTSX","\\relax");v("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");v("\\,","\\tmspace+{3mu}{.1667em}");v("\\thinspace","\\,");v("\\>","\\mskip{4mu}");v("\\:","\\tmspace+{4mu}{.2222em}");v("\\medspace","\\:");v("\\;","\\tmspace+{5mu}{.2777em}");v("\\thickspace","\\;");v("\\!","\\tmspace-{3mu}{.1667em}");v("\\negthinspace","\\!");v("\\negmedspace","\\tmspace-{4mu}{.2222em}");v("\\negthickspace","\\tmspace-{5mu}{.277em}");v("\\enspace","\\kern.5em ");v("\\enskip","\\hskip.5em\\relax");v("\\quad","\\hskip1em\\relax");v("\\qquad","\\hskip2em\\relax");v("\\tag","\\@ifstar\\tag@literal\\tag@paren");v("\\tag@paren","\\tag@literal{({#1})}");v("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new L("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});v("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");v("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");v("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");v("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");v("\\newline","\\\\\\relax");v("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var $s=P(st["Main-Regular"][84][1]-.7*st["Main-Regular"][65][1]);v("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+$s+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");v("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+$s+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");v("\\hspace","\\@ifstar\\@hspacer\\@hspace");v("\\@hspace","\\hskip #1\\relax");v("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");v("\\ordinarycolon",":");v("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");v("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');v("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');v("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');v("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');v("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');v("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');v("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');v("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');v("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');v("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');v("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');v("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');v("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');v("∷","\\dblcolon");v("∹","\\eqcolon");v("≔","\\coloneqq");v("≕","\\eqqcolon");v("⩴","\\Coloneqq");v("\\ratio","\\vcentcolon");v("\\coloncolon","\\dblcolon");v("\\colonequals","\\coloneqq");v("\\coloncolonequals","\\Coloneqq");v("\\equalscolon","\\eqqcolon");v("\\equalscoloncolon","\\Eqqcolon");v("\\colonminus","\\coloneq");v("\\coloncolonminus","\\Coloneq");v("\\minuscolon","\\eqcolon");v("\\minuscoloncolon","\\Eqcolon");v("\\coloncolonapprox","\\Colonapprox");v("\\coloncolonsim","\\Colonsim");v("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");v("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");v("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");v("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");v("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");v("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");v("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");v("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");v("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");v("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");v("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");v("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");v("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");v("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");v("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");v("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");v("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");v("\\nleqq","\\html@mathml{\\@nleqq}{≰}");v("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");v("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");v("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");v("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");v("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");v("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");v("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");v("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");v("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");v("\\imath","\\html@mathml{\\@imath}{ı}");v("\\jmath","\\html@mathml{\\@jmath}{ȷ}");v("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");v("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");v("⟦","\\llbracket");v("⟧","\\rrbracket");v("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");v("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");v("⦃","\\lBrace");v("⦄","\\rBrace");v("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");v("⦵","\\minuso");v("\\darr","\\downarrow");v("\\dArr","\\Downarrow");v("\\Darr","\\Downarrow");v("\\lang","\\langle");v("\\rang","\\rangle");v("\\uarr","\\uparrow");v("\\uArr","\\Uparrow");v("\\Uarr","\\Uparrow");v("\\N","\\mathbb{N}");v("\\R","\\mathbb{R}");v("\\Z","\\mathbb{Z}");v("\\alef","\\aleph");v("\\alefsym","\\aleph");v("\\Alpha","\\mathrm{A}");v("\\Beta","\\mathrm{B}");v("\\bull","\\bullet");v("\\Chi","\\mathrm{X}");v("\\clubs","\\clubsuit");v("\\cnums","\\mathbb{C}");v("\\Complex","\\mathbb{C}");v("\\Dagger","\\ddagger");v("\\diamonds","\\diamondsuit");v("\\empty","\\emptyset");v("\\Epsilon","\\mathrm{E}");v("\\Eta","\\mathrm{H}");v("\\exist","\\exists");v("\\harr","\\leftrightarrow");v("\\hArr","\\Leftrightarrow");v("\\Harr","\\Leftrightarrow");v("\\hearts","\\heartsuit");v("\\image","\\Im");v("\\infin","\\infty");v("\\Iota","\\mathrm{I}");v("\\isin","\\in");v("\\Kappa","\\mathrm{K}");v("\\larr","\\leftarrow");v("\\lArr","\\Leftarrow");v("\\Larr","\\Leftarrow");v("\\lrarr","\\leftrightarrow");v("\\lrArr","\\Leftrightarrow");v("\\Lrarr","\\Leftrightarrow");v("\\Mu","\\mathrm{M}");v("\\natnums","\\mathbb{N}");v("\\Nu","\\mathrm{N}");v("\\Omicron","\\mathrm{O}");v("\\plusmn","\\pm");v("\\rarr","\\rightarrow");v("\\rArr","\\Rightarrow");v("\\Rarr","\\Rightarrow");v("\\real","\\Re");v("\\reals","\\mathbb{R}");v("\\Reals","\\mathbb{R}");v("\\Rho","\\mathrm{P}");v("\\sdot","\\cdot");v("\\sect","\\S");v("\\spades","\\spadesuit");v("\\sub","\\subset");v("\\sube","\\subseteq");v("\\supe","\\supseteq");v("\\Tau","\\mathrm{T}");v("\\thetasym","\\vartheta");v("\\weierp","\\wp");v("\\Zeta","\\mathrm{Z}");v("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");v("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");v("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");v("\\bra","\\mathinner{\\langle{#1}|}");v("\\ket","\\mathinner{|{#1}\\rangle}");v("\\braket","\\mathinner{\\langle{#1}\\rangle}");v("\\Bra","\\left\\langle#1\\right|");v("\\Ket","\\left|#1\\right\\rangle");var Us=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,l=t.macros.get("|"),s=t.macros.get("\\|");t.macros.beginGroup();var o=m=>d=>{e&&(d.macros.set("|",l),i.length&&d.macros.set("\\|",s));var p=m;if(!m&&i.length){var y=d.future();y.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};t.macros.set("|",o(!1)),i.length&&t.macros.set("\\|",o(!0));var u=t.consumeArg().tokens,h=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};v("\\bra@ket",Us(!1));v("\\bra@set",Us(!0));v("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");v("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");v("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");v("\\angln","{\\angl n}");v("\\blue","\\textcolor{##6495ed}{#1}");v("\\orange","\\textcolor{##ffa500}{#1}");v("\\pink","\\textcolor{##ff00af}{#1}");v("\\red","\\textcolor{##df0030}{#1}");v("\\green","\\textcolor{##28ae7b}{#1}");v("\\gray","\\textcolor{gray}{#1}");v("\\purple","\\textcolor{##9d38bd}{#1}");v("\\blueA","\\textcolor{##ccfaff}{#1}");v("\\blueB","\\textcolor{##80f6ff}{#1}");v("\\blueC","\\textcolor{##63d9ea}{#1}");v("\\blueD","\\textcolor{##11accd}{#1}");v("\\blueE","\\textcolor{##0c7f99}{#1}");v("\\tealA","\\textcolor{##94fff5}{#1}");v("\\tealB","\\textcolor{##26edd5}{#1}");v("\\tealC","\\textcolor{##01d1c1}{#1}");v("\\tealD","\\textcolor{##01a995}{#1}");v("\\tealE","\\textcolor{##208170}{#1}");v("\\greenA","\\textcolor{##b6ffb0}{#1}");v("\\greenB","\\textcolor{##8af281}{#1}");v("\\greenC","\\textcolor{##74cf70}{#1}");v("\\greenD","\\textcolor{##1fab54}{#1}");v("\\greenE","\\textcolor{##0d923f}{#1}");v("\\goldA","\\textcolor{##ffd0a9}{#1}");v("\\goldB","\\textcolor{##ffbb71}{#1}");v("\\goldC","\\textcolor{##ff9c39}{#1}");v("\\goldD","\\textcolor{##e07d10}{#1}");v("\\goldE","\\textcolor{##a75a05}{#1}");v("\\redA","\\textcolor{##fca9a9}{#1}");v("\\redB","\\textcolor{##ff8482}{#1}");v("\\redC","\\textcolor{##f9685d}{#1}");v("\\redD","\\textcolor{##e84d39}{#1}");v("\\redE","\\textcolor{##bc2612}{#1}");v("\\maroonA","\\textcolor{##ffbde0}{#1}");v("\\maroonB","\\textcolor{##ff92c6}{#1}");v("\\maroonC","\\textcolor{##ed5fa6}{#1}");v("\\maroonD","\\textcolor{##ca337c}{#1}");v("\\maroonE","\\textcolor{##9e034e}{#1}");v("\\purpleA","\\textcolor{##ddd7ff}{#1}");v("\\purpleB","\\textcolor{##c6b9fc}{#1}");v("\\purpleC","\\textcolor{##aa87ff}{#1}");v("\\purpleD","\\textcolor{##7854ab}{#1}");v("\\purpleE","\\textcolor{##543b78}{#1}");v("\\mintA","\\textcolor{##f5f9e8}{#1}");v("\\mintB","\\textcolor{##edf2df}{#1}");v("\\mintC","\\textcolor{##e0e5cc}{#1}");v("\\grayA","\\textcolor{##f6f7f7}{#1}");v("\\grayB","\\textcolor{##f0f1f2}{#1}");v("\\grayC","\\textcolor{##e3e5e6}{#1}");v("\\grayD","\\textcolor{##d6d8da}{#1}");v("\\grayE","\\textcolor{##babec2}{#1}");v("\\grayF","\\textcolor{##888d93}{#1}");v("\\grayG","\\textcolor{##626569}{#1}");v("\\grayH","\\textcolor{##3b3e40}{#1}");v("\\grayI","\\textcolor{##21242c}{#1}");v("\\kaBlue","\\textcolor{##314453}{#1}");v("\\kaGreen","\\textcolor{##71B307}{#1}");var _s={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Z2{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new X2(K2,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new Ba(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new We("EOF",n.loc)),this.pushTokens(i),new We("",qe.range(r,n))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,l=0,s=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++l;else if(a.text==="}"){if(--l,l===-1)throw new L("Extra }",a)}else if(a.text==="EOF")throw new L("Unexpected end of input in a macro argument, expected '"+(t&&n?t[s]:"}")+"'",a);if(t&&n)if((l===0||l===1&&t[s]==="{")&&a.text===t[s]){if(++s,s===t.length){r.splice(-s,s);break}}else s=0}while(l!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new L("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;ithis.settings.maxExpand)throw new L("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new L("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,l=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var s=a.length-1;s>=0;--s){var o=a[s];if(o.text==="#"){if(s===0)throw new L("Incomplete placeholder at end of macro body",o);if(o=a[--s],o.text==="#")a.splice(s+1,1);else if(/^[1-9]$/.test(o.text))a.splice(s,2,...l[+o.text-1]);else throw new L("Not a valid argument number",o)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new We(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.indexOf("#")!==-1)for(var l=i.replace(/##/g,"");l.indexOf("#"+(a+1))!==-1;)++a;for(var s=new Ba(i,this.settings),o=[],u=s.lex();u.text!=="EOF";)o.push(u),u=s.lex();o.reverse();var h={tokens:o,numArgs:a};return h}return i}isDefined(t){return this.macros.has(t)||Mt.hasOwnProperty(t)||de.math.hasOwnProperty(t)||de.text.hasOwnProperty(t)||_s.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Mt.hasOwnProperty(t)&&!Mt[t].primitive}}var La=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,jr=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Xn={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Ra={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class fn{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Z2(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new L("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new We("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(fn.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||t&&Mt[i.text]&&Mt[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var s=de[this.mode][r].group,o=qe.range(t),u;if(qf.hasOwnProperty(s)){var h=s;u={type:"atom",mode:this.mode,family:h,loc:o,text:r}}else u={type:s,mode:this.mode,loc:o,text:r};l=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(es(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),l={type:"textord",mode:"text",loc:qe.range(t),text:r};else return null;if(this.consume(),a)for(var m=0;m=0;)c=dn(e,t,n,r,u+1,i+1,s),c>f&&(u===o?c*=jn:ts.test(e.charAt(u-1))?(c*=Ji,p=e.slice(o,u-1).match(ns),p&&o>0&&(c*=Math.pow(Zt,p.length))):rs.test(e.charAt(u-1))?(c*=Zi,h=e.slice(o,u-1).match(Nr),h&&o>0&&(c*=Math.pow(Zt,h.length))):(c*=Xi,o>0&&(c*=Math.pow(Zt,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Qi)),(cc&&(c=d*Kt)),c>f&&(f=c),u=n.indexOf(l,u+1);return s[a]=f,f}function Bn(e){return e.toLowerCase().replace(Nr," ")}function os(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,dn(e,t,Bn(e),Bn(t),0,0,{})}var is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=is.reduce((e,t)=>{const n=fi(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),yi.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),at='[cmdk-group=""]',Jt='[cmdk-group-items=""]',ss='[cmdk-group-heading=""]',Dr='[cmdk-item=""]',Ln=`${Dr}:not([aria-disabled="true"])`,pn="cmdk-item-select",Ve="data-value",as=(e,t,n)=>os(e,t,n),Ir=b.createContext(void 0),bt=()=>b.useContext(Ir),Wr=b.createContext(void 0),On=()=>b.useContext(Wr),Rr=b.createContext(void 0),Ar=b.forwardRef((e,t)=>{let n=Ke(()=>{var k,R;return{search:"",value:(R=(k=e.value)!=null?k:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ke(()=>new Set),o=Ke(()=>new Map),i=Ke(()=>new Map),s=Ke(()=>new Set),a=_r(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:S=!0,...y}=e,m=Ze(),E=Ze(),M=Ze(),C=b.useRef(null),O=gs();ze(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,D.emit()}},[f]),ze(()=>{O(6,fe)},[]);let D=b.useMemo(()=>({subscribe:k=>(s.current.add(k),()=>s.current.delete(k)),snapshot:()=>n.current,setState:(k,R,B)=>{var W,U,V,ne;if(!Object.is(n.current[k],R)){if(n.current[k]=R,k==="search")ue(),$(),O(1,oe);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Q=document.getElementById(M);Q?Q.focus():(W=document.getElementById(m))==null||W.focus()}if(O(7,()=>{var Q;n.current.selectedItemId=(Q=X())==null?void 0:Q.id,D.emit()}),B||O(5,fe),((U=a.current)==null?void 0:U.value)!==void 0){let Q=R??"";(ne=(V=a.current).onValueChange)==null||ne.call(V,Q);return}}D.emit()}},emit:()=>{s.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,R,B)=>{var W;R!==((W=i.current.get(k))==null?void 0:W.value)&&(i.current.set(k,{value:R,keywords:B}),n.current.filtered.items.set(k,Z(R,B)),O(2,()=>{$(),D.emit()}))},item:(k,R)=>(r.current.add(k),R&&(o.current.has(R)?o.current.get(R).add(k):o.current.set(R,new Set([k]))),O(3,()=>{ue(),$(),n.current.value||oe(),D.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let B=X();O(4,()=>{ue(),B?.getAttribute("id")===k&&oe(),D.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:m,inputId:M,labelId:E,listInnerRef:C}),[]);function Z(k,R){var B,W;let U=(W=(B=a.current)==null?void 0:B.filter)!=null?W:as;return k?U(k,n.current.search,R):0}function $(){if(!n.current.search||a.current.shouldFilter===!1)return;let k=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let U=o.current.get(W),V=0;U.forEach(ne=>{let Q=k.get(ne);V=Math.max(Q,V)}),R.push([W,V])});let B=C.current;de().sort((W,U)=>{var V,ne;let Q=W.getAttribute("id"),xe=U.getAttribute("id");return((V=k.get(xe))!=null?V:0)-((ne=k.get(Q))!=null?ne:0)}).forEach(W=>{let U=W.closest(Jt);U?U.appendChild(W.parentElement===U?W:W.closest(`${Jt} > *`)):B.appendChild(W.parentElement===B?W:W.closest(`${Jt} > *`))}),R.sort((W,U)=>U[1]-W[1]).forEach(W=>{var U;let V=(U=C.current)==null?void 0:U.querySelector(`${at}[${Ve}="${encodeURIComponent(W[0])}"]`);V?.parentElement.appendChild(V)})}function oe(){let k=de().find(B=>B.getAttribute("aria-disabled")!=="true"),R=k?.getAttribute(Ve);D.setState("value",R||void 0)}function ue(){var k,R,B,W;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let V of r.current){let ne=(R=(k=i.current.get(V))==null?void 0:k.value)!=null?R:"",Q=(W=(B=i.current.get(V))==null?void 0:B.keywords)!=null?W:[],xe=Z(ne,Q);n.current.filtered.items.set(V,xe),xe>0&&U++}for(let[V,ne]of o.current)for(let Q of ne)if(n.current.filtered.items.get(Q)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=U}function fe(){var k,R,B;let W=X();W&&(((k=W.parentElement)==null?void 0:k.firstChild)===W&&((B=(R=W.closest(at))==null?void 0:R.querySelector(ss))==null||B.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function X(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Dr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(Ln))||[])}function Ae(k){let R=de()[k];R&&D.setState("value",R.getAttribute(Ve))}function Le(k){var R;let B=X(),W=de(),U=W.findIndex(ne=>ne===B),V=W[U+k];(R=a.current)!=null&&R.loop&&(V=U+k<0?W[W.length-1]:U+k===W.length?W[0]:W[U+k]),V&&D.setState("value",V.getAttribute(Ve))}function qe(k){let R=X(),B=R?.closest(at),W;for(;B&&!W;)B=k>0?ys(B,at):vs(B,at),W=B?.querySelector(Ln);W?D.setState("value",W.getAttribute(Ve)):Le(k)}let ie=()=>Ae(de().length-1),se=k=>{k.preventDefault(),k.metaKey?ie():k.altKey?qe(1):Le(1)},pe=k=>{k.preventDefault(),k.metaKey?Ae(0):k.altKey?qe(-1):Le(-1)};return b.createElement(Be.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var R;(R=y.onKeyDown)==null||R.call(y,k);let B=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||B))switch(k.key){case"n":case"j":{S&&k.ctrlKey&&se(k);break}case"ArrowDown":{se(k);break}case"p":case"k":{S&&k.ctrlKey&&pe(k);break}case"ArrowUp":{pe(k);break}case"Home":{k.preventDefault(),Ae(0);break}case"End":{k.preventDefault(),ie();break}case"Enter":{k.preventDefault();let W=X();if(W){let U=new Event(pn);W.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:ws},l),jt(e,k=>b.createElement(Wr.Provider,{value:D},b.createElement(Ir.Provider,{value:j},k))))}),ls=b.forwardRef((e,t)=>{var n,r;let o=Ze(),i=b.useRef(null),s=b.useContext(Rr),a=bt(),l=_r(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;ze(()=>{if(!u)return a.item(o,s?.id)},[u]);let f=Fr(o,i,[e.value,e.children,i],e.keywords),c=On(),d=Fe(O=>O.value&&O.value===f.current),p=Fe(O=>u||a.filter()===!1?!0:O.search?O.filtered.items.get(o)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(pn,h),()=>O.removeEventListener(pn,h)},[p,e.onSelect,e.disabled]);function h(){var O,D;v(),(D=(O=l.current).onSelect)==null||D.call(O,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:S,value:y,onSelect:m,forceMount:E,keywords:M,...C}=e;return b.createElement(Be.div,{ref:mt(i,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!d,"data-disabled":!!S,"data-selected":!!d,onPointerMove:S||a.getDisablePointerSelection()?void 0:v,onClick:S?void 0:h},e.children)}),cs=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=Ze(),a=b.useRef(null),l=b.useRef(null),u=Ze(),f=bt(),c=Fe(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ze(()=>f.group(s),[]),Fr(s,a,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(Be.div,{ref:mt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),jt(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Rr.Provider,{value:d},p))))}),us=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=Fe(s=>!s.search);return!n&&!i?null:b.createElement(Be.div,{ref:mt(o,t),...r,"cmdk-separator":"",role:"separator"})}),fs=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=On(),s=Fe(u=>u.search),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Be.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),ds=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(Be.div,{ref:mt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},jt(e,u=>b.createElement("div",{ref:mt(s,l.listInnerRef),"cmdk-list-sizer":""},u)))}),ps=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return b.createElement(di,{open:n,onOpenChange:r},b.createElement(pi,{container:s},b.createElement(hi,{"cmdk-overlay":"",className:o}),b.createElement(mi,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(Ar,{ref:t,...a}))))}),hs=b.forwardRef((e,t)=>Fe(n=>n.filtered.count===0)?b.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ms=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Be.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jt(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),nf=Object.assign(Ar,{List:ds,Item:ls,Input:fs,Group:cs,Separator:us,Dialog:ps,Empty:hs,Loading:ms});function ys(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vs(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _r(e){let t=b.useRef(e);return ze(()=>{t.current=e}),t}var ze=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ke(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Fe(e){let t=On(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Fr(e,t,n,r=[]){let o=b.useRef(),i=bt();return ze(()=>{var s;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,a,l),(s=t.current)==null||s.setAttribute(Ve,a),o.current=a}),o}var gs=()=>{let[e,t]=b.useState(),n=Ke(()=>new Map);return ze(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function bs(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jt({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(bs(t),{ref:t.ref},n(t.props.children)):n(t)}var ws={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function jr(e){return t=>typeof t===e}var Os=jr("function"),Ss=e=>e===null,$n=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Hn=e=>!Es(e)&&!Ss(e)&&(Os(e)||typeof e=="object"),Es=jr("undefined");function ks(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!re(e[r],t[r]))return!1;return!0}function Cs(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ts(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!re(n[1],t.get(n[0])))return!1;return!0}function Ms(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function re(e,t){if(e===t)return!0;if(e&&Hn(e)&&t&&Hn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ks(e,t);if(e instanceof Map&&t instanceof Map)return Ts(e,t);if(e instanceof Set&&t instanceof Set)return Ms(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Cs(e,t);if($n(e)&&$n(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!re(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var Ps=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],xs=["bigint","boolean","null","number","string","symbol","undefined"];function Bt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Ns(t))return t}function be(e){return t=>Bt(t)===e}function Ns(e){return Ps.includes(e)}function tt(e){return t=>typeof t===e}function Ds(e){return xs.includes(e)}var Is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function P(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(P.array(e))return"Array";if(P.plainFunction(e))return"Function";const t=Bt(e);return t||"Object"}P.array=Array.isArray;P.arrayOf=(e,t)=>!P.array(e)&&!P.function(t)?!1:e.every(n=>t(n));P.asyncGeneratorFunction=e=>Bt(e)==="AsyncGeneratorFunction";P.asyncFunction=be("AsyncFunction");P.bigint=tt("bigint");P.boolean=e=>e===!0||e===!1;P.date=be("Date");P.defined=e=>!P.undefined(e);P.domElement=e=>P.object(e)&&!P.plainObject(e)&&e.nodeType===1&&P.string(e.nodeName)&&Is.every(t=>t in e);P.empty=e=>P.string(e)&&e.length===0||P.array(e)&&e.length===0||P.object(e)&&!P.map(e)&&!P.set(e)&&Object.keys(e).length===0||P.set(e)&&e.size===0||P.map(e)&&e.size===0;P.error=be("Error");P.function=tt("function");P.generator=e=>P.iterable(e)&&P.function(e.next)&&P.function(e.throw);P.generatorFunction=be("GeneratorFunction");P.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;P.iterable=e=>!P.nullOrUndefined(e)&&P.function(e[Symbol.iterator]);P.map=be("Map");P.nan=e=>Number.isNaN(e);P.null=e=>e===null;P.nullOrUndefined=e=>P.null(e)||P.undefined(e);P.number=e=>tt("number")(e)&&!P.nan(e);P.numericString=e=>P.string(e)&&e.length>0&&!Number.isNaN(Number(e));P.object=e=>!P.nullOrUndefined(e)&&(P.function(e)||typeof e=="object");P.oneOf=(e,t)=>P.array(e)?e.indexOf(t)>-1:!1;P.plainFunction=be("Function");P.plainObject=e=>{if(Bt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};P.primitive=e=>P.null(e)||Ds(typeof e);P.promise=be("Promise");P.propertyOf=(e,t,n)=>{if(!P.object(e)||!t)return!1;const r=e[t];return P.function(n)?n(r):P.defined(r)};P.regexp=be("RegExp");P.set=be("Set");P.string=tt("string");P.symbol=tt("symbol");P.undefined=tt("undefined");P.weakMap=be("WeakMap");P.weakSet=be("WeakSet");var x=P;function Ws(...e){return e.every(t=>x.string(t)||x.array(t)||x.plainObject(t))}function Rs(e,t,n){return Br(e,t)?[e,t].every(x.array)?!e.some(Gn(n))&&t.some(Gn(n)):[e,t].every(x.plainObject)?!Object.entries(e).some(qn(n))&&Object.entries(t).some(qn(n)):t===n:!1}function zn(e,t,n){const{actual:r,key:o,previous:i,type:s}=n,a=Ce(e,o),l=Ce(t,o);let u=[a,l].every(x.number)&&(s==="increased"?al);return x.undefined(r)||(u=u&&l===r),x.undefined(i)||(u=u&&a===i),u}function Un(e,t,n){const{key:r,type:o,value:i}=n,s=Ce(e,r),a=Ce(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!x.nullOrUndefined(i)){if(x.defined(l)){if(x.array(l)||x.plainObject(l))return Rs(l,u,i)}else return re(u,i);return!1}return[s,a].every(x.array)?!u.every(Sn(l)):[s,a].every(x.plainObject)?As(Object.keys(l),Object.keys(u)):![s,a].every(f=>x.primitive(f)&&x.defined(f))&&(o==="added"?!x.defined(s)&&x.defined(a):x.defined(s)&&!x.defined(a))}function Yn(e,t,{key:n}={}){let r=Ce(e,n),o=Ce(t,n);if(!Br(r,o))throw new TypeError("Inputs have different types");if(!Ws(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(x.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function qn(e){return([t,n])=>x.array(e)?re(e,n)||e.some(r=>re(r,n)||x.array(n)&&Sn(n)(r)):x.plainObject(e)&&e[t]?!!e[t]&&re(e[t],n):re(e,n)}function As(e,t){return t.some(n=>!e.includes(n))}function Gn(e){return t=>x.array(e)?e.some(n=>re(n,t)||x.array(t)&&Sn(t)(n)):re(e,t)}function lt(e,t){return x.array(e)?e.some(n=>re(n,t)):re(e,t)}function Sn(e){return t=>e.some(n=>re(n,t))}function Br(...e){return e.every(x.array)||e.every(x.number)||e.every(x.plainObject)||e.every(x.string)}function Ce(e,t){return x.plainObject(e)||x.array(e)?x.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):x.number(t)?e[t]:e:e}function Rt(e,t){if([e,t].some(x.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>x.plainObject(f)||x.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return Un(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(c),S=x.defined(d);if(v||S){const y=S?lt(d,p):!lt(c,p),m=lt(c,h);return y&&m}return[p,h].every(x.array)||[p,h].every(x.plainObject)?!re(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!x.defined(f))return!1;try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(d);return lt(c,p)&&(v?lt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Yn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Yn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return Un(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var Xt,Vn;function _s(){if(Vn)return Xt;Vn=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;Xt={left:o("scrollLeft"),top:o("scrollTop")};function o(a){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=s);var p=r(),h=u[a],v=c.ease||i,S=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[a]):requestAnimationFrame(E),m;function m(){y=!0}function E(M){if(y)return d(t,u[a]);var C=r(),O=n(1,(C-p)/S),D=v(O);u[a]=D*(f-h)+h,O<1?requestAnimationFrame(E):requestAnimationFrame(function(){d(null,u[a])})}}}function i(a){return .5*(1-Math.cos(Math.PI*a))}function s(){}return Xt}var Fs=_s();const js=gt(Fs);var It={exports:{}},Bs=It.exports,Kn;function Ls(){return Kn||(Kn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Bs,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(It)),It.exports}var $s=Ls();const Lr=gt($s);var Qt,Zn;function Hs(){if(Zn)return Qt;Zn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Qt=n,Qt}var zs=Hs();const Jn=gt(zs);var en,Xn;function Us(){if(Xn)return en;Xn=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function s(y){return Array.isArray(y)?[]:{}}function a(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(s(y),y,m):y}function l(y,m,E){return y.concat(m).map(function(M){return a(M,E)})}function u(y,m){if(!m.customMerge)return v;var E=m.customMerge(y);return typeof E=="function"?E:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,E){var M={};return E.isMergeableObject(y)&&c(y).forEach(function(C){M[C]=a(y[C],E)}),c(m).forEach(function(C){p(y,C)||(d(y,C)&&E.isMergeableObject(m[C])?M[C]=u(C,E)(y[C],m[C],E):M[C]=a(m[C],E))}),M}function v(y,m,E){E=E||{},E.arrayMerge=E.arrayMerge||l,E.isMergeableObject=E.isMergeableObject||e,E.cloneUnlessOtherwiseSpecified=a;var M=Array.isArray(m),C=Array.isArray(y),O=M===C;return O?M?E.arrayMerge(y,m,E):h(y,m,E):a(m,E)}v.all=function(m,E){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(M,C){return v(M,C,E)},{})};var S=v;return en=S,en}var Ys=Us();const ve=gt(Ys);var tn={exports:{}},nn,Qn;function qs(){if(Qn)return nn;Qn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,er;function Gs(){if(er)return rn;er=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,rn=function(){function r(s,a,l,u,f,c){if(c!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rn}var tr;function Vs(){return tr||(tr=1,tn.exports=Gs()()),tn.exports}var Ks=Vs();const T=gt(Ks);var wt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function Js(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Xs(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Zs))}}var Qs=wt&&window.Promise,ea=Qs?Js:Xs;function $r(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function Ye(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function En(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function Ot(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=Ye(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:Ot(En(e))}function Hr(e){return e&&e.referenceNode?e.referenceNode:e}var nr=wt&&!!(window.MSInputMethodContext&&document.documentMode),rr=wt&&/MSIE 10/.test(navigator.userAgent);function nt(e){return e===11?nr:e===10?rr:nr||rr}function Je(e){if(!e)return document.documentElement;for(var t=nt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Ye(n,"position")==="static"?Je(n):n}function ta(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Je(e.firstElementChild)===e}function hn(e){return e.parentNode!==null?hn(e.parentNode):e}function At(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return ta(s)?s:Je(s);var a=hn(e);return a.host?At(a.host,t):At(e,hn(t).host)}function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function na(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Xe(t,"top"),o=Xe(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function or(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function ir(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],nt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function zr(e){var t=e.body,n=e.documentElement,r=nt(10)&&getComputedStyle(n);return{height:ir("Height",t,n,r),width:ir("Width",t,n,r)}}var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},oa=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=nt(10),o=t.nodeName==="HTML",i=mn(e),s=mn(t),a=Ot(e),l=Ye(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(s.top=Math.max(s.top,0),s.left=Math.max(s.left,0));var c=je({top:i.top-s.top-u,left:i.left-s.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(a):t===a&&a.nodeName!=="BODY")&&(c=na(c,t)),c}function ia(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=kn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),s=t?0:Xe(n),a=t?0:Xe(n,"left"),l={top:s-r.top+r.marginTop,left:a-r.left+r.marginLeft,width:o,height:i};return je(l)}function Ur(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(Ye(e,"position")==="fixed")return!0;var n=En(e);return n?Ur(n):!1}function Yr(e){if(!e||!e.parentElement||nt())return document.documentElement;for(var t=e.parentElement;t&&Ye(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function Cn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},s=o?Yr(e):At(e,Hr(t));if(r==="viewport")i=ia(s,o);else{var a=void 0;r==="scrollParent"?(a=Ot(En(t)),a.nodeName==="BODY"&&(a=e.ownerDocument.documentElement)):r==="window"?a=e.ownerDocument.documentElement:a=r;var l=kn(a,s,o);if(a.nodeName==="HTML"&&!Ur(s)){var u=zr(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function sa(e){var t=e.width,n=e.height;return t*n}function qr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var s=Cn(n,r,i,o),a={top:{width:s.width,height:t.top-s.top},right:{width:s.right-t.right,height:s.height},bottom:{width:s.width,height:s.bottom-t.bottom},left:{width:t.left-s.left,height:s.height}},l=Object.keys(a).map(function(d){return he({key:d},a[d],{area:sa(a[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Gr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Yr(t):At(t,Hr(n));return kn(n,o,r)}function Vr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function _t(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Kr(e,t,n){n=n.split("-")[0];var r=Vr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,s=i?"top":"left",a=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[s]=t[s]+t[l]/2-r[l]/2,n===a?o[a]=t[a]-r[u]:o[a]=t[_t(a)],o}function St(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function aa(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=St(e,function(o){return o[t]===n});return e.indexOf(r)}function Zr(e,t,n){var r=n===void 0?e:e.slice(0,aa(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&$r(i)&&(t.offsets.popper=je(t.offsets.popper),t.offsets.reference=je(t.offsets.reference),t=i(t,o))}),t}function la(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Gr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=qr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Kr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Zr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Jr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function Tn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;rs[p]&&(e.offsets.popper[c]+=a[c]+h-s[p]),e.offsets.popper=je(e.offsets.popper);var v=a[c]+a[u]/2-h/2,S=Ye(e.instance.popper),y=parseFloat(S["margin"+f]),m=parseFloat(S["border"+f+"Width"]),E=v-e.offsets.popper[c]-y-m;return E=Math.max(Math.min(s[u]-h,E),0),e.arrowElement=r,e.offsets.arrow=(n={},Qe(n,c,Math.round(E)),Qe(n,d,""),n),e}function Oa(e){return e==="end"?"start":e==="start"?"end":e}var to=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],on=to.slice(3);function sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=on.indexOf(e),r=on.slice(n+1).concat(on.slice(0,n));return t?r.reverse():r}var sn={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Sa(e,t){if(Jr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=Cn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=_t(r),i=e.placement.split("-")[1]||"",s=[];switch(t.behavior){case sn.FLIP:s=[r,o];break;case sn.CLOCKWISE:s=sr(r);break;case sn.COUNTERCLOCKWISE:s=sr(r,!0);break;default:s=t.behavior}return s.forEach(function(a,l){if(r!==a||s.length===l+1)return e;r=e.placement.split("-")[0],o=_t(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&S,m=["top","bottom"].indexOf(r)!==-1,E=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&S),M=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&S||!m&&i==="end"&&v),C=E||M;(d||y||C)&&(e.flipped=!0,(d||y)&&(r=s[l+1]),C&&(i=Oa(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Kr(e.instance.popper,e.offsets.reference,e.placement)),e=Zr(e.instance.modifiers,e,"flip"))}),e}function Ea(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,s=["top","bottom"].indexOf(o)!==-1,a=s?"right":"bottom",l=s?"left":"top",u=s?"width":"height";return n[a]i(r[a])&&(e.offsets.popper[l]=i(r[a])),e}function ka(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],s=o[2];if(!i)return e;if(s.indexOf("%")===0){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=r}var l=je(a);return l[t]/100*i}else if(s==="vh"||s==="vw"){var u=void 0;return s==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Ca(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,s=e.split(/(\+|\-)/).map(function(f){return f.trim()}),a=s.indexOf(St(s,function(f){return f.search(/,|\s/)!==-1}));s[a]&&s[a].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=a!==-1?[s.slice(0,a).concat([s[a].split(l)[0]]),[s[a].split(l)[1]].concat(s.slice(a+1))]:[s];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return ka(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){Mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ta(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,s=o.reference,a=r.split("-")[0],l=void 0;return Mn(+n)?l=[+n,0]:l=Ca(n,i,s,a),a==="left"?(i.top+=l[0],i.left-=l[1]):a==="right"?(i.top+=l[0],i.left+=l[1]):a==="top"?(i.left+=l[0],i.top-=l[1]):a==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Ma(e,t){var n=t.boundariesElement||Je(e.instance.popper);e.instance.reference===n&&(n=Je(n));var r=Tn("transform"),o=e.instance.popper.style,i=o.top,s=o.left,a=o[r];o.top="",o.left="",o[r]="";var l=Cn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=s,o[r]=a,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Qe({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Pa(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,s=o.popper,a=["bottom","top"].indexOf(n)!==-1,l=a?"left":"top",u=a?"width":"height",f={start:Qe({},l,i[l]),end:Qe({},l,i[l]+i[u]-s[u])};e.offsets.popper=he({},s,f[r])}return e}function xa(e){if(!eo(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=St(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};ra(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=ea(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(s){r.options.modifiers[s]=he({},e.Defaults.modifiers[s]||{},o.modifiers?o.modifiers[s]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(s){return he({name:s},r.options.modifiers[s])}).sort(function(s,a){return s.order-a.order}),this.modifiers.forEach(function(s){s.enabled&&$r(s.onLoad)&&s.onLoad(r.reference,r.popper,r.options,s,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return oa(e,[{key:"update",value:function(){return la.call(this)}},{key:"destroy",value:function(){return ca.call(this)}},{key:"enableEventListeners",value:function(){return fa.call(this)}},{key:"disableEventListeners",value:function(){return pa.call(this)}}]),e})();yt.Utils=(typeof window<"u"?window:global).PopperUtils;yt.placements=to;yt.Defaults=Ia;var Wa=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Aa=["bigint","boolean","null","number","string","symbol","undefined"];function Lt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(_a(t))return t}function we(e){return function(t){return Lt(t)===e}}function _a(e){return Ra.includes(e)}function rt(e){return function(t){return typeof t===e}}function Fa(e){return Aa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Lt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Lt(e)==="AsyncGeneratorFunction"};g.asyncFunction=we("AsyncFunction");g.bigint=rt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=we("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&Wa.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=we("Error");g.function=rt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=we("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=we("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return rt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=we("Function");g.plainObject=function(e){if(Lt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||Fa(typeof e)};g.promise=we("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=we("RegExp");g.set=we("Set");g.string=rt("string");g.symbol=rt("symbol");g.undefined=rt("undefined");g.weakMap=we("WeakMap");g.weakSet=we("WeakSet");function no(e){return function(t){return typeof t===e}}var ja=no("function"),Ba=function(e){return e===null},ar=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},lr=function(e){return!La(e)&&!Ba(e)&&(ja(e)||typeof e=="object")},La=no("undefined"),vn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function Ha(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function za(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var s=vn(e.entries()),a=s.next();!a.done;a=s.next()){var l=a.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}try{for(var u=vn(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function Ua(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=vn(e.entries()),i=o.next();!i.done;i=o.next()){var s=i.value;if(!t.has(s[0]))return!1}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&lr(e)&&t&&lr(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return $a(e,t);if(e instanceof Map&&t instanceof Map)return za(e,t);if(e instanceof Set&&t instanceof Set)return Ua(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Ha(e,t);if(ar(e)&&ar(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function Ya(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&a===i),u}function ur(e,t,n){var r=n.key,o=n.type,i=n.value,s=Te(e,r),a=Te(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return qa(l,u,i)}else return ae(u,i);return!1}return[s,a].every(g.array)?!u.every(Pn(l)):[s,a].every(g.plainObject)?Ga(Object.keys(l),Object.keys(u)):![s,a].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(s)&&g.defined(a):g.defined(s)&&!g.defined(a))}function fr(e,t,n){var r=n===void 0?{}:n,o=r.key,i=Te(e,o),s=Te(t,o);if(!ro(i,s))throw new TypeError("Inputs have different types");if(!Ya(i,s))throw new TypeError("Inputs don't have length");return[i,s].every(g.plainObject)&&(i=Object.keys(i),s=Object.keys(s)),[i,s]}function dr(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&Pn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function Ga(e,t){return t.some(function(n){return!e.includes(n)})}function pr(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&Pn(t)(n)}):ae(e,t)}}function ct(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function Pn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function ro(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function oo(e,t){if(e==null)return{};var n=Ja(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(e)}function Tt(e){var t=Za();return function(){var r=Ft(e),o;if(t){var i=Ft(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Xa(this,o)}}function Qa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=Qa(e,"string");return typeof t=="symbol"?t:String(t)}var el={flip:{padding:20},preventOverflow:{padding:10}},tl="The typeValidator argument must be a function with the signature function(props, propName, componentName).",nl="The error message is optional, but must be a string if provided.";function rl(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function ol(e,t){return Object.hasOwnProperty.call(e,t)}function il(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function sl(e,t){if(typeof e!="function")throw new TypeError(tl);if(t&&typeof t!="string")throw new TypeError(nl)}function mr(e,t,n){return sl(e,n),function(r,o,i){for(var s=arguments.length,a=new Array(s>3?s-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function ll(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function cl(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(s){n(s),ll(e,t,o)},al(e,t,o,r)}function yr(){}var so=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"componentDidMount",value:function(){Ee()&&(this.node||this.appendNode(),ut||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Ee()&&(ut||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Ee()||!this.node||(ut||Nt.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,s=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),s&&(this.node.style.zIndex=s),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Ee())return null;var o=this.props,i=o.children,s=o.setRef;if(this.node||this.appendNode(),ut)return Nt.createPortal(i,this.node);var a=Nt.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return s(a),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,s=o.placement,a=o.target;return i?this.renderPortal():a||s==="center"?this.renderPortal():null}},{key:"render",value:function(){return ut?this.renderReact16():null}}]),n})(w.Component);te(so,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var ao=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,s=o.styles,a=s.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=a):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=a):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,s=o.setArrowRef,a=o.styles,l=a.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},S,y=h,m=c;return i.startsWith("top")?(S="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(S="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,S="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,S="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:s,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:S,fill:u}))))}}]),n})(w.Component);te(ao,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var ul=["color","height","width"];function lo(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,s=oo(n,ul);return w.createElement("button",{"aria-label":"close",onClick:t,style:s,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}lo.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function co(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,s=e.showCloseButton,a=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return a&&(u.title=w.isValidElement(a)?a:w.createElement("div",{className:"__floater__title",style:l.title},a)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(s||i)&&!g.boolean(o)&&(u.close=w.createElement(lo,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}co.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var uo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,s=o.component,a=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,S=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(a.startsWith("top")?m.padding="0 0 ".concat(c,"px"):a.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):a.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):a.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[z.OPENING,z.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===z.CLOSING&&(m=K(K({},m),h)),u===z.OPEN&&!i&&(m=K(K({},m),S)),a==="center"&&(m=K(K({},m),p)),s&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,s=o.handleClick,a=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:s}):f.content=i({closeFn:s}):f.content=w.createElement(co,this.props),u===z.OPEN&&c.push("__floater__open"),a||(f.arrow=w.createElement(ao,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);te(uo,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var fo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"render",value:function(){var o=this.props,i=o.children,s=o.handleClick,a=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),te({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:s,onMouseEnter:a,onMouseLeave:l},p):null}}]),n})(w.Component);te(fo,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var fl={zIndex:100};function dl(e){var t=ve(fl,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var pl=["arrow","flip","offset"],hl=["position","top","right","bottom","left"],xn=(function(e){Ct(n,e);var t=Tt(n);function n(r){var o;return Et(this,n),o=t.call(this,r),te(Ne(o),"setArrowRef",function(i){o.arrowRef=i}),te(Ne(o),"setChildRef",function(i){o.childRef=i}),te(Ne(o),"setFloaterRef",function(i){o.floaterRef=i}),te(Ne(o),"setWrapperRef",function(i){o.wrapperRef=i}),te(Ne(o),"handleTransitionEnd",function(){var i=o.state.status,s=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===z.OPENING?z.OPEN:z.IDLE},function(){var a=o.state.status;s(a===z.OPEN?"open":"close",o.props)})}),te(Ne(o),"handleClick",function(){var i=o.props,s=i.event,a=i.open;if(!g.boolean(a)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(xt({title:"click",data:[{event:s,status:f===z.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),te(Ne(o),"handleMouseEnter",function(){var i=o.props,s=i.event,a=i.open;if(!(g.boolean(a)||an())){var l=o.state.status;o.event==="hover"&&l===z.IDLE&&(xt({title:"mouseEnter",data:[{key:"originalEvent",value:s}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),te(Ne(o),"handleMouseLeave",function(){var i=o.props,s=i.event,a=i.eventDelay,l=i.open;if(!(g.boolean(l)||an())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(xt({title:"mouseLeave",data:[{key:"originalEvent",value:s}],debug:o.debug}),a?[z.OPENING,z.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},a*1e3)):o.toggle(z.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:z.INIT,statusWrapper:z.INIT},o._isMounted=!1,o.hasMounted=!1,Ee()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return kt(n,[{key:"componentDidMount",value:function(){if(Ee()){var o=this.state.positionWrapper,i=this.props,s=i.children,a=i.open,l=i.target;this._isMounted=!0,xt({title:"init",data:{hasChildren:!!s,hasTarget:!!l,isControlled:g.boolean(a),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!s&&l&&g.boolean(a)}}},{key:"componentDidUpdate",value:function(o,i){if(Ee()){var s=this.props,a=s.autoOpen,l=s.open,u=s.target,f=s.wrapperOptions,c=Va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?z.OPENING:z.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",z.IDLE)&&l?this.toggle(z.OPEN):d("status",z.INIT,z.IDLE)&&a&&this.toggle(z.OPEN),this.popper&&p("status",z.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",z.OPENING)||p("status",z.CLOSING))&&cl(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Ee()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,s=this.state.positionWrapper,a=this.props,l=a.disableFlip,u=a.getPopper,f=a.hideArrow,c=a.offset,d=a.placement,p=a.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:z.IDLE});else if(i&&this.floaterRef){var v=this.options,S=v.arrow,y=v.flip,m=v.offset,E=oo(v,pl);new yt(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},S),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},E),onCreate:function(O){var D;if(o.popper=O,!((D=o.floaterRef)!==null&&D!==void 0&&D.isConnected)){o.setState({needsUpdate:!0});return}u(O,"floater"),o._isMounted&&o.setState({currentPlacement:O.placement,status:z.IDLE}),d!==O.placement&&setTimeout(function(){O.instance.update()},1)},onUpdate:function(O){o.popper=O;var D=o.state.currentPlacement;o._isMounted&&O.placement!==D&&o.setState({currentPlacement:O.placement})}})}if(s){var M=g.undefined(p.offset)?0:p.offset;new yt(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(M,"px")},flip:{enabled:!1}},onCreate:function(O){o.wrapperPopper=O,o._isMounted&&o.setState({statusWrapper:z.IDLE}),u(O,"wrapper"),d!==O.placement&&setTimeout(function(){O.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,s=o.wrapperOptions;this.setState({positionWrapper:s.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,s=i===z.OPEN?z.CLOSING:z.OPENING;g.undefined(o)||(s=o),this.setState({status:s})}},{key:"debug",get:function(){var o=this.props.debug;return o||Ee()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,s=o.event;return s==="hover"&&an()&&!i?"click":s}},{key:"options",get:function(){var o=this.props.options;return ve(el,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,s=i.status,a=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ve(dl(u),u);if(a){var c;[z.IDLE].indexOf(s)===-1||[z.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},a||(hl.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Ee())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,s=o.positionWrapper,a=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,S=l.open,y=l.showCloseButton,m=l.style,E=l.target,M=l.title,C=w.createElement(fo,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),O={};return s?O.wrapperInPortal=C:O.wrapperAsChildren=C,w.createElement("span",null,w.createElement(so,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:E,zIndex:this.styles.options.zIndex},w.createElement(uo,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:S,placement:i,positionWrapper:s,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:a,styles:this.styles,title:M}),O.wrapperInPortal),O.wrapperAsChildren)}}]),n})(w.Component);te(xn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:mr(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:mr(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});te(xn,"defaultProps",{autoOpen:!1,callback:yr,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:yr,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var ml=Object.defineProperty,yl=(e,t,n)=>t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>yl(e,typeof t!="symbol"?t+"":t,n),q={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},ye={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},L={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function _e(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function po(e){return e?e.getBoundingClientRect():null}function vl(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,s)=>i-s),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function De(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function gl(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function vt(e,t,n){if(!e)return $e();const r=Lr(e);if(r){if(r.isSameNode($e()))return n?document:$e();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",$e()}return r}function $t(e,t){if(!e)return!1;const n=vt(e,t);return n?!n.isSameNode($e()):!1}function bl(e){return e.offsetParent!==document.body}function et(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=gl(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?et(e.parentNode,t):!1}function wl(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function Ol(e,t,n){var r,o,i;const s=po(e),a=vt(e,n),l=$t(e,n),u=et(e);let f=0,c=(r=s?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=a?.scrollTop)!=null?i:0;c=d-p}else a instanceof HTMLElement&&(f=a.scrollTop,!l&&!et(e)&&(c+=f),a.isSameNode($e())||(c+=$e().scrollTop));return Math.floor(c-t)}function Sl(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=Lr(e))!=null?r:{};let s=e.getBoundingClientRect().top+i;o&&($t(e,n)||bl(e))&&(s-=o);const a=Math.floor(s-t);return a<0?0:a}function $e(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function El(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:s}=r,a=e>s?e-s:s-e;js.top(r,e,{duration:a<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var ft=Dt.createPortal!==void 0;function ho(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Wt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ke(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=Jn(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Wt(e.type)==="function"){const s=e.type({});i=ke(s,t)}else i=Jn(n);return i}function kl(e,t){return!x.plainObject(e)||!x.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Cl(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,s,a)=>i+i+s+s+a+a),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function vr(e){return e.disableBeacon||e.placement==="center"}function gr(){return!["chrome","safari","firefox","opera"].includes(ho())}function Ue({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{x.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Tl(e){return Object.keys(e)}function mo(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Ml(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bn(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Wt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Wt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):bn(i,t,n))});if(Wt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return bn(i,t,n)}return e}function Pl(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:s}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!et(s))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var xl={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},yo={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Nl={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:yo,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Dl={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Il={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},dt={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},br={borderRadius:4,position:"absolute"};function Wl(e,t){var n,r,o,i,s;const{floaterProps:a,styles:l}=e,u=ve((n=t.floaterProps)!=null?n:{},a??{}),f=ve(l??{},(r=t.styles)!=null?r:{}),c=ve(Il,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthvo(n,t)):(Ue({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var go={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:L.IDLE},Or=Tl(mo(go,"controlled","size")),Al=class{constructor(e){N(this,"beaconPopper"),N(this,"tooltipPopper"),N(this,"data",new Map),N(this,"listener"),N(this,"store",new Map),N(this,"addListener",o=>{this.listener=o}),N(this,"setSteps",o=>{const{size:i,status:s}=this.getState(),a={size:o.length,status:s};this.data.set("steps",o),s===L.WAITING&&!i&&o.length&&(a.status=L.RUNNING),this.setState(a)}),N(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),N(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),N(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),N(this,"close",(o=null)=>{const{index:i,status:s}=this.getState();s===L.RUNNING&&this.setState({...this.getNextState({action:q.CLOSE,index:i+1,origin:o})})}),N(this,"go",o=>{const{controlled:i,status:s}=this.getState();if(i||s!==L.RUNNING)return;const a=this.getSteps()[o];this.setState({...this.getNextState({action:q.GO,index:o}),status:a?s:L.FINISHED})}),N(this,"info",()=>this.getState()),N(this,"next",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState(this.getNextState({action:q.NEXT,index:o+1}))}),N(this,"open",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({...this.getNextState({action:q.UPDATE,lifecycle:A.TOOLTIP})})}),N(this,"prev",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState({...this.getNextState({action:q.PREV,index:o-1})})}),N(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:q.RESET,index:0}),status:o?L.RUNNING:L.READY})}),N(this,"skip",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({action:q.SKIP,lifecycle:A.INIT,status:L.SKIPPED})}),N(this,"start",o=>{const{index:i,size:s}=this.getState();this.setState({...this.getNextState({action:q.START,index:x.number(o)?o:i},!0),status:s?L.RUNNING:L.WAITING})}),N(this,"stop",(o=!1)=>{const{index:i,status:s}=this.getState();[L.FINISHED,L.SKIPPED].includes(s)||this.setState({...this.getNextState({action:q.STOP,index:i+(o?1:0)}),status:L.PAUSED})}),N(this,"update",o=>{var i,s;if(!kl(o,Or))throw new Error(`State is not valid. Valid keys: ${Or.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:q.UPDATE,origin:(s=o.origin)!=null?s:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:q.INIT,controlled:x.number(n),continuous:t,index:x.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?L.READY:L.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...go}}getNextState(e,t=!1){var n,r,o,i,s;const{action:a,controlled:l,index:u,size:f,status:c}=this.getState(),d=x.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:a,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?L.FINISHED:(s=e.status)!=null?s:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:s=null,size:a,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",s),this.store.set("size",a),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function _l(e){return new Al(e)}function Fl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var jl=Fl,Bl=class extends b.Component{constructor(){super(...arguments),N(this,"isActive",!1),N(this,"resizeTimeout"),N(this,"scrollTimeout"),N(this,"scrollParent"),N(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),N(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),N(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:s}=this.spotlightStyles,a=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=a>=i&&a<=i+n,c=l>=r&&l<=r+s&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),N(this,"handleScroll",()=>{const{target:e}=this.props,t=De(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else et(t,"sticky")&&this.updateState({})}),N(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=De(r);this.scrollParent=vt(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:s}=Rt(e,this.props);if(s("target")||s("disableScrollParentFix")){const a=De(i);this.scrollParent=vt(a??document.body,n,!0)}s("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:a}=this.state;a||this.updateState({showSpotlight:!0})},100)),(s("spotlightClicks")||s("disableOverlay")||s("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return gr()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:vl(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:s=0,styles:a,target:l}=this.props,u=De(l),f=po(u),c=et(u),d=Ol(u,s,o);return{...gr()?a.spotlightLegacy:a.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+s*2),left:Math.round(((t=f?.left)!=null?t:0)-s),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+s*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let s=n!=="center"&&e&&b.createElement(jl,{styles:i});if(ho()==="safari"){const{mixBlendMode:a,zIndex:l,...u}=o;s=b.createElement("div",{style:{...u}},s),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},s)}},Ll=class extends b.Component{constructor(){super(...arguments),N(this,"node",null)}componentDidMount(){const{id:e}=this.props;_e()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),ft||this.renderReact15())}componentDidUpdate(){_e()&&(ft||this.renderReact15())}componentWillUnmount(){!_e()||!this.node||(ft||Dt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!_e())return;const{children:e}=this.props;this.node&&Dt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!_e()||!ft)return null;const{children:e}=this.props;return this.node?Dt.createPortal(e,this.node):null}render(){return ft?this.renderReact16():null}},$l=class{constructor(e,t){if(N(this,"element"),N(this,"options"),N(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),N(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),N(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),N(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),N(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),N(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),N(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),N(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),N(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),N(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Hl=class extends b.Component{constructor(e){if(super(e),N(this,"beacon",null),N(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` - @keyframes joyride-beacon-inner { - 20% { - opacity: 0.9; - } - - 90% { - opacity: 0.7; - } - } - - @keyframes joyride-beacon-outer { - 0% { - transform: scale(1); - } - - 45% { - opacity: 0.7; - transform: scale(0.75); - } - - 100% { - opacity: 0.9; - transform: scale(1); - } - } - `)),t.appendChild(n)}componentDidMount(){const{shouldFocus:e}=this.props;setTimeout(()=>{x.domElement(this.beacon)&&e&&this.beacon.focus()},0)}componentWillUnmount(){const e=document.getElementById("joyride-beacon-animation");e?.parentNode&&e.parentNode.removeChild(e)}render(){const{beaconComponent:e,continuous:t,index:n,isLastStep:r,locale:o,onClickOrHover:i,size:s,step:a,styles:l}=this.props,u=ke(o.open),f={"aria-label":u,onClick:i,onMouseEnter:i,ref:this.setBeaconRef,title:u};let c;if(e){const d=e;c=b.createElement(d,{continuous:t,index:n,isLastStep:r,size:s,step:a,...f})}else c=b.createElement("button",{key:"JoyrideBeacon",className:"react-joyride__beacon","data-test-id":"button-beacon",style:l.beacon,type:"button",...f},b.createElement("span",{style:l.beaconInner}),b.createElement("span",{style:l.beaconOuter}));return c}};function zl({styles:e,...t}){const{color:n,height:r,width:o,...i}=e;return w.createElement("button",{style:i,type:"button",...t},w.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof o=="number"?`${o}px`:o,xmlns:"http://www.w3.org/2000/svg"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}var Ul=zl;function Yl(e){const{backProps:t,closeProps:n,index:r,isLastStep:o,primaryProps:i,skipProps:s,step:a,tooltipProps:l}=e,{content:u,hideBackButton:f,hideCloseButton:c,hideFooter:d,showSkipButton:p,styles:h,title:v}=a,S={};return S.primary=b.createElement("button",{"data-test-id":"button-primary",style:h.buttonNext,type:"button",...i}),p&&!o&&(S.skip=b.createElement("button",{"aria-live":"off","data-test-id":"button-skip",style:h.buttonSkip,type:"button",...s})),!f&&r>0&&(S.back=b.createElement("button",{"data-test-id":"button-back",style:h.buttonBack,type:"button",...t})),S.close=!c&&b.createElement(Ul,{"data-test-id":"button-close",styles:h.buttonClose,...n}),b.createElement("div",{key:"JoyrideTooltip","aria-label":ke(v??u),className:"react-joyride__tooltip",style:h.tooltip,...l},b.createElement("div",{style:h.tooltipContainer},v&&b.createElement("h1",{"aria-label":ke(v),style:h.tooltipTitle},v),b.createElement("div",{style:h.tooltipContent},u)),!d&&b.createElement("div",{style:h.tooltipFooter},b.createElement("div",{style:h.tooltipFooterSpacer},S.skip),S.back,S.primary),S.close)}var ql=Yl,Gl=class extends b.Component{constructor(){super(...arguments),N(this,"handleClickBack",e=>{e.preventDefault();const{helpers:t}=this.props;t.prev()}),N(this,"handleClickClose",e=>{e.preventDefault();const{helpers:t}=this.props;t.close("button_close")}),N(this,"handleClickPrimary",e=>{e.preventDefault();const{continuous:t,helpers:n}=this.props;if(!t){n.close("button_primary");return}n.next()}),N(this,"handleClickSkip",e=>{e.preventDefault();const{helpers:t}=this.props;t.skip()}),N(this,"getElementsProps",()=>{const{continuous:e,index:t,isLastStep:n,setTooltipRef:r,size:o,step:i}=this.props,{back:s,close:a,last:l,next:u,nextLabelWithProgress:f,skip:c}=i.locale,d=ke(s),p=ke(a),h=ke(l),v=ke(u),S=ke(c);let y=a,m=p;if(e){if(y=u,m=v,i.showProgress&&!n){const E=ke(f,{step:t+1,steps:o});y=bn(f,t+1,o),m=E}n&&(y=l,m=h)}return{backProps:{"aria-label":d,children:s,"data-action":"back",onClick:this.handleClickBack,role:"button",title:d},closeProps:{"aria-label":p,children:a,"data-action":"close",onClick:this.handleClickClose,role:"button",title:p},primaryProps:{"aria-label":m,children:y,"data-action":"primary",onClick:this.handleClickPrimary,role:"button",title:m},skipProps:{"aria-label":S,children:c,"data-action":"skip",onClick:this.handleClickSkip,role:"button",title:S},tooltipProps:{"aria-modal":!0,ref:r,role:"alertdialog"}}})}render(){const{continuous:e,index:t,isLastStep:n,setTooltipRef:r,size:o,step:i}=this.props,{beaconComponent:s,tooltipComponent:a,...l}=i;let u;if(a){const f={...this.getElementsProps(),continuous:e,index:t,isLastStep:n,size:o,step:l,setTooltipRef:r},c=a;u=b.createElement(c,{...f})}else u=b.createElement(ql,{...this.getElementsProps(),continuous:e,index:t,isLastStep:n,size:o,step:i});return u}},Vl=class extends b.Component{constructor(){super(...arguments),N(this,"scope",null),N(this,"tooltip",null),N(this,"handleClickHoverBeacon",e=>{const{step:t,store:n}=this.props;e.type==="mouseenter"&&t.event!=="hover"||n.update({lifecycle:A.TOOLTIP})}),N(this,"setTooltipRef",e=>{this.tooltip=e}),N(this,"setPopper",(e,t)=>{var n;const{action:r,lifecycle:o,step:i,store:s}=this.props;t==="wrapper"?s.setPopper("beacon",e):s.setPopper("tooltip",e),s.getPopper("beacon")&&(s.getPopper("tooltip")||i.placement==="center")&&o===A.INIT&&s.update({action:r,lifecycle:A.READY}),(n=i.floaterProps)!=null&&n.getPopper&&i.floaterProps.getPopper(e,t)}),N(this,"renderTooltip",e=>{const{continuous:t,helpers:n,index:r,size:o,step:i}=this.props;return b.createElement(Gl,{continuous:t,helpers:n,index:r,isLastStep:r+1===o,setTooltipRef:this.setTooltipRef,size:o,step:i,...e})})}componentDidMount(){const{debug:e,index:t}=this.props;Ue({title:`step:${t}`,data:[{key:"props",value:this.props}],debug:e})}componentDidUpdate(e){var t;const{action:n,callback:r,continuous:o,controlled:i,debug:s,helpers:a,index:l,lifecycle:u,shouldScroll:f,status:c,step:d,store:p}=this.props,{changed:h,changedFrom:v}=Rt(e,this.props),S=a.info(),y=o&&n!==q.CLOSE&&(l>0||n===q.PREV),m=h("action")||h("index")||h("lifecycle")||h("status"),E=v("lifecycle",[A.TOOLTIP,A.INIT],A.INIT),M=h("action",[q.NEXT,q.PREV,q.SKIP,q.CLOSE]),C=i&&l===e.index;if(M&&(E||C)&&r({...S,index:e.index,lifecycle:A.COMPLETE,step:e.step,type:ye.STEP_AFTER}),d.placement==="center"&&c===L.RUNNING&&h("index")&&n!==q.START&&u===A.INIT&&p.update({lifecycle:A.READY}),m){const O=De(d.target),D=!!O;D&&wl(O)?(v("status",L.READY,L.RUNNING)||v("lifecycle",A.INIT,A.READY))&&r({...S,step:d,type:ye.STEP_BEFORE}):(console.warn(D?"Target not visible":"Target not mounted",d),r({...S,type:ye.TARGET_NOT_FOUND,step:d}),i||p.update({index:l+(n===q.PREV?-1:1)}))}v("lifecycle",A.INIT,A.READY)&&p.update({lifecycle:vr(d)||y?A.TOOLTIP:A.BEACON}),h("index")&&Ue({title:`step:${u}`,data:[{key:"props",value:this.props}],debug:s}),h("lifecycle",A.BEACON)&&r({...S,step:d,type:ye.BEACON}),h("lifecycle",A.TOOLTIP)&&(r({...S,step:d,type:ye.TOOLTIP}),f&&this.tooltip&&(this.scope=new $l(this.tooltip,{selector:"[data-action=primary]"}),this.scope.setFocus())),v("lifecycle",[A.TOOLTIP,A.INIT],A.INIT)&&((t=this.scope)==null||t.removeScope(),p.cleanupPoppers())}componentWillUnmount(){var e;(e=this.scope)==null||e.removeScope()}get open(){const{lifecycle:e,step:t}=this.props;return vr(t)||e===A.TOOLTIP}render(){const{continuous:e,debug:t,index:n,nonce:r,shouldScroll:o,size:i,step:s}=this.props,a=De(s.target);return!vo(s)||!x.domElement(a)?null:b.createElement("div",{key:`JoyrideStep-${n}`,className:"react-joyride__step"},b.createElement(xn,{...s.floaterProps,component:this.renderTooltip,debug:t,getPopper:this.setPopper,id:`react-joyride-step-${n}`,open:this.open,placement:s.placement,target:s.target},b.createElement(Hl,{beaconComponent:s.beaconComponent,continuous:e,index:n,isLastStep:n+1===i,locale:s.locale,nonce:r,onClickOrHover:this.handleClickHoverBeacon,shouldFocus:o,size:i,step:s,styles:s.styles})))}},bo=class extends b.Component{constructor(e){super(e),N(this,"helpers"),N(this,"store"),N(this,"callback",s=>{const{callback:a}=this.props;x.function(a)&&a(s)}),N(this,"handleKeyboard",s=>{const{index:a,lifecycle:l}=this.state,{steps:u}=this.props,f=u[a];l===A.TOOLTIP&&s.code==="Escape"&&f&&!f.disableCloseOnEsc&&this.store.close("keyboard")}),N(this,"handleClickOverlay",()=>{const{index:s}=this.state,{steps:a}=this.props;Ge(this.props,a[s]).disableOverlayClose||this.helpers.close("overlay")}),N(this,"syncState",s=>{this.setState(s)});const{debug:t,getHelpers:n,run:r=!0,stepIndex:o}=e;this.store=_l({...e,controlled:r&&x.number(o)}),this.helpers=this.store.getHelpers();const{addListener:i}=this.store;Ue({title:"init",data:[{key:"props",value:this.props},{key:"state",value:this.state}],debug:t}),i(this.syncState),n&&n(this.helpers),this.state=this.store.getState()}componentDidMount(){if(!_e())return;const{debug:e,disableCloseOnEsc:t,run:n,steps:r}=this.props,{start:o}=this.store;wr(r,e)&&n&&o(),t||document.body.addEventListener("keydown",this.handleKeyboard,{passive:!0})}componentDidUpdate(e,t){if(!_e())return;const{action:n,controlled:r,index:o,status:i}=this.state,{debug:s,run:a,stepIndex:l,steps:u}=this.props,{stepIndex:f,steps:c}=e,{reset:d,setSteps:p,start:h,stop:v,update:S}=this.store,{changed:y}=Rt(e,this.props),{changed:m,changedFrom:E}=Rt(t,this.state),M=Ge(this.props,u[o]),C=!re(c,u),O=x.number(l)&&y("stepIndex"),D=De(M.target);if(C&&(wr(u,s)?p(u):console.warn("Steps are not valid",u)),y("run")&&(a?h(l):v()),O){let $=x.number(f)&&f=0?v:0,r===L.RUNNING&&El(v,{element:h,duration:s}).then(()=>{setTimeout(()=>{var m;(m=this.store.getPopper("tooltip"))==null||m.instance.update()},10)})}}render(){if(!_e())return null;const{index:e,lifecycle:t,status:n}=this.state,{continuous:r=!1,debug:o=!1,nonce:i,scrollToFirstStep:s=!1,steps:a}=this.props,l=n===L.RUNNING,u={};if(l&&a[e]){const f=Ge(this.props,a[e]);u.step=b.createElement(Vl,{...this.state,callback:this.callback,continuous:r,debug:o,helpers:this.helpers,nonce:i,shouldScroll:!f.disableScrolling&&(e!==0||s),step:f,store:this.store}),u.overlay=b.createElement(Ll,{id:"react-joyride-portal"},b.createElement(Bl,{...f,continuous:r,debug:o,lifecycle:t,onClickOverlay:this.handleClickOverlay}))}return b.createElement("div",{className:"react-joyride"},u.step,u.overlay)}};N(bo,"defaultProps",Dl);var rf=bo;function Kl(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const Zl={},ht={};function He(e,t){try{const r=(Zl[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return r in ht?ht[r]:Sr(r,r.split(":"))}catch{if(e in ht)return ht[e];const n=e?.match(Jl);return n?Sr(e,n.slice(1)):NaN}}const Jl=/([+-]\d\d):?(\d\d)?/;function Sr(e,t){const n=+(t[0]||0),r=+(t[1]||0),o=+(t[2]||0)/60;return ht[e]=n*60+r>0?n*60+r+o:n*60-r-o}class Me extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(He(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),wo(this),wn(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new Me(...n,t):new Me(Date.now(),t)}withTimeZone(t){return new Me(+this,t)}getTimezoneOffset(){const t=-He(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),wn(this),+this}[Symbol.for("constructDateFrom")](t){return new Me(+new Date(t),this.timeZone)}}const Er=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Er.test(e))return;const t=e.replace(Er,"$1UTC");Me.prototype[t]&&(e.startsWith("get")?Me.prototype[e]=function(){return this.internal[t]()}:(Me.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Xl(this),+this},Me.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),wn(this),+this}))});function wn(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-He(e.timeZone,e)*60))}function Xl(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),wo(e)}function wo(e){const t=He(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const o=-new Date(+e).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),s=o-i,a=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();s&&a&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+s);const l=o-n;l&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);const u=new Date(+e);u.setUTCSeconds(0);const f=o>0?u.getSeconds():(u.getSeconds()-60)%60,c=Math.round(-(He(e.timeZone,e)*60))%60;(c||f)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+c),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+c+f));const d=He(e.timeZone,e),p=d>0?Math.floor(d):Math.ceil(d),v=-new Date(+e).getTimezoneOffset()-p,S=p!==n,y=v-l;if(S&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const m=He(e.timeZone,e),E=m>0?Math.floor(m):Math.ceil(m),M=p-E;M&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+M))}}class Ie extends Me{static tz(t,...n){return n.length?new Ie(...n,t):new Ie(Date.now(),t)}toISOString(){const[t,n,r]=this.tzComponents(),o=`${t}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,r,o]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${r} ${n} ${o}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,r,o]=this.tzComponents();return`${t} GMT${n}${r}${o} (${Kl(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",r=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),o=String(Math.abs(t)%60).padStart(2,"0");return[n,r,o]}withTimeZone(t){return new Ie(+this,t)}[Symbol.for("constructDateFrom")](t){return new Ie(+new Date(t),this.timeZone)}}const kr=5,Ql=4;function ec(e,t){const n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,o=t.addDays(e,-r+1),i=t.addDays(o,kr*7-1);return t.getMonth(e)===t.getMonth(i)?kr:Ql}function Oo(e,t){const n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function tc(e,t){const n=Oo(e,t),r=ec(e,t);return t.addDays(n,r*7-1)}const nc={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},rc=(e,t,n)=>{let r;const o=nc[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},oc={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},ic={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},sc={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},ac={date:Vt({formats:oc,defaultWidth:"full"}),time:Vt({formats:ic,defaultWidth:"full"}),dateTime:Vt({formats:sc,defaultWidth:"full"})};function Cr(e,t,n){const r="eeee p";return vi(e,t,n)?r:e.getTime()>t.getTime()?"'下个'"+r:"'上个'"+r}const lc={lastWeek:Cr,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Cr,other:"PP p"},cc=(e,t,n,r)=>{const o=lc[e];return typeof o=="function"?o(t,n,r):o},uc={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},fc={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},dc={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},pc={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},hc={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},mc={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},yc=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},vc={ordinalNumber:yc,era:ot({values:uc,defaultWidth:"wide"}),quarter:ot({values:fc,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ot({values:dc,defaultWidth:"wide"}),day:ot({values:pc,defaultWidth:"wide"}),dayPeriod:ot({values:hc,defaultWidth:"wide",formattingValues:mc,defaultFormattingWidth:"wide"})},gc=/^(第\s*)?\d+(日|时|分|秒)?/i,bc=/\d+/i,wc={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},Oc={any:[/^(前)/i,/^(公元)/i]},Sc={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Ec={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},kc={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Cc={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},Tc={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Mc={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Pc={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},xc={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},Nc={ordinalNumber:gi({matchPattern:gc,parsePattern:bc,valueCallback:e=>parseInt(e,10)}),era:it({matchPatterns:wc,defaultMatchWidth:"wide",parsePatterns:Oc,defaultParseWidth:"any"}),quarter:it({matchPatterns:Sc,defaultMatchWidth:"wide",parsePatterns:Ec,defaultParseWidth:"any",valueCallback:e=>e+1}),month:it({matchPatterns:kc,defaultMatchWidth:"wide",parsePatterns:Cc,defaultParseWidth:"any"}),day:it({matchPatterns:Tc,defaultMatchWidth:"wide",parsePatterns:Mc,defaultParseWidth:"any"}),dayPeriod:it({matchPatterns:Pc,defaultMatchWidth:"any",parsePatterns:xc,defaultParseWidth:"any"})},of={code:"zh-CN",formatDistance:rc,formatLong:ac,formatRelative:cc,localize:vc,match:Nc,options:{weekStartsOn:1,firstWeekContainsDate:4}},So={...st,labels:{labelDayButton:(e,t,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(s,a)=>pt(s,a,{locale:st,...n});let i=o(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,i)=>pt(o,i,{locale:st,...t}),r(e,"LLLL yyyy")},labelGridcell:(e,t,n,r)=>{let o;r&&typeof r.format=="function"?o=r.format.bind(r):o=(s,a)=>pt(s,a,{locale:st,...n});let i=o(e,"PPPP");return t?.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(o,i)=>pt(o,i,{locale:st,...t}),r(e,"cccc")}}};class ce{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Ie.tz(this.options.timeZone):new this.Date,this.newDate=(r,o,i)=>this.overrides?.newDate?this.overrides.newDate(r,o,i):this.options.timeZone?new Ie(r,o,i,this.options.timeZone):new Date(r,o,i),this.addDays=(r,o)=>this.overrides?.addDays?this.overrides.addDays(r,o):bi(r,o),this.addMonths=(r,o)=>this.overrides?.addMonths?this.overrides.addMonths(r,o):wi(r,o),this.addWeeks=(r,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,o):Oi(r,o),this.addYears=(r,o)=>this.overrides?.addYears?this.overrides.addYears(r,o):Si(r,o),this.differenceInCalendarDays=(r,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,o):Ei(r,o),this.differenceInCalendarMonths=(r,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,o):ki(r,o),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Ci(r),this.eachYearOfInterval=r=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Ti(r),i=new Set(o.map(a=>this.getYear(a)));if(i.size===o.length)return o;const s=[];return i.forEach(a=>{s.push(new Date(a,0,1))}),s},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):tc(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):Mi(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Pi(r),this.endOfWeek=(r,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,o):xi(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):Ni(r),this.format=(r,o,i)=>{const s=this.overrides?.format?this.overrides.format(r,o,this.options):pt(r,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(s):s},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Di(r),this.getMonth=(r,o)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Ii(r,this.options),this.getYear=(r,o)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Wi(r,this.options),this.getWeek=(r,o)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):Ri(r,this.options),this.isAfter=(r,o)=>this.overrides?.isAfter?this.overrides.isAfter(r,o):Ai(r,o),this.isBefore=(r,o)=>this.overrides?.isBefore?this.overrides.isBefore(r,o):_i(r,o),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Fi(r),this.isSameDay=(r,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,o):ji(r,o),this.isSameMonth=(r,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,o):Bi(r,o),this.isSameYear=(r,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,o):Li(r,o),this.max=r=>this.overrides?.max?this.overrides.max(r):$i(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Hi(r),this.setMonth=(r,o)=>this.overrides?.setMonth?this.overrides.setMonth(r,o):zi(r,o),this.setYear=(r,o)=>this.overrides?.setYear?this.overrides.setYear(r,o):Ui(r,o),this.startOfBroadcastWeek=(r,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Oo(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):Yi(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):qi(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):Gi(r),this.startOfWeek=(r,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Vi(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):Ki(r),this.options={locale:So,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),r={};for(let o=0;o<10;o++)r[o.toString()]=n.format(o);return r}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,r=>n[r]||r)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&ce.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:r,numerals:o}=this.options,i=n?.code;if(i&&ce.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:o}).format(t)}catch{}const s=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,s)}}ce.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Pe=new ce;class Eo{constructor(t,n,r=Pe){this.date=t,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(t,n)),this.dateLib=r,this.isoDate=r.format(t,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class Dc{constructor(t,n){this.date=t,this.weeks=n}}class Ic{constructor(t,n){this.days=n,this.weekNumber=t}}function Wc(e){return w.createElement("button",{...e})}function Rc(e){return w.createElement("span",{...e})}function Ac(e){const{size:t=24,orientation:n="left",className:r}=e;return w.createElement("svg",{className:r,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&w.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&w.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&w.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&w.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function _c(e){const{day:t,modifiers:n,...r}=e;return w.createElement("td",{...r})}function Fc(e){const{day:t,modifiers:n,...r}=e,o=w.useRef(null);return w.useEffect(()=>{n.focused&&o.current?.focus()},[n.focused]),w.createElement("button",{ref:o,...r})}var I;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(I||(I={}));var J;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(J||(J={}));var ge;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(ge||(ge={}));var le;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(le||(le={}));function jc(e){const{options:t,className:n,components:r,classNames:o,...i}=e,s=[o[I.Dropdown],n].join(" "),a=t?.find(({value:l})=>l===i.value);return w.createElement("span",{"data-disabled":i.disabled,className:o[I.DropdownRoot]},w.createElement(r.Select,{className:s,...i},t?.map(({value:l,label:u,disabled:f})=>w.createElement(r.Option,{key:l,value:l,disabled:f},u))),w.createElement("span",{className:o[I.CaptionLabel],"aria-hidden":!0},a?.label,w.createElement(r.Chevron,{orientation:"down",size:18,className:o[I.Chevron]})))}function Bc(e){return w.createElement("div",{...e})}function Lc(e){return w.createElement("div",{...e})}function $c(e){const{calendarMonth:t,displayIndex:n,...r}=e;return w.createElement("div",{...r},e.children)}function Hc(e){const{calendarMonth:t,displayIndex:n,...r}=e;return w.createElement("div",{...r})}function zc(e){return w.createElement("table",{...e})}function Uc(e){return w.createElement("div",{...e})}const ko=b.createContext(void 0);function Mt(){const e=b.useContext(ko);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Yc(e){const{components:t}=Mt();return w.createElement(t.Dropdown,{...e})}function qc(e){const{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:o,...i}=e,{components:s,classNames:a,labels:{labelPrevious:l,labelNext:u}}=Mt(),f=b.useCallback(d=>{o&&n?.(d)},[o,n]),c=b.useCallback(d=>{r&&t?.(d)},[r,t]);return w.createElement("nav",{...i},w.createElement(s.PreviousMonthButton,{type:"button",className:a[I.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":l(r),onClick:c},w.createElement(s.Chevron,{disabled:r?void 0:!0,className:a[I.Chevron],orientation:"left"})),w.createElement(s.NextMonthButton,{type:"button",className:a[I.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":u(o),onClick:f},w.createElement(s.Chevron,{disabled:o?void 0:!0,orientation:"right",className:a[I.Chevron]})))}function Gc(e){const{components:t}=Mt();return w.createElement(t.Button,{...e})}function Vc(e){return w.createElement("option",{...e})}function Kc(e){const{components:t}=Mt();return w.createElement(t.Button,{...e})}function Zc(e){const{rootRef:t,...n}=e;return w.createElement("div",{...n,ref:t})}function Jc(e){return w.createElement("select",{...e})}function Xc(e){const{week:t,...n}=e;return w.createElement("tr",{...n})}function Qc(e){return w.createElement("th",{...e})}function eu(e){return w.createElement("thead",{"aria-hidden":!0},w.createElement("tr",{...e}))}function tu(e){const{week:t,...n}=e;return w.createElement("th",{...n})}function nu(e){return w.createElement("th",{...e})}function ru(e){return w.createElement("tbody",{...e})}function ou(e){const{components:t}=Mt();return w.createElement(t.Dropdown,{...e})}const iu=Object.freeze(Object.defineProperty({__proto__:null,Button:Wc,CaptionLabel:Rc,Chevron:Ac,Day:_c,DayButton:Fc,Dropdown:jc,DropdownNav:Bc,Footer:Lc,Month:$c,MonthCaption:Hc,MonthGrid:zc,Months:Uc,MonthsDropdown:Yc,Nav:qc,NextMonthButton:Gc,Option:Vc,PreviousMonthButton:Kc,Root:Zc,Select:Jc,Week:Xc,WeekNumber:tu,WeekNumberHeader:nu,Weekday:Qc,Weekdays:eu,Weeks:ru,YearsDropdown:ou},Symbol.toStringTag,{value:"Module"}));function We(e,t,n=!1,r=Pe){let{from:o,to:i}=e;const{differenceInCalendarDays:s,isSameDay:a}=r;return o&&i?(s(i,o)<0&&([o,i]=[i,o]),s(t,o)>=(n?1:0)&&s(i,t)>=(n?1:0)):!n&&i?a(i,t):!n&&o?a(o,t):!1}function Nn(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Ht(e){return!!(e&&typeof e=="object"&&"from"in e)}function Dn(e){return!!(e&&typeof e=="object"&&"after"in e)}function In(e){return!!(e&&typeof e=="object"&&"before"in e)}function Co(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function To(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Re(e,t,n=Pe){const r=Array.isArray(t)?t:[t],{isSameDay:o,differenceInCalendarDays:i,isAfter:s}=n;return r.some(a=>{if(typeof a=="boolean")return a;if(n.isDate(a))return o(e,a);if(To(a,n))return a.some(l=>o(e,l));if(Ht(a))return We(a,e,!1,n);if(Co(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(e.getDay()):a.dayOfWeek===e.getDay();if(Nn(a)){const l=i(a.before,e),u=i(a.after,e),f=l>0,c=u<0;return s(a.before,a.after)?c&&f:f||c}return Dn(a)?i(e,a.after)>0:In(a)?i(a.before,e)>0:typeof a=="function"?a(e):!1})}function su(e,t,n,r,o){const{disabled:i,hidden:s,modifiers:a,showOutsideDays:l,broadcastCalendar:u,today:f=o.today()}=t,{isSameDay:c,isSameMonth:d,startOfMonth:p,isBefore:h,endOfMonth:v,isAfter:S}=o,y=n&&p(n),m=r&&v(r),E={[J.focused]:[],[J.outside]:[],[J.disabled]:[],[J.hidden]:[],[J.today]:[]},M={};for(const C of e){const{date:O,displayMonth:D}=C,j=!!(D&&!d(O,D)),Z=!!(y&&h(O,y)),$=!!(m&&S(O,m)),oe=!!(i&&Re(O,i,o)),ue=!!(s&&Re(O,s,o))||Z||$||!u&&!l&&j||u&&l===!1&&j,fe=c(O,f);j&&E.outside.push(C),oe&&E.disabled.push(C),ue&&E.hidden.push(C),fe&&E.today.push(C),a&&Object.keys(a).forEach(X=>{const de=a?.[X];de&&Re(O,de,o)&&(M[X]?M[X].push(C):M[X]=[C])})}return C=>{const O={[J.focused]:!1,[J.disabled]:!1,[J.hidden]:!1,[J.outside]:!1,[J.today]:!1},D={};for(const j in E){const Z=E[j];O[j]=Z.some($=>$===C)}for(const j in M)D[j]=M[j].some(Z=>Z===C);return{...O,...D}}}function au(e,t,n={}){return Object.entries(e).filter(([,o])=>o===!0).reduce((o,[i])=>(n[i]?o.push(n[i]):t[J[i]]?o.push(t[J[i]]):t[ge[i]]&&o.push(t[ge[i]]),o),[t[I.Day]])}function lu(e){return{...iu,...e}}function cu(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(t[n]=r)}),t}function uu(){const e={};for(const t in I)e[I[t]]=`rdp-${I[t]}`;for(const t in J)e[J[t]]=`rdp-${J[t]}`;for(const t in ge)e[ge[t]]=`rdp-${ge[t]}`;for(const t in le)e[le[t]]=`rdp-${le[t]}`;return e}function Mo(e,t,n){return(n??new ce(t)).formatMonthYear(e)}const fu=Mo;function du(e,t,n){return(n??new ce(t)).format(e,"d")}function pu(e,t=Pe){return t.format(e,"LLLL")}function hu(e,t,n){return(n??new ce(t)).format(e,"cccccc")}function mu(e,t=Pe){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function yu(){return""}function Po(e,t=Pe){return t.format(e,"yyyy")}const vu=Po,gu=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Mo,formatDay:du,formatMonthCaption:fu,formatMonthDropdown:pu,formatWeekNumber:mu,formatWeekNumberHeader:yu,formatWeekdayName:hu,formatYearCaption:vu,formatYearDropdown:Po},Symbol.toStringTag,{value:"Module"}));function bu(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...gu,...e}}function Wn(e,t,n,r){let o=(r??new ce(n)).format(e,"PPPP");return t.today&&(o=`Today, ${o}`),t.selected&&(o=`${o}, selected`),o}const wu=Wn;function Rn(e,t,n){return(n??new ce(t)).formatMonthYear(e)}const Ou=Rn;function xo(e,t,n,r){let o=(r??new ce(n)).format(e,"PPPP");return t?.today&&(o=`Today, ${o}`),o}function No(e){return"Choose the Month"}function Do(){return""}const Su="Go to the Next Month";function Io(e,t){return Su}function Wo(e){return"Go to the Previous Month"}function Ro(e,t,n){return(n??new ce(t)).format(e,"cccc")}function Ao(e,t){return`Week ${e}`}function _o(e){return"Week Number"}function Fo(e){return"Choose the Year"}const Eu=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:Ou,labelDay:wu,labelDayButton:Wn,labelGrid:Rn,labelGridcell:xo,labelMonthDropdown:No,labelNav:Do,labelNext:Io,labelPrevious:Wo,labelWeekNumber:Ao,labelWeekNumberHeader:_o,labelWeekday:Ro,labelYearDropdown:Fo},Symbol.toStringTag,{value:"Module"})),me=(e,t,n)=>t||(n?typeof n=="function"?n:(...r)=>n:e);function ku(e,t){const n=t.locale?.labels??{};return{...Eu,...e??{},labelDayButton:me(Wn,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:me(No,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:me(Io,e?.labelNext,n.labelNext),labelPrevious:me(Wo,e?.labelPrevious,n.labelPrevious),labelWeekNumber:me(Ao,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:me(Fo,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:me(Rn,e?.labelGrid,n.labelGrid),labelGridcell:me(xo,e?.labelGridcell,n.labelGridcell),labelNav:me(Do,e?.labelNav,n.labelNav),labelWeekNumberHeader:me(_o,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:me(Ro,e?.labelWeekday,n.labelWeekday)}}function Cu(e,t,n,r,o){const{startOfMonth:i,startOfYear:s,endOfYear:a,eachMonthOfInterval:l,getMonth:u}=o;return l({start:s(e),end:a(e)}).map(d=>{const p=r.formatMonthDropdown(d,o),h=u(d),v=t&&di(n)||!1;return{value:h,label:p,disabled:v}})}function Tu(e,t={},n={}){let r={...t?.[I.Day]};return Object.entries(e).filter(([,o])=>o===!0).forEach(([o])=>{r={...r,...n?.[o]}}),r}function Mu(e,t,n,r){const o=r??e.today(),i=n?e.startOfBroadcastWeek(o,e):t?e.startOfISOWeek(o):e.startOfWeek(o),s=[];for(let a=0;a<7;a++){const l=e.addDays(i,a);s.push(l)}return s}function Pu(e,t,n,r,o=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:s,eachYearOfInterval:a,getYear:l}=r,u=i(e),f=s(t),c=a({start:u,end:f});return o&&c.reverse(),c.map(d=>{const p=n.formatYearDropdown(d,r);return{value:l(d),label:p,disabled:!1}})}const Pt=e=>e instanceof HTMLElement?e:null,ln=e=>[...e.querySelectorAll("[data-animated-month]")??[]],xu=e=>Pt(e.querySelector("[data-animated-month]")),cn=e=>Pt(e.querySelector("[data-animated-caption]")),un=e=>Pt(e.querySelector("[data-animated-weeks]")),Nu=e=>Pt(e.querySelector("[data-animated-nav]")),Du=e=>Pt(e.querySelector("[data-animated-weekdays]"));function Iu(e,t,{classNames:n,months:r,focused:o,dateLib:i}){const s=b.useRef(null),a=b.useRef(r),l=b.useRef(!1);b.useLayoutEffect(()=>{const u=a.current;if(a.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const f=i.isSameMonth(r[0].date,u[0].date),c=i.isAfter(r[0].date,u[0].date),d=c?n[le.caption_after_enter]:n[le.caption_before_enter],p=c?n[le.weeks_after_enter]:n[le.weeks_before_enter],h=s.current,v=e.current.cloneNode(!0);if(v instanceof HTMLElement?(ln(v).forEach(E=>{if(!(E instanceof HTMLElement))return;const M=xu(E);M&&E.contains(M)&&E.removeChild(M);const C=cn(E);C&&C.classList.remove(d);const O=un(E);O&&O.classList.remove(p)}),s.current=v):s.current=null,l.current||f||o)return;const S=h instanceof HTMLElement?ln(h):[],y=ln(e.current);if(y?.every(m=>m instanceof HTMLElement)&&S&&S.every(m=>m instanceof HTMLElement)){l.current=!0,e.current.style.isolation="isolate";const m=Nu(e.current);m&&(m.style.zIndex="1"),y.forEach((E,M)=>{const C=S[M];if(!C)return;E.style.position="relative",E.style.overflow="hidden";const O=cn(E);O&&O.classList.add(d);const D=un(E);D&&D.classList.add(p);const j=()=>{l.current=!1,e.current&&(e.current.style.isolation=""),m&&(m.style.zIndex=""),O&&O.classList.remove(d),D&&D.classList.remove(p),E.style.position="",E.style.overflow="",E.contains(C)&&E.removeChild(C)};C.style.pointerEvents="none",C.style.position="absolute",C.style.overflow="hidden",C.setAttribute("aria-hidden","true");const Z=Du(C);Z&&(Z.style.opacity="0");const $=cn(C);$&&($.classList.add(c?n[le.caption_before_exit]:n[le.caption_after_exit]),$.addEventListener("animationend",j));const oe=un(C);oe&&oe.classList.add(c?n[le.weeks_before_exit]:n[le.weeks_after_exit]),E.insertBefore(C,E.firstChild)})}})}function Wu(e,t,n,r){const o=e[0],i=e[e.length-1],{ISOWeek:s,fixedWeeks:a,broadcastCalendar:l}=n??{},{addDays:u,differenceInCalendarDays:f,differenceInCalendarMonths:c,endOfBroadcastWeek:d,endOfISOWeek:p,endOfMonth:h,endOfWeek:v,isAfter:S,startOfBroadcastWeek:y,startOfISOWeek:m,startOfWeek:E}=r,M=l?y(o,r):s?m(o):E(o),C=l?d(i):s?p(h(i)):v(h(i)),O=t&&(l?d(t):s?p(t):v(t)),D=O&&S(C,O)?O:C,j=f(D,M),Z=c(i,o)+1,$=[];for(let fe=0;fe<=j;fe++){const X=u(M,fe);$.push(X)}const ue=(l?35:42)*Z;if(a&&$.length{const o=r.weeks.reduce((i,s)=>i.concat(s.days.slice()),t.slice());return n.concat(o.slice())},t.slice())}function Au(e,t,n,r){const{numberOfMonths:o=1}=n,i=[];for(let s=0;st)break;i.push(a)}return i}function Tr(e,t,n,r){const{month:o,defaultMonth:i,today:s=r.today(),numberOfMonths:a=1}=e;let l=o||i||s;const{differenceInCalendarMonths:u,addMonths:f,startOfMonth:c}=r;if(n&&u(n,l){const y=n.broadcastCalendar?c(S,r):n.ISOWeek?d(S):p(S),m=n.broadcastCalendar?i(S):n.ISOWeek?s(a(S)):l(a(S)),E=t.filter(D=>D>=y&&D<=m),M=n.broadcastCalendar?35:42;if(n.fixedWeeks&&E.length{const Z=M-E.length;return j>m&&j<=o(m,Z)});E.push(...D)}const C=E.reduce((D,j)=>{const Z=n.ISOWeek?u(j):f(j),$=D.find(ue=>ue.weekNumber===Z),oe=new Eo(j,S,r);return $?$.days.push(oe):D.push(new Ic(Z,[oe])),D},[]),O=new Dc(S,C);return v.push(O),v},[]);return n.reverseMonths?h.reverse():h}function Fu(e,t){let{startMonth:n,endMonth:r}=e;const{startOfYear:o,startOfDay:i,startOfMonth:s,endOfMonth:a,addYears:l,endOfYear:u,newDate:f,today:c}=t,{fromYear:d,toYear:p,fromMonth:h,toMonth:v}=e;!n&&h&&(n=h),!n&&d&&(n=t.newDate(d,0,1)),!r&&v&&(r=v),!r&&p&&(r=f(p,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=s(n):d?n=f(d,0,1):!n&&S&&(n=o(l(e.today??c(),-100))),r?r=a(r):p?r=f(p,11,31):!r&&S&&(r=u(e.today??c())),[n&&i(n),r&&i(r)]}function ju(e,t,n,r){if(n.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:i=1}=n,{startOfMonth:s,addMonths:a,differenceInCalendarMonths:l}=r,u=o?i:1,f=s(e);if(!t)return a(f,u);if(!(l(t,e)n.concat(r.weeks.slice()),t.slice())}function zt(e,t){const[n,r]=b.useState(e);return[t===void 0?n:t,r]}function $u(e,t){const[n,r]=Fu(e,t),{startOfMonth:o,endOfMonth:i}=t,s=Tr(e,n,r,t),[a,l]=zt(s,e.month?s:void 0);b.useEffect(()=>{const M=Tr(e,n,r,t);l(M)},[e.timeZone]);const{months:u,weeks:f,days:c,previousMonth:d,nextMonth:p}=b.useMemo(()=>{const M=Au(a,r,{numberOfMonths:e.numberOfMonths},t),C=Wu(M,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),O=_u(M,C,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),D=Lu(O),j=Ru(O),Z=Bu(a,n,e,t),$=ju(a,r,e,t);return{months:O,weeks:D,days:j,previousMonth:Z,nextMonth:$}},[t,a.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:h,onMonthChange:v}=e,S=M=>f.some(C=>C.days.some(O=>O.isEqualTo(M))),y=M=>{if(h)return;let C=o(M);n&&Co(r)&&(C=o(r)),l(C),v?.(C)};return{months:u,weeks:f,days:c,navStart:n,navEnd:r,previousMonth:d,nextMonth:p,goToMonth:y,goToDay:M=>{S(M)||y(M.date)}}}var Se;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(Se||(Se={}));function Mr(e){return!e[J.disabled]&&!e[J.hidden]&&!e[J.outside]}function Hu(e,t,n,r){let o,i=-1;for(const s of e){const a=t(s);Mr(a)&&(a[J.focused]&&iMr(t(s)))),o}function zu(e,t,n,r,o,i,s){const{ISOWeek:a,broadcastCalendar:l}=i,{addDays:u,addMonths:f,addWeeks:c,addYears:d,endOfBroadcastWeek:p,endOfISOWeek:h,endOfWeek:v,max:S,min:y,startOfBroadcastWeek:m,startOfISOWeek:E,startOfWeek:M}=s;let O={day:u,week:c,month:f,year:d,startOfWeek:D=>l?m(D,s):a?E(D):M(D),endOfWeek:D=>l?p(D):a?h(D):v(D)}[e](n,t==="after"?1:-1);return t==="before"&&r?O=S([r,O]):t==="after"&&o&&(O=y([o,O])),O}function jo(e,t,n,r,o,i,s,a=0){if(a>365)return;const l=zu(e,t,n.date,r,o,i,s),u=!!(i.disabled&&Re(l,i.disabled,s)),f=!!(i.hidden&&Re(l,i.hidden,s)),c=l,d=new Eo(l,c,s);return!u&&!f?d:jo(e,t,d,r,o,i,s,a+1)}function Uu(e,t,n,r,o){const{autoFocus:i}=e,[s,a]=b.useState(),l=Hu(t.days,n,r||(()=>!1),s),[u,f]=b.useState(i?l:void 0);return{isFocusTarget:v=>!!l?.isEqualTo(v),setFocused:f,focused:u,blur:()=>{a(u),f(void 0)},moveFocus:(v,S)=>{if(!u)return;const y=jo(v,S,u,t.navStart,t.navEnd,e,o);y&&(e.disableNavigation&&!t.days.some(E=>E.isEqualTo(y))||(t.goToDay(y),f(y)))}}}function Yu(e,t){const{selected:n,required:r,onSelect:o}=e,[i,s]=zt(n,o?n:void 0),a=o?n:i,{isSameDay:l}=t,u=p=>a?.some(h=>l(h,p))??!1,{min:f,max:c}=e;return{selected:a,select:(p,h,v)=>{let S=[...a??[]];if(u(p)){if(a?.length===f||r&&a?.length===1)return;S=a?.filter(y=>!l(y,p))}else a?.length===c?S=[p]:S=[...S,p];return o||s(S),o?.(S,p,h,v),S},isSelected:u}}function qu(e,t,n=0,r=0,o=!1,i=Pe){const{from:s,to:a}=t||{},{isSameDay:l,isAfter:u,isBefore:f}=i;let c;if(!s&&!a)c={from:e,to:n>0?void 0:e};else if(s&&!a)l(s,e)?n===0?c={from:s,to:e}:o?c={from:s,to:void 0}:c=void 0:f(e,s)?c={from:e,to:s}:c={from:s,to:e};else if(s&&a)if(l(s,e)&&l(a,e))o?c={from:s,to:a}:c=void 0;else if(l(s,e))c={from:s,to:n>0?void 0:e};else if(l(a,e))c={from:e,to:n>0?void 0:e};else if(f(e,s))c={from:e,to:a};else if(u(e,s))c={from:s,to:e};else if(u(e,a))c={from:s,to:e};else throw new Error("Invalid range");if(c?.from&&c?.to){const d=i.differenceInCalendarDays(c.to,c.from);r>0&&d>r?c={from:e,to:void 0}:n>1&&dtypeof a!="function").some(a=>typeof a=="boolean"?a:n.isDate(a)?We(e,a,!1,n):To(a,n)?a.some(l=>We(e,l,!1,n)):Ht(a)?a.from&&a.to?Pr(e,{from:a.from,to:a.to},n):!1:Co(a)?Gu(e,a.dayOfWeek,n):Nn(a)?n.isAfter(a.before,a.after)?Pr(e,{from:n.addDays(a.after,1),to:n.addDays(a.before,-1)},n):Re(e.from,a,n)||Re(e.to,a,n):Dn(a)||In(a)?Re(e.from,a,n)||Re(e.to,a,n):!1))return!0;const s=r.filter(a=>typeof a=="function");if(s.length){let a=e.from;const l=n.differenceInCalendarDays(e.to,e.from);for(let u=0;u<=l;u++){if(s.some(f=>f(a)))return!0;a=n.addDays(a,1)}}return!1}function Ku(e,t){const{disabled:n,excludeDisabled:r,selected:o,required:i,onSelect:s}=e,[a,l]=zt(o,s?o:void 0),u=s?o:a;return{selected:u,select:(d,p,h)=>{const{min:v,max:S}=e,y=d?qu(d,u,v,S,i,t):void 0;return r&&n&&y?.from&&y.to&&Vu({from:y.from,to:y.to},n,t)&&(y.from=d,y.to=void 0),s||l(y),s?.(y,d,p,h),y},isSelected:d=>u&&We(u,d,!1,t)}}function Zu(e,t){const{selected:n,required:r,onSelect:o}=e,[i,s]=zt(n,o?n:void 0),a=o?n:i,{isSameDay:l}=t;return{selected:a,select:(c,d,p)=>{let h=c;return!r&&a&&a&&l(c,a)&&(h=void 0),o||s(h),o?.(h,c,d,p),h},isSelected:c=>a?l(a,c):!1}}function Ju(e,t){const n=Zu(e,t),r=Yu(e,t),o=Ku(e,t);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return o;default:return}}function ee(e,t){return e instanceof Ie&&e.timeZone===t?e:new Ie(e,t)}function xr(e,t){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?ee(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?ee(n,t):n):Ht(e)?{...e,from:e.from?ee(e.from,t):e.from,to:e.to?ee(e.to,t):e.to}:Nn(e)?{before:ee(e.before,t),after:ee(e.after,t)}:Dn(e)?{after:ee(e.after,t)}:In(e)?{before:ee(e.before,t)}:e}function fn(e,t){return e&&(Array.isArray(e)?e.map(n=>xr(n,t)):xr(e,t))}function sf(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=ee(t.today,n)),t.month&&(t.month=ee(t.month,n)),t.defaultMonth&&(t.defaultMonth=ee(t.defaultMonth,n)),t.startMonth&&(t.startMonth=ee(t.startMonth,n)),t.endMonth&&(t.endMonth=ee(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=ee(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(F=>ee(F,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?ee(t.selected.from,n):t.selected.from,to:t.selected.to?ee(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=fn(t.disabled,n)),t.hidden!==void 0&&(t.hidden=fn(t.hidden,n)),t.modifiers)){const F={};Object.keys(t.modifiers).forEach(Y=>{F[Y]=fn(t.modifiers?.[Y],n)}),t.modifiers=F}const{components:r,formatters:o,labels:i,dateLib:s,locale:a,classNames:l}=b.useMemo(()=>{const F={...So,...t.locale},Y=new ce({locale:F,weekStartsOn:t.broadcastCalendar?1:t.weekStartsOn,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},t.dateLib);return{dateLib:Y,components:lu(t.components),formatters:bu(t.formatters),labels:ku(t.labels,Y.options),locale:F,classNames:{...uu(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:s.today()});const{captionLayout:u,mode:f,navLayout:c,numberOfMonths:d=1,onDayBlur:p,onDayClick:h,onDayFocus:v,onDayKeyDown:S,onDayMouseEnter:y,onDayMouseLeave:m,onNextClick:E,onPrevClick:M,showWeekNumber:C,styles:O}=t,{formatCaption:D,formatDay:j,formatMonthDropdown:Z,formatWeekNumber:$,formatWeekNumberHeader:oe,formatWeekdayName:ue,formatYearDropdown:fe}=o,X=$u(t,s),{days:de,months:Ae,navStart:Le,navEnd:qe,previousMonth:ie,nextMonth:se,goToMonth:pe}=X,k=su(de,t,Le,qe,s),{isSelected:R,select:B,selected:W}=Ju(t,s)??{},{blur:U,focused:V,isFocusTarget:ne,moveFocus:Q,setFocused:xe}=Uu(t,X,k,R??(()=>!1),s),{labelDayButton:Bo,labelGridcell:Lo,labelGrid:$o,labelMonthDropdown:Ho,labelNav:An,labelPrevious:zo,labelNext:Uo,labelWeekday:Yo,labelWeekNumber:qo,labelWeekNumberHeader:Go,labelYearDropdown:Vo}=i,Ko=b.useMemo(()=>Mu(s,t.ISOWeek,t.broadcastCalendar,t.today),[s,t.ISOWeek,t.broadcastCalendar,t.today]),_n=f!==void 0||h!==void 0,Ut=b.useCallback(()=>{ie&&(pe(ie),M?.(ie))},[ie,pe,M]),Yt=b.useCallback(()=>{se&&(pe(se),E?.(se))},[pe,se,E]),Zo=b.useCallback((F,Y)=>_=>{_.preventDefault(),_.stopPropagation(),xe(F),!Y.disabled&&(B?.(F.date,Y,_),h?.(F.date,Y,_))},[B,h,xe]),Jo=b.useCallback((F,Y)=>_=>{xe(F),v?.(F.date,Y,_)},[v,xe]),Xo=b.useCallback((F,Y)=>_=>{U(),p?.(F.date,Y,_)},[U,p]),Qo=b.useCallback((F,Y)=>_=>{const G={ArrowLeft:[_.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[_.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[_.shiftKey?"year":"week","after"],ArrowUp:[_.shiftKey?"year":"week","before"],PageUp:[_.shiftKey?"year":"month","before"],PageDown:[_.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(G[_.key]){_.preventDefault(),_.stopPropagation();const[Oe,H]=G[_.key];Q(Oe,H)}S?.(F.date,Y,_)},[Q,S,t.dir]),ei=b.useCallback((F,Y)=>_=>{y?.(F.date,Y,_)},[y]),ti=b.useCallback((F,Y)=>_=>{m?.(F.date,Y,_)},[m]),ni=b.useCallback(F=>Y=>{const _=Number(Y.target.value),G=s.setMonth(s.startOfMonth(F),_);pe(G)},[s,pe]),ri=b.useCallback(F=>Y=>{const _=Number(Y.target.value),G=s.setYear(s.startOfMonth(F),_);pe(G)},[s,pe]),{className:oi,style:ii}=b.useMemo(()=>({className:[l[I.Root],t.className].filter(Boolean).join(" "),style:{...O?.[I.Root],...t.style}}),[l,t.className,t.style,O]),si=cu(t),Fn=b.useRef(null);Iu(Fn,!!t.animate,{classNames:l,months:Ae,focused:V,dateLib:s});const ai={dayPickerProps:t,selected:W,select:B,isSelected:R,months:Ae,nextMonth:se,previousMonth:ie,goToMonth:pe,getModifiers:k,components:r,classNames:l,styles:O,labels:i,formatters:o};return w.createElement(ko.Provider,{value:ai},w.createElement(r.Root,{rootRef:t.animate?Fn:void 0,className:oi,style:ii,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...si},w.createElement(r.Months,{className:l[I.Months],style:O?.[I.Months]},!t.hideNavigation&&!c&&w.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[I.Nav],style:O?.[I.Nav],"aria-label":An(),onPreviousClick:Ut,onNextClick:Yt,previousMonth:ie,nextMonth:se}),Ae.map((F,Y)=>w.createElement(r.Month,{"data-animated-month":t.animate?"true":void 0,className:l[I.Month],style:O?.[I.Month],key:Y,displayIndex:Y,calendarMonth:F},c==="around"&&!t.hideNavigation&&Y===0&&w.createElement(r.PreviousMonthButton,{type:"button",className:l[I.PreviousMonthButton],tabIndex:ie?void 0:-1,"aria-disabled":ie?void 0:!0,"aria-label":zo(ie),onClick:Ut,"data-animated-button":t.animate?"true":void 0},w.createElement(r.Chevron,{disabled:ie?void 0:!0,className:l[I.Chevron],orientation:t.dir==="rtl"?"right":"left"})),w.createElement(r.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:l[I.MonthCaption],style:O?.[I.MonthCaption],calendarMonth:F,displayIndex:Y},u?.startsWith("dropdown")?w.createElement(r.DropdownNav,{className:l[I.Dropdowns],style:O?.[I.Dropdowns]},(()=>{const _=u==="dropdown"||u==="dropdown-months"?w.createElement(r.MonthsDropdown,{key:"month",className:l[I.MonthsDropdown],"aria-label":Ho(),classNames:l,components:r,disabled:!!t.disableNavigation,onChange:ni(F.date),options:Cu(F.date,Le,qe,o,s),style:O?.[I.Dropdown],value:s.getMonth(F.date)}):w.createElement("span",{key:"month"},Z(F.date,s)),G=u==="dropdown"||u==="dropdown-years"?w.createElement(r.YearsDropdown,{key:"year",className:l[I.YearsDropdown],"aria-label":Vo(s.options),classNames:l,components:r,disabled:!!t.disableNavigation,onChange:ri(F.date),options:Pu(Le,qe,o,s,!!t.reverseYears),style:O?.[I.Dropdown],value:s.getYear(F.date)}):w.createElement("span",{key:"year"},fe(F.date,s));return s.getMonthYearOrder()==="year-first"?[G,_]:[_,G]})(),w.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},D(F.date,s.options,s))):w.createElement(r.CaptionLabel,{className:l[I.CaptionLabel],role:"status","aria-live":"polite"},D(F.date,s.options,s))),c==="around"&&!t.hideNavigation&&Y===d-1&&w.createElement(r.NextMonthButton,{type:"button",className:l[I.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Uo(se),onClick:Yt,"data-animated-button":t.animate?"true":void 0},w.createElement(r.Chevron,{disabled:se?void 0:!0,className:l[I.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Y===d-1&&c==="after"&&!t.hideNavigation&&w.createElement(r.Nav,{"data-animated-nav":t.animate?"true":void 0,className:l[I.Nav],style:O?.[I.Nav],"aria-label":An(),onPreviousClick:Ut,onNextClick:Yt,previousMonth:ie,nextMonth:se}),w.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":$o(F.date,s.options,s)||void 0,className:l[I.MonthGrid],style:O?.[I.MonthGrid]},!t.hideWeekdays&&w.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:l[I.Weekdays],style:O?.[I.Weekdays]},C&&w.createElement(r.WeekNumberHeader,{"aria-label":Go(s.options),className:l[I.WeekNumberHeader],style:O?.[I.WeekNumberHeader],scope:"col"},oe()),Ko.map(_=>w.createElement(r.Weekday,{"aria-label":Yo(_,s.options,s),className:l[I.Weekday],key:String(_),style:O?.[I.Weekday],scope:"col"},ue(_,s.options,s)))),w.createElement(r.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:l[I.Weeks],style:O?.[I.Weeks]},F.weeks.map(_=>w.createElement(r.Week,{className:l[I.Week],key:_.weekNumber,style:O?.[I.Week],week:_},C&&w.createElement(r.WeekNumber,{week:_,style:O?.[I.WeekNumber],"aria-label":qo(_.weekNumber,{locale:a}),className:l[I.WeekNumber],scope:"row",role:"rowheader"},$(_.weekNumber,s)),_.days.map(G=>{const{date:Oe}=G,H=k(G);if(H[J.focused]=!H.hidden&&!!V?.isEqualTo(G),H[ge.selected]=R?.(Oe)||H.selected,Ht(W)){const{from:qt,to:Gt}=W;H[ge.range_start]=!!(qt&&Gt&&s.isSameDay(Oe,qt)),H[ge.range_end]=!!(qt&&Gt&&s.isSameDay(Oe,Gt)),H[ge.range_middle]=We(W,Oe,!0,s)}const li=Tu(H,O,t.modifiersStyles),ci=au(H,l,t.modifiersClassNames),ui=!_n&&!H.hidden?Lo(Oe,H,s.options,s):void 0;return w.createElement(r.Day,{key:`${G.isoDate}_${G.displayMonthId}`,day:G,modifiers:H,className:ci.join(" "),style:li,role:"gridcell","aria-selected":H.selected||void 0,"aria-label":ui,"data-day":G.isoDate,"data-month":G.outside?G.dateMonthId:void 0,"data-selected":H.selected||void 0,"data-disabled":H.disabled||void 0,"data-hidden":H.hidden||void 0,"data-outside":G.outside||void 0,"data-focused":H.focused||void 0,"data-today":H.today||void 0},!H.hidden&&_n?w.createElement(r.DayButton,{className:l[I.DayButton],style:O?.[I.DayButton],type:"button",day:G,modifiers:H,disabled:!H.focused&&H.disabled||void 0,"aria-disabled":H.focused&&H.disabled||void 0,tabIndex:ne(G)?0:-1,"aria-label":Bo(Oe,H,s.options,s),onClick:Zo(G,H),onBlur:Xo(G,H),onFocus:Jo(G,H),onKeyDown:Qo(G,H),onMouseEnter:ei(G,H),onMouseLeave:ti(G,H)},j(Oe,s.options,s)):!H.hidden&&j(G.date,s.options,s))})))))))),t.footer&&w.createElement(r.Footer,{className:l[I.Footer],style:O?.[I.Footer],role:"status","aria-live":"polite"},t.footer)))}export{sf as D,nf as _,rf as c,uu as g,of as z}; diff --git a/webui/dist/assets/radix-core-DyJi0yyw.js b/webui/dist/assets/radix-core-DyJi0yyw.js deleted file mode 100644 index 2dee8fdf..00000000 --- a/webui/dist/assets/radix-core-DyJi0yyw.js +++ /dev/null @@ -1,45 +0,0 @@ -import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-9vIXuQkh.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Hs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Us="DismissableLayer",Ut="dismissableLayer.update",Ks="dismissableLayer.pointerDownOutside",zs="dismissableLayer.focusOutside",In,ro=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ro),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Xs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Gs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return Hs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Us;var Ys="DismissableLayerBranch",so=i.forwardRef((e,t)=>{const n=i.useContext(ro),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});so.displayName=Ys;function Xs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){io(Ks,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Gs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&io(zs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function io(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var qs=Xe,Zs=so,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},Qs="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(Js(ri(ao(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=ei(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=Qs;function Js(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function ei(e){const t=ao(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function ao(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ti(n,{upTo:t}))return n}function ti(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ni(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ni(e)&&t&&e.select()}}var Mn=oi();function oi(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ri(e){return e.filter(t=>t.tagName!=="A")}var si="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=si;var kt=0;function co(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return bi;var t=Ei(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ti=po(),Me="data-scroll-locked",Ri=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` - .`.concat(ai,` { - overflow: hidden `).concat(o,`; - padding-right: `).concat(c,"px ").concat(o,`; - } - body[`).concat(Me,`] { - overflow: hidden `).concat(o,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&` - padding-left: `.concat(r,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(a,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(o,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(o,";")].filter(Boolean).join(""),` - } - - .`).concat(it,` { - right: `).concat(c,"px ").concat(o,`; - } - - .`).concat(at,` { - margin-right: `).concat(c,"px ").concat(o,`; - } - - .`).concat(it," .").concat(it,` { - right: 0 `).concat(o,`; - } - - .`).concat(at," .").concat(at,` { - margin-right: 0 `).concat(o,`; - } - - body[`).concat(Me,`] { - `).concat(ci,": ").concat(c,`px; - } -`)},Fn=function(){var e=parseInt(document.body.getAttribute(Me)||"0",10);return isFinite(e)?e:0},Pi=function(){i.useEffect(function(){return document.body.setAttribute(Me,(Fn()+1).toString()),function(){var e=Fn()-1;e<=0?document.body.removeAttribute(Me):document.body.setAttribute(Me,e.toString())}},[])},Ai=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;Pi();var s=i.useMemo(function(){return Si(r)},[r]);return i.createElement(Ti,{styles:Ri(s,!t,r,n?"":"!important")})},Kt=!1;if(typeof window<"u")try{var et=Object.defineProperty({},"passive",{get:function(){return Kt=!0,!0}});window.addEventListener("test",et,et),window.removeEventListener("test",et,et)}catch{Kt=!1}var Ne=Kt?{passive:!1}:!1,Oi=function(e){return e.tagName==="TEXTAREA"},mo=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Oi(e)&&n[t]==="visible")},Ii=function(e){return mo(e,"overflowY")},Ni=function(e){return mo(e,"overflowX")},$n=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=ho(e,o);if(r){var s=vo(e,o),a=s[1],c=s[2];if(a>c)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},_i=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},Di=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},ho=function(e,t){return e==="v"?Ii(t):Ni(t)},vo=function(e,t){return e==="v"?_i(t):Di(t)},Mi=function(e,t){return e==="h"&&t==="rtl"?-1:1},Li=function(e,t,n,o,r){var s=Mi(e,window.getComputedStyle(t).direction),a=s*o,c=n.target,l=t.contains(c),u=!1,f=a>0,p=0,y=0;do{if(!c)break;var h=vo(e,c),x=h[0],d=h[1],m=h[2],w=d-m-s*x;(x||w)&&ho(e,c)&&(p+=w,y+=x);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(f&&Math.abs(p)<1||!f&&Math.abs(y)<1)&&(u=!0),u},tt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Wn=function(e){return[e.deltaX,e.deltaY]},Bn=function(e){return e&&"current"in e?e.current:e},ki=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ji=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},Fi=0,_e=[];function $i(e){var t=i.useRef([]),n=i.useRef([0,0]),o=i.useRef(),r=i.useState(Fi++)[0],s=i.useState(po)[0],a=i.useRef(e);i.useEffect(function(){a.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=ii([e.lockRef.current],(e.shards||[]).map(Bn),!0).filter(Boolean);return d.forEach(function(m){return m.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),d.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(d,m){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!a.current.allowPinchZoom;var w=tt(d),g=n.current,C="deltaX"in d?d.deltaX:g[0]-w[0],b="deltaY"in d?d.deltaY:g[1]-w[1],E,R=d.target,S=Math.abs(C)>Math.abs(b)?"h":"v";if("touches"in d&&S==="h"&&R.type==="range")return!1;var O=$n(S,R);if(!O)return!0;if(O?E=S:(E=S==="v"?"h":"v",O=$n(S,R)),!O)return!1;if(!o.current&&"changedTouches"in d&&(C||b)&&(o.current=E),!E)return!0;var M=o.current||E;return Li(M,m,d,M==="h"?C:b)},[]),l=i.useCallback(function(d){var m=d;if(!(!_e.length||_e[_e.length-1]!==s)){var w="deltaY"in m?Wn(m):tt(m),g=t.current.filter(function(E){return E.name===m.type&&(E.target===m.target||m.target===E.shadowParent)&&ki(E.delta,w)})[0];if(g&&g.should){m.cancelable&&m.preventDefault();return}if(!g){var C=(a.current.shards||[]).map(Bn).filter(Boolean).filter(function(E){return E.contains(m.target)}),b=C.length>0?c(m,C[0]):!a.current.noIsolation;b&&m.cancelable&&m.preventDefault()}}},[]),u=i.useCallback(function(d,m,w,g){var C={name:d,delta:m,target:w,should:g,shadowParent:Wi(w)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(b){return b!==C})},1)},[]),f=i.useCallback(function(d){n.current=tt(d),o.current=void 0},[]),p=i.useCallback(function(d){u(d.type,Wn(d),d.target,c(d,e.lockRef.current))},[]),y=i.useCallback(function(d){u(d.type,tt(d),d.target,c(d,e.lockRef.current))},[]);i.useEffect(function(){return _e.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:y}),document.addEventListener("wheel",l,Ne),document.addEventListener("touchmove",l,Ne),document.addEventListener("touchstart",f,Ne),function(){_e=_e.filter(function(d){return d!==s}),document.removeEventListener("wheel",l,Ne),document.removeEventListener("touchmove",l,Ne),document.removeEventListener("touchstart",f,Ne)}},[]);var h=e.removeScrollBar,x=e.inert;return i.createElement(i.Fragment,null,x?i.createElement(s,{styles:ji(r)}):null,h?i.createElement(Ai,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Wi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Bi=hi(fo,$i);var cn=i.forwardRef(function(e,t){return i.createElement(vt,se({},e,{ref:t,sideCar:Bi}))});cn.classNames=vt.classNames;var Vi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},De=new WeakMap,nt=new WeakMap,ot={},Wt=0,go=function(e){return e&&(e.host||go(e.parentNode))},Hi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=go(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ui=function(e,t,n,o){var r=Hi(t,Array.isArray(e)?e:[e]);ot[n]||(ot[n]=new WeakMap);var s=ot[n],a=[],c=new Set,l=new Set(r),u=function(p){!p||c.has(p)||(c.add(p),u(p.parentNode))};r.forEach(u);var f=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(y){if(c.has(y))f(y);else try{var h=y.getAttribute(o),x=h!==null&&h!=="false",d=(De.get(y)||0)+1,m=(s.get(y)||0)+1;De.set(y,d),s.set(y,m),a.push(y),d===1&&x&&nt.set(y,!0),m===1&&y.setAttribute(n,"true"),x||y.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",y,w)}})};return f(t),c.clear(),Wt++,function(){a.forEach(function(p){var y=De.get(p)-1,h=s.get(p)-1;De.set(p,y),s.set(p,h),y||(nt.has(p)||p.removeAttribute(o),nt.delete(p)),h||p.removeAttribute(n)}),Wt--,Wt||(De=new WeakMap,De=new WeakMap,nt=new WeakMap,ot={})}},yo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Vi(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Ui(o,r,n,"aria-hidden")):function(){return null}};function Ki(e){const t=zi(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Xi);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function zi(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=qi(r),c=Gi(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yi=Symbol("radix.slottable");function Xi(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yi}function Gi(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function qi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gt="Dialog",[wo,Kl]=Oe(gt),[Zi,oe]=wo(gt),xo=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,c=i.useRef(null),l=i.useRef(null),[u,f]=ke({prop:o,defaultProp:r??!1,onChange:s,caller:gt});return v.jsx(Zi,{scope:t,triggerRef:c,contentRef:l,contentId:Se(),titleId:Se(),descriptionId:Se(),open:u,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(p=>!p),[f]),modal:a,children:n})};xo.displayName=gt;var Co="DialogTrigger",bo=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(Co,n),s=B(t,r.triggerRef);return v.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":dn(r.open),...o,ref:s,onClick:N(e.onClick,r.onOpenToggle)})});bo.displayName=Co;var ln="DialogPortal",[Qi,Eo]=wo(ln,{forceMount:void 0}),So=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=oe(ln,t);return v.jsx(Qi,{scope:t,forceMount:n,children:i.Children.map(o,a=>v.jsx(ye,{present:n||s.open,children:v.jsx(Ge,{asChild:!0,container:r,children:a})}))})};So.displayName=ln;var ut="DialogOverlay",To=i.forwardRef((e,t)=>{const n=Eo(ut,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=oe(ut,e.__scopeDialog);return s.modal?v.jsx(ye,{present:o||s.open,children:v.jsx(ea,{...r,ref:t})}):null});To.displayName=ut;var Ji=Ki("DialogOverlay.RemoveScroll"),ea=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(ut,n);return v.jsx(cn,{as:Ji,allowPinchZoom:!0,shards:[r.contentRef],children:v.jsx(D.div,{"data-state":dn(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Te="DialogContent",Ro=i.forwardRef((e,t)=>{const n=Eo(Te,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=oe(Te,e.__scopeDialog);return v.jsx(ye,{present:o||s.open,children:s.modal?v.jsx(ta,{...r,ref:t}):v.jsx(na,{...r,ref:t})})});Ro.displayName=Te;var ta=i.forwardRef((e,t)=>{const n=oe(Te,e.__scopeDialog),o=i.useRef(null),r=B(t,n.contentRef,o);return i.useEffect(()=>{const s=o.current;if(s)return yo(s)},[]),v.jsx(Po,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:N(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:N(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0;(a.button===2||c)&&s.preventDefault()}),onFocusOutside:N(e.onFocusOutside,s=>s.preventDefault())})}),na=i.forwardRef((e,t)=>{const n=oe(Te,e.__scopeDialog),o=i.useRef(!1),r=i.useRef(!1);return v.jsx(Po,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;n.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Po=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,c=oe(Te,n),l=i.useRef(null),u=B(t,l);return co(),v.jsxs(v.Fragment,{children:[v.jsx(an,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:v.jsx(Xe,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":dn(c.open),...a,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(oa,{titleId:c.titleId}),v.jsx(sa,{contentRef:l,descriptionId:c.descriptionId})]})]})}),un="DialogTitle",Ao=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(un,n);return v.jsx(D.h2,{id:r.titleId,...o,ref:t})});Ao.displayName=un;var Oo="DialogDescription",Io=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(Oo,n);return v.jsx(D.p,{id:r.descriptionId,...o,ref:t})});Io.displayName=Oo;var No="DialogClose",_o=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(No,n);return v.jsx(D.button,{type:"button",...o,ref:t,onClick:N(e.onClick,()=>r.onOpenChange(!1))})});_o.displayName=No;function dn(e){return e?"open":"closed"}var Do="DialogTitleWarning",[zl,Mo]=fs(Do,{contentName:Te,titleName:un,docsSlug:"dialog"}),oa=({titleId:e})=>{const t=Mo(Do),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ra="DialogDescriptionWarning",sa=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Mo(ra).contentName}}.`;return i.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Yl=xo,Xl=bo,Gl=So,ql=To,Zl=Ro,Ql=Ao,Jl=Io,eu=_o;function Lo(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ko(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var yt="Checkbox",[ia]=Oe(yt),[aa,fn]=ia(yt);function ca(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:r,disabled:s,form:a,name:c,onCheckedChange:l,required:u,value:f="on",internal_do_not_use_render:p}=e,[y,h]=ke({prop:n,defaultProp:r??!1,onChange:l,caller:yt}),[x,d]=i.useState(null),[m,w]=i.useState(null),g=i.useRef(!1),C=x?!!a||!!x.closest("form"):!0,b={checked:y,disabled:s,setChecked:h,control:x,setControl:d,name:c,form:a,value:f,hasConsumerStoppedPropagationRef:g,required:u,defaultChecked:he(r)?!1:r,isFormControl:C,bubbleInput:m,setBubbleInput:w};return v.jsx(aa,{scope:t,...b,children:da(p)?p(b):o})}var jo="CheckboxTrigger",Fo=i.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},r)=>{const{control:s,value:a,disabled:c,checked:l,required:u,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:y,isFormControl:h,bubbleInput:x}=fn(jo,e),d=B(r,f),m=i.useRef(l);return i.useEffect(()=>{const w=s?.form;if(w){const g=()=>p(m.current);return w.addEventListener("reset",g),()=>w.removeEventListener("reset",g)}},[s,p]),v.jsx(D.button,{type:"button",role:"checkbox","aria-checked":he(l)?"mixed":l,"aria-required":u,"data-state":Vo(l),"data-disabled":c?"":void 0,disabled:c,value:a,...o,ref:d,onKeyDown:N(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:N(n,w=>{p(g=>he(g)?!0:!g),x&&h&&(y.current=w.isPropagationStopped(),y.current||w.stopPropagation())})})});Fo.displayName=jo;var la=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:r,defaultChecked:s,required:a,disabled:c,value:l,onCheckedChange:u,form:f,...p}=e;return v.jsx(ca,{__scopeCheckbox:n,checked:r,defaultChecked:s,disabled:c,required:a,onCheckedChange:u,name:o,form:f,value:l,internal_do_not_use_render:({isFormControl:y})=>v.jsxs(v.Fragment,{children:[v.jsx(Fo,{...p,ref:t,__scopeCheckbox:n}),y&&v.jsx(Bo,{__scopeCheckbox:n})]})})});la.displayName=yt;var $o="CheckboxIndicator",ua=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...r}=e,s=fn($o,n);return v.jsx(ye,{present:o||he(s.checked)||s.checked===!0,children:v.jsx(D.span,{"data-state":Vo(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});ua.displayName=$o;var Wo="CheckboxBubbleInput",Bo=i.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:r,checked:s,defaultChecked:a,required:c,disabled:l,name:u,value:f,form:p,bubbleInput:y,setBubbleInput:h}=fn(Wo,e),x=B(n,h),d=Lo(s),m=ko(o);i.useEffect(()=>{const g=y;if(!g)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,R=!r.current;if(d!==s&&E){const S=new Event("click",{bubbles:R});g.indeterminate=he(s),E.call(g,he(s)?!1:s),g.dispatchEvent(S)}},[y,d,s,r]);const w=i.useRef(he(s)?!1:s);return v.jsx(D.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??w.current,required:c,disabled:l,name:u,value:f,form:p,...t,tabIndex:-1,ref:x,style:{...t.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Bo.displayName=Wo;function da(e){return typeof e=="function"}function he(e){return e==="indeterminate"}function Vo(e){return he(e)?"indeterminate":e?"checked":"unchecked"}const fa=["top","right","bottom","left"],ve=Math.min,G=Math.max,dt=Math.round,rt=Math.floor,ae=e=>({x:e,y:e}),pa={left:"right",right:"left",bottom:"top",top:"bottom"},ma={start:"end",end:"start"};function zt(e,t,n){return G(e,ve(t,n))}function fe(e,t){return typeof e=="function"?e(t):e}function pe(e){return e.split("-")[0]}function We(e){return e.split("-")[1]}function pn(e){return e==="x"?"y":"x"}function mn(e){return e==="y"?"height":"width"}const ha=new Set(["top","bottom"]);function ie(e){return ha.has(pe(e))?"y":"x"}function hn(e){return pn(ie(e))}function va(e,t,n){n===void 0&&(n=!1);const o=We(e),r=hn(e),s=mn(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=ft(a)),[a,ft(a)]}function ga(e){const t=ft(e);return[Yt(e),t,Yt(t)]}function Yt(e){return e.replace(/start|end/g,t=>ma[t])}const Vn=["left","right"],Hn=["right","left"],ya=["top","bottom"],wa=["bottom","top"];function xa(e,t,n){switch(e){case"top":case"bottom":return n?t?Hn:Vn:t?Vn:Hn;case"left":case"right":return t?ya:wa;default:return[]}}function Ca(e,t,n,o){const r=We(e);let s=xa(pe(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Yt)))),s}function ft(e){return e.replace(/left|right|bottom|top/g,t=>pa[t])}function ba(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ho(e){return typeof e!="number"?ba(e):{top:e,right:e,bottom:e,left:e}}function pt(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Un(e,t,n){let{reference:o,floating:r}=e;const s=ie(t),a=hn(t),c=mn(a),l=pe(t),u=s==="y",f=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,y=o[c]/2-r[c]/2;let h;switch(l){case"top":h={x:f,y:o.y-r.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:p};break;case"left":h={x:o.x-r.width,y:p};break;default:h={x:o.x,y:o.y}}switch(We(t)){case"start":h[a]-=y*(n&&u?-1:1);break;case"end":h[a]+=y*(n&&u?-1:1);break}return h}const Ea=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,c=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:p}=Un(u,o,l),y=o,h={},x=0;for(let d=0;d({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:c,middlewareData:l}=t,{element:u,padding:f=0}=fe(e,t)||{};if(u==null)return{};const p=Ho(f),y={x:n,y:o},h=hn(r),x=mn(h),d=await a.getDimensions(u),m=h==="y",w=m?"top":"left",g=m?"bottom":"right",C=m?"clientHeight":"clientWidth",b=s.reference[x]+s.reference[h]-y[h]-s.floating[x],E=y[h]-s.reference[h],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let S=R?R[C]:0;(!S||!await(a.isElement==null?void 0:a.isElement(R)))&&(S=c.floating[C]||s.floating[x]);const O=b/2-E/2,M=S/2-d[x]/2-1,L=ve(p[w],M),k=ve(p[g],M),$=L,F=S-d[x]-k,T=S/2-d[x]/2+O,j=zt($,T,F),I=!l.arrow&&We(r)!=null&&T!==j&&s.reference[x]/2-(T<$?L:k)-d[x]/2<0,_=I?T<$?T-$:T-F:0;return{[h]:y[h]+_,data:{[h]:j,centerOffset:T-j-_,...I&&{alignmentOffset:_}},reset:I}}}),Ta=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:y,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:d=!0,...m}=fe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=pe(r),g=ie(c),C=pe(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=y||(C||!d?[ft(c)]:ga(c)),R=x!=="none";!y&&R&&E.push(...Ca(c,d,x,b));const S=[c,...E],O=await Ue(t,m),M=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&M.push(O[w]),p){const T=va(r,a,b);M.push(O[T[0]],O[T[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(T=>T<=0)){var k,$;const T=(((k=s.flip)==null?void 0:k.index)||0)+1,j=S[T];if(j&&(!(p==="alignment"?g!==ie(j):!1)||L.every(P=>ie(P.placement)===g?P.overflows[0]>0:!0)))return{data:{index:T,overflows:L},reset:{placement:j}};let I=($=L.filter(_=>_.overflows[0]<=0).sort((_,P)=>_.overflows[1]-P.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(h){case"bestFit":{var F;const _=(F=L.filter(P=>{if(R){const W=ie(P.placement);return W===g||W==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((P,W)=>P[1]-W[1])[0])==null?void 0:F[0];_&&(I=_);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};function Kn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zn(e){return fa.some(t=>e[t]>=0)}const Ra=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=fe(e,t);switch(o){case"referenceHidden":{const s=await Ue(t,{...r,elementContext:"reference"}),a=Kn(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zn(a)}}}case"escaped":{const s=await Ue(t,{...r,altBoundary:!0}),a=Kn(s,n.floating);return{data:{escapedOffsets:a,escaped:zn(a)}}}default:return{}}}}},Uo=new Set(["left","top"]);async function Pa(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=pe(n),c=We(n),l=ie(n)==="y",u=Uo.has(a)?-1:1,f=s&&l?-1:1,p=fe(t,e);let{mainAxis:y,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof x=="number"&&(h=c==="end"?x*-1:x),l?{x:h*f,y:y*u}:{x:y*u,y:h*f}}const Aa=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:c}=t,l=await Pa(t,e);return a===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:a}}}}},Oa=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:c={fn:m=>{let{x:w,y:g}=m;return{x:w,y:g}}},...l}=fe(e,t),u={x:n,y:o},f=await Ue(t,l),p=ie(pe(r)),y=pn(p);let h=u[y],x=u[p];if(s){const m=y==="y"?"top":"left",w=y==="y"?"bottom":"right",g=h+f[m],C=h-f[w];h=zt(g,h,C)}if(a){const m=p==="y"?"top":"left",w=p==="y"?"bottom":"right",g=x+f[m],C=x-f[w];x=zt(g,x,C)}const d=c.fn({...t,[y]:h,[p]:x});return{...d,data:{x:d.x-n,y:d.y-o,enabled:{[y]:s,[p]:a}}}}}},Ia=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=fe(e,t),f={x:n,y:o},p=ie(r),y=pn(p);let h=f[y],x=f[p];const d=fe(c,t),m=typeof d=="number"?{mainAxis:d,crossAxis:0}:{mainAxis:0,crossAxis:0,...d};if(l){const C=y==="y"?"height":"width",b=s.reference[y]-s.floating[C]+m.mainAxis,E=s.reference[y]+s.reference[C]-m.mainAxis;hE&&(h=E)}if(u){var w,g;const C=y==="y"?"width":"height",b=Uo.has(pe(r)),E=s.reference[p]-s.floating[C]+(b&&((w=a.offset)==null?void 0:w[p])||0)+(b?0:m.crossAxis),R=s.reference[p]+s.reference[C]+(b?0:((g=a.offset)==null?void 0:g[p])||0)-(b?m.crossAxis:0);xR&&(x=R)}return{[y]:h,[p]:x}}}},Na=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:c}=t,{apply:l=()=>{},...u}=fe(e,t),f=await Ue(t,u),p=pe(r),y=We(r),h=ie(r)==="y",{width:x,height:d}=s.floating;let m,w;p==="top"||p==="bottom"?(m=p,w=y===(await(a.isRTL==null?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(w=p,m=y==="end"?"top":"bottom");const g=d-f.top-f.bottom,C=x-f.left-f.right,b=ve(d-f[m],g),E=ve(x-f[w],C),R=!t.middlewareData.shift;let S=b,O=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(S=g),R&&!y){const L=G(f.left,0),k=G(f.right,0),$=G(f.top,0),F=G(f.bottom,0);h?O=x-2*(L!==0||k!==0?L+k:G(f.left,f.right)):S=d-2*($!==0||F!==0?$+F:G(f.top,f.bottom))}await l({...t,availableWidth:O,availableHeight:S});const M=await a.getDimensions(c.floating);return x!==M.width||d!==M.height?{reset:{rects:!0}}:{}}}};function wt(){return typeof window<"u"}function Be(e){return Ko(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function le(e){var t;return(t=(Ko(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ko(e){return wt()?e instanceof Node||e instanceof q(e).Node:!1}function te(e){return wt()?e instanceof Element||e instanceof q(e).Element:!1}function ce(e){return wt()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Yn(e){return!wt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}const _a=new Set(["inline","contents"]);function qe(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ne(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!_a.has(r)}const Da=new Set(["table","td","th"]);function Ma(e){return Da.has(Be(e))}const La=[":popover-open",":modal"];function xt(e){return La.some(t=>{try{return e.matches(t)}catch{return!1}})}const ka=["transform","translate","scale","rotate","perspective"],ja=["transform","translate","scale","rotate","perspective","filter"],Fa=["paint","layout","strict","content"];function vn(e){const t=gn(),n=te(e)?ne(e):e;return ka.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ja.some(o=>(n.willChange||"").includes(o))||Fa.some(o=>(n.contain||"").includes(o))}function $a(e){let t=ge(e);for(;ce(t)&&!je(t);){if(vn(t))return t;if(xt(t))return null;t=ge(t)}return null}function gn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Wa=new Set(["html","body","#document"]);function je(e){return Wa.has(Be(e))}function ne(e){return q(e).getComputedStyle(e)}function Ct(e){return te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ge(e){if(Be(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Yn(e)&&e.host||le(e);return Yn(t)?t.host:t}function zo(e){const t=ge(e);return je(t)?e.ownerDocument?e.ownerDocument.body:e.body:ce(t)&&qe(t)?t:zo(t)}function Ke(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=zo(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=q(r);if(s){const c=Xt(a);return t.concat(a,a.visualViewport||[],qe(r)?r:[],c&&n?Ke(c):[])}return t.concat(r,Ke(r,[],n))}function Xt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yo(e){const t=ne(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ce(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,c=dt(n)!==s||dt(o)!==a;return c&&(n=s,o=a),{width:n,height:o,$:c}}function yn(e){return te(e)?e:e.contextElement}function Le(e){const t=yn(e);if(!ce(t))return ae(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Yo(t);let a=(s?dt(n.width):n.width)/o,c=(s?dt(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const Ba=ae(0);function Xo(e){const t=q(e);return!gn()||!t.visualViewport?Ba:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Va(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function Re(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=yn(e);let a=ae(1);t&&(o?te(o)&&(a=Le(o)):a=Le(e));const c=Va(s,n,o)?Xo(s):ae(0);let l=(r.left+c.x)/a.x,u=(r.top+c.y)/a.y,f=r.width/a.x,p=r.height/a.y;if(s){const y=q(s),h=o&&te(o)?q(o):o;let x=y,d=Xt(x);for(;d&&o&&h!==x;){const m=Le(d),w=d.getBoundingClientRect(),g=ne(d),C=w.left+(d.clientLeft+parseFloat(g.paddingLeft))*m.x,b=w.top+(d.clientTop+parseFloat(g.paddingTop))*m.y;l*=m.x,u*=m.y,f*=m.x,p*=m.y,l+=C,u+=b,x=q(d),d=Xt(x)}}return pt({width:f,height:p,x:l,y:u})}function bt(e,t){const n=Ct(e).scrollLeft;return t?t.left+n:Re(le(e)).left+n}function Go(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-bt(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Ha(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=le(o),c=t?xt(t.floating):!1;if(o===a||c&&s)return n;let l={scrollLeft:0,scrollTop:0},u=ae(1);const f=ae(0),p=ce(o);if((p||!p&&!s)&&((Be(o)!=="body"||qe(a))&&(l=Ct(o)),ce(o))){const h=Re(o);u=Le(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const y=a&&!p&&!s?Go(a,l):ae(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+f.x+y.x,y:n.y*u.y-l.scrollTop*u.y+f.y+y.y}}function Ua(e){return Array.from(e.getClientRects())}function Ka(e){const t=le(e),n=Ct(e),o=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=G(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+bt(e);const c=-n.scrollTop;return ne(o).direction==="rtl"&&(a+=G(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:c}}const Xn=25;function za(e,t){const n=q(e),o=le(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,c=0,l=0;if(r){s=r.width,a=r.height;const f=gn();(!f||f&&t==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}const u=bt(o);if(u<=0){const f=o.ownerDocument,p=f.body,y=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,x=Math.abs(o.clientWidth-p.clientWidth-h);x<=Xn&&(s-=x)}else u<=Xn&&(s+=u);return{width:s,height:a,x:c,y:l}}const Ya=new Set(["absolute","fixed"]);function Xa(e,t){const n=Re(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=ce(e)?Le(e):ae(1),a=e.clientWidth*s.x,c=e.clientHeight*s.y,l=r*s.x,u=o*s.y;return{width:a,height:c,x:l,y:u}}function Gn(e,t,n){let o;if(t==="viewport")o=za(e,n);else if(t==="document")o=Ka(le(e));else if(te(t))o=Xa(t,n);else{const r=Xo(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return pt(o)}function qo(e,t){const n=ge(e);return n===t||!te(n)||je(n)?!1:ne(n).position==="fixed"||qo(n,t)}function Ga(e,t){const n=t.get(e);if(n)return n;let o=Ke(e,[],!1).filter(c=>te(c)&&Be(c)!=="body"),r=null;const s=ne(e).position==="fixed";let a=s?ge(e):e;for(;te(a)&&!je(a);){const c=ne(a),l=vn(a);!l&&c.position==="fixed"&&(r=null),(s?!l&&!r:!l&&c.position==="static"&&!!r&&Ya.has(r.position)||qe(a)&&!l&&qo(e,a))?o=o.filter(f=>f!==a):r=c,a=ge(a)}return t.set(e,o),o}function qa(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?xt(t)?[]:Ga(t,this._c):[].concat(n),o],c=a[0],l=a.reduce((u,f)=>{const p=Gn(t,f,r);return u.top=G(p.top,u.top),u.right=ve(p.right,u.right),u.bottom=ve(p.bottom,u.bottom),u.left=G(p.left,u.left),u},Gn(t,c,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Za(e){const{width:t,height:n}=Yo(e);return{width:t,height:n}}function Qa(e,t,n){const o=ce(t),r=le(t),s=n==="fixed",a=Re(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=ae(0);function u(){l.x=bt(r)}if(o||!o&&!s)if((Be(t)!=="body"||qe(r))&&(c=Ct(t)),o){const h=Re(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else r&&u();s&&!o&&r&&u();const f=r&&!o&&!s?Go(r,c):ae(0),p=a.left+c.scrollLeft-l.x-f.x,y=a.top+c.scrollTop-l.y-f.y;return{x:p,y,width:a.width,height:a.height}}function Bt(e){return ne(e).position==="static"}function qn(e,t){if(!ce(e)||ne(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function Zo(e,t){const n=q(e);if(xt(e))return n;if(!ce(e)){let r=ge(e);for(;r&&!je(r);){if(te(r)&&!Bt(r))return r;r=ge(r)}return n}let o=qn(e,t);for(;o&&Ma(o)&&Bt(o);)o=qn(o,t);return o&&je(o)&&Bt(o)&&!vn(o)?n:o||$a(e)||n}const Ja=async function(e){const t=this.getOffsetParent||Zo,n=this.getDimensions,o=await n(e.floating);return{reference:Qa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ec(e){return ne(e).direction==="rtl"}const tc={convertOffsetParentRelativeRectToViewportRelativeRect:Ha,getDocumentElement:le,getClippingRect:qa,getOffsetParent:Zo,getElementRects:Ja,getClientRects:Ua,getDimensions:Za,getScale:Le,isElement:te,isRTL:ec};function Qo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nc(e,t){let n=null,o;const r=le(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function a(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:f,top:p,width:y,height:h}=u;if(c||t(),!y||!h)return;const x=rt(p),d=rt(r.clientWidth-(f+y)),m=rt(r.clientHeight-(p+h)),w=rt(f),C={rootMargin:-x+"px "+-d+"px "+-m+"px "+-w+"px",threshold:G(0,ve(1,l))||1};let b=!0;function E(R){const S=R[0].intersectionRatio;if(S!==l){if(!b)return a();S?a(!1,S):o=setTimeout(()=>{a(!1,1e-7)},1e3)}S===1&&!Qo(u,e.getBoundingClientRect())&&a(),b=!1}try{n=new IntersectionObserver(E,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(E,C)}n.observe(e)}return a(!0),s}function oc(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=yn(e),f=r||s?[...u?Ke(u):[],...Ke(t)]:[];f.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=u&&c?nc(u,n):null;let y=-1,h=null;a&&(h=new ResizeObserver(w=>{let[g]=w;g&&g.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var C;(C=h)==null||C.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let x,d=l?Re(e):null;l&&m();function m(){const w=Re(e);d&&!Qo(d,w)&&n(),d=w,x=requestAnimationFrame(m)}return n(),()=>{var w;f.forEach(g=>{r&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),p?.(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(x)}}const rc=Aa,sc=Oa,ic=Ta,ac=Na,cc=Ra,Zn=Sa,lc=Ia,uc=(e,t,n)=>{const o=new Map,r={platform:tc,...n},s={...r.platform,_c:o};return Ea(e,t,{...r,platform:s})};var dc=typeof document<"u",fc=function(){},ct=dc?i.useLayoutEffect:fc;function mt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!mt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!mt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Jo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qn(e,t){const n=Jo(e);return Math.round(t*n)/n}function Vt(e){const t=i.useRef(e);return ct(()=>{t.current=e}),t}function pc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[f,p]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,h]=i.useState(o);mt(y,o)||h(o);const[x,d]=i.useState(null),[m,w]=i.useState(null),g=i.useCallback(P=>{P!==R.current&&(R.current=P,d(P))},[]),C=i.useCallback(P=>{P!==S.current&&(S.current=P,w(P))},[]),b=s||x,E=a||m,R=i.useRef(null),S=i.useRef(null),O=i.useRef(f),M=l!=null,L=Vt(l),k=Vt(r),$=Vt(u),F=i.useCallback(()=>{if(!R.current||!S.current)return;const P={placement:t,strategy:n,middleware:y};k.current&&(P.platform=k.current),uc(R.current,S.current,P).then(W=>{const Y={...W,isPositioned:$.current!==!1};T.current&&!mt(O.current,Y)&&(O.current=Y,Ye.flushSync(()=>{p(Y)}))})},[y,t,n,k,$]);ct(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const T=i.useRef(!1);ct(()=>(T.current=!0,()=>{T.current=!1}),[]),ct(()=>{if(b&&(R.current=b),E&&(S.current=E),b&&E){if(L.current)return L.current(b,E,F);F()}},[b,E,F,L,M]);const j=i.useMemo(()=>({reference:R,floating:S,setReference:g,setFloating:C}),[g,C]),I=i.useMemo(()=>({reference:b,floating:E}),[b,E]),_=i.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const W=Qn(I.floating,f.x),Y=Qn(I.floating,f.y);return c?{...P,transform:"translate("+W+"px, "+Y+"px)",...Jo(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,c,I.floating,f.x,f.y]);return i.useMemo(()=>({...f,update:F,refs:j,elements:I,floatingStyles:_}),[f,F,j,I,_])}const mc=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?Zn({element:o.current,padding:r}).fn(n):{}:o?Zn({element:o,padding:r}).fn(n):{}}}},hc=(e,t)=>({...rc(e),options:[e,t]}),vc=(e,t)=>({...sc(e),options:[e,t]}),gc=(e,t)=>({...lc(e),options:[e,t]}),yc=(e,t)=>({...ic(e),options:[e,t]}),wc=(e,t)=>({...ac(e),options:[e,t]}),xc=(e,t)=>({...cc(e),options:[e,t]}),Cc=(e,t)=>({...mc(e),options:[e,t]});var bc="Arrow",er=i.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return v.jsx(D.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});er.displayName=bc;var Ec=er,wn="Popper",[tr,Et]=Oe(wn),[Sc,nr]=tr(wn),or=e=>{const{__scopePopper:t,children:n}=e,[o,r]=i.useState(null);return v.jsx(Sc,{scope:t,anchor:o,onAnchorChange:r,children:n})};or.displayName=wn;var rr="PopperAnchor",sr=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=nr(rr,n),a=i.useRef(null),c=B(t,a),l=i.useRef(null);return i.useEffect(()=>{const u=l.current;l.current=o?.current||a.current,u!==l.current&&s.onAnchorChange(l.current)}),o?null:v.jsx(D.div,{...r,ref:c})});sr.displayName=rr;var xn="PopperContent",[Tc,Rc]=tr(xn),ir=i.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:y=!1,updatePositionStrategy:h="optimized",onPlaced:x,...d}=e,m=nr(xn,n),[w,g]=i.useState(null),C=B(t,A=>g(A)),[b,E]=i.useState(null),R=ko(b),S=R?.width??0,O=R?.height??0,M=o+(s!=="center"?"-"+s:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(u)?u:[u],$=k.length>0,F={padding:L,boundary:k.filter(Ac),altBoundary:$},{refs:T,floatingStyles:j,placement:I,isPositioned:_,middlewareData:P}=pc({strategy:"fixed",placement:M,whileElementsMounted:(...A)=>oc(...A,{animationFrame:h==="always"}),elements:{reference:m.anchor},middleware:[hc({mainAxis:r+O,alignmentAxis:a}),l&&vc({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?gc():void 0,...F}),l&&yc({...F}),wc({...F,apply:({elements:A,rects:U,availableWidth:X,availableHeight:V})=>{const{width:H,height:K}=U.reference,Z=A.floating.style;Z.setProperty("--radix-popper-available-width",`${X}px`),Z.setProperty("--radix-popper-available-height",`${V}px`),Z.setProperty("--radix-popper-anchor-width",`${H}px`),Z.setProperty("--radix-popper-anchor-height",`${K}px`)}}),b&&Cc({element:b,padding:c}),Oc({arrowWidth:S,arrowHeight:O}),y&&xc({strategy:"referenceHidden",...F})]}),[W,Y]=lr(I),ue=ee(x);z(()=>{_&&ue?.()},[_,ue]);const de=P.arrow?.x,re=P.arrow?.y,Q=P.arrow?.centerOffset!==0,[Ie,Ce]=i.useState();return z(()=>{w&&Ce(window.getComputedStyle(w).zIndex)},[w]),v.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:_?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ie,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(" "),...P.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(Tc,{scope:n,placedSide:W,onArrowChange:E,arrowX:de,arrowY:re,shouldHideArrow:Q,children:v.jsx(D.div,{"data-side":W,"data-align":Y,...d,ref:C,style:{...d.style,animation:_?void 0:"none"}})})})});ir.displayName=xn;var ar="PopperArrow",Pc={top:"bottom",right:"left",bottom:"top",left:"right"},cr=i.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=Rc(ar,o),a=Pc[s.placedSide];return v.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:v.jsx(Ec,{...r,ref:n,style:{...r.style,display:"block"}})})});cr.displayName=ar;function Ac(e){return e!==null}var Oc=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,a=r.arrow?.centerOffset!==0,c=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[u,f]=lr(n),p={start:"0%",center:"50%",end:"100%"}[f],y=(r.arrow?.x??0)+c/2,h=(r.arrow?.y??0)+l/2;let x="",d="";return u==="bottom"?(x=a?p:`${y}px`,d=`${-l}px`):u==="top"?(x=a?p:`${y}px`,d=`${o.floating.height+l}px`):u==="right"?(x=`${-l}px`,d=a?p:`${h}px`):u==="left"&&(x=`${o.floating.width+l}px`,d=a?p:`${h}px`),{data:{x,y:d}}}});function lr(e){const[t,n="center"]=e.split("-");return[t,n]}var ur=or,dr=sr,fr=ir,pr=cr;function Ic(e){const t=Nc(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Dc);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Nc(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Lc(r),c=Mc(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _c=Symbol("radix.slottable");function Dc(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_c}function Mc(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Lc(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mr=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),kc="VisuallyHidden",St=i.forwardRef((e,t)=>v.jsx(D.span,{...e,ref:t,style:{...mr,...e.style}}));St.displayName=kc;var jc=St,Fc=[" ","Enter","ArrowUp","ArrowDown"],$c=[" ","Enter"],Pe="Select",[Tt,Rt,Wc]=eo(Pe),[Ve]=Oe(Pe,[Wc,Et]),Pt=Et(),[Bc,we]=Ve(Pe),[Vc,Hc]=Ve(Pe),hr=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:a,defaultValue:c,onValueChange:l,dir:u,name:f,autoComplete:p,disabled:y,required:h,form:x}=e,d=Pt(t),[m,w]=i.useState(null),[g,C]=i.useState(null),[b,E]=i.useState(!1),R=_s(u),[S,O]=ke({prop:o,defaultProp:r??!1,onChange:s,caller:Pe}),[M,L]=ke({prop:a,defaultProp:c,onChange:l,caller:Pe}),k=i.useRef(null),$=m?x||!!m.closest("form"):!0,[F,T]=i.useState(new Set),j=Array.from(F).map(I=>I.props.value).join(";");return v.jsx(ur,{...d,children:v.jsxs(Bc,{required:h,scope:t,trigger:m,onTriggerChange:w,valueNode:g,onValueNodeChange:C,valueNodeHasChildren:b,onValueNodeHasChildrenChange:E,contentId:Se(),value:M,onValueChange:L,open:S,onOpenChange:O,dir:R,triggerPointerDownPosRef:k,disabled:y,children:[v.jsx(Tt.Provider,{scope:t,children:v.jsx(Vc,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(I=>{T(_=>new Set(_).add(I))},[]),onNativeOptionRemove:i.useCallback(I=>{T(_=>{const P=new Set(_);return P.delete(I),P})},[]),children:n})}),$?v.jsxs($r,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:M,onChange:I=>L(I.target.value),disabled:y,form:x,children:[M===void 0?v.jsx("option",{value:""}):null,Array.from(F)]},j):null]})})};hr.displayName=Pe;var vr="SelectTrigger",gr=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=Pt(n),a=we(vr,n),c=a.disabled||o,l=B(t,a.onTriggerChange),u=Rt(n),f=i.useRef("touch"),[p,y,h]=Br(d=>{const m=u().filter(C=>!C.disabled),w=m.find(C=>C.value===a.value),g=Vr(m,d,w);g!==void 0&&a.onValueChange(g.value)}),x=d=>{c||(a.onOpenChange(!0),h()),d&&(a.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return v.jsx(dr,{asChild:!0,...s,children:v.jsx(D.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Wr(a.value)?"":void 0,...r,ref:l,onClick:N(r.onClick,d=>{d.currentTarget.focus(),f.current!=="mouse"&&x(d)}),onPointerDown:N(r.onPointerDown,d=>{f.current=d.pointerType;const m=d.target;m.hasPointerCapture(d.pointerId)&&m.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(x(d),d.preventDefault())}),onKeyDown:N(r.onKeyDown,d=>{const m=p.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&y(d.key),!(m&&d.key===" ")&&Fc.includes(d.key)&&(x(),d.preventDefault())})})})});gr.displayName=vr;var yr="SelectValue",wr=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:a="",...c}=e,l=we(yr,n),{onValueNodeHasChildrenChange:u}=l,f=s!==void 0,p=B(t,l.onValueNodeChange);return z(()=>{u(f)},[u,f]),v.jsx(D.span,{...c,ref:p,style:{pointerEvents:"none"},children:Wr(l.value)?v.jsx(v.Fragment,{children:a}):s})});wr.displayName=yr;var Uc="SelectIcon",xr=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return v.jsx(D.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});xr.displayName=Uc;var Kc="SelectPortal",Cr=e=>v.jsx(Ge,{asChild:!0,...e});Cr.displayName=Kc;var Ae="SelectContent",br=i.forwardRef((e,t)=>{const n=we(Ae,e.__scopeSelect),[o,r]=i.useState();if(z(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?Ye.createPortal(v.jsx(Er,{scope:e.__scopeSelect,children:v.jsx(Tt.Slot,{scope:e.__scopeSelect,children:v.jsx("div",{children:e.children})})}),s):null}return v.jsx(Sr,{...e,ref:t})});br.displayName=Ae;var J=10,[Er,xe]=Ve(Ae),zc="SelectContentImpl",Yc=Ic("SelectContent.RemoveScroll"),Sr=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:a,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:y,collisionPadding:h,sticky:x,hideWhenDetached:d,avoidCollisions:m,...w}=e,g=we(Ae,n),[C,b]=i.useState(null),[E,R]=i.useState(null),S=B(t,A=>b(A)),[O,M]=i.useState(null),[L,k]=i.useState(null),$=Rt(n),[F,T]=i.useState(!1),j=i.useRef(!1);i.useEffect(()=>{if(C)return yo(C)},[C]),co();const I=i.useCallback(A=>{const[U,...X]=$().map(K=>K.ref.current),[V]=X.slice(-1),H=document.activeElement;for(const K of A)if(K===H||(K?.scrollIntoView({block:"nearest"}),K===U&&E&&(E.scrollTop=0),K===V&&E&&(E.scrollTop=E.scrollHeight),K?.focus(),document.activeElement!==H))return},[$,E]),_=i.useCallback(()=>I([O,C]),[I,O,C]);i.useEffect(()=>{F&&_()},[F,_]);const{onOpenChange:P,triggerPointerDownPosRef:W}=g;i.useEffect(()=>{if(C){let A={x:0,y:0};const U=V=>{A={x:Math.abs(Math.round(V.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(V.pageY)-(W.current?.y??0))}},X=V=>{A.x<=10&&A.y<=10?V.preventDefault():C.contains(V.target)||P(!1),document.removeEventListener("pointermove",U),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",X,{capture:!0})}}},[C,P,W]),i.useEffect(()=>{const A=()=>P(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[P]);const[Y,ue]=Br(A=>{const U=$().filter(H=>!H.disabled),X=U.find(H=>H.ref.current===document.activeElement),V=Vr(U,A,X);V&&setTimeout(()=>V.ref.current.focus())}),de=i.useCallback((A,U,X)=>{const V=!j.current&&!X;(g.value!==void 0&&g.value===U||V)&&(M(A),V&&(j.current=!0))},[g.value]),re=i.useCallback(()=>C?.focus(),[C]),Q=i.useCallback((A,U,X)=>{const V=!j.current&&!X;(g.value!==void 0&&g.value===U||V)&&k(A)},[g.value]),Ie=o==="popper"?Gt:Tr,Ce=Ie===Gt?{side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:y,collisionPadding:h,sticky:x,hideWhenDetached:d,avoidCollisions:m}:{};return v.jsx(Er,{scope:n,content:C,viewport:E,onViewportChange:R,itemRefCallback:de,selectedItem:O,onItemLeave:re,itemTextRefCallback:Q,focusSelectedItem:_,selectedItemText:L,position:o,isPositioned:F,searchRef:Y,children:v.jsx(cn,{as:Yc,allowPinchZoom:!0,children:v.jsx(an,{asChild:!0,trapped:g.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:N(r,A=>{g.trigger?.focus({preventScroll:!0}),A.preventDefault()}),children:v.jsx(Xe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:v.jsx(Ie,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:A=>A.preventDefault(),...w,...Ce,onPlaced:()=>T(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:N(w.onKeyDown,A=>{const U=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!U&&A.key.length===1&&ue(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let V=$().filter(H=>!H.disabled).map(H=>H.ref.current);if(["ArrowUp","End"].includes(A.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){const H=A.target,K=V.indexOf(H);V=V.slice(K+1)}setTimeout(()=>I(V)),A.preventDefault()}})})})})})})});Sr.displayName=zc;var Xc="SelectItemAlignedPosition",Tr=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=we(Ae,n),a=xe(Ae,n),[c,l]=i.useState(null),[u,f]=i.useState(null),p=B(t,S=>f(S)),y=Rt(n),h=i.useRef(!1),x=i.useRef(!0),{viewport:d,selectedItem:m,selectedItemText:w,focusSelectedItem:g}=a,C=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&d&&m&&w){const S=s.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),L=w.getBoundingClientRect();if(s.dir!=="rtl"){const H=L.left-O.left,K=M.left-H,Z=S.left-K,be=S.width+Z,Nt=Math.max(be,O.width),_t=window.innerWidth-J,Dt=On(K,[J,Math.max(J,_t-Nt)]);c.style.minWidth=be+"px",c.style.left=Dt+"px"}else{const H=O.right-L.right,K=window.innerWidth-M.right-H,Z=window.innerWidth-S.right-K,be=S.width+Z,Nt=Math.max(be,O.width),_t=window.innerWidth-J,Dt=On(K,[J,Math.max(J,_t-Nt)]);c.style.minWidth=be+"px",c.style.right=Dt+"px"}const k=y(),$=window.innerHeight-J*2,F=d.scrollHeight,T=window.getComputedStyle(u),j=parseInt(T.borderTopWidth,10),I=parseInt(T.paddingTop,10),_=parseInt(T.borderBottomWidth,10),P=parseInt(T.paddingBottom,10),W=j+I+F+P+_,Y=Math.min(m.offsetHeight*5,W),ue=window.getComputedStyle(d),de=parseInt(ue.paddingTop,10),re=parseInt(ue.paddingBottom,10),Q=S.top+S.height/2-J,Ie=$-Q,Ce=m.offsetHeight/2,A=m.offsetTop+Ce,U=j+I+A,X=W-U;if(U<=Q){const H=k.length>0&&m===k[k.length-1].ref.current;c.style.bottom="0px";const K=u.clientHeight-d.offsetTop-d.offsetHeight,Z=Math.max(Ie,Ce+(H?re:0)+K+_),be=U+Z;c.style.height=be+"px"}else{const H=k.length>0&&m===k[0].ref.current;c.style.top="0px";const Z=Math.max(Q,j+d.offsetTop+(H?de:0)+Ce)+X;c.style.height=Z+"px",d.scrollTop=U-Q+d.offsetTop}c.style.margin=`${J}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=$+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[y,s.trigger,s.valueNode,c,u,d,m,w,s.dir,o]);z(()=>C(),[C]);const[b,E]=i.useState();z(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const R=i.useCallback(S=>{S&&x.current===!0&&(C(),g?.(),x.current=!1)},[C,g]);return v.jsx(qc,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R,children:v.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:v.jsx(D.div,{...r,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Tr.displayName=Xc;var Gc="SelectPopperPosition",Gt=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=J,...s}=e,a=Pt(n);return v.jsx(fr,{...a,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gt.displayName=Gc;var[qc,Cn]=Ve(Ae,{}),qt="SelectViewport",Rr=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=xe(qt,n),a=Cn(qt,n),c=B(t,s.onViewportChange),l=i.useRef(0);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),v.jsx(Tt.Slot,{scope:n,children:v.jsx(D.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:N(r.onScroll,u=>{const f=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:y}=a;if(y?.current&&p){const h=Math.abs(l.current-f.scrollTop);if(h>0){const x=window.innerHeight-J*2,d=parseFloat(p.style.minHeight),m=parseFloat(p.style.height),w=Math.max(d,m);if(w0?b:0,p.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Rr.displayName=qt;var Pr="SelectGroup",[Zc,Qc]=Ve(Pr),Jc=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Se();return v.jsx(Zc,{scope:n,id:r,children:v.jsx(D.div,{role:"group","aria-labelledby":r,...o,ref:t})})});Jc.displayName=Pr;var Ar="SelectLabel",Or=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Qc(Ar,n);return v.jsx(D.div,{id:r.id,...o,ref:t})});Or.displayName=Ar;var ht="SelectItem",[el,Ir]=Ve(ht),Nr=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...a}=e,c=we(ht,n),l=xe(ht,n),u=c.value===o,[f,p]=i.useState(s??""),[y,h]=i.useState(!1),x=B(t,g=>l.itemRefCallback?.(g,o,r)),d=Se(),m=i.useRef("touch"),w=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return v.jsx(el,{scope:n,value:o,disabled:r,textId:d,isSelected:u,onItemTextChange:i.useCallback(g=>{p(C=>C||(g?.textContent??"").trim())},[]),children:v.jsx(Tt.ItemSlot,{scope:n,value:o,disabled:r,textValue:f,children:v.jsx(D.div,{role:"option","aria-labelledby":d,"data-highlighted":y?"":void 0,"aria-selected":u&&y,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:x,onFocus:N(a.onFocus,()=>h(!0)),onBlur:N(a.onBlur,()=>h(!1)),onClick:N(a.onClick,()=>{m.current!=="mouse"&&w()}),onPointerUp:N(a.onPointerUp,()=>{m.current==="mouse"&&w()}),onPointerDown:N(a.onPointerDown,g=>{m.current=g.pointerType}),onPointerMove:N(a.onPointerMove,g=>{m.current=g.pointerType,r?l.onItemLeave?.():m.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(a.onPointerLeave,g=>{g.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:N(a.onKeyDown,g=>{l.searchRef?.current!==""&&g.key===" "||($c.includes(g.key)&&w(),g.key===" "&&g.preventDefault())})})})})});Nr.displayName=ht;var He="SelectItemText",_r=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,a=we(He,n),c=xe(He,n),l=Ir(He,n),u=Hc(He,n),[f,p]=i.useState(null),y=B(t,w=>p(w),l.onItemTextChange,w=>c.itemTextRefCallback?.(w,l.value,l.disabled)),h=f?.textContent,x=i.useMemo(()=>v.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:d,onNativeOptionRemove:m}=u;return z(()=>(d(x),()=>m(x)),[d,m,x]),v.jsxs(v.Fragment,{children:[v.jsx(D.span,{id:l.textId,...s,ref:y}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ye.createPortal(s.children,a.valueNode):null]})});_r.displayName=He;var Dr="SelectItemIndicator",Mr=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Ir(Dr,n).isSelected?v.jsx(D.span,{"aria-hidden":!0,...o,ref:t}):null});Mr.displayName=Dr;var Zt="SelectScrollUpButton",Lr=i.forwardRef((e,t)=>{const n=xe(Zt,e.__scopeSelect),o=Cn(Zt,e.__scopeSelect),[r,s]=i.useState(!1),a=B(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?v.jsx(jr,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Lr.displayName=Zt;var Qt="SelectScrollDownButton",kr=i.forwardRef((e,t)=>{const n=xe(Qt,e.__scopeSelect),o=Cn(Qt,e.__scopeSelect),[r,s]=i.useState(!1),a=B(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?v.jsx(jr,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});kr.displayName=Qt;var jr=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=xe("SelectScrollButton",n),a=i.useRef(null),c=Rt(n),l=i.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return i.useEffect(()=>()=>l(),[l]),z(()=>{c().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),v.jsx(D.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:N(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:N(r.onPointerMove,()=>{s.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:N(r.onPointerLeave,()=>{l()})})}),tl="SelectSeparator",Fr=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return v.jsx(D.div,{"aria-hidden":!0,...o,ref:t})});Fr.displayName=tl;var Jt="SelectArrow",nl=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Pt(n),s=we(Jt,n),a=xe(Jt,n);return s.open&&a.position==="popper"?v.jsx(pr,{...r,...o,ref:t}):null});nl.displayName=Jt;var ol="SelectBubbleInput",$r=i.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=i.useRef(null),s=B(o,r),a=Lo(t);return i.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&f){const p=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(p)}},[a,t]),v.jsx(D.select,{...n,style:{...mr,...n.style},ref:s,defaultValue:t})});$r.displayName=ol;function Wr(e){return e===""||e===void 0}function Br(e){const t=ee(e),n=i.useRef(""),o=i.useRef(0),r=i.useCallback(a=>{const c=n.current+a;t(c),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=i.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function Vr(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=rl(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function rl(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var tu=hr,nu=gr,ou=wr,ru=xr,su=Cr,iu=br,au=Rr,cu=Or,lu=Nr,uu=_r,du=Mr,fu=Lr,pu=kr,mu=Fr,sl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],il=sl.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),al="Label",Hr=i.forwardRef((e,t)=>v.jsx(il.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Hr.displayName=al;var hu=Hr,cl=Symbol("radix.slottable");function ll(e){const t=({children:n})=>v.jsx(v.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=cl,t}var[At]=Oe("Tooltip",[Et]),Ot=Et(),Ur="TooltipProvider",ul=700,en="tooltip.open",[dl,bn]=At(Ur),Kr=e=>{const{__scopeTooltip:t,delayDuration:n=ul,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=i.useRef(!0),c=i.useRef(!1),l=i.useRef(0);return i.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),v.jsx(dl,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:i.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:i.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:c,onPointerInTransitChange:i.useCallback(u=>{c.current=u},[]),disableHoverableContent:r,children:s})};Kr.displayName=Ur;var ze="Tooltip",[fl,Ze]=At(ze),zr=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:c}=e,l=bn(ze,e.__scopeTooltip),u=Ot(t),[f,p]=i.useState(null),y=Se(),h=i.useRef(0),x=a??l.disableHoverableContent,d=c??l.delayDuration,m=i.useRef(!1),[w,g]=ke({prop:o,defaultProp:r??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(en))):l.onClose(),s?.(S)},caller:ze}),C=i.useMemo(()=>w?m.current?"delayed-open":"instant-open":"closed",[w]),b=i.useCallback(()=>{window.clearTimeout(h.current),h.current=0,m.current=!1,g(!0)},[g]),E=i.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g(!1)},[g]),R=i.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{m.current=!0,g(!0),h.current=0},d)},[d,g]);return i.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),v.jsx(ur,{...u,children:v.jsx(fl,{scope:t,contentId:y,open:w,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:i.useCallback(()=>{l.isOpenDelayedRef.current?R():b()},[l.isOpenDelayedRef,R,b]),onTriggerLeave:i.useCallback(()=>{x?E():(window.clearTimeout(h.current),h.current=0)},[E,x]),onOpen:b,onClose:E,disableHoverableContent:x,children:n})})};zr.displayName=ze;var tn="TooltipTrigger",Yr=i.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Ze(tn,n),s=bn(tn,n),a=Ot(n),c=i.useRef(null),l=B(t,c,r.onTriggerChange),u=i.useRef(!1),f=i.useRef(!1),p=i.useCallback(()=>u.current=!1,[]);return i.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),v.jsx(dr,{asChild:!0,...a,children:v.jsx(D.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:l,onPointerMove:N(e.onPointerMove,y=>{y.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:N(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:N(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:N(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:N(e.onBlur,r.onClose),onClick:N(e.onClick,r.onClose)})})});Yr.displayName=tn;var En="TooltipPortal",[pl,ml]=At(En,{forceMount:void 0}),Xr=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=Ze(En,t);return v.jsx(pl,{scope:t,forceMount:n,children:v.jsx(ye,{present:n||s.open,children:v.jsx(Ge,{asChild:!0,container:r,children:o})})})};Xr.displayName=En;var Fe="TooltipContent",Gr=i.forwardRef((e,t)=>{const n=ml(Fe,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=Ze(Fe,e.__scopeTooltip);return v.jsx(ye,{present:o||a.open,children:a.disableHoverableContent?v.jsx(qr,{side:r,...s,ref:t}):v.jsx(hl,{side:r,...s,ref:t})})}),hl=i.forwardRef((e,t)=>{const n=Ze(Fe,e.__scopeTooltip),o=bn(Fe,e.__scopeTooltip),r=i.useRef(null),s=B(t,r),[a,c]=i.useState(null),{trigger:l,onClose:u}=n,f=r.current,{onPointerInTransitChange:p}=o,y=i.useCallback(()=>{c(null),p(!1)},[p]),h=i.useCallback((x,d)=>{const m=x.currentTarget,w={x:x.clientX,y:x.clientY},g=xl(w,m.getBoundingClientRect()),C=Cl(w,g),b=bl(d.getBoundingClientRect()),E=Sl([...C,...b]);c(E),p(!0)},[p]);return i.useEffect(()=>()=>y(),[y]),i.useEffect(()=>{if(l&&f){const x=m=>h(m,f),d=m=>h(m,l);return l.addEventListener("pointerleave",x),f.addEventListener("pointerleave",d),()=>{l.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",d)}}},[l,f,h,y]),i.useEffect(()=>{if(a){const x=d=>{const m=d.target,w={x:d.clientX,y:d.clientY},g=l?.contains(m)||f?.contains(m),C=!El(w,a);g?y():C&&(y(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,f,a,u,y]),v.jsx(qr,{...e,ref:s})}),[vl,gl]=At(ze,{isInside:!1}),yl=ll("TooltipContent"),qr=i.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...c}=e,l=Ze(Fe,n),u=Ot(n),{onClose:f}=l;return i.useEffect(()=>(document.addEventListener(en,f),()=>document.removeEventListener(en,f)),[f]),i.useEffect(()=>{if(l.trigger){const p=y=>{y.target?.contains(l.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[l.trigger,f]),v.jsx(Xe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:v.jsxs(fr,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[v.jsx(yl,{children:o}),v.jsx(vl,{scope:n,isInside:!0,children:v.jsx(jc,{id:l.contentId,role:"tooltip",children:r||o})})]})})});Gr.displayName=Fe;var Zr="TooltipArrow",wl=i.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Ot(n);return gl(Zr,n).isInside?null:v.jsx(pr,{...r,...o,ref:t})});wl.displayName=Zr;function xl(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Cl(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function bl(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function El(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;so!=y>o&&n<(p-u)*(o-f)/(y-f)+u&&(r=!r)}return r}function Sl(e){const t=e.slice();return t.sort((n,o)=>n.xo.x?1:n.yo.y?1:0),Tl(t)}function Tl(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vu=Kr,gu=zr,yu=Yr,wu=Xr,xu=Gr,Sn="ToastProvider",[Tn,Rl,Pl]=eo("Toast"),[Qr]=Oe("Toast",[Pl]),[Al,It]=Qr(Sn),Jr=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:r="right",swipeThreshold:s=50,children:a}=e,[c,l]=i.useState(null),[u,f]=i.useState(0),p=i.useRef(!1),y=i.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Sn}\`. Expected non-empty \`string\`.`),v.jsx(Tn.Provider,{scope:t,children:v.jsx(Al,{scope:t,label:n,duration:o,swipeDirection:r,swipeThreshold:s,toastCount:u,viewport:c,onViewportChange:l,onToastAdd:i.useCallback(()=>f(h=>h+1),[]),onToastRemove:i.useCallback(()=>f(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:y,children:a})})};Jr.displayName=Sn;var es="ToastViewport",Ol=["F8"],nn="toast.viewportPause",on="toast.viewportResume",ts=i.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=Ol,label:r="Notifications ({hotkey})",...s}=e,a=It(es,n),c=Rl(n),l=i.useRef(null),u=i.useRef(null),f=i.useRef(null),p=i.useRef(null),y=B(t,p,a.onViewportChange),h=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=a.toastCount>0;i.useEffect(()=>{const m=w=>{o.length!==0&&o.every(C=>w[C]||w.code===C)&&p.current?.focus()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[o]),i.useEffect(()=>{const m=l.current,w=p.current;if(x&&m&&w){const g=()=>{if(!a.isClosePausedRef.current){const R=new CustomEvent(nn);w.dispatchEvent(R),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const R=new CustomEvent(on);w.dispatchEvent(R),a.isClosePausedRef.current=!1}},b=R=>{!m.contains(R.relatedTarget)&&C()},E=()=>{m.contains(document.activeElement)||C()};return m.addEventListener("focusin",g),m.addEventListener("focusout",b),m.addEventListener("pointermove",g),m.addEventListener("pointerleave",E),window.addEventListener("blur",g),window.addEventListener("focus",C),()=>{m.removeEventListener("focusin",g),m.removeEventListener("focusout",b),m.removeEventListener("pointermove",g),m.removeEventListener("pointerleave",E),window.removeEventListener("blur",g),window.removeEventListener("focus",C)}}},[x,a.isClosePausedRef]);const d=i.useCallback(({tabbingDirection:m})=>{const g=c().map(C=>{const b=C.ref.current,E=[b,...Vl(b)];return m==="forwards"?E:E.reverse()});return(m==="forwards"?g.reverse():g).flat()},[c]);return i.useEffect(()=>{const m=p.current;if(m){const w=g=>{const C=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!C){const E=document.activeElement,R=g.shiftKey;if(g.target===m&&R){u.current?.focus();return}const M=d({tabbingDirection:R?"backwards":"forwards"}),L=M.findIndex(k=>k===E);Ht(M.slice(L+1))?g.preventDefault():R?u.current?.focus():f.current?.focus()}};return m.addEventListener("keydown",w),()=>m.removeEventListener("keydown",w)}},[c,d]),v.jsxs(Zs,{ref:l,role:"region","aria-label":r.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&v.jsx(rn,{ref:u,onFocusFromOutsideViewport:()=>{const m=d({tabbingDirection:"forwards"});Ht(m)}}),v.jsx(Tn.Slot,{scope:n,children:v.jsx(D.ol,{tabIndex:-1,...s,ref:y})}),x&&v.jsx(rn,{ref:f,onFocusFromOutsideViewport:()=>{const m=d({tabbingDirection:"backwards"});Ht(m)}})]})});ts.displayName=es;var ns="ToastFocusProxy",rn=i.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...r}=e,s=It(ns,n);return v.jsx(St,{tabIndex:0,...r,ref:t,style:{position:"fixed"},onFocus:a=>{const c=a.relatedTarget;!s.viewport?.contains(c)&&o()}})});rn.displayName=ns;var Qe="Toast",Il="toast.swipeStart",Nl="toast.swipeMove",_l="toast.swipeCancel",Dl="toast.swipeEnd",os=i.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:r,onOpenChange:s,...a}=e,[c,l]=ke({prop:o,defaultProp:r??!0,onChange:s,caller:Qe});return v.jsx(ye,{present:n||c,children:v.jsx(kl,{open:c,...a,ref:t,onClose:()=>l(!1),onPause:ee(e.onPause),onResume:ee(e.onResume),onSwipeStart:N(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:N(e.onSwipeMove,u=>{const{x:f,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:N(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:N(e.onSwipeEnd,u=>{const{x:f,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),l(!1)})})})});os.displayName=Qe;var[Ml,Ll]=Qr(Qe,{onClose(){}}),kl=i.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:r,open:s,onClose:a,onEscapeKeyDown:c,onPause:l,onResume:u,onSwipeStart:f,onSwipeMove:p,onSwipeCancel:y,onSwipeEnd:h,...x}=e,d=It(Qe,n),[m,w]=i.useState(null),g=B(t,T=>w(T)),C=i.useRef(null),b=i.useRef(null),E=r||d.duration,R=i.useRef(0),S=i.useRef(E),O=i.useRef(0),{onToastAdd:M,onToastRemove:L}=d,k=ee(()=>{m?.contains(document.activeElement)&&d.viewport?.focus(),a()}),$=i.useCallback(T=>{!T||T===1/0||(window.clearTimeout(O.current),R.current=new Date().getTime(),O.current=window.setTimeout(k,T))},[k]);i.useEffect(()=>{const T=d.viewport;if(T){const j=()=>{$(S.current),u?.()},I=()=>{const _=new Date().getTime()-R.current;S.current=S.current-_,window.clearTimeout(O.current),l?.()};return T.addEventListener(nn,I),T.addEventListener(on,j),()=>{T.removeEventListener(nn,I),T.removeEventListener(on,j)}}},[d.viewport,E,l,u,$]),i.useEffect(()=>{s&&!d.isClosePausedRef.current&&$(E)},[s,E,d.isClosePausedRef,$]),i.useEffect(()=>(M(),()=>L()),[M,L]);const F=i.useMemo(()=>m?us(m):null,[m]);return d.viewport?v.jsxs(v.Fragment,{children:[F&&v.jsx(jl,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite",children:F}),v.jsx(Ml,{scope:n,onClose:k,children:Ye.createPortal(v.jsx(Tn.ItemSlot,{scope:n,children:v.jsx(qs,{asChild:!0,onEscapeKeyDown:N(c,()=>{d.isFocusedToastEscapeKeyDownRef.current||k(),d.isFocusedToastEscapeKeyDownRef.current=!1}),children:v.jsx(D.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":d.swipeDirection,...x,ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:N(e.onKeyDown,T=>{T.key==="Escape"&&(c?.(T.nativeEvent),T.nativeEvent.defaultPrevented||(d.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:N(e.onPointerDown,T=>{T.button===0&&(C.current={x:T.clientX,y:T.clientY})}),onPointerMove:N(e.onPointerMove,T=>{if(!C.current)return;const j=T.clientX-C.current.x,I=T.clientY-C.current.y,_=!!b.current,P=["left","right"].includes(d.swipeDirection),W=["left","up"].includes(d.swipeDirection)?Math.min:Math.max,Y=P?W(0,j):0,ue=P?0:W(0,I),de=T.pointerType==="touch"?10:2,re={x:Y,y:ue},Q={originalEvent:T,delta:re};_?(b.current=re,st(Nl,p,Q,{discrete:!1})):Jn(re,d.swipeDirection,de)?(b.current=re,st(Il,f,Q,{discrete:!1}),T.target.setPointerCapture(T.pointerId)):(Math.abs(j)>de||Math.abs(I)>de)&&(C.current=null)}),onPointerUp:N(e.onPointerUp,T=>{const j=b.current,I=T.target;if(I.hasPointerCapture(T.pointerId)&&I.releasePointerCapture(T.pointerId),b.current=null,C.current=null,j){const _=T.currentTarget,P={originalEvent:T,delta:j};Jn(j,d.swipeDirection,d.swipeThreshold)?st(Dl,h,P,{discrete:!0}):st(_l,y,P,{discrete:!0}),_.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),d.viewport)})]}):null}),jl=e=>{const{__scopeToast:t,children:n,...o}=e,r=It(Qe,t),[s,a]=i.useState(!1),[c,l]=i.useState(!1);return Wl(()=>a(!0)),i.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),c?null:v.jsx(Ge,{asChild:!0,children:v.jsx(St,{...o,children:s&&v.jsxs(v.Fragment,{children:[r.label," ",n]})})})},Fl="ToastTitle",rs=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return v.jsx(D.div,{...o,ref:t})});rs.displayName=Fl;var $l="ToastDescription",ss=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return v.jsx(D.div,{...o,ref:t})});ss.displayName=$l;var is="ToastAction",as=i.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?v.jsx(ls,{altText:n,asChild:!0,children:v.jsx(Rn,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${is}\`. Expected non-empty \`string\`.`),null)});as.displayName=is;var cs="ToastClose",Rn=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,r=Ll(cs,n);return v.jsx(ls,{asChild:!0,children:v.jsx(D.button,{type:"button",...o,ref:t,onClick:N(e.onClick,r.onClose)})})});Rn.displayName=cs;var ls=i.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...r}=e;return v.jsx(D.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...r,ref:t})});function us(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),Bl(o)){const r=o.ariaHidden||o.hidden||o.style.display==="none",s=o.dataset.radixToastAnnounceExclude==="";if(!r)if(s){const a=o.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...us(o))}}),t}function st(e,t,n,{discrete:o}){const r=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Jn=(e,t,n=0)=>{const o=Math.abs(e.x),r=Math.abs(e.y),s=o>r;return t==="left"||t==="right"?s&&o>n:!s&&r>n};function Wl(e=()=>{}){const t=ee(e);z(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function Bl(e){return e.nodeType===e.ELEMENT_NODE}function Vl(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ht(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Cu=Jr,bu=ts,Eu=os,Su=rs,Tu=ss,Ru=as,Pu=Rn;export{tu as $,ur as A,dr as B,Zl as C,Jl as D,pr as E,an as F,to as G,la as H,ua as I,nu as J,ru as K,fu as L,pu as M,su as N,ql as O,D as P,iu as Q,Yl as R,Ul as S,Ql as T,cu as U,au as V,zl as W,lu as X,du as Y,uu as Z,mu as _,eo as a,ou as a0,hu as a1,wu as a2,xu as a3,vu as a4,gu as a5,yu as a6,bu as a7,Eu as a8,Ru as a9,Pu as aa,Su as ab,Tu as ac,Cu as ad,N as b,Oe as c,B as d,_s as e,ke as f,ee as g,ye as h,z as i,On as j,oo as k,Lo as l,ko as m,Kl as n,Gl as o,eu as p,Xl as q,$e as r,Ge as s,Et as t,Se as u,yo as v,cn as w,co as x,Xe as y,fr as z}; diff --git a/webui/dist/assets/radix-extra-DmmnfeQE.js b/webui/dist/assets/radix-extra-DmmnfeQE.js deleted file mode 100644 index e13199cb..00000000 --- a/webui/dist/assets/radix-extra-DmmnfeQE.js +++ /dev/null @@ -1,12 +0,0 @@ -import{r as s,j as u,d as jr}from"./router-9vIXuQkh.js";import{c as G,a as Be,u as Ce,P as E,b,d as T,e as de,f as re,g as B,h as $,i as ce,j as Ke,k as Ge,l as xt,m as Ct,n as wt,O as Or,o as Lr,W as Fr,C as kr,T as $r,D as Vr,p as Pt,R as Br,q as Kr,r as He,s as Rt,t as we,v as Et,w as _t,x as yt,F as At,y as Tt,z as Mt,A as It,B as Ue,E as Dt,G as Gr}from"./radix-core-DyJi0yyw.js";var Oe="rovingFocusGroup.onEntryFocus",Hr={bubbles:!1,cancelable:!0},fe="RovingFocusGroup",[Le,Nt,Ur]=Be(fe),[Wr,Pe]=G(fe,[Ur]),[zr,Yr]=Wr(fe),jt=s.forwardRef((e,t)=>u.jsx(Le.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Le.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Xr,{...e,ref:t})})}));jt.displayName=fe;var Xr=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:n=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:p,preventScrollOnEntryFocus:f=!1,...d}=e,v=s.useRef(null),m=T(t,v),h=de(a),[x,g]=re({prop:i,defaultProp:c??null,onChange:l,caller:fe}),[S,R]=s.useState(!1),w=B(p),P=Nt(o),I=s.useRef(!1),[j,D]=s.useState(0);return s.useEffect(()=>{const M=v.current;if(M)return M.addEventListener(Oe,w),()=>M.removeEventListener(Oe,w)},[w]),u.jsx(zr,{scope:o,orientation:r,dir:h,loop:n,currentTabStopId:x,onItemFocus:s.useCallback(M=>g(M),[g]),onItemShiftTab:s.useCallback(()=>R(!0),[]),onFocusableItemAdd:s.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:s.useCallback(()=>D(M=>M-1),[]),children:u.jsx(E.div,{tabIndex:S||j===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:b(e.onMouseDown,()=>{I.current=!0}),onFocus:b(e.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!S){const A=new CustomEvent(Oe,Hr);if(M.currentTarget.dispatchEvent(A),!A.defaultPrevented){const y=P().filter(N=>N.focusable),O=y.find(N=>N.active),U=y.find(N=>N.id===x),X=[O,U,...y].filter(Boolean).map(N=>N.ref.current);Ft(X,f)}}I.current=!1}),onBlur:b(e.onBlur,()=>R(!1))})})}),Ot="RovingFocusGroupItem",Lt=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:n=!1,tabStopId:a,children:i,...c}=e,l=Ce(),p=a||l,f=Yr(Ot,o),d=f.currentTabStopId===p,v=Nt(o),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:x}=f;return s.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),u.jsx(Le.ItemSlot,{scope:o,id:p,focusable:r,active:n,children:u.jsx(E.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:b(e.onMouseDown,g=>{r?f.onItemFocus(p):g.preventDefault()}),onFocus:b(e.onFocus,()=>f.onItemFocus(p)),onKeyDown:b(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){f.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const S=Jr(g,f.orientation,f.dir);if(S!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=v().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")w.reverse();else if(S==="prev"||S==="next"){S==="prev"&&w.reverse();const P=w.indexOf(g.currentTarget);w=f.loop?Qr(w,P+1):w.slice(P+1)}setTimeout(()=>Ft(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:x!=null}):i})})});Lt.displayName=Ot;var qr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zr(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jr(e,t,o){const r=Zr(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qr[r]}function Ft(e,t=!1){const o=document.activeElement;for(const r of e)if(r===o||(r.focus({preventScroll:t}),document.activeElement!==o))return}function Qr(e,t){return e.map((o,r)=>e[(t+r)%e.length])}var kt=jt,$t=Lt,Re="Tabs",[en]=G(Re,[Pe]),Vt=Pe(),[tn,We]=en(Re),Bt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,onValueChange:n,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:l="automatic",...p}=e,f=de(c),[d,v]=re({prop:r,onChange:n,defaultProp:a??"",caller:Re});return u.jsx(tn,{scope:o,baseId:Ce(),value:d,onValueChange:v,orientation:i,dir:f,activationMode:l,children:u.jsx(E.div,{dir:f,"data-orientation":i,...p,ref:t})})});Bt.displayName=Re;var Kt="TabsList",Gt=s.forwardRef((e,t)=>{const{__scopeTabs:o,loop:r=!0,...n}=e,a=We(Kt,o),i=Vt(o);return u.jsx(kt,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:u.jsx(E.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:t})})});Gt.displayName=Kt;var Ht="TabsTrigger",Ut=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,disabled:n=!1,...a}=e,i=We(Ht,o),c=Vt(o),l=Yt(i.baseId,r),p=Xt(i.baseId,r),f=r===i.value;return u.jsx($t,{asChild:!0,...c,focusable:!n,active:f,children:u.jsx(E.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":p,"data-state":f?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:l,...a,ref:t,onMouseDown:b(e.onMouseDown,d=>{!n&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:b(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:b(e.onFocus,()=>{const d=i.activationMode!=="manual";!f&&!n&&d&&i.onValueChange(r)})})})});Ut.displayName=Ht;var Wt="TabsContent",zt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,forceMount:n,children:a,...i}=e,c=We(Wt,o),l=Yt(c.baseId,r),p=Xt(c.baseId,r),f=r===c.value,d=s.useRef(f);return s.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx($,{present:n||f,children:({present:v})=>u.jsx(E.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:p,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:v&&a})})});zt.displayName=Wt;function Yt(e,t){return`${e}-trigger-${t}`}function Xt(e,t){return`${e}-content-${t}`}var hs=Bt,gs=Gt,Ss=Ut,bs=zt;function on(e,t){return s.useReducer((o,r)=>t[o][r]??o,e)}var ze="ScrollArea",[qt]=G(ze),[rn,V]=qt(ze),Zt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:r="hover",dir:n,scrollHideDelay:a=600,...i}=e,[c,l]=s.useState(null),[p,f]=s.useState(null),[d,v]=s.useState(null),[m,h]=s.useState(null),[x,g]=s.useState(null),[S,R]=s.useState(0),[w,P]=s.useState(0),[I,j]=s.useState(!1),[D,M]=s.useState(!1),_=T(t,y=>l(y)),A=de(n);return u.jsx(rn,{scope:o,type:r,dir:A,scrollHideDelay:a,scrollArea:c,viewport:p,onViewportChange:f,content:d,onContentChange:v,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:I,onScrollbarXEnabledChange:j,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:R,onCornerHeightChange:P,children:u.jsx(E.div,{dir:A,...i,ref:_,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Zt.displayName=ze;var Jt="ScrollAreaViewport",Qt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:r,nonce:n,...a}=e,i=V(Jt,o),c=s.useRef(null),l=T(t,c,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),u.jsx(E.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Qt.displayName=Jt;var K="ScrollAreaScrollbar",nn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=n,c=e.orientation==="horizontal";return s.useEffect(()=>(c?a(!0):i(!0),()=>{c?a(!1):i(!1)}),[c,a,i]),n.type==="hover"?u.jsx(an,{...r,ref:t,forceMount:o}):n.type==="scroll"?u.jsx(sn,{...r,ref:t,forceMount:o}):n.type==="auto"?u.jsx(eo,{...r,ref:t,forceMount:o}):n.type==="always"?u.jsx(Ye,{...r,ref:t}):null});nn.displayName=K;var an=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),[a,i]=s.useState(!1);return s.useEffect(()=>{const c=n.scrollArea;let l=0;if(c){const p=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",f)}}},[n.scrollArea,n.scrollHideDelay]),u.jsx($,{present:o||a,children:u.jsx(eo,{"data-state":a?"visible":"hidden",...r,ref:t})})}),sn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),a=e.orientation==="horizontal",i=_e(()=>l("SCROLL_END"),100),[c,l]=on("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>l("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,n.scrollHideDelay,l]),s.useEffect(()=>{const p=n.viewport,f=a?"scrollLeft":"scrollTop";if(p){let d=p[f];const v=()=>{const m=p[f];d!==m&&(l("SCROLL"),i()),d=m};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[n.viewport,a,l,i]),u.jsx($,{present:o||c!=="hidden",children:u.jsx(Ye,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:b(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:b(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),eo=s.forwardRef((e,t)=>{const o=V(K,e.__scopeScrollArea),{forceMount:r,...n}=e,[a,i]=s.useState(!1),c=e.orientation==="horizontal",l=_e(()=>{if(o.viewport){const p=o.viewport.offsetWidth{const{orientation:o="vertical",...r}=e,n=V(K,e.__scopeScrollArea),a=s.useRef(null),i=s.useRef(0),[c,l]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=no(c.viewport,c.content),f={...r,sizes:c,onSizesChange:l,hasThumb:p>0&&p<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function d(v,m){return vn(v,i.current,c,m)}return o==="horizontal"?u.jsx(cn,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollLeft,m=vt(v,c,n.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollLeft=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollLeft=d(v,n.dir))}}):o==="vertical"?u.jsx(ln,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollTop,m=vt(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollTop=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollTop=d(v))}}):null}),cn=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarXChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"horizontal",...n,ref:p,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ge(i.paddingLeft),paddingEnd:ge(i.paddingRight)}})}})}),ln=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarYChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"vertical",...n,ref:p,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ge(i.paddingTop),paddingEnd:ge(i.paddingBottom)}})}})}),[un,to]=qt(K),oo=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:r,hasThumb:n,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:p,onWheelScroll:f,onResize:d,...v}=e,m=V(K,o),[h,x]=s.useState(null),g=T(t,_=>x(_)),S=s.useRef(null),R=s.useRef(""),w=m.viewport,P=r.content-r.viewport,I=B(f),j=B(l),D=_e(d,10);function M(_){if(S.current){const A=_.clientX-S.current.left,y=_.clientY-S.current.top;p({x:A,y})}}return s.useEffect(()=>{const _=A=>{const y=A.target;h?.contains(y)&&I(A,P)};return document.addEventListener("wheel",_,{passive:!1}),()=>document.removeEventListener("wheel",_,{passive:!1})},[w,h,P,I]),s.useEffect(j,[r,j]),te(h,D),te(m.content,D),u.jsx(un,{scope:o,scrollbar:h,hasThumb:n,onThumbChange:B(a),onThumbPointerUp:B(i),onThumbPositionChange:j,onThumbPointerDown:B(c),children:u.jsx(E.div,{...v,ref:g,style:{position:"absolute",...v.style},onPointerDown:b(e.onPointerDown,_=>{_.button===0&&(_.target.setPointerCapture(_.pointerId),S.current=h.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),M(_))}),onPointerMove:b(e.onPointerMove,M),onPointerUp:b(e.onPointerUp,_=>{const A=_.target;A.hasPointerCapture(_.pointerId)&&A.releasePointerCapture(_.pointerId),document.body.style.webkitUserSelect=R.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.current=null})})})}),he="ScrollAreaThumb",dn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=to(he,e.__scopeScrollArea);return u.jsx($,{present:o||n.hasThumb,children:u.jsx(fn,{ref:t,...r})})}),fn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:r,...n}=e,a=V(he,o),i=to(he,o),{onThumbPositionChange:c}=i,l=T(t,d=>i.onThumbChange(d)),p=s.useRef(void 0),f=_e(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const d=a.viewport;if(d){const v=()=>{if(f(),!p.current){const m=mn(d,c);p.current=m,c()}};return c(),d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(E.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:b(e.onPointerDownCapture,d=>{const m=d.target.getBoundingClientRect(),h=d.clientX-m.left,x=d.clientY-m.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:b(e.onPointerUp,i.onThumbPointerUp)})});dn.displayName=he;var Xe="ScrollAreaCorner",ro=s.forwardRef((e,t)=>{const o=V(Xe,e.__scopeScrollArea),r=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&r?u.jsx(pn,{...e,ref:t}):null});ro.displayName=Xe;var pn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,...r}=e,n=V(Xe,o),[a,i]=s.useState(0),[c,l]=s.useState(0),p=!!(a&&c);return te(n.scrollbarX,()=>{const f=n.scrollbarX?.offsetHeight||0;n.onCornerHeightChange(f),l(f)}),te(n.scrollbarY,()=>{const f=n.scrollbarY?.offsetWidth||0;n.onCornerWidthChange(f),i(f)}),p?u.jsx(E.div,{...r,ref:t,style:{width:a,height:c,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ge(e){return e?parseInt(e,10):0}function no(e,t){const o=e/t;return isNaN(o)?0:o}function Ee(e){const t=no(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-o)*t;return Math.max(r,18)}function vn(e,t,o,r="ltr"){const n=Ee(o),a=n/2,i=t||a,c=n-i,l=o.scrollbar.paddingStart+i,p=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,d=r==="ltr"?[0,f]:[f*-1,0];return ao([l,p],d)(e)}function vt(e,t,o="ltr"){const r=Ee(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-n,i=t.content-t.viewport,c=a-r,l=o==="ltr"?[0,i]:[i*-1,0],p=Ke(e,l);return ao([0,i],[0,c])(p)}function ao(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function so(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},r=0;return(function n(){const a={left:e.scrollLeft,top:e.scrollTop},i=o.left!==a.left,c=o.top!==a.top;(i||c)&&t(),o=a,r=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(r)};function _e(e,t){const o=B(e),r=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),s.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(o,t)},[o,t])}function te(e,t){const o=B(t);ce(()=>{let r=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(o)});return n.observe(e),()=>{window.cancelAnimationFrame(r),n.unobserve(e)}}},[e,o])}var xs=Zt,Cs=Qt,ws=ro;function hn(e,t=[]){let o=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const l=o.length;o=[...o,i];const p=d=>{const{scope:v,children:m,...h}=d,x=v?.[e]?.[l]||c,g=s.useMemo(()=>h,Object.values(h));return u.jsx(x.Provider,{value:g,children:m})};p.displayName=a+"Provider";function f(d,v){const m=v?.[e]?.[l]||c,h=s.useContext(m);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[p,f]}const n=()=>{const a=o.map(i=>s.createContext(i));return function(c){const l=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return n.scopeName=e,[r,gn(n,...t)]}function gn(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const i=r.reduce((c,{useScope:l,scopeName:p})=>{const d=l(a)[`__scope${p}`];return{...c,...d}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return o.scopeName=t.scopeName,o}var Sn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=Sn.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qe="Progress",Ze=100,[bn]=hn(qe),[xn,Cn]=bn(qe),co=s.forwardRef((e,t)=>{const{__scopeProgress:o,value:r=null,max:n,getValueLabel:a=wn,...i}=e;(n||n===0)&&!mt(n)&&console.error(Pn(`${n}`,"Progress"));const c=mt(n)?n:Ze;r!==null&&!ht(r,c)&&console.error(Rn(`${r}`,"Progress"));const l=ht(r,c)?r:null,p=Se(l)?a(l,c):void 0;return u.jsx(xn,{scope:o,value:l,max:c,children:u.jsx(io.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Se(l)?l:void 0,"aria-valuetext":p,role:"progressbar","data-state":fo(l,c),"data-value":l??void 0,"data-max":c,...i,ref:t})})});co.displayName=qe;var lo="ProgressIndicator",uo=s.forwardRef((e,t)=>{const{__scopeProgress:o,...r}=e,n=Cn(lo,o);return u.jsx(io.div,{"data-state":fo(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...r,ref:t})});uo.displayName=lo;function wn(e,t){return`${Math.round(e/t*100)}%`}function fo(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Se(e){return typeof e=="number"}function mt(e){return Se(e)&&!isNaN(e)&&e>0}function ht(e,t){return Se(e)&&!isNaN(e)&&e<=t&&e>=0}function Pn(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ze}\`.`}function Rn(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${Ze} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var Ps=co,Rs=uo,ye="Switch",[En]=G(ye),[_n,yn]=En(ye),po=s.forwardRef((e,t)=>{const{__scopeSwitch:o,name:r,checked:n,defaultChecked:a,required:i,disabled:c,value:l="on",onCheckedChange:p,form:f,...d}=e,[v,m]=s.useState(null),h=T(t,w=>m(w)),x=s.useRef(!1),g=v?f||!!v.closest("form"):!0,[S,R]=re({prop:n,defaultProp:a??!1,onChange:p,caller:ye});return u.jsxs(_n,{scope:o,checked:S,disabled:c,children:[u.jsx(E.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":go(S),"data-disabled":c?"":void 0,disabled:c,value:l,...d,ref:h,onClick:b(e.onClick,w=>{R(P=>!P),g&&(x.current=w.isPropagationStopped(),x.current||w.stopPropagation())})}),g&&u.jsx(ho,{control:v,bubbles:!x.current,name:r,value:l,checked:S,required:i,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});po.displayName=ye;var vo="SwitchThumb",mo=s.forwardRef((e,t)=>{const{__scopeSwitch:o,...r}=e,n=yn(vo,o);return u.jsx(E.span,{"data-state":go(n.checked),"data-disabled":n.disabled?"":void 0,...r,ref:t})});mo.displayName=vo;var An="SwitchBubbleInput",ho=s.forwardRef(({__scopeSwitch:e,control:t,checked:o,bubbles:r=!0,...n},a)=>{const i=s.useRef(null),c=T(i,a),l=xt(o),p=Ct(t);return s.useEffect(()=>{const f=i.current;if(!f)return;const d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==o&&m){const h=new Event("click",{bubbles:r});m.call(f,o),f.dispatchEvent(h)}},[l,o,r]),u.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...n,tabIndex:-1,ref:c,style:{...n.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ho.displayName=An;function go(e){return e?"checked":"unchecked"}var Es=po,_s=mo,So=["PageUp","PageDown"],bo=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],xo={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ne="Slider",[Fe,Tn,Mn]=Be(ne),[Co]=G(ne,[Mn]),[In,Ae]=Co(ne),wo=s.forwardRef((e,t)=>{const{name:o,min:r=0,max:n=100,step:a=1,orientation:i="horizontal",disabled:c=!1,minStepsBetweenThumbs:l=0,defaultValue:p=[r],value:f,onValueChange:d=()=>{},onValueCommit:v=()=>{},inverted:m=!1,form:h,...x}=e,g=s.useRef(new Set),S=s.useRef(0),w=i==="horizontal"?Dn:Nn,[P=[],I]=re({prop:f,defaultProp:p,onChange:y=>{[...g.current][S.current]?.focus(),d(y)}}),j=s.useRef(P);function D(y){const O=kn(P,y);A(y,O)}function M(y){A(y,S.current)}function _(){const y=j.current[S.current];P[S.current]!==y&&v(P)}function A(y,O,{commit:U}={commit:!1}){const Y=Kn(a),X=Gn(Math.round((y-r)/a)*a+r,Y),N=Ke(X,[r,n]);I((W=[])=>{const L=Ln(W,N,O);if(Bn(L,l*a)){S.current=L.indexOf(N);const C=String(L)!==String(W);return C&&U&&v(L),C?L:W}else return W})}return u.jsx(In,{scope:e.__scopeSlider,name:o,disabled:c,min:r,max:n,valueIndexToChangeRef:S,thumbs:g.current,values:P,orientation:i,form:h,children:u.jsx(Fe.Provider,{scope:e.__scopeSlider,children:u.jsx(Fe.Slot,{scope:e.__scopeSlider,children:u.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...x,ref:t,onPointerDown:b(x.onPointerDown,()=>{c||(j.current=P)}),min:r,max:n,inverted:m,onSlideStart:c?void 0:D,onSlideMove:c?void 0:M,onSlideEnd:c?void 0:_,onHomeKeyDown:()=>!c&&A(r,0,{commit:!0}),onEndKeyDown:()=>!c&&A(n,P.length-1,{commit:!0}),onStepKeyDown:({event:y,direction:O})=>{if(!c){const X=So.includes(y.key)||y.shiftKey&&bo.includes(y.key)?10:1,N=S.current,W=P[N],L=a*X*O;A(W+L,N,{commit:!0})}}})})})})});wo.displayName=ne;var[Po,Ro]=Co(ne,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Dn=s.forwardRef((e,t)=>{const{min:o,max:r,dir:n,inverted:a,onSlideStart:i,onSlideMove:c,onSlideEnd:l,onStepKeyDown:p,...f}=e,[d,v]=s.useState(null),m=T(t,w=>v(w)),h=s.useRef(void 0),x=de(n),g=x==="ltr",S=g&&!a||!g&&a;function R(w){const P=h.current||d.getBoundingClientRect(),I=[0,P.width],D=Je(I,S?[o,r]:[r,o]);return h.current=P,D(w-P.left)}return u.jsx(Po,{scope:e.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:u.jsx(Eo,{dir:x,"data-orientation":"horizontal",...f,ref:m,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const P=R(w.clientX);i?.(P)},onSlideMove:w=>{const P=R(w.clientX);c?.(P)},onSlideEnd:()=>{h.current=void 0,l?.()},onStepKeyDown:w=>{const I=xo[S?"from-left":"from-right"].includes(w.key);p?.({event:w,direction:I?-1:1})}})})}),Nn=s.forwardRef((e,t)=>{const{min:o,max:r,inverted:n,onSlideStart:a,onSlideMove:i,onSlideEnd:c,onStepKeyDown:l,...p}=e,f=s.useRef(null),d=T(t,f),v=s.useRef(void 0),m=!n;function h(x){const g=v.current||f.current.getBoundingClientRect(),S=[0,g.height],w=Je(S,m?[r,o]:[o,r]);return v.current=g,w(x-g.top)}return u.jsx(Po,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:u.jsx(Eo,{"data-orientation":"vertical",...p,ref:d,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:x=>{const g=h(x.clientY);a?.(g)},onSlideMove:x=>{const g=h(x.clientY);i?.(g)},onSlideEnd:()=>{v.current=void 0,c?.()},onStepKeyDown:x=>{const S=xo[m?"from-bottom":"from-top"].includes(x.key);l?.({event:x,direction:S?-1:1})}})})}),Eo=s.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:r,onSlideMove:n,onSlideEnd:a,onHomeKeyDown:i,onEndKeyDown:c,onStepKeyDown:l,...p}=e,f=Ae(ne,o);return u.jsx(E.span,{...p,ref:t,onKeyDown:b(e.onKeyDown,d=>{d.key==="Home"?(i(d),d.preventDefault()):d.key==="End"?(c(d),d.preventDefault()):So.concat(bo).includes(d.key)&&(l(d),d.preventDefault())}),onPointerDown:b(e.onPointerDown,d=>{const v=d.target;v.setPointerCapture(d.pointerId),d.preventDefault(),f.thumbs.has(v)?v.focus():r(d)}),onPointerMove:b(e.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&n(d)}),onPointerUp:b(e.onPointerUp,d=>{const v=d.target;v.hasPointerCapture(d.pointerId)&&(v.releasePointerCapture(d.pointerId),a(d))})})}),_o="SliderTrack",yo=s.forwardRef((e,t)=>{const{__scopeSlider:o,...r}=e,n=Ae(_o,o);return u.jsx(E.span,{"data-disabled":n.disabled?"":void 0,"data-orientation":n.orientation,...r,ref:t})});yo.displayName=_o;var ke="SliderRange",Ao=s.forwardRef((e,t)=>{const{__scopeSlider:o,...r}=e,n=Ae(ke,o),a=Ro(ke,o),i=s.useRef(null),c=T(t,i),l=n.values.length,p=n.values.map(v=>Io(v,n.min,n.max)),f=l>1?Math.min(...p):0,d=100-Math.max(...p);return u.jsx(E.span,{"data-orientation":n.orientation,"data-disabled":n.disabled?"":void 0,...r,ref:c,style:{...e.style,[a.startEdge]:f+"%",[a.endEdge]:d+"%"}})});Ao.displayName=ke;var $e="SliderThumb",To=s.forwardRef((e,t)=>{const o=Tn(e.__scopeSlider),[r,n]=s.useState(null),a=T(t,c=>n(c)),i=s.useMemo(()=>r?o().findIndex(c=>c.ref.current===r):-1,[o,r]);return u.jsx(jn,{...e,ref:a,index:i})}),jn=s.forwardRef((e,t)=>{const{__scopeSlider:o,index:r,name:n,...a}=e,i=Ae($e,o),c=Ro($e,o),[l,p]=s.useState(null),f=T(t,R=>p(R)),d=l?i.form||!!l.closest("form"):!0,v=Ct(l),m=i.values[r],h=m===void 0?0:Io(m,i.min,i.max),x=Fn(r,i.values.length),g=v?.[c.size],S=g?$n(g,h,c.direction):0;return s.useEffect(()=>{if(l)return i.thumbs.add(l),()=>{i.thumbs.delete(l)}},[l,i.thumbs]),u.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${h}% + ${S}px)`},children:[u.jsx(Fe.ItemSlot,{scope:e.__scopeSlider,children:u.jsx(E.span,{role:"slider","aria-label":e["aria-label"]||x,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...a,ref:f,style:m===void 0?{display:"none"}:e.style,onFocus:b(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),d&&u.jsx(Mo,{name:n??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});To.displayName=$e;var On="RadioBubbleInput",Mo=s.forwardRef(({__scopeSlider:e,value:t,...o},r)=>{const n=s.useRef(null),a=T(n,r),i=xt(t);return s.useEffect(()=>{const c=n.current;if(!c)return;const l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&f){const d=new Event("input",{bubbles:!0});f.call(c,t),c.dispatchEvent(d)}},[i,t]),u.jsx(E.input,{style:{display:"none"},...o,ref:a,defaultValue:t})});Mo.displayName=On;function Ln(e=[],t,o){const r=[...e];return r[o]=t,r.sort((n,a)=>n-a)}function Io(e,t,o){const a=100/(o-t)*(e-t);return Ke(a,[0,100])}function Fn(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function kn(e,t){if(e.length===1)return 0;const o=e.map(n=>Math.abs(n-t)),r=Math.min(...o);return o.indexOf(r)}function $n(e,t,o){const r=e/2,a=Je([0,50],[0,r]);return(r-a(t)*o)*o}function Vn(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function Bn(e,t){if(t>0){const o=Vn(e);return Math.min(...o)>=t}return!0}function Je(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function Kn(e){return(String(e).split(".")[1]||"").length}function Gn(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}var ys=wo,As=yo,Ts=Ao,Ms=To,Hn=Symbol("radix.slottable");function Un(e){const t=({children:o})=>u.jsx(u.Fragment,{children:o});return t.displayName=`${e}.Slottable`,t.__radixId=Hn,t}var Do="AlertDialog",[Wn]=G(Do,[wt]),H=wt(),No=e=>{const{__scopeAlertDialog:t,...o}=e,r=H(t);return u.jsx(Br,{...r,...o,modal:!0})};No.displayName=Do;var zn="AlertDialogTrigger",jo=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...r}=e,n=H(o);return u.jsx(Kr,{...n,...r,ref:t})});jo.displayName=zn;var Yn="AlertDialogPortal",Oo=e=>{const{__scopeAlertDialog:t,...o}=e,r=H(t);return u.jsx(Lr,{...r,...o})};Oo.displayName=Yn;var Xn="AlertDialogOverlay",Lo=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...r}=e,n=H(o);return u.jsx(Or,{...n,...r,ref:t})});Lo.displayName=Xn;var ee="AlertDialogContent",[qn,Zn]=Wn(ee),Jn=Un("AlertDialogContent"),Fo=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,children:r,...n}=e,a=H(o),i=s.useRef(null),c=T(t,i),l=s.useRef(null);return u.jsx(Fr,{contentName:ee,titleName:ko,docsSlug:"alert-dialog",children:u.jsx(qn,{scope:o,cancelRef:l,children:u.jsxs(kr,{role:"alertdialog",...a,...n,ref:c,onOpenAutoFocus:b(n.onOpenAutoFocus,p=>{p.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[u.jsx(Jn,{children:r}),u.jsx(ea,{contentRef:i})]})})})});Fo.displayName=ee;var ko="AlertDialogTitle",$o=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...r}=e,n=H(o);return u.jsx($r,{...n,...r,ref:t})});$o.displayName=ko;var Vo="AlertDialogDescription",Bo=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...r}=e,n=H(o);return u.jsx(Vr,{...n,...r,ref:t})});Bo.displayName=Vo;var Qn="AlertDialogAction",Ko=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...r}=e,n=H(o);return u.jsx(Pt,{...n,...r,ref:t})});Ko.displayName=Qn;var Go="AlertDialogCancel",Ho=s.forwardRef((e,t)=>{const{__scopeAlertDialog:o,...r}=e,{cancelRef:n}=Zn(Go,o),a=H(o),i=T(t,n);return u.jsx(Pt,{...a,...r,ref:i})});Ho.displayName=Go;var ea=({contentRef:e})=>{const t=`\`${ee}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${ee}\` by passing a \`${Vo}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ee}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return s.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Is=No,Ds=jo,Ns=Oo,js=Lo,Os=Fo,Ls=Ko,Fs=Ho,ks=$o,$s=Bo,ta=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oa=ta.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ra="Separator",gt="horizontal",na=["horizontal","vertical"],Uo=s.forwardRef((e,t)=>{const{decorative:o,orientation:r=gt,...n}=e,a=aa(r)?r:gt,c=o?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return u.jsx(oa.div,{"data-orientation":a,...c,...n,ref:t})});Uo.displayName=ra;function aa(e){return na.includes(e)}var Vs=Uo;function sa(e){const t=ia(e),o=s.forwardRef((r,n)=>{const{children:a,...i}=r,c=s.Children.toArray(a),l=c.find(la);if(l){const p=l.props.children,f=c.map(d=>d===l?s.Children.count(p)>1?s.Children.only(null):s.isValidElement(p)?p.props.children:null:d);return u.jsx(t,{...i,ref:n,children:s.isValidElement(p)?s.cloneElement(p,void 0,f):null})}return u.jsx(t,{...i,ref:n,children:a})});return o.displayName=`${e}.Slot`,o}function ia(e){const t=s.forwardRef((o,r)=>{const{children:n,...a}=o;if(s.isValidElement(n)){const i=da(n),c=ua(a,n.props);return n.type!==s.Fragment&&(c.ref=r?He(r,i):i),s.cloneElement(n,c)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ca=Symbol("radix.slottable");function la(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ca}function ua(e,t){const o={...t};for(const r in t){const n=e[r],a=t[r];/^on[A-Z]/.test(r)?n&&a?o[r]=(...c)=>{const l=a(...c);return n(...c),l}:n&&(o[r]=n):r==="style"?o[r]={...n,...a}:r==="className"&&(o[r]=[n,a].filter(Boolean).join(" "))}return{...e,...o}}function da(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var Te="Popover",[Wo]=G(Te,[we]),pe=we(),[fa,z]=Wo(Te),zo=e=>{const{__scopePopover:t,children:o,open:r,defaultOpen:n,onOpenChange:a,modal:i=!1}=e,c=pe(t),l=s.useRef(null),[p,f]=s.useState(!1),[d,v]=re({prop:r,defaultProp:n??!1,onChange:a,caller:Te});return u.jsx(It,{...c,children:u.jsx(fa,{scope:t,contentId:Ce(),triggerRef:l,open:d,onOpenChange:v,onOpenToggle:s.useCallback(()=>v(m=>!m),[v]),hasCustomAnchor:p,onCustomAnchorAdd:s.useCallback(()=>f(!0),[]),onCustomAnchorRemove:s.useCallback(()=>f(!1),[]),modal:i,children:o})})};zo.displayName=Te;var Yo="PopoverAnchor",pa=s.forwardRef((e,t)=>{const{__scopePopover:o,...r}=e,n=z(Yo,o),a=pe(o),{onCustomAnchorAdd:i,onCustomAnchorRemove:c}=n;return s.useEffect(()=>(i(),()=>c()),[i,c]),u.jsx(Ue,{...a,...r,ref:t})});pa.displayName=Yo;var Xo="PopoverTrigger",qo=s.forwardRef((e,t)=>{const{__scopePopover:o,...r}=e,n=z(Xo,o),a=pe(o),i=T(t,n.triggerRef),c=u.jsx(E.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":tr(n.open),...r,ref:i,onClick:b(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?c:u.jsx(Ue,{asChild:!0,...a,children:c})});qo.displayName=Xo;var Qe="PopoverPortal",[va,ma]=Wo(Qe,{forceMount:void 0}),Zo=e=>{const{__scopePopover:t,forceMount:o,children:r,container:n}=e,a=z(Qe,t);return u.jsx(va,{scope:t,forceMount:o,children:u.jsx($,{present:o||a.open,children:u.jsx(Rt,{asChild:!0,container:n,children:r})})})};Zo.displayName=Qe;var oe="PopoverContent",Jo=s.forwardRef((e,t)=>{const o=ma(oe,e.__scopePopover),{forceMount:r=o.forceMount,...n}=e,a=z(oe,e.__scopePopover);return u.jsx($,{present:r||a.open,children:a.modal?u.jsx(ga,{...n,ref:t}):u.jsx(Sa,{...n,ref:t})})});Jo.displayName=oe;var ha=sa("PopoverContent.RemoveScroll"),ga=s.forwardRef((e,t)=>{const o=z(oe,e.__scopePopover),r=s.useRef(null),n=T(t,r),a=s.useRef(!1);return s.useEffect(()=>{const i=r.current;if(i)return Et(i)},[]),u.jsx(_t,{as:ha,allowPinchZoom:!0,children:u.jsx(Qo,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:b(e.onCloseAutoFocus,i=>{i.preventDefault(),a.current||o.triggerRef.current?.focus()}),onPointerDownOutside:b(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,p=c.button===2||l;a.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:b(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Sa=s.forwardRef((e,t)=>{const o=z(oe,e.__scopePopover),r=s.useRef(!1),n=s.useRef(!1);return u.jsx(Qo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||o.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const i=a.target;o.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),Qo=s.forwardRef((e,t)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:p,onInteractOutside:f,...d}=e,v=z(oe,o),m=pe(o);return yt(),u.jsx(At,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:a,children:u.jsx(Tt,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:p,onDismiss:()=>v.onOpenChange(!1),children:u.jsx(Mt,{"data-state":tr(v.open),role:"dialog",id:v.contentId,...m,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),er="PopoverClose",ba=s.forwardRef((e,t)=>{const{__scopePopover:o,...r}=e,n=z(er,o);return u.jsx(E.button,{type:"button",...r,ref:t,onClick:b(e.onClick,()=>n.onOpenChange(!1))})});ba.displayName=er;var xa="PopoverArrow",Ca=s.forwardRef((e,t)=>{const{__scopePopover:o,...r}=e,n=pe(o);return u.jsx(Dt,{...n,...r,ref:t})});Ca.displayName=xa;function tr(e){return e?"open":"closed"}var Bs=zo,Ks=qo,Gs=Zo,Hs=Jo,Me="Collapsible",[wa,Us]=G(Me),[Pa,et]=wa(Me),or=s.forwardRef((e,t)=>{const{__scopeCollapsible:o,open:r,defaultOpen:n,disabled:a,onOpenChange:i,...c}=e,[l,p]=re({prop:r,defaultProp:n??!1,onChange:i,caller:Me});return u.jsx(Pa,{scope:o,disabled:a,contentId:Ce(),open:l,onOpenToggle:s.useCallback(()=>p(f=>!f),[p]),children:u.jsx(E.div,{"data-state":ot(l),"data-disabled":a?"":void 0,...c,ref:t})})});or.displayName=Me;var rr="CollapsibleTrigger",nr=s.forwardRef((e,t)=>{const{__scopeCollapsible:o,...r}=e,n=et(rr,o);return u.jsx(E.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":ot(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...r,ref:t,onClick:b(e.onClick,n.onOpenToggle)})});nr.displayName=rr;var tt="CollapsibleContent",ar=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=et(tt,e.__scopeCollapsible);return u.jsx($,{present:o||n.open,children:({present:a})=>u.jsx(Ra,{...r,ref:t,present:a})})});ar.displayName=tt;var Ra=s.forwardRef((e,t)=>{const{__scopeCollapsible:o,present:r,children:n,...a}=e,i=et(tt,o),[c,l]=s.useState(r),p=s.useRef(null),f=T(t,p),d=s.useRef(0),v=d.current,m=s.useRef(0),h=m.current,x=i.open||c,g=s.useRef(x),S=s.useRef(void 0);return s.useEffect(()=>{const R=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(R)},[]),ce(()=>{const R=p.current;if(R){S.current=S.current||{transitionDuration:R.style.transitionDuration,animationName:R.style.animationName},R.style.transitionDuration="0s",R.style.animationName="none";const w=R.getBoundingClientRect();d.current=w.height,m.current=w.width,g.current||(R.style.transitionDuration=S.current.transitionDuration,R.style.animationName=S.current.animationName),l(r)}},[i.open,r]),u.jsx(E.div,{"data-state":ot(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...a,ref:f,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:x&&n})});function ot(e){return e?"open":"closed"}var Ws=or,zs=nr,Ys=ar;function Ea(e,t=[]){let o=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const l=o.length;o=[...o,i];const p=d=>{const{scope:v,children:m,...h}=d,x=v?.[e]?.[l]||c,g=s.useMemo(()=>h,Object.values(h));return u.jsx(x.Provider,{value:g,children:m})};p.displayName=a+"Provider";function f(d,v){const m=v?.[e]?.[l]||c,h=s.useContext(m);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[p,f]}const n=()=>{const a=o.map(i=>s.createContext(i));return function(c){const l=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return n.scopeName=e,[r,_a(n,...t)]}function _a(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const i=r.reduce((c,{useScope:l,scopeName:p})=>{const d=l(a)[`__scope${p}`];return{...c,...d}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return o.scopeName=t.scopeName,o}var ya=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rt=ya.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Aa=jr();function Ta(){return Aa.useSyncExternalStore(Ma,()=>!0,()=>!1)}function Ma(){return()=>{}}var nt="Avatar",[Ia]=Ea(nt),[Da,sr]=Ia(nt),ir=s.forwardRef((e,t)=>{const{__scopeAvatar:o,...r}=e,[n,a]=s.useState("idle");return u.jsx(Da,{scope:o,imageLoadingStatus:n,onImageLoadingStatusChange:a,children:u.jsx(rt.span,{...r,ref:t})})});ir.displayName=nt;var cr="AvatarImage",lr=s.forwardRef((e,t)=>{const{__scopeAvatar:o,src:r,onLoadingStatusChange:n=()=>{},...a}=e,i=sr(cr,o),c=Na(r,a),l=B(p=>{n(p),i.onImageLoadingStatusChange(p)});return ce(()=>{c!=="idle"&&l(c)},[c,l]),c==="loaded"?u.jsx(rt.img,{...a,ref:t,src:r}):null});lr.displayName=cr;var ur="AvatarFallback",dr=s.forwardRef((e,t)=>{const{__scopeAvatar:o,delayMs:r,...n}=e,a=sr(ur,o),[i,c]=s.useState(r===void 0);return s.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>c(!0),r);return()=>window.clearTimeout(l)}},[r]),i&&a.imageLoadingStatus!=="loaded"?u.jsx(rt.span,{...n,ref:t}):null});dr.displayName=ur;function St(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Na(e,{referrerPolicy:t,crossOrigin:o}){const r=Ta(),n=s.useRef(null),a=r?(n.current||(n.current=new window.Image),n.current):null,[i,c]=s.useState(()=>St(a,e));return ce(()=>{c(St(a,e))},[a,e]),ce(()=>{const l=d=>()=>{c(d)};if(!a)return;const p=l("loaded"),f=l("error");return a.addEventListener("load",p),a.addEventListener("error",f),t&&(a.referrerPolicy=t),typeof o=="string"&&(a.crossOrigin=o),()=>{a.removeEventListener("load",p),a.removeEventListener("error",f)}},[a,o,t]),i}var Xs=ir,qs=lr,Zs=dr;function ja(e){const t=Oa(e),o=s.forwardRef((r,n)=>{const{children:a,...i}=r,c=s.Children.toArray(a),l=c.find(Fa);if(l){const p=l.props.children,f=c.map(d=>d===l?s.Children.count(p)>1?s.Children.only(null):s.isValidElement(p)?p.props.children:null:d);return u.jsx(t,{...i,ref:n,children:s.isValidElement(p)?s.cloneElement(p,void 0,f):null})}return u.jsx(t,{...i,ref:n,children:a})});return o.displayName=`${e}.Slot`,o}function Oa(e){const t=s.forwardRef((o,r)=>{const{children:n,...a}=o;if(s.isValidElement(n)){const i=$a(n),c=ka(a,n.props);return n.type!==s.Fragment&&(c.ref=r?He(r,i):i),s.cloneElement(n,c)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var La=Symbol("radix.slottable");function Fa(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===La}function ka(e,t){const o={...t};for(const r in t){const n=e[r],a=t[r];/^on[A-Z]/.test(r)?n&&a?o[r]=(...c)=>{const l=a(...c);return n(...c),l}:n&&(o[r]=n):r==="style"?o[r]={...n,...a}:r==="className"&&(o[r]=[n,a].filter(Boolean).join(" "))}return{...e,...o}}function $a(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var Ve=["Enter"," "],Va=["ArrowDown","PageUp","Home"],fr=["ArrowUp","PageDown","End"],Ba=[...Va,...fr],Ka={ltr:[...Ve,"ArrowRight"],rtl:[...Ve,"ArrowLeft"]},Ga={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ve="Menu",[le,Ha,Ua]=Be(ve),[Z,Js]=G(ve,[Ua,we,Pe]),Ie=we(),pr=Pe(),[Wa,J]=Z(ve),[za,me]=Z(ve),vr=e=>{const{__scopeMenu:t,open:o=!1,children:r,dir:n,onOpenChange:a,modal:i=!0}=e,c=Ie(t),[l,p]=s.useState(null),f=s.useRef(!1),d=B(a),v=de(n);return s.useEffect(()=>{const m=()=>{f.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},h=()=>f.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),u.jsx(It,{...c,children:u.jsx(Wa,{scope:t,open:o,onOpenChange:d,content:l,onContentChange:p,children:u.jsx(za,{scope:t,onClose:s.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:f,dir:v,modal:i,children:r})})})};vr.displayName=ve;var Ya="MenuAnchor",at=s.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e,n=Ie(o);return u.jsx(Ue,{...n,...r,ref:t})});at.displayName=Ya;var st="MenuPortal",[Xa,mr]=Z(st,{forceMount:void 0}),hr=e=>{const{__scopeMenu:t,forceMount:o,children:r,container:n}=e,a=J(st,t);return u.jsx(Xa,{scope:t,forceMount:o,children:u.jsx($,{present:o||a.open,children:u.jsx(Rt,{asChild:!0,container:n,children:r})})})};hr.displayName=st;var k="MenuContent",[qa,it]=Z(k),gr=s.forwardRef((e,t)=>{const o=mr(k,e.__scopeMenu),{forceMount:r=o.forceMount,...n}=e,a=J(k,e.__scopeMenu),i=me(k,e.__scopeMenu);return u.jsx(le.Provider,{scope:e.__scopeMenu,children:u.jsx($,{present:r||a.open,children:u.jsx(le.Slot,{scope:e.__scopeMenu,children:i.modal?u.jsx(Za,{...n,ref:t}):u.jsx(Ja,{...n,ref:t})})})})}),Za=s.forwardRef((e,t)=>{const o=J(k,e.__scopeMenu),r=s.useRef(null),n=T(t,r);return s.useEffect(()=>{const a=r.current;if(a)return Et(a)},[]),u.jsx(ct,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)})}),Ja=s.forwardRef((e,t)=>{const o=J(k,e.__scopeMenu);return u.jsx(ct,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)})}),Qa=ja("MenuContent.ScrollLock"),ct=s.forwardRef((e,t)=>{const{__scopeMenu:o,loop:r=!1,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:v,onDismiss:m,disableOutsideScroll:h,...x}=e,g=J(k,o),S=me(k,o),R=Ie(o),w=pr(o),P=Ha(o),[I,j]=s.useState(null),D=s.useRef(null),M=T(t,D,g.onContentChange),_=s.useRef(0),A=s.useRef(""),y=s.useRef(0),O=s.useRef(null),U=s.useRef("right"),Y=s.useRef(0),X=h?_t:s.Fragment,N=h?{as:Qa,allowPinchZoom:!0}:void 0,W=C=>{const Q=A.current+C,q=P().filter(F=>!F.disabled),ae=document.activeElement,Ne=q.find(F=>F.ref.current===ae)?.textValue,je=q.map(F=>F.textValue),ft=ds(je,Q,Ne),se=q.find(F=>F.textValue===ft)?.ref.current;(function F(pt){A.current=pt,window.clearTimeout(_.current),pt!==""&&(_.current=window.setTimeout(()=>F(""),1e3))})(Q),se&&setTimeout(()=>se.focus())};s.useEffect(()=>()=>window.clearTimeout(_.current),[]),yt();const L=s.useCallback(C=>U.current===O.current?.side&&ps(C,O.current?.area),[]);return u.jsx(qa,{scope:o,searchRef:A,onItemEnter:s.useCallback(C=>{L(C)&&C.preventDefault()},[L]),onItemLeave:s.useCallback(C=>{L(C)||(D.current?.focus(),j(null))},[L]),onTriggerLeave:s.useCallback(C=>{L(C)&&C.preventDefault()},[L]),pointerGraceTimerRef:y,onPointerGraceIntentChange:s.useCallback(C=>{O.current=C},[]),children:u.jsx(X,{...N,children:u.jsx(At,{asChild:!0,trapped:n,onMountAutoFocus:b(a,C=>{C.preventDefault(),D.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:u.jsx(Tt,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:p,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:v,onDismiss:m,children:u.jsx(kt,{asChild:!0,...w,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:I,onCurrentTabStopIdChange:j,onEntryFocus:b(l,C=>{S.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(Mt,{role:"menu","aria-orientation":"vertical","data-state":Nr(g.open),"data-radix-menu-content":"",dir:S.dir,...R,...x,ref:M,style:{outline:"none",...x.style},onKeyDown:b(x.onKeyDown,C=>{const q=C.target.closest("[data-radix-menu-content]")===C.currentTarget,ae=C.ctrlKey||C.altKey||C.metaKey,Ne=C.key.length===1;q&&(C.key==="Tab"&&C.preventDefault(),!ae&&Ne&&W(C.key));const je=D.current;if(C.target!==je||!Ba.includes(C.key))return;C.preventDefault();const se=P().filter(F=>!F.disabled).map(F=>F.ref.current);fr.includes(C.key)&&se.reverse(),ls(se)}),onBlur:b(e.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(_.current),A.current="")}),onPointerMove:b(e.onPointerMove,ue(C=>{const Q=C.target,q=Y.current!==C.clientX;if(C.currentTarget.contains(Q)&&q){const ae=C.clientX>Y.current?"right":"left";U.current=ae,Y.current=C.clientX}}))})})})})})})});gr.displayName=k;var es="MenuGroup",lt=s.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e;return u.jsx(E.div,{role:"group",...r,ref:t})});lt.displayName=es;var ts="MenuLabel",Sr=s.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e;return u.jsx(E.div,{...r,ref:t})});Sr.displayName=ts;var be="MenuItem",bt="menu.itemSelect",De=s.forwardRef((e,t)=>{const{disabled:o=!1,onSelect:r,...n}=e,a=s.useRef(null),i=me(be,e.__scopeMenu),c=it(be,e.__scopeMenu),l=T(t,a),p=s.useRef(!1),f=()=>{const d=a.current;if(!o&&d){const v=new CustomEvent(bt,{bubbles:!0,cancelable:!0});d.addEventListener(bt,m=>r?.(m),{once:!0}),Gr(d,v),v.defaultPrevented?p.current=!1:i.onClose()}};return u.jsx(br,{...n,ref:l,disabled:o,onClick:b(e.onClick,f),onPointerDown:d=>{e.onPointerDown?.(d),p.current=!0},onPointerUp:b(e.onPointerUp,d=>{p.current||d.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,d=>{const v=c.searchRef.current!=="";o||v&&d.key===" "||Ve.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});De.displayName=be;var br=s.forwardRef((e,t)=>{const{__scopeMenu:o,disabled:r=!1,textValue:n,...a}=e,i=it(be,o),c=pr(o),l=s.useRef(null),p=T(t,l),[f,d]=s.useState(!1),[v,m]=s.useState("");return s.useEffect(()=>{const h=l.current;h&&m((h.textContent??"").trim())},[a.children]),u.jsx(le.ItemSlot,{scope:o,disabled:r,textValue:n??v,children:u.jsx($t,{asChild:!0,...c,focusable:!r,children:u.jsx(E.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:p,onPointerMove:b(e.onPointerMove,ue(h=>{r?i.onItemLeave(h):(i.onItemEnter(h),h.defaultPrevented||h.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,ue(h=>i.onItemLeave(h))),onFocus:b(e.onFocus,()=>d(!0)),onBlur:b(e.onBlur,()=>d(!1))})})})}),os="MenuCheckboxItem",xr=s.forwardRef((e,t)=>{const{checked:o=!1,onCheckedChange:r,...n}=e;return u.jsx(Er,{scope:e.__scopeMenu,checked:o,children:u.jsx(De,{role:"menuitemcheckbox","aria-checked":xe(o)?"mixed":o,...n,ref:t,"data-state":dt(o),onSelect:b(n.onSelect,()=>r?.(xe(o)?!0:!o),{checkForDefaultPrevented:!1})})})});xr.displayName=os;var Cr="MenuRadioGroup",[rs,ns]=Z(Cr,{value:void 0,onValueChange:()=>{}}),wr=s.forwardRef((e,t)=>{const{value:o,onValueChange:r,...n}=e,a=B(r);return u.jsx(rs,{scope:e.__scopeMenu,value:o,onValueChange:a,children:u.jsx(lt,{...n,ref:t})})});wr.displayName=Cr;var Pr="MenuRadioItem",Rr=s.forwardRef((e,t)=>{const{value:o,...r}=e,n=ns(Pr,e.__scopeMenu),a=o===n.value;return u.jsx(Er,{scope:e.__scopeMenu,checked:a,children:u.jsx(De,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":dt(a),onSelect:b(r.onSelect,()=>n.onValueChange?.(o),{checkForDefaultPrevented:!1})})})});Rr.displayName=Pr;var ut="MenuItemIndicator",[Er,as]=Z(ut,{checked:!1}),_r=s.forwardRef((e,t)=>{const{__scopeMenu:o,forceMount:r,...n}=e,a=as(ut,o);return u.jsx($,{present:r||xe(a.checked)||a.checked===!0,children:u.jsx(E.span,{...n,ref:t,"data-state":dt(a.checked)})})});_r.displayName=ut;var ss="MenuSeparator",yr=s.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e;return u.jsx(E.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});yr.displayName=ss;var is="MenuArrow",Ar=s.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e,n=Ie(o);return u.jsx(Dt,{...n,...r,ref:t})});Ar.displayName=is;var cs="MenuSub",[Qs,Tr]=Z(cs),ie="MenuSubTrigger",Mr=s.forwardRef((e,t)=>{const o=J(ie,e.__scopeMenu),r=me(ie,e.__scopeMenu),n=Tr(ie,e.__scopeMenu),a=it(ie,e.__scopeMenu),i=s.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=a,p={__scopeMenu:e.__scopeMenu},f=s.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return s.useEffect(()=>f,[f]),s.useEffect(()=>{const d=c.current;return()=>{window.clearTimeout(d),l(null)}},[c,l]),u.jsx(at,{asChild:!0,...p,children:u.jsx(br,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":n.contentId,"data-state":Nr(o.open),...e,ref:He(t,n.onTriggerChange),onClick:d=>{e.onClick?.(d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,ue(d=>{a.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!o.open&&!i.current&&(a.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{o.onOpenChange(!0),f()},100))})),onPointerLeave:b(e.onPointerLeave,ue(d=>{f();const v=o.content?.getBoundingClientRect();if(v){const m=o.content?.dataset.side,h=m==="right",x=h?-5:5,g=v[h?"left":"right"],S=v[h?"right":"left"];a.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:g,y:v.top},{x:S,y:v.top},{x:S,y:v.bottom},{x:g,y:v.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(d),d.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:b(e.onKeyDown,d=>{const v=a.searchRef.current!=="";e.disabled||v&&d.key===" "||Ka[r.dir].includes(d.key)&&(o.onOpenChange(!0),o.content?.focus(),d.preventDefault())})})})});Mr.displayName=ie;var Ir="MenuSubContent",Dr=s.forwardRef((e,t)=>{const o=mr(k,e.__scopeMenu),{forceMount:r=o.forceMount,...n}=e,a=J(k,e.__scopeMenu),i=me(k,e.__scopeMenu),c=Tr(Ir,e.__scopeMenu),l=s.useRef(null),p=T(t,l);return u.jsx(le.Provider,{scope:e.__scopeMenu,children:u.jsx($,{present:r||a.open,children:u.jsx(le.Slot,{scope:e.__scopeMenu,children:u.jsx(ct,{id:c.contentId,"aria-labelledby":c.triggerId,...n,ref:p,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{i.isUsingKeyboardRef.current&&l.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:b(e.onFocusOutside,f=>{f.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:b(e.onKeyDown,f=>{const d=f.currentTarget.contains(f.target),v=Ga[i.dir].includes(f.key);d&&v&&(a.onOpenChange(!1),c.trigger?.focus(),f.preventDefault())})})})})})});Dr.displayName=Ir;function Nr(e){return e?"open":"closed"}function xe(e){return e==="indeterminate"}function dt(e){return xe(e)?"indeterminate":e?"checked":"unchecked"}function ls(e){const t=document.activeElement;for(const o of e)if(o===t||(o.focus(),document.activeElement!==t))return}function us(e,t){return e.map((o,r)=>e[(t+r)%e.length])}function ds(e,t,o){const n=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,a=o?e.indexOf(o):-1;let i=us(e,Math.max(a,0));n.length===1&&(i=i.filter(p=>p!==o));const l=i.find(p=>p.toLowerCase().startsWith(n.toLowerCase()));return l!==o?l:void 0}function fs(e,t){const{x:o,y:r}=e;let n=!1;for(let a=0,i=t.length-1;ar!=v>r&&o<(d-p)*(r-f)/(v-f)+p&&(n=!n)}return n}function ps(e,t){if(!t)return!1;const o={x:e.clientX,y:e.clientY};return fs(o,t)}function ue(e){return t=>t.pointerType==="mouse"?e(t):void 0}var ei=vr,ti=at,oi=hr,ri=gr,ni=lt,ai=Sr,si=De,ii=xr,ci=wr,li=Rr,ui=_r,di=yr,fi=Ar,pi=Mr,vi=Dr;export{ni as $,Ls as A,kt as B,bs as C,$s as D,$t as E,Zs as F,Js as G,pi as H,Rs as I,vi as J,oi as K,gs as L,ri as M,si as N,js as O,Ns as P,ii as Q,hs as R,nn as S,Ss as T,ui as U,Cs as V,li as W,ai as X,di as Y,ei as Z,ti as _,xs as a,ci as a0,fi as a1,Us as a2,zs as a3,Ys as a4,ws as b,dn as c,Ps as d,Es as e,_s as f,ys as g,As as h,Ts as i,Ms as j,Os as k,ks as l,Fs as m,Is as n,Ds as o,Vs as p,Gs as q,Hs as r,Bs as s,Ks as t,Ws as u,nr as v,ar as w,Xs as x,qs as y,Pe as z}; diff --git a/webui/dist/assets/react-vendor-BmxF9s7Q.js b/webui/dist/assets/react-vendor-BmxF9s7Q.js deleted file mode 100644 index 97721520..00000000 --- a/webui/dist/assets/react-vendor-BmxF9s7Q.js +++ /dev/null @@ -1 +0,0 @@ -var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ae(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var $={exports:{}},P={};var W;function oe(){if(W)return P;W=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.fragment");function v(y,E,g){var R=null;if(g!==void 0&&(R=""+g),E.key!==void 0&&(R=""+E.key),"key"in E){g={};for(var m in E)m!=="key"&&(g[m]=E[m])}else g=E;return E=g.ref,{$$typeof:_,type:y,key:R,ref:E!==void 0?E:null,props:g}}return P.Fragment=O,P.jsx=v,P.jsxs=v,P}var X;function le(){return X||(X=1,$.exports=oe()),$.exports}var k={exports:{}},n={};var F;function ie(){if(F)return n;F=1;var _=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),R=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),t=Symbol.for("react.memo"),c=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),h=Symbol.iterator;function w(e){return e===null||typeof e!="object"?null:(e=h&&e[h]||e["@@iterator"],typeof e=="function"?e:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,q={};function C(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}C.prototype.isReactComponent={},C.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")},C.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function b(){}b.prototype=C.prototype;function N(e,r,o){this.props=e,this.context=r,this.refs=q,this.updater=o||Y}var j=N.prototype=new b;j.constructor=N,U(j,C.prototype),j.isPureReactComponent=!0;var G=Array.isArray;function D(){}var a={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function L(e,r,o){var u=o.ref;return{$$typeof:_,type:e,key:r,ref:u!==void 0?u:null,props:o}}function V(e,r){return L(e.type,r,e.props)}function x(e){return typeof e=="object"&&e!==null&&e.$$typeof===_}function ee(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(o){return r[o]})}var B=/\/+/g;function M(e,r){return typeof e=="object"&&e!==null&&e.key!=null?ee(""+e.key):r.toString(36)}function te(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(D,D):(e.status="pending",e.then(function(r){e.status==="pending"&&(e.status="fulfilled",e.value=r)},function(r){e.status==="pending"&&(e.status="rejected",e.reason=r)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function A(e,r,o,u,s){var f=typeof e;(f==="undefined"||f==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(f){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case _:case O:l=!0;break;case c:return l=e._init,A(l(e._payload),r,o,u,s)}}if(l)return s=s(e),l=u===""?"."+M(e,0):u,G(s)?(o="",l!=null&&(o=l.replace(B,"$&/")+"/"),A(s,r,o,"",function(ue){return ue})):s!=null&&(x(s)&&(s=V(s,o+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(B,"$&/")+"/")+l)),r.push(s)),1;l=0;var T=u===""?".":u+":";if(G(e))for(var d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(O){console.error(O)}}return _(),I.exports=fe(),I.exports}export{se as a,ye as b,ce as c,ae as g,le as r}; diff --git a/webui/dist/assets/reactflow-DtsZHOR4.js b/webui/dist/assets/reactflow-DtsZHOR4.js deleted file mode 100644 index dbf46732..00000000 --- a/webui/dist/assets/reactflow-DtsZHOR4.js +++ /dev/null @@ -1,2 +0,0 @@ -import{u as hm,R as L,r as k}from"./router-9vIXuQkh.js";import{i as pm,a as vc,b as vm,c as gc,d as gm,e as ym,f as mm}from"./charts-simvewUa.js";import{c as Xt}from"./react-vendor-BmxF9s7Q.js";var Ur,yc;function qe(){if(yc)return Ur;yc=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ur=e,Ur}var jr,mc;function gv(){if(mc)return jr;mc=1;var e=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt;return jr=e,jr}var Kr,_c;function Me(){if(_c)return Kr;_c=1;var e=gv(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Kr=r,Kr}var Yr,bc;function _m(){if(bc)return Yr;bc=1;var e=Me(),t=function(){return e.Date.now()};return Yr=t,Yr}var Wr,wc;function bm(){if(wc)return Wr;wc=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Wr=t,Wr}var Zr,Ec;function wm(){if(Ec)return Zr;Ec=1;var e=bm(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Zr=r,Zr}var Xr,xc;function Et(){if(xc)return Xr;xc=1;var e=Me(),t=e.Symbol;return Xr=t,Xr}var Jr,Sc;function Em(){if(Sc)return Jr;Sc=1;var e=Et(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var l=!0}catch{}var c=n.call(o);return l&&(s?o[i]=u:delete o[i]),c}return Jr=a,Jr}var Qr,qc;function xm(){if(qc)return Qr;qc=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Qr=r,Qr}var en,Rc;function st(){if(Rc)return en;Rc=1;var e=Et(),t=Em(),r=xm(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return en=o,en}var tn,Cc;function Le(){if(Cc)return tn;Cc=1;function e(t){return t!=null&&typeof t=="object"}return tn=e,tn}var rn,Ac;function xt(){if(Ac)return rn;Ac=1;var e=st(),t=Le(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return rn=n,rn}var nn,Nc;function Sm(){if(Nc)return nn;Nc=1;var e=wm(),t=qe(),r=xt(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return n;if(t(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=t(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=e(l);var f=a.test(l);return f||o.test(l)?s(l.slice(2),f?2:8):i.test(l)?n:+l}return nn=u,nn}function pe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;r{let t;const r=new Set,n=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(_=>_(t,h))}},i=()=>t,u={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(qm?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},l=t=e(n,i,u);return u},Rm=e=>e?Ic(e):Ic,{useDebugValue:Cm}=L,{useSyncExternalStoreWithSelector:Am}=hm,Nm=e=>e;function yv(e,t=Nm,r){const n=Am(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Cm(n),n}const Tc=(e,t)=>{const r=Rm(e),n=(i,a=t)=>yv(r,i,a);return Object.assign(n,r),n},Im=(e,t)=>e?Tc(e,t):Tc;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,i]of e)if(!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}var Tm={value:()=>{}};function yr(){for(var e=0,t=arguments.length,r={},n;e=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ir.prototype=yr.prototype={constructor:ir,on:function(e,t){var r=this._,n=Mm(e+"",r),i,a=-1,o=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Pc.hasOwnProperty(t)?{space:Pc[t],local:e}:e}function Om(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===mu&&t.documentElement.namespaceURI===mu?t.createElement(e):t.createElementNS(r,e)}}function km(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function mv(e){var t=mr(e);return(t.local?km:Om)(t)}function Dm(){}function Tu(e){return e==null?Dm:function(){return this.querySelector(e)}}function Lm(e){typeof e!="function"&&(e=Tu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i=b&&(b=y+1);!(E=v[b])&&++b<_;);m._next=E||null}}return o=new Ee(o,n),o._enter=s,o._exit=u,o}function n_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i_(){return new Ee(this._exit||this._groups.map(Ev),this._parents)}function a_(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}function o_(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=new Array(i),u=0;u=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function u_(e){e||(e=c_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;at?1:e>=t?0:NaN}function l_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function f_(){return Array.from(this)}function d_(){for(var e=this._groups,t=0,r=e.length;t1?this.each((t==null?x_:typeof t=="function"?q_:S_)(e,t,r??"")):_t(this.node(),e)}function _t(e,t){return e.style.getPropertyValue(t)||xv(e).getComputedStyle(e,null).getPropertyValue(t)}function C_(e){return function(){delete this[e]}}function A_(e,t){return function(){this[e]=t}}function N_(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function I_(e,t){return arguments.length>1?this.each((t==null?C_:typeof t=="function"?N_:A_)(e,t)):this.node()[e]}function Sv(e){return e.trim().split(/^|\s+/)}function Mu(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Sv(e.getAttribute("class")||"")}qv.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Rv(e,t){for(var r=Mu(e),n=-1,i=t.length;++n=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function ib(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r()=>e;function _u(e,{sourceEvent:t,subject:r,target:n,identifier:i,active:a,x:o,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}_u.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pb(e){return!e.ctrlKey&&!e.button}function vb(){return this.parentNode}function gb(e,t){return t??{x:e.x,y:e.y}}function yb(){return navigator.maxTouchPoints||"ontouchstart"in this}function mb(){var e=pb,t=vb,r=gb,n=yb,i={},a=yr("start","drag","end"),o=0,s,u,l,c,f=0;function d(m){m.on("mousedown.drag",h).filter(n).on("touchstart.drag",v).on("touchmove.drag",p,hb).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,E){if(!(c||!e.call(this,m,E))){var x=b(this,t.call(this,m,E),m,E,"mouse");x&&(xe(m.view).on("mousemove.drag",_,zt).on("mouseup.drag",g,zt),Iv(m.view),an(m),l=!1,s=m.clientX,u=m.clientY,x("start",m))}}function _(m){if(yt(m),!l){var E=m.clientX-s,x=m.clientY-u;l=E*E+x*x>f}i.mouse("drag",m)}function g(m){xe(m.view).on("mousemove.drag mouseup.drag",null),Tv(m.view,l),yt(m),i.mouse("end",m)}function v(m,E){if(e.call(this,m,E)){var x=m.changedTouches,S=t.call(this,m,E),N=x.length,q,A;for(q=0;q=0&&e._call.call(void 0,t),e=e._next;--bt}function Oc(){at=(lr=Bt.now())+_r,bt=Pt=0;try{bb()}finally{bt=0,Eb(),at=0}}function wb(){var e=Bt.now(),t=e-lr;t>Mv&&(_r-=t,lr=e)}function Eb(){for(var e,t=cr,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:cr=r);Ot=e,bu(n)}function bu(e){if(!bt){Pt&&(Pt=clearTimeout(Pt));var t=e-at;t>24?(e<1/0&&(Pt=setTimeout(Oc,e-Bt.now()-_r)),At&&(At=clearInterval(At))):(At||(lr=Bt.now(),At=setInterval(wb,Mv)),bt=1,Pv(Oc))}}function kc(e,t,r){var n=new fr;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var xb=yr("start","end","cancel","interrupt"),Sb=[],kv=0,Dc=1,wu=2,ar=3,Lc=4,Eu=5,or=6;function br(e,t,r,n,i,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;qb(e,r,{name:t,index:n,group:i,on:xb,tween:Sb,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:kv})}function Ou(e,t){var r=Pe(e,t);if(r.state>kv)throw new Error("too late; already scheduled");return r}function Fe(e,t){var r=Pe(e,t);if(r.state>ar)throw new Error("too late; already running");return r}function Pe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function qb(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Ov(a,0,r.time);function a(l){r.state=Dc,r.timer.restart(o,r.delay,r.time),r.delay<=l&&o(l-r.delay)}function o(l){var c,f,d,h;if(r.state!==Dc)return u();for(c in n)if(h=n[c],h.name===r.name){if(h.state===ar)return kc(o);h.state===Lc?(h.state=or,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[c]):+cwu&&n.state=0&&(t=t.slice(0,r)),!t||t==="start"})}function t0(e,t,r){var n,i,a=e0(t)?Ou:Fe;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}function r0(e,t){var r=this._id;return arguments.length<2?Pe(this.node(),r).on.on(e):this.each(t0(r,e,t))}function n0(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function i0(){return this.on("end.remove",n0(this._id))}function a0(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Tu(e));for(var n=this._groups,i=n.length,a=new Array(i),o=0;o()=>e;function I0(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function $e(e,t,r){this.k=e,this.x=t,this.y=r}$e.prototype={constructor:$e,scale:function(e){return e===1?this:new $e(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new $e(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ge=new $e(1,0,0);$e.prototype;function on(e){e.stopImmediatePropagation()}function Nt(e){e.preventDefault(),e.stopImmediatePropagation()}function T0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function M0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fc(){return this.__zoom||Ge}function P0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function O0(){return navigator.maxTouchPoints||"ontouchstart"in this}function k0(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function zv(){var e=T0,t=M0,r=k0,n=P0,i=O0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=mm,l=yr("start","zoom","end"),c,f,d,h=500,_=150,g=0,v=10;function p(w){w.property("__zoom",Fc).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,T,C,z){var H=w.selection?w.selection():w;H.property("__zoom",Fc),w!==H?E(w,T,C,z):H.interrupt().each(function(){x(this,arguments).event(z).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},p.scaleBy=function(w,T,C,z){p.scaleTo(w,function(){var H=this.__zoom.k,M=typeof T=="function"?T.apply(this,arguments):T;return H*M},C,z)},p.scaleTo=function(w,T,C,z){p.transform(w,function(){var H=t.apply(this,arguments),M=this.__zoom,B=C==null?m(H):typeof C=="function"?C.apply(this,arguments):C,G=M.invert(B),V=typeof T=="function"?T.apply(this,arguments):T;return r(b(y(M,V),B,G),H,o)},C,z)},p.translateBy=function(w,T,C,z){p.transform(w,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),o)},null,z)},p.translateTo=function(w,T,C,z,H){p.transform(w,function(){var M=t.apply(this,arguments),B=this.__zoom,G=z==null?m(M):typeof z=="function"?z.apply(this,arguments):z;return r(Ge.translate(G[0],G[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof C=="function"?-C.apply(this,arguments):-C),M,o)},z,H)};function y(w,T){return T=Math.max(a[0],Math.min(a[1],T)),T===w.k?w:new $e(T,w.x,w.y)}function b(w,T,C){var z=T[0]-C[0]*w.k,H=T[1]-C[1]*w.k;return z===w.x&&H===w.y?w:new $e(w.k,z,H)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,T,C,z){w.on("start.zoom",function(){x(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(z).end()}).tween("zoom",function(){var H=this,M=arguments,B=x(H,M).event(z),G=t.apply(H,M),V=C==null?m(G):typeof C=="function"?C.apply(H,M):C,U=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),R=H.__zoom,P=typeof T=="function"?T.apply(H,M):T,F=u(R.invert(V).concat(U/R.k),P.invert(V).concat(U/P.k));return function($){if($===1)$=P;else{var j=F($),W=U/j[2];$=new $e(W,V[0]-j[0]*W,V[1]-j[1]*W)}B.zoom(null,$)}})}function x(w,T,C){return!C&&w.__zooming||new S(w,T)}function S(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}S.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=xe(this.that).datum();l.call(w,this.that,new I0(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),T)}};function N(w,...T){if(!e.apply(this,arguments))return;var C=x(this,T).event(w),z=this.__zoom,H=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,n.apply(this,arguments)))),M=Ne(w);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=z.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if(z.k===H)return;C.mouse=[M,z.invert(M)],sr(this),C.start()}Nt(w),C.wheel=setTimeout(B,_),C.zoom("mouse",r(b(y(z,H),C.mouse[0],C.mouse[1]),C.extent,o));function B(){C.wheel=null,C.end()}}function q(w,...T){if(d||!e.apply(this,arguments))return;var C=w.currentTarget,z=x(this,T,!0).event(w),H=xe(w.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",U,!0),M=Ne(w,C),B=w.clientX,G=w.clientY;Iv(w.view),on(w),z.mouse=[M,this.__zoom.invert(M)],sr(this),z.start();function V(R){if(Nt(R),!z.moved){var P=R.clientX-B,F=R.clientY-G;z.moved=P*P+F*F>g}z.event(R).zoom("mouse",r(b(z.that.__zoom,z.mouse[0]=Ne(R,C),z.mouse[1]),z.extent,o))}function U(R){H.on("mousemove.zoom mouseup.zoom",null),Tv(R.view,z.moved),Nt(R),z.event(R).end()}}function A(w,...T){if(e.apply(this,arguments)){var C=this.__zoom,z=Ne(w.changedTouches?w.changedTouches[0]:w,this),H=C.invert(z),M=C.k*(w.shiftKey?.5:2),B=r(b(y(C,M),z,H),t.apply(this,T),o);Nt(w),s>0?xe(this).transition().duration(s).call(E,B,z,w):xe(this).call(p.transform,B,z,w)}}function I(w,...T){if(e.apply(this,arguments)){var C=w.touches,z=C.length,H=x(this,T,w.changedTouches.length===z).event(w),M,B,G,V;for(on(w),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},Bv=Ue.error001();function ne(e,t){const r=k.useContext(wr);if(r===null)throw new Error(Bv);return yv(r,e,t)}const fe=()=>{const e=k.useContext(wr);if(e===null)throw new Error(Bv);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},L0=e=>e.userSelectionActive?"none":"all";function Du({position:e,children:t,className:r,style:n,...i}){const a=ne(L0),o=`${e}`.split("-");return L.createElement("div",{className:pe(["react-flow__panel",r,...o]),style:{...n,pointerEvents:a},...i},t)}function F0({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:L.createElement(Du,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},L.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const z0=({x:e,y:t,label:r,labelStyle:n={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:u,className:l,...c})=>{const f=k.useRef(null),[d,h]=k.useState({x:0,y:0,width:0,height:0}),_=pe(["react-flow__edge-textwrapper",l]);return k.useEffect(()=>{if(f.current){const g=f.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[r]),typeof r>"u"||!r?null:L.createElement("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...c},i&&L.createElement("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),L.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:f,style:n},r),u)};var B0=k.memo(z0);const Lu=e=>({width:e.offsetWidth,height:e.offsetHeight}),wt=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Fu=(e={x:0,y:0},t)=>({x:wt(e.x,t[0][0],t[1][0]),y:wt(e.y,t[0][1],t[1][1])}),zc=(e,t,r)=>er?-wt(Math.abs(e-r),1,50)/50:0,Hv=(e,t)=>{const r=zc(e.x,35,t.width-35)*20,n=zc(e.y,35,t.height-35)*20;return[r,n]},$v=e=>e.getRootNode?.()||window?.document,Gv=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Ht=({x:e,y:t,width:r,height:n})=>({x:e,y:t,x2:e+r,y2:t+n}),Vv=({x:e,y:t,x2:r,y2:n})=>({x:e,y:t,width:r-e,height:n-t}),Bc=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),H0=(e,t)=>Vv(Gv(Ht(e),Ht(t))),xu=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*n)},$0=e=>Se(e.width)&&Se(e.height)&&Se(e.x)&&Se(e.y),Se=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),Uv=["Enter"," ","Escape"],G0=(e,t)=>{},V0=e=>"nativeEvent"in e;function Su(e){const r=(V0(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const jv=e=>"clientX"in e,Je=(e,t)=>{const r=jv(e),n=r?e.clientX:e.touches?.[0].clientX,i=r?e.clientY:e.touches?.[0].clientY;return{x:n-(t?.left??0),y:i-(t?.top??0)}},dr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Ut=({id:e,path:t,labelX:r,labelY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h=20})=>L.createElement(L.Fragment,null,L.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:d}),h&&L.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Se(r)&&Se(n)?L.createElement(B0,{x:r,y:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l}):null);Ut.displayName="BaseEdge";function It(e,t,r){return r===void 0?r:n=>{const i=t().edges.find(a=>a.id===e);i&&r(n,{...i})}}function Kv({sourceX:e,sourceY:t,targetX:r,targetY:n}){const i=Math.abs(r-e)/2,a=r{const[v,p,y]=Wv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a});return L.createElement(Ut,{path:v,labelX:p,labelY:y,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:g})});zu.displayName="SimpleBezierEdge";const $c={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},U0=({source:e,sourcePosition:t=J.Bottom,target:r})=>t===J.Left||t===J.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function j0({source:e,sourcePosition:t=J.Bottom,target:r,targetPosition:n=J.Top,center:i,offset:a}){const o=$c[t],s=$c[n],u={x:e.x+o.x*a,y:e.y+o.y*a},l={x:r.x+s.x*a,y:r.y+s.y*a},c=U0({source:u,sourcePosition:t,target:l}),f=c.x!==0?"x":"y",d=c[f];let h=[],_,g;const v={x:0,y:0},p={x:0,y:0},[y,b,m,E]=Kv({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(o[f]*s[f]===-1){_=i.x??y,g=i.y??b;const S=[{x:_,y:u.y},{x:_,y:l.y}],N=[{x:u.x,y:g},{x:l.x,y:g}];o[f]===d?h=f==="x"?S:N:h=f==="x"?N:S}else{const S=[{x:u.x,y:l.y}],N=[{x:l.x,y:u.y}];if(f==="x"?h=o.x===d?N:S:h=o.y===d?S:N,t===n){const O=Math.abs(e[f]-r[f]);if(O<=a){const w=Math.min(a-1,a-O);o[f]===d?v[f]=(u[f]>e[f]?-1:1)*w:p[f]=(l[f]>r[f]?-1:1)*w}}if(t!==n){const O=f==="x"?"y":"x",w=o[f]===s[O],T=u[O]>l[O],C=u[O]=D?(_=(q.x+A.x)/2,g=h[0].y):(_=h[0].x,g=(q.y+A.y)/2)}return[[e,{x:u.x+v.x,y:u.y+v.y},...h,{x:l.x+p.x,y:l.y+p.y},r],_,g,m,E]}function K0(e,t,r,n){const i=Math.min(Gc(e,t)/2,Gc(t,r)/2,n),{x:a,y:o}=t;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const l=e.x{let b="";return y>0&&y{const[p,y,b]=qu({sourceX:e,sourceY:t,sourcePosition:f,targetX:r,targetY:n,targetPosition:d,borderRadius:g?.borderRadius,offset:g?.offset});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:h,markerStart:_,interactionWidth:v})});Er.displayName="SmoothStepEdge";const Bu=k.memo(e=>L.createElement(Er,{...e,pathOptions:k.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Bu.displayName="StepEdge";function Y0({sourceX:e,sourceY:t,targetX:r,targetY:n}){const[i,a,o,s]=Kv({sourceX:e,sourceY:t,targetX:r,targetY:n});return[`M ${e},${t}L ${r},${n}`,i,a,o,s]}const Hu=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})=>{const[_,g,v]=Y0({sourceX:e,sourceY:t,targetX:r,targetY:n});return L.createElement(Ut,{path:_,labelX:g,labelY:v,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})});Hu.displayName="StraightEdge";function er(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Vc({pos:e,x1:t,y1:r,x2:n,y2:i,c:a}){switch(e){case J.Left:return[t-er(t-n,a),r];case J.Right:return[t+er(n-t,a),r];case J.Top:return[t,r-er(r-i,a)];case J.Bottom:return[t,r+er(i-r,a)]}}function Zv({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top,curvature:o=.25}){const[s,u]=Vc({pos:r,x1:e,y1:t,x2:n,y2:i,c:o}),[l,c]=Vc({pos:a,x1:n,y1:i,x2:e,y2:t,c:o}),[f,d,h,_]=Yv({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${u} ${l},${c} ${n},${i}`,f,d,h,_]}const pr=k.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,sourcePosition:i=J.Bottom,targetPosition:a=J.Top,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,pathOptions:g,interactionWidth:v})=>{const[p,y,b]=Zv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a,curvature:g?.curvature});return L.createElement(Ut,{path:p,labelX:y,labelY:b,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:v})});pr.displayName="BezierEdge";const $u=k.createContext(null),W0=$u.Provider;$u.Consumer;const Z0=()=>k.useContext($u),X0=e=>"id"in e&&"source"in e&&"target"in e,J0=({source:e,sourceHandle:t,target:r,targetHandle:n})=>`reactflow__edge-${e}${t||""}-${r}${n||""}`,Ru=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`,Q0=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),ew=(e,t)=>{if(!e.source||!e.target)return t;let r;return X0(e)?r={...e}:r={...e,id:J0(e)},Q0(r,t)?t:t.concat(r)},Cu=({x:e,y:t},[r,n,i],a,[o,s])=>{const u={x:(e-r)/i,y:(t-n)/i};return a?{x:o*Math.round(u.x/o),y:s*Math.round(u.y/s)}:u},Xv=({x:e,y:t},[r,n,i])=>({x:e*i+r,y:t*i+n}),it=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],n=(e.height??0)*t[1],i={x:e.position.x-r,y:e.position.y-n};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-n}:i}},xr=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((n,i)=>{const{x:a,y:o}=it(i,t).positionAbsolute;return Gv(n,Ht({x:a,y:o,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Vv(r)},Jv=(e,t,[r,n,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{const u={x:(t.x-r)/i,y:(t.y-n)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(c=>{const{width:f,height:d,selectable:h=!0,hidden:_=!1}=c;if(o&&!h||_)return!1;const{positionAbsolute:g}=it(c,s),v={x:g.x,y:g.y,width:f||0,height:d||0},p=xu(u,v),y=typeof f>"u"||typeof d>"u"||f===null||d===null,b=a&&p>0,m=(f||0)*(d||0);(y||b||p>=m||c.dragging)&&l.push(c)}),l},Qv=(e,t)=>{const r=e.map(n=>n.id);return t.filter(n=>r.includes(n.source)||r.includes(n.target))},eg=(e,t,r,n,i,a=.1)=>{const o=t/(e.width*(1+a)),s=r/(e.height*(1+a)),u=Math.min(o,s),l=wt(u,n,i),c=e.x+e.width/2,f=e.y+e.height/2,d=t/2-c*l,h=r/2-f*l;return{x:d,y:h,zoom:l}},rt=(e,t=0)=>e.transition().duration(t);function Uc(e,t,r,n){return(t[r]||[]).reduce((i,a)=>(`${e.id}-${a.id}-${r}`!==n&&i.push({id:a.id||null,type:r,nodeId:e.id,x:(e.positionAbsolute?.x??0)+a.x+a.width/2,y:(e.positionAbsolute?.y??0)+a.y+a.height/2}),i),[])}function tw(e,t,r,n,i,a){const{x:o,y:s}=Je(e),l=t.elementsFromPoint(o,s).find(_=>_.classList.contains("react-flow__handle"));if(l){const _=l.getAttribute("data-nodeid");if(_){const g=Gu(void 0,l),v=l.getAttribute("data-handleid"),p=a({nodeId:_,id:v,type:g});if(p){const y=i.find(b=>b.nodeId===_&&b.type===g&&b.id===v);return{handle:{id:v,type:g,nodeId:_,x:y?.x||r.x,y:y?.y||r.y},validHandleResult:p}}}}let c=[],f=1/0;if(i.forEach(_=>{const g=Math.sqrt((_.x-r.x)**2+(_.y-r.y)**2);if(g<=n){const v=a(_);g<=f&&(g_.isValid),h=c.some(({handle:_})=>_.type==="target");return c.find(({handle:_,validHandleResult:g})=>h?_.type==="target":d?g.isValid:!0)||c[0]}const rw={source:null,target:null,sourceHandle:null,targetHandle:null},tg=()=>({handleDomNode:null,isValid:!1,connection:rw,endHandle:null});function rg(e,t,r,n,i,a,o){const s=i==="target",u=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...tg(),handleDomNode:u};if(u){const c=Gu(void 0,u),f=u.getAttribute("data-nodeid"),d=u.getAttribute("data-handleid"),h=u.classList.contains("connectable"),_=u.classList.contains("connectableend"),g={source:s?f:r,sourceHandle:s?d:n,target:s?r:f,targetHandle:s?n:d};l.connection=g,h&&_&&(t===ot.Strict?s&&c==="source"||!s&&c==="target":f!==r||d!==n)&&(l.endHandle={nodeId:f,handleId:d,type:c},l.isValid=a(g))}return l}function nw({nodes:e,nodeId:t,handleId:r,handleType:n}){return e.reduce((i,a)=>{if(a[se]){const{handleBounds:o}=a[se];let s=[],u=[];o&&(s=Uc(a,o,"source",`${t}-${r}-${n}`),u=Uc(a,o,"target",`${t}-${r}-${n}`)),i.push(...s,...u)}return i},[])}function Gu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function sn(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function iw(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function ng({event:e,handleId:t,nodeId:r,onConnect:n,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:u,onReconnectEnd:l}){const c=$v(e.target),{connectionMode:f,domNode:d,autoPanOnConnect:h,connectionRadius:_,onConnectStart:g,panBy:v,getNodes:p,cancelConnection:y}=a();let b=0,m;const{x:E,y:x}=Je(e),S=c?.elementFromPoint(E,x),N=Gu(u,S),q=d?.getBoundingClientRect();if(!q||!N)return;let A,I=Je(e,q),D=!1,O=null,w=!1,T=null;const C=nw({nodes:p(),nodeId:r,handleId:t,handleType:N}),z=()=>{if(!h)return;const[B,G]=Hv(I,q);v({x:B,y:G}),b=requestAnimationFrame(z)};o({connectionPosition:I,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:N,connectionStartHandle:{nodeId:r,handleId:t,type:N},connectionEndHandle:null}),g?.(e,{nodeId:r,handleId:t,handleType:N});function H(B){const{transform:G}=a();I=Je(B,q);const{handle:V,validHandleResult:U}=tw(B,c,Cu(I,G,!1,[1,1]),_,C,R=>rg(R,f,r,t,i?"target":"source",s,c));if(m=V,D||(z(),D=!0),T=U.handleDomNode,O=U.connection,w=U.isValid,o({connectionPosition:m&&w?Xv({x:m.x,y:m.y},G):I,connectionStatus:iw(!!m,w),connectionEndHandle:U.endHandle}),!m&&!w&&!T)return sn(A);O.source!==O.target&&T&&(sn(A),A=T,T.classList.add("connecting","react-flow__handle-connecting"),T.classList.toggle("valid",w),T.classList.toggle("react-flow__handle-valid",w))}function M(B){(m||T)&&O&&w&&n?.(O),a().onConnectEnd?.(B),u&&l?.(B),sn(A),y(),cancelAnimationFrame(b),D=!1,w=!1,O=null,T=null,c.removeEventListener("mousemove",H),c.removeEventListener("mouseup",M),c.removeEventListener("touchmove",H),c.removeEventListener("touchend",M)}c.addEventListener("mousemove",H),c.addEventListener("mouseup",M),c.addEventListener("touchmove",H),c.addEventListener("touchend",M)}const jc=()=>!0,aw=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),ow=(e,t,r)=>n=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=n;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===r||a?.nodeId===e&&a?.handleId===t&&a?.type===r,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===r}},ig=k.forwardRef(({type:e="source",position:t=J.Top,isValidConnection:r,isConnectable:n=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:u,className:l,onMouseDown:c,onTouchStart:f,...d},h)=>{const _=o||null,g=e==="target",v=fe(),p=Z0(),{connectOnClick:y,noPanClassName:b}=ne(aw,he),{connecting:m,clickConnecting:E}=ne(ow(p,_,e),he);p||v.getState().onError?.("010",Ue.error010());const x=q=>{const{defaultEdgeOptions:A,onConnect:I,hasDefaultEdges:D}=v.getState(),O={...A,...q};if(D){const{edges:w,setEdges:T}=v.getState();T(ew(O,w))}I?.(O),s?.(O)},S=q=>{if(!p)return;const A=jv(q);i&&(A&&q.button===0||!A)&&ng({event:q,handleId:_,nodeId:p,onConnect:x,isTarget:g,getState:v.getState,setState:v.setState,isValidConnection:r||v.getState().isValidConnection||jc}),A?c?.(q):f?.(q)},N=q=>{const{onClickConnectStart:A,onClickConnectEnd:I,connectionClickStartHandle:D,connectionMode:O,isValidConnection:w}=v.getState();if(!p||!D&&!i)return;if(!D){A?.(q,{nodeId:p,handleId:_,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:_}});return}const T=$v(q.target),C=r||w||jc,{connection:z,isValid:H}=rg({nodeId:p,id:_,type:e},O,D.nodeId,D.handleId||null,D.type,C,T);H&&x(z),I?.(q),v.setState({connectionClickStartHandle:null})};return L.createElement("div",{"data-handleid":_,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${_}-${e}`,className:pe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,l,{source:!g,target:g,connectable:n,connectablestart:i,connectableend:a,connecting:E,connectionindicator:n&&(i&&!m||a&&m)}]),onMouseDown:S,onTouchStart:S,onClick:y?N:void 0,ref:h,...d},u)});ig.displayName="Handle";var vr=k.memo(ig);const ag=({data:e,isConnectable:t,targetPosition:r=J.Top,sourcePosition:n=J.Bottom})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label,L.createElement(vr,{type:"source",position:n,isConnectable:t}));ag.displayName="DefaultNode";var Au=k.memo(ag);const og=({data:e,isConnectable:t,sourcePosition:r=J.Bottom})=>L.createElement(L.Fragment,null,e?.label,L.createElement(vr,{type:"source",position:r,isConnectable:t}));og.displayName="InputNode";var sg=k.memo(og);const ug=({data:e,isConnectable:t,targetPosition:r=J.Top})=>L.createElement(L.Fragment,null,L.createElement(vr,{type:"target",position:r,isConnectable:t}),e?.label);ug.displayName="OutputNode";var cg=k.memo(ug);const Vu=()=>null;Vu.displayName="GroupNode";const sw=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),tr=e=>e.id;function uw(e,t){return he(e.selectedNodes.map(tr),t.selectedNodes.map(tr))&&he(e.selectedEdges.map(tr),t.selectedEdges.map(tr))}const lg=k.memo(({onSelectionChange:e})=>{const t=fe(),{selectedNodes:r,selectedEdges:n}=ne(sw,uw);return k.useEffect(()=>{const i={nodes:r,edges:n};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,n,e]),null});lg.displayName="SelectionListener";const cw=e=>!!e.onSelectionChange;function lw({onSelectionChange:e}){const t=ne(cw);return e||t?L.createElement(lg,{onSelectionChange:e}):null}const fw=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function dt(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Q(e,t,r){k.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const dw=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:u,nodesDraggable:l,nodesConnectable:c,nodesFocusable:f,edgesFocusable:d,edgesUpdatable:h,elevateNodesOnSelect:_,minZoom:g,maxZoom:v,nodeExtent:p,onNodesChange:y,onEdgesChange:b,elementsSelectable:m,connectionMode:E,snapGrid:x,snapToGrid:S,translateExtent:N,connectOnClick:q,defaultEdgeOptions:A,fitView:I,fitViewOptions:D,onNodesDelete:O,onEdgesDelete:w,onNodeDrag:T,onNodeDragStart:C,onNodeDragStop:z,onSelectionDrag:H,onSelectionDragStart:M,onSelectionDragStop:B,noPanClassName:G,nodeOrigin:V,rfId:U,autoPanOnConnect:R,autoPanOnNodeDrag:P,onError:F,connectionRadius:$,isValidConnection:j,nodeDragThreshold:W})=>{const{setNodes:Z,setEdges:te,setDefaultNodesAndEdges:ie,setMinZoom:re,setMaxZoom:ee,setTranslateExtent:X,setNodeExtent:ue,reset:K}=ne(fw,he),Y=fe();return k.useEffect(()=>{const oe=n?.map(Ce=>({...Ce,...A}));return ie(r,oe),()=>{K()}},[]),Q("defaultEdgeOptions",A,Y.setState),Q("connectionMode",E,Y.setState),Q("onConnect",i,Y.setState),Q("onConnectStart",a,Y.setState),Q("onConnectEnd",o,Y.setState),Q("onClickConnectStart",s,Y.setState),Q("onClickConnectEnd",u,Y.setState),Q("nodesDraggable",l,Y.setState),Q("nodesConnectable",c,Y.setState),Q("nodesFocusable",f,Y.setState),Q("edgesFocusable",d,Y.setState),Q("edgesUpdatable",h,Y.setState),Q("elementsSelectable",m,Y.setState),Q("elevateNodesOnSelect",_,Y.setState),Q("snapToGrid",S,Y.setState),Q("snapGrid",x,Y.setState),Q("onNodesChange",y,Y.setState),Q("onEdgesChange",b,Y.setState),Q("connectOnClick",q,Y.setState),Q("fitViewOnInit",I,Y.setState),Q("fitViewOnInitOptions",D,Y.setState),Q("onNodesDelete",O,Y.setState),Q("onEdgesDelete",w,Y.setState),Q("onNodeDrag",T,Y.setState),Q("onNodeDragStart",C,Y.setState),Q("onNodeDragStop",z,Y.setState),Q("onSelectionDrag",H,Y.setState),Q("onSelectionDragStart",M,Y.setState),Q("onSelectionDragStop",B,Y.setState),Q("noPanClassName",G,Y.setState),Q("nodeOrigin",V,Y.setState),Q("rfId",U,Y.setState),Q("autoPanOnConnect",R,Y.setState),Q("autoPanOnNodeDrag",P,Y.setState),Q("onError",F,Y.setState),Q("connectionRadius",$,Y.setState),Q("isValidConnection",j,Y.setState),Q("nodeDragThreshold",W,Y.setState),dt(e,Z),dt(t,te),dt(g,re),dt(v,ee),dt(N,X),dt(p,ue),null},Kc={display:"none"},hw={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},fg="react-flow__node-desc",dg="react-flow__edge-desc",pw="react-flow__aria-live",vw=e=>e.ariaLiveMessage;function gw({rfId:e}){const t=ne(vw);return L.createElement("div",{id:`${pw}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hw},t)}function yw({rfId:e,disableKeyboardA11y:t}){return L.createElement(L.Fragment,null,L.createElement("div",{id:`${fg}-${e}`,style:Kc},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),L.createElement("div",{id:`${dg}-${e}`,style:Kc},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&L.createElement(gw,{rfId:e}))}var Gt=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,n]=k.useState(!1),i=k.useRef(!1),a=k.useRef(new Set([])),[o,s]=k.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=l.reduce((f,d)=>f.concat(...d),[]);return[l,c]}return[[],[]]},[e]);return k.useEffect(()=>{const u=typeof document<"u"?document:null,l=t?.target||u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);a.current.add(h[g]),Yc(o,a.current,!1)&&(h.preventDefault(),n(!0))},f=h=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Su(h))return!1;const g=Wc(h.code,s);Yc(o,a.current,!0)?(n(!1),a.current.clear()):a.current.delete(h[g]),h.key==="Meta"&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),n(!1)};return l?.addEventListener("keydown",c),l?.addEventListener("keyup",f),window.addEventListener("blur",d),()=>{l?.removeEventListener("keydown",c),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d)}}},[e,n]),r};function Yc(e,t,r){return e.filter(n=>r||n.length===t.size).some(n=>n.every(i=>t.has(i)))}function Wc(e,t){return t.includes(e)?"code":"key"}function hg(e,t,r,n){const i=e.parentNode||e.parentId;if(!i)return r;const a=t.get(i),o=it(a,n);return hg(a,t,{x:(r.x??0)+o.x,y:(r.y??0)+o.y,z:(a[se]?.z??0)>(r.z??0)?a[se]?.z??0:r.z??0},n)}function pg(e,t,r){e.forEach(n=>{const i=n.parentNode||n.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||r?.[n.id]){const{x:a,y:o,z:s}=hg(n,e,{...n.position,z:n[se]?.z??0},t);n.positionAbsolute={x:a,y:o},n[se].z=s,r?.[n.id]&&(n[se].isParent=!0)}})}function un(e,t,r,n){const i=new Map,a={},o=n?1e3:0;return e.forEach(s=>{const u=(Se(s.zIndex)?s.zIndex:0)+(s.selected?o:0),l=t.get(s.id),c={...s,positionAbsolute:{x:s.position.x,y:s.position.y}},f=s.parentNode||s.parentId;f&&(a[f]=!0);const d=l?.type&&l?.type!==s.type;Object.defineProperty(c,se,{enumerable:!1,value:{handleBounds:d?void 0:l?.[se]?.handleBounds,z:u}}),i.set(s.id,c)}),pg(i,r,a),i}function vg(e,t={}){const{getNodes:r,width:n,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:u,fitViewOnInitDone:l,fitViewOnInit:c,nodeOrigin:f}=e(),d=t.initial&&!l&&c;if(s&&u&&(d||!t.initial)){const _=r().filter(v=>{const p=t.includeHiddenNodes?v.width&&v.height:!v.hidden;return t.nodes?.length?p&&t.nodes.some(y=>y.id===v.id):p}),g=_.every(v=>v.width&&v.height);if(_.length>0&&g){const v=xr(_,f),{x:p,y,zoom:b}=eg(v,n,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),m=Ge.translate(p,y).scale(b);return typeof t.duration=="number"&&t.duration>0?s.transform(rt(u,t.duration),m):s.transform(u,m),!0}}return!1}function mw(e,t){return e.forEach(r=>{const n=t.get(r.id);n&&t.set(n.id,{...n,[se]:n[se],selected:r.selected})}),new Map(t)}function _w(e,t){return t.map(r=>{const n=e.find(i=>i.id===r.id);return n&&(r.selected=n.selected),r})}function rr({changedNodes:e,changedEdges:t,get:r,set:n}){const{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:u,hasDefaultEdges:l}=r();e?.length&&(u&&n({nodeInternals:mw(e,i)}),o?.(e)),t?.length&&(l&&n({edges:_w(t,a)}),s?.(t))}const ht=()=>{},bw={zoomIn:ht,zoomOut:ht,zoomTo:ht,getZoom:()=>1,setViewport:ht,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:ht,fitBounds:ht,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},ww=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Ew=()=>{const e=fe(),{d3Zoom:t,d3Selection:r}=ne(ww,he);return k.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(rt(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(rt(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(rt(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[o,s,u]=e.getState().transform,l=Ge.translate(i.x??o,i.y??s).scale(i.zoom??u);t.transform(rt(r,a?.duration),l)},getViewport:()=>{const[i,a,o]=e.getState().transform;return{x:i,y:a,zoom:o}},fitView:i=>vg(e.getState,i),setCenter:(i,a,o)=>{const{width:s,height:u,maxZoom:l}=e.getState(),c=typeof o?.zoom<"u"?o.zoom:l,f=s/2-i*c,d=u/2-a*c,h=Ge.translate(f,d).scale(c);t.transform(rt(r,o?.duration),h)},fitBounds:(i,a)=>{const{width:o,height:s,minZoom:u,maxZoom:l}=e.getState(),{x:c,y:f,zoom:d}=eg(i,o,s,u,l,a?.padding??.1),h=Ge.translate(c,f).scale(d);t.transform(rt(r,a?.duration),h)},project:i=>{const{transform:a,snapToGrid:o,snapGrid:s}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Cu(i,a,o,s)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:o,snapGrid:s,domNode:u}=e.getState();if(!u)return i;const{x:l,y:c}=u.getBoundingClientRect(),f={x:i.x-l,y:i.y-c};return Cu(f,a,o,s)},flowToScreenPosition:i=>{const{transform:a,domNode:o}=e.getState();if(!o)return i;const{x:s,y:u}=o.getBoundingClientRect(),l=Xv(i,a);return{x:l.x+s,y:l.y+u}},viewportInitialized:!0}:bw,[t,r])};function Uu(){const e=Ew(),t=fe(),r=k.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),n=k.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=k.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},[]),a=k.useCallback(g=>{const{edges:v=[]}=t.getState();return v.find(p=>p.id===g)},[]),o=k.useCallback(g=>{const{getNodes:v,setNodes:p,hasDefaultNodes:y,onNodesChange:b}=t.getState(),m=v(),E=typeof g=="function"?g(m):g;if(y)p(E);else if(b){const x=E.length===0?m.map(S=>({type:"remove",id:S.id})):E.map(S=>({item:S,type:"reset"}));b(x)}},[]),s=k.useCallback(g=>{const{edges:v=[],setEdges:p,hasDefaultEdges:y,onEdgesChange:b}=t.getState(),m=typeof g=="function"?g(v):g;if(y)p(m);else if(b){const E=m.length===0?v.map(x=>({type:"remove",id:x.id})):m.map(x=>({item:x,type:"reset"}));b(E)}},[]),u=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{getNodes:p,setNodes:y,hasDefaultNodes:b,onNodesChange:m}=t.getState();if(b){const x=[...p(),...v];y(x)}else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),l=k.useCallback(g=>{const v=Array.isArray(g)?g:[g],{edges:p=[],setEdges:y,hasDefaultEdges:b,onEdgesChange:m}=t.getState();if(b)y([...p,...v]);else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),c=k.useCallback(()=>{const{getNodes:g,edges:v=[],transform:p}=t.getState(),[y,b,m]=p;return{nodes:g().map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:y,y:b,zoom:m}}},[]),f=k.useCallback(({nodes:g,edges:v})=>{const{nodeInternals:p,getNodes:y,edges:b,hasDefaultNodes:m,hasDefaultEdges:E,onNodesDelete:x,onEdgesDelete:S,onNodesChange:N,onEdgesChange:q}=t.getState(),A=(g||[]).map(T=>T.id),I=(v||[]).map(T=>T.id),D=y().reduce((T,C)=>{const z=C.parentNode||C.parentId,H=!A.includes(C.id)&&z&&T.find(B=>B.id===z);return(typeof C.deletable=="boolean"?C.deletable:!0)&&(A.includes(C.id)||H)&&T.push(C),T},[]),O=b.filter(T=>typeof T.deletable=="boolean"?T.deletable:!0),w=O.filter(T=>I.includes(T.id));if(D||w){const T=Qv(D,O),C=[...w,...T],z=C.reduce((H,M)=>(H.includes(M.id)||H.push(M.id),H),[]);if((E||m)&&(E&&t.setState({edges:b.filter(H=>!z.includes(H.id))}),m&&(D.forEach(H=>{p.delete(H.id)}),t.setState({nodeInternals:new Map(p)}))),z.length>0&&(S?.(C),q&&q(z.map(H=>({id:H,type:"remove"})))),D.length>0&&(x?.(D),N)){const H=D.map(M=>({id:M.id,type:"remove"}));N(H)}}},[]),d=k.useCallback(g=>{const v=$0(g),p=v?null:t.getState().nodeInternals.get(g.id);return!v&&!p?[null,null,v]:[v?g:Bc(p),p,v]},[]),h=k.useCallback((g,v=!0,p)=>{const[y,b,m]=d(g);return y?(p||t.getState().getNodes()).filter(E=>{if(!m&&(E.id===b.id||!E.positionAbsolute))return!1;const x=Bc(E),S=xu(x,y);return v&&S>0||S>=y.width*y.height}):[]},[]),_=k.useCallback((g,v,p=!0)=>{const[y]=d(g);if(!y)return!1;const b=xu(y,v);return p&&b>0||b>=y.width*y.height},[]);return k.useMemo(()=>({...e,getNodes:r,getNode:n,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:u,addEdges:l,toObject:c,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:_}),[e,r,n,i,a,o,s,u,l,c,f,h,_])}const xw={actInsideInputWithModifier:!1};var Sw=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=fe(),{deleteElements:n}=Uu(),i=Gt(e,xw),a=Gt(t);k.useEffect(()=>{if(i){const{edges:o,getNodes:s}=r.getState(),u=s().filter(c=>c.selected),l=o.filter(c=>c.selected);n({nodes:u,edges:l}),r.setState({nodesSelectionActive:!1})}},[i]),k.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function qw(e){const t=fe();k.useEffect(()=>{let r;const n=()=>{if(!e.current)return;const i=Lu(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Ue.error004()),t.setState({width:i.width||500,height:i.height||500})};return n(),window.addEventListener("resize",n),e.current&&(r=new ResizeObserver(()=>n()),r.observe(e.current)),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}},[])}const ju={position:"absolute",width:"100%",height:"100%",top:0,left:0},Rw=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,nr=e=>({x:e.x,y:e.y,zoom:e.k}),pt=(e,t)=>e.target.closest(`.${t}`),Zc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xc=e=>{const t=e.ctrlKey&&dr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Cw=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Aw=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:n,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=nt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:_,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:p=!0,children:y,noWheelClassName:b,noPanClassName:m})=>{const E=k.useRef(),x=fe(),S=k.useRef(!1),N=k.useRef(!1),q=k.useRef(null),A=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:D,d3ZoomHandler:O,userSelectionActive:w}=ne(Cw,he),T=Gt(v),C=k.useRef(0),z=k.useRef(!1),H=k.useRef();return qw(q),k.useEffect(()=>{if(q.current){const M=q.current.getBoundingClientRect(),B=zv().scaleExtent([_,g]).translateExtent(h),G=xe(q.current).call(B),V=Ge.translate(d.x,d.y).scale(wt(d.zoom,_,g)),U=[[0,0],[M.width,M.height]],R=B.constrain()(V,U,h);B.transform(G,R),B.wheelDelta(Xc),x.setState({d3Zoom:B,d3Selection:G,d3ZoomHandler:G.on("wheel.zoom"),transform:[R.x,R.y,R.k],domNode:q.current.closest(".react-flow")})}},[]),k.useEffect(()=>{D&&I&&(o&&!T&&!w?D.on("wheel.zoom",M=>{if(pt(M,b))return!1;M.preventDefault(),M.stopImmediatePropagation();const B=D.property("__zoom").k||1;if(M.ctrlKey&&a){const j=Ne(M),W=Xc(M),Z=B*Math.pow(2,W);I.scaleTo(D,Z,j,M);return}const G=M.deltaMode===1?20:1;let V=u===nt.Vertical?0:M.deltaX*G,U=u===nt.Horizontal?0:M.deltaY*G;!dr()&&M.shiftKey&&u!==nt.Vertical&&(V=M.deltaY*G,U=0),I.translateBy(D,-(V/B)*s,-(U/B)*s,{internal:!0});const R=nr(D.property("__zoom")),{onViewportChangeStart:P,onViewportChange:F,onViewportChangeEnd:$}=x.getState();clearTimeout(H.current),z.current||(z.current=!0,t?.(M,R),P?.(R)),z.current&&(e?.(M,R),F?.(R),H.current=setTimeout(()=>{r?.(M,R),$?.(R),z.current=!1},150))},{passive:!1}):typeof O<"u"&&D.on("wheel.zoom",function(M,B){if(!p&&M.type==="wheel"&&!M.ctrlKey||pt(M,b))return null;M.preventDefault(),O.call(this,M,B)},{passive:!1}))},[w,o,u,D,I,O,T,a,p,b,t,e,r]),k.useEffect(()=>{I&&I.on("start",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;C.current=M.sourceEvent?.button;const{onViewportChangeStart:B}=x.getState(),G=nr(M.transform);S.current=!0,A.current=G,M.sourceEvent?.type==="mousedown"&&x.setState({paneDragging:!0}),B?.(G),t?.(M.sourceEvent,G)})},[I,t]),k.useEffect(()=>{I&&(w&&!S.current?I.on("zoom",null):w||I.on("zoom",M=>{const{onViewportChange:B}=x.getState();if(x.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),N.current=!!(n&&Zc(f,C.current??0)),(e||B)&&!M.sourceEvent?.internal){const G=nr(M.transform);B?.(G),e?.(M.sourceEvent,G)}}))},[w,I,e,f,n]),k.useEffect(()=>{I&&I.on("end",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=x.getState();if(S.current=!1,x.setState({paneDragging:!1}),n&&Zc(f,C.current??0)&&!N.current&&n(M.sourceEvent),N.current=!1,(r||B)&&Rw(A.current,M.transform)){const G=nr(M.transform);A.current=G,clearTimeout(E.current),E.current=setTimeout(()=>{B?.(G),r?.(M.sourceEvent,G)},o?150:0)}})},[I,o,f,r,n]),k.useEffect(()=>{I&&I.filter(M=>{const B=T||i,G=a&&M.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&M.button===1&&M.type==="mousedown"&&(pt(M,"react-flow__node")||pt(M,"react-flow__edge")))return!0;if(!f&&!B&&!o&&!l&&!a||w||!l&&M.type==="dblclick"||pt(M,b)&&M.type==="wheel"||pt(M,m)&&(M.type!=="wheel"||o&&M.type==="wheel"&&!T)||!a&&M.ctrlKey&&M.type==="wheel"||!B&&!o&&!G&&M.type==="wheel"||!f&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(f)&&!f.includes(M.button)&&M.type==="mousedown")return!1;const V=Array.isArray(f)&&f.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&V})},[w,I,i,a,o,l,f,c,T]),L.createElement("div",{className:"react-flow__renderer",ref:q,style:ju},y)},Nw=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Iw(){const{userSelectionActive:e,userSelectionRect:t}=ne(Nw,he);return e&&t?L.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Jc(e,t){const r=t.parentNode||t.parentId,n=e.find(i=>i.id===r);if(n){const i=t.position.x+t.width-n.width,a=t.position.y+t.height-n.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,i>0&&(n.style.width+=i),a>0&&(n.style.height+=a),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function gg(e,t){if(e.some(n=>n.type==="reset"))return e.filter(n=>n.type==="reset").map(n=>n.item);const r=e.filter(n=>n.type==="add").map(n=>n.item);return t.reduce((n,i)=>{const a=e.filter(s=>s.id===i.id);if(a.length===0)return n.push(i),n;const o={...i};for(const s of a)if(s)switch(s.type){case"select":{o.selected=s.selected;break}case"position":{typeof s.position<"u"&&(o.position=s.position),typeof s.positionAbsolute<"u"&&(o.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(o.dragging=s.dragging),o.expandParent&&Jc(n,o);break}case"dimensions":{typeof s.dimensions<"u"&&(o.width=s.dimensions.width,o.height=s.dimensions.height),typeof s.updateStyle<"u"&&(o.style={...o.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(o.resizing=s.resizing),o.expandParent&&Jc(n,o);break}case"remove":return n}return n.push(o),n},r)}function yg(e,t){return gg(e,t)}function Tw(e,t){return gg(e,t)}const Ze=(e,t)=>({id:e,type:"select",selected:t});function gt(e,t){return e.reduce((r,n)=>{const i=t.includes(n.id);return!n.selected&&i?(n.selected=!0,r.push(Ze(n.id,!0))):n.selected&&!i&&(n.selected=!1,r.push(Ze(n.id,!1))),r},[])}const cn=(e,t)=>r=>{r.target===t.current&&e?.(r)},Mw=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),mg=k.memo(({isSelecting:e,selectionMode:t=$t.Full,panOnDrag:r,onSelectionStart:n,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:u,onPaneMouseMove:l,onPaneMouseLeave:c,children:f})=>{const d=k.useRef(null),h=fe(),_=k.useRef(0),g=k.useRef(0),v=k.useRef(),{userSelectionActive:p,elementsSelectable:y,dragging:b}=ne(Mw,he),m=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},E=O=>{a?.(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=O=>{if(Array.isArray(r)&&r?.includes(2)){O.preventDefault();return}o?.(O)},S=s?O=>s(O):void 0,N=O=>{const{resetSelectedElements:w,domNode:T}=h.getState();if(v.current=T?.getBoundingClientRect(),!y||!e||O.button!==0||O.target!==d.current||!v.current)return;const{x:C,y:z}=Je(O,v.current);w(),h.setState({userSelectionRect:{width:0,height:0,startX:C,startY:z,x:C,y:z}}),n?.(O)},q=O=>{const{userSelectionRect:w,nodeInternals:T,edges:C,transform:z,onNodesChange:H,onEdgesChange:M,nodeOrigin:B,getNodes:G}=h.getState();if(!e||!v.current||!w)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Je(O,v.current),U=w.startX??0,R=w.startY??0,P={...w,x:V.xZ.id),W=$.map(Z=>Z.id);if(_.current!==W.length){_.current=W.length;const Z=gt(F,W);Z.length&&H?.(Z)}if(g.current!==j.length){g.current=j.length;const Z=gt(C,j);Z.length&&M?.(Z)}h.setState({userSelectionRect:P})},A=O=>{if(O.button!==0)return;const{userSelectionRect:w}=h.getState();!p&&w&&O.target===d.current&&E?.(O),h.setState({nodesSelectionActive:_.current>0}),m(),i?.(O)},I=O=>{p&&(h.setState({nodesSelectionActive:_.current>0}),i?.(O)),m()},D=y&&(e||p);return L.createElement("div",{className:pe(["react-flow__pane",{dragging:b,selection:e}]),onClick:D?void 0:cn(E,d),onContextMenu:cn(x,d),onWheel:cn(S,d),onMouseEnter:D?void 0:u,onMouseDown:D?N:void 0,onMouseMove:D?q:l,onMouseUp:D?A:void 0,onMouseLeave:D?I:c,ref:d,style:ju},f,L.createElement(Iw,null))});mg.displayName="Pane";function _g(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const n=t.get(r);return n?n.selected?!0:_g(n,t):!1}function Qc(e,t,r){let n=e;do{if(n?.matches(t))return!0;if(n===r.current)return!1;n=n.parentElement}while(n);return!1}function Pw(e,t,r,n){return Array.from(e.values()).filter(i=>(i.selected||i.id===n)&&(!i.parentNode||i.parentId||!_g(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>({id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:r.x-(i.positionAbsolute?.x??0),y:r.y-(i.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}))}function Ow(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function bg(e,t,r,n,i=[0,0],a){const o=Ow(e,e.extent||n);let s=o;const u=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(u&&e.width&&e.height){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=f&&Se(d)&&Se(h)&&Se(f.width)&&Se(f.height)?[[d+e.width*i[0],h+e.height*i[1]],[d+f.width-e.width+e.width*i[0],h+f.height-e.height+e.height*i[1]]]:s}else a?.("005",Ue.error005()),s=o;else if(e.extent&&u&&e.extent!=="parent"){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+h],[e.extent[1][0]+d,e.extent[1][1]+h]]}let l={x:0,y:0};if(u){const f=r.get(u);l=it(f,i).positionAbsolute}const c=s&&s!=="parent"?Fu(t,s):t;return{position:{x:c.x-l.x,y:c.y-l.y},positionAbsolute:c}}function ln({nodeId:e,dragItems:t,nodeInternals:r}){const n=t.map(i=>({...r.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?n.find(i=>i.id===e):n[0],n]}const el=(e,t,r,n)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*n[0],y:o.height*n[1]};return a.map(u=>{const l=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(l.left-o.left-s.x)/r,y:(l.top-o.top-s.y)/r,...Lu(u)}})};function Tt(e,t,r){return r===void 0?r:n=>{const i=t().nodeInternals.get(e);i&&r(n,{...i})}}function Nu({id:e,store:t,unselect:r=!1,nodeRef:n}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:u}=t.getState(),l=s.get(e);if(!l){u?.("012",Ue.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(r||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>n?.current?.blur())):i([e])}function kw(){const e=fe();return k.useCallback(({sourceEvent:r})=>{const{transform:n,snapGrid:i,snapToGrid:a}=e.getState(),o=r.touches?r.touches[0].clientX:r.clientX,s=r.touches?r.touches[0].clientY:r.clientY,u={x:(o-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:a?i[0]*Math.round(u.x/i[0]):u.x,ySnapped:a?i[1]*Math.round(u.y/i[1]):u.y,...u}},[])}function fn(e){return(t,r,n)=>e?.(t,n)}function wg({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:n,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){const s=fe(),[u,l]=k.useState(!1),c=k.useRef([]),f=k.useRef({x:null,y:null}),d=k.useRef(0),h=k.useRef(null),_=k.useRef({x:0,y:0}),g=k.useRef(null),v=k.useRef(!1),p=k.useRef(!1),y=k.useRef(!1),b=kw();return k.useEffect(()=>{if(e?.current){const m=xe(e.current),E=({x:N,y:q})=>{const{nodeInternals:A,onNodeDrag:I,onSelectionDrag:D,updateNodePositions:O,nodeExtent:w,snapGrid:T,snapToGrid:C,nodeOrigin:z,onError:H}=s.getState();f.current={x:N,y:q};let M=!1,B={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&w){const V=xr(c.current,z);B=Ht(V)}if(c.current=c.current.map(V=>{const U={x:N-V.distance.x,y:q-V.distance.y};C&&(U.x=T[0]*Math.round(U.x/T[0]),U.y=T[1]*Math.round(U.y/T[1]));const R=[[w[0][0],w[0][1]],[w[1][0],w[1][1]]];c.current.length>1&&w&&!V.extent&&(R[0][0]=V.positionAbsolute.x-B.x+w[0][0],R[1][0]=V.positionAbsolute.x+(V.width??0)-B.x2+w[1][0],R[0][1]=V.positionAbsolute.y-B.y+w[0][1],R[1][1]=V.positionAbsolute.y+(V.height??0)-B.y2+w[1][1]);const P=bg(V,U,A,R,z,H);return M=M||V.position.x!==P.position.x||V.position.y!==P.position.y,V.position=P.position,V.positionAbsolute=P.positionAbsolute,V}),!M)return;O(c.current,!0,!0),l(!0);const G=i?I:fn(D);if(G&&g.current){const[V,U]=ln({nodeId:i,dragItems:c.current,nodeInternals:A});G(g.current,V,U)}},x=()=>{if(!h.current)return;const[N,q]=Hv(_.current,h.current);if(N!==0||q!==0){const{transform:A,panBy:I}=s.getState();f.current.x=(f.current.x??0)-N/A[2],f.current.y=(f.current.y??0)-q/A[2],I({x:N,y:q})&&E(f.current)}d.current=requestAnimationFrame(x)},S=N=>{const{nodeInternals:q,multiSelectionActive:A,nodesDraggable:I,unselectNodesAndEdges:D,onNodeDragStart:O,onSelectionDragStart:w}=s.getState();p.current=!0;const T=i?O:fn(w);(!o||!a)&&!A&&i&&(q.get(i)?.selected||D()),i&&a&&o&&Nu({id:i,store:s,nodeRef:e});const C=b(N);if(f.current=C,c.current=Pw(q,I,C,i),T&&c.current){const[z,H]=ln({nodeId:i,dragItems:c.current,nodeInternals:q});T(N.sourceEvent,z,H)}};if(t)m.on(".drag",null);else{const N=mb().on("start",q=>{const{domNode:A,nodeDragThreshold:I}=s.getState();I===0&&S(q),y.current=!1;const D=b(q);f.current=D,h.current=A?.getBoundingClientRect()||null,_.current=Je(q.sourceEvent,h.current)}).on("drag",q=>{const A=b(q),{autoPanOnNodeDrag:I,nodeDragThreshold:D}=s.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&p.current&&I&&(v.current=!0,x()),!p.current){const O=A.xSnapped-(f?.current?.x??0),w=A.ySnapped-(f?.current?.y??0);Math.sqrt(O*O+w*w)>D&&S(q)}(f.current.x!==A.xSnapped||f.current.y!==A.ySnapped)&&c.current&&p.current&&(g.current=q.sourceEvent,_.current=Je(q.sourceEvent,h.current),E(A))}}).on("end",q=>{if(!(!p.current||y.current)&&(l(!1),v.current=!1,p.current=!1,cancelAnimationFrame(d.current),c.current)){const{updateNodePositions:A,nodeInternals:I,onNodeDragStop:D,onSelectionDragStop:O}=s.getState(),w=i?D:fn(O);if(A(c.current,!1,!1),w){const[T,C]=ln({nodeId:i,dragItems:c.current,nodeInternals:I});w(q.sourceEvent,T,C)}}}).filter(q=>{const A=q.target;return!q.button&&(!r||!Qc(A,`.${r}`,e))&&(!n||Qc(A,n,e))});return m.call(N),()=>{m.on(".drag",null)}}}},[e,t,r,n,a,s,i,o,b]),u}function Eg(){const e=fe();return k.useCallback(r=>{const{nodeInternals:n,nodeExtent:i,updateNodePositions:a,getNodes:o,snapToGrid:s,snapGrid:u,onError:l,nodesDraggable:c}=e.getState(),f=o().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),d=s?u[0]:5,h=s?u[1]:5,_=r.isShiftPressed?4:1,g=r.x*d*_,v=r.y*h*_,p=f.map(y=>{if(y.positionAbsolute){const b={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+v};s&&(b.x=u[0]*Math.round(b.x/u[0]),b.y=u[1]*Math.round(b.y/u[1]));const{positionAbsolute:m,position:E}=bg(y,b,n,i,void 0,l);y.position=E,y.positionAbsolute=m}return y});a(p,!0,!1)},[])}const mt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Mt=e=>{const t=({id:r,type:n,data:i,xPos:a,yPos:o,xPosOrigin:s,yPosOrigin:u,selected:l,onClick:c,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onContextMenu:_,onDoubleClick:g,style:v,className:p,isDraggable:y,isSelectable:b,isConnectable:m,isFocusable:E,selectNodesOnDrag:x,sourcePosition:S,targetPosition:N,hidden:q,resizeObserver:A,dragHandle:I,zIndex:D,isParent:O,noDragClassName:w,noPanClassName:T,initialized:C,disableKeyboardA11y:z,ariaLabel:H,rfId:M,hasHandleBounds:B})=>{const G=fe(),V=k.useRef(null),U=k.useRef(null),R=k.useRef(S),P=k.useRef(N),F=k.useRef(n),$=b||y||c||f||d||h,j=Eg(),W=Tt(r,G.getState,f),Z=Tt(r,G.getState,d),te=Tt(r,G.getState,h),ie=Tt(r,G.getState,_),re=Tt(r,G.getState,g),ee=K=>{const{nodeDragThreshold:Y}=G.getState();if(b&&(!x||!y||Y>0)&&Nu({id:r,store:G,nodeRef:V}),c){const oe=G.getState().nodeInternals.get(r);oe&&c(K,{...oe})}},X=K=>{if(!Su(K)&&!z)if(Uv.includes(K.key)&&b){const Y=K.key==="Escape";Nu({id:r,store:G,unselect:Y,nodeRef:V})}else y&&l&&Object.prototype.hasOwnProperty.call(mt,K.key)&&(G.setState({ariaLiveMessage:`Moved selected node ${K.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~o}`}),j({x:mt[K.key].x,y:mt[K.key].y,isShiftPressed:K.shiftKey}))};k.useEffect(()=>()=>{U.current&&(A?.unobserve(U.current),U.current=null)},[]),k.useEffect(()=>{if(V.current&&!q){const K=V.current;(!C||!B||U.current!==K)&&(U.current&&A?.unobserve(U.current),A?.observe(K),U.current=K)}},[q,C,B]),k.useEffect(()=>{const K=F.current!==n,Y=R.current!==S,oe=P.current!==N;V.current&&(K||Y||oe)&&(K&&(F.current=n),Y&&(R.current=S),oe&&(P.current=N),G.getState().updateNodeDimensions([{id:r,nodeElement:V.current,forceUpdate:!0}]))},[r,n,S,N]);const ue=wg({nodeRef:V,disabled:q||!y,noDragClassName:w,handleSelector:I,nodeId:r,isSelectable:b,selectNodesOnDrag:x});return q?null:L.createElement("div",{className:pe(["react-flow__node",`react-flow__node-${n}`,{[T]:y},p,{selected:l,selectable:b,parent:O,dragging:ue}]),ref:V,style:{zIndex:D,transform:`translate(${s}px,${u}px)`,pointerEvents:$?"all":"none",visibility:C?"visible":"hidden",...v},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:W,onMouseMove:Z,onMouseLeave:te,onContextMenu:ie,onClick:ee,onDoubleClick:re,onKeyDown:E?X:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":z?void 0:`${fg}-${M}`,"aria-label":H},L.createElement(W0,{value:r},L.createElement(e,{id:r,data:i,type:n,xPos:a,yPos:o,selected:l,isConnectable:m,sourcePosition:S,targetPosition:N,dragging:ue,dragHandle:I,zIndex:D})))};return t.displayName="NodeWrapper",k.memo(t)};const Dw=e=>{const t=e.getNodes().filter(r=>r.selected);return{...xr(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Lw({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const n=fe(),{width:i,height:a,x:o,y:s,transformString:u,userSelectionActive:l}=ne(Dw,he),c=Eg(),f=k.useRef(null);if(k.useEffect(()=>{r||f.current?.focus({preventScroll:!0})},[r]),wg({nodeRef:f}),l||!i||!a)return null;const d=e?_=>{const g=n.getState().getNodes().filter(v=>v.selected);e(_,g)}:void 0,h=_=>{Object.prototype.hasOwnProperty.call(mt,_.key)&&c({x:mt[_.key].x,y:mt[_.key].y,isShiftPressed:_.shiftKey})};return L.createElement("div",{className:pe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u}},L.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:a,top:s,left:o}}))}var Fw=k.memo(Lw);const zw=e=>e.nodesSelectionActive,xg=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:u,onMoveStart:l,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:d,selectionMode:h,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:p,zoomActivationKeyCode:y,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:A,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,preventScrolling:T,onSelectionContextMenu:C,noWheelClassName:z,noPanClassName:H,disableKeyboardA11y:M})=>{const B=ne(zw),G=Gt(f),V=Gt(p),U=V||A,R=V||x,P=G||d&&U!==!0;return Sw({deleteKeyCode:s,multiSelectionKeyCode:v}),L.createElement(Aw,{onMove:u,onMoveStart:l,onMoveEnd:c,onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:R,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:!G&&U,defaultViewport:I,translateExtent:D,minZoom:O,maxZoom:w,zoomActivationKeyCode:y,preventScrolling:T,noWheelClassName:z,noPanClassName:H},L.createElement(mg,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:U,isSelecting:!!P,selectionMode:h},e,B&&L.createElement(Fw,{onSelectionContextMenu:C,noPanClassName:H,disableKeyboardA11y:M})))};xg.displayName="FlowRenderer";var Bw=k.memo(xg);function Hw(e){return ne(k.useCallback(r=>e?Jv(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $w(e){const t={input:Mt(e.input||sg),default:Mt(e.default||Au),output:Mt(e.output||cg),group:Mt(e.group||Vu)},r={},n=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Mt(e[a]||Au),i),r);return{...t,...n}}const Gw=({x:e,y:t,width:r,height:n,origin:i})=>!r||!n?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-r*i[0],y:t-n*i[1]},Vw=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Sg=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,updateNodeDimensions:a,onError:o}=ne(Vw,he),s=Hw(e.onlyRenderVisibleElements),u=k.useRef(),l=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const d=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));a(d)});return u.current=c,c},[]);return k.useEffect(()=>()=>{u?.current?.disconnect()},[]),L.createElement("div",{className:"react-flow__nodes",style:ju},s.map(c=>{let f=c.type||"default";e.nodeTypes[f]||(o?.("003",Ue.error003(f)),f="default");const d=e.nodeTypes[f]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),_=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||r&&typeof c.connectable>"u"),v=!!(c.focusable||n&&typeof c.focusable>"u"),p=e.nodeExtent?Fu(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=p?.x??0,b=p?.y??0,m=Gw({x:y,y:b,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return L.createElement(d,{key:c.id,id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||J.Bottom,targetPosition:c.targetPosition||J.Top,hidden:c.hidden,xPos:y,yPos:b,xPosOrigin:m.x,yPosOrigin:m.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:_,isConnectable:g,isFocusable:v,resizeObserver:l,dragHandle:c.dragHandle,zIndex:c[se]?.z??0,isParent:!!c[se]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!c[se]?.handleBounds})}))};Sg.displayName="NodeRenderer";var Uw=k.memo(Sg);const jw=(e,t,r)=>r===J.Left?e-t:r===J.Right?e+t:e,Kw=(e,t,r)=>r===J.Top?e-t:r===J.Bottom?e+t:e,tl="react-flow__edgeupdater",rl=({position:e,centerX:t,centerY:r,radius:n=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>L.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:pe([tl,`${tl}-${s}`]),cx:jw(t,n,e),cy:Kw(r,n,e),r:n,stroke:"transparent",fill:"transparent"}),Yw=()=>!0;var vt=e=>{const t=({id:r,className:n,type:i,data:a,onClick:o,onEdgeDoubleClick:s,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,style:v,source:p,target:y,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,elementsSelectable:q,hidden:A,sourceHandleId:I,targetHandleId:D,onContextMenu:O,onMouseEnter:w,onMouseMove:T,onMouseLeave:C,reconnectRadius:z,onReconnect:H,onReconnectStart:M,onReconnectEnd:B,markerEnd:G,markerStart:V,rfId:U,ariaLabel:R,isFocusable:P,isReconnectable:F,pathOptions:$,interactionWidth:j,disableKeyboardA11y:W})=>{const Z=k.useRef(null),[te,ie]=k.useState(!1),[re,ee]=k.useState(!1),X=fe(),ue=k.useMemo(()=>`url('#${Ru(V,U)}')`,[V,U]),K=k.useMemo(()=>`url('#${Ru(G,U)}')`,[G,U]);if(A)return null;const Y=de=>{const{edges:we,addSelectedEdges:ve,unselectNodesAndEdges:ye,multiSelectionActive:ft}=X.getState(),De=we.find(et=>et.id===r);De&&(q&&(X.setState({nodesSelectionActive:!1}),De.selected&&ft?(ye({nodes:[],edges:[De]}),Z.current?.blur()):ve([r])),o&&o(de,De))},oe=It(r,X.getState,s),Ce=It(r,X.getState,O),Oe=It(r,X.getState,w),ge=It(r,X.getState,T),ce=It(r,X.getState,C),me=(de,we)=>{if(de.button!==0)return;const{edges:ve,isValidConnection:ye}=X.getState(),ft=we?y:p,De=(we?D:I)||null,et=we?"target":"source",Hr=ye||Yw,$r=we,Ct=ve.find(tt=>tt.id===r);ee(!0),M?.(de,Ct,et);const Gr=tt=>{ee(!1),B?.(tt,Ct,et)};ng({event:de,handleId:De,nodeId:ft,onConnect:tt=>H?.(Ct,tt),isTarget:$r,getState:X.getState,setState:X.setState,isValidConnection:Hr,edgeUpdaterType:et,onReconnectEnd:Gr})},Ae=de=>me(de,!0),ze=de=>me(de,!1),ke=()=>ie(!0),be=()=>ie(!1),Be=!q&&!o,Ye=de=>{if(!W&&Uv.includes(de.key)&&q){const{unselectNodesAndEdges:we,addSelectedEdges:ve,edges:ye}=X.getState();de.key==="Escape"?(Z.current?.blur(),we({edges:[ye.find(De=>De.id===r)]})):ve([r])}};return L.createElement("g",{className:pe(["react-flow__edge",`react-flow__edge-${i}`,n,{selected:u,animated:l,inactive:Be,updating:te}]),onClick:Y,onDoubleClick:oe,onContextMenu:Ce,onMouseEnter:Oe,onMouseMove:ge,onMouseLeave:ce,onKeyDown:P?Ye:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":R===null?void 0:R||`Edge from ${p} to ${y}`,"aria-describedby":P?`${dg}-${U}`:void 0,ref:Z},!re&&L.createElement(e,{id:r,source:p,target:y,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,sourceHandleId:I,targetHandleId:D,markerStart:ue,markerEnd:K,pathOptions:$,interactionWidth:j}),F&&L.createElement(L.Fragment,null,(F==="source"||F===!0)&&L.createElement(rl,{position:S,centerX:b,centerY:m,radius:z,onMouseDown:Ae,onMouseEnter:ke,onMouseOut:be,type:"source"}),(F==="target"||F===!0)&&L.createElement(rl,{position:N,centerX:E,centerY:x,radius:z,onMouseDown:ze,onMouseEnter:ke,onMouseOut:be,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function Ww(e){const t={default:vt(e.default||pr),straight:vt(e.bezier||Hu),step:vt(e.step||Bu),smoothstep:vt(e.step||Er),simplebezier:vt(e.simplebezier||zu)},r={},n=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=vt(e[a]||pr),i),r);return{...t,...n}}function nl(e,t,r=null){const n=(r?.x||0)+t.x,i=(r?.y||0)+t.y,a=r?.width||t.width,o=r?.height||t.height;switch(e){case J.Top:return{x:n+a/2,y:i};case J.Right:return{x:n+a,y:i+o/2};case J.Bottom:return{x:n+a/2,y:i+o};case J.Left:return{x:n,y:i+o/2}}}function il(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const Zw=(e,t,r,n,i,a)=>{const o=nl(r,e,t),s=nl(a,n,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function Xw({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:n,targetWidth:i,targetHeight:a,width:o,height:s,transform:u}){const l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+i),y2:Math.max(e.y+n,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=Ht({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:o/u[2],height:s/u[2]}),f=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),d=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(f*d)>0}function al(e){const t=e?.[se]?.handleBounds||null,r=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!r]}const Jw=[{level:0,isMaxLevel:!0,edges:[]}];function Qw(e,t,r=!1){let n=-1;const i=e.reduce((o,s)=>{const u=Se(s.zIndex);let l=u?s.zIndex:0;if(r){const c=t.get(s.target),f=t.get(s.source),d=s.selected||c?.selected||f?.selected,h=Math.max(f?.[se]?.z||0,c?.[se]?.z||0,1e3);l=(u?s.zIndex:0)+(d?h:0)}return o[l]?o[l].push(s):o[l]=[s],n=l>n?l:n,o},{}),a=Object.entries(i).map(([o,s])=>{const u=+o;return{edges:s,level:u,isMaxLevel:u===n}});return a.length===0?Jw:a}function e1(e,t,r){const n=ne(k.useCallback(i=>e?i.edges.filter(a=>{const o=t.get(a.source),s=t.get(a.target);return o?.width&&o?.height&&s?.width&&s?.height&&Xw({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return Qw(n,t,r)}const t1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),r1=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ol={[hr.Arrow]:t1,[hr.ArrowClosed]:r1};function n1(e){const t=fe();return k.useMemo(()=>Object.prototype.hasOwnProperty.call(ol,e)?ol[e]:(t.getState().onError?.("009",Ue.error009(e)),null),[e])}const i1=({id:e,type:t,color:r,width:n=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const u=n1(t);return u?L.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0"},L.createElement(u,{color:r,strokeWidth:o})):null},a1=({defaultColor:e,rfId:t})=>r=>{const n=[];return r.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(o=>{if(o&&typeof o=="object"){const s=Ru(o,t);n.includes(s)||(i.push({id:s,color:o.color||e,...o}),n.push(s))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},qg=({defaultColor:e,rfId:t})=>{const r=ne(k.useCallback(a1({defaultColor:e,rfId:t}),[e,t]),(n,i)=>!(n.length!==i.length||n.some((a,o)=>a.id!==i[o].id)));return L.createElement("defs",null,r.map(n=>L.createElement(i1,{id:n.id,key:n.id,type:n.type,color:n.color,width:n.width,height:n.height,markerUnits:n.markerUnits,strokeWidth:n.strokeWidth,orient:n.orient})))};qg.displayName="MarkerDefinitions";var o1=k.memo(qg);const s1=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Rg=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:n,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,children:v,disableKeyboardA11y:p})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:m,width:E,height:x,connectionMode:S,nodeInternals:N,onError:q}=ne(s1,he),A=e1(t,N,r);return E?L.createElement(L.Fragment,null,A.map(({level:I,edges:D,isMaxLevel:O})=>L.createElement("svg",{key:I,style:{zIndex:I},width:E,height:x,className:"react-flow__edges react-flow__container"},O&&L.createElement(o1,{defaultColor:e,rfId:n}),L.createElement("g",null,D.map(w=>{const[T,C,z]=al(N.get(w.source)),[H,M,B]=al(N.get(w.target));if(!z||!B)return null;let G=w.type||"default";i[G]||(q?.("011",Ue.error011(G)),G="default");const V=i[G]||i.default,U=S===ot.Strict?M.target:(M.target??[]).concat(M.source??[]),R=il(C.source,w.sourceHandle),P=il(U,w.targetHandle),F=R?.position||J.Bottom,$=P?.position||J.Top,j=!!(w.focusable||y&&typeof w.focusable>"u"),W=w.reconnectable||w.updatable,Z=typeof d<"u"&&(W||b&&typeof W>"u");if(!R||!P)return q?.("008",Ue.error008(R,w)),null;const{sourceX:te,sourceY:ie,targetX:re,targetY:ee}=Zw(T,R,F,H,P,$);return L.createElement(V,{key:w.id,id:w.id,className:pe([w.className,a]),type:G,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:te,sourceY:ie,targetX:re,targetY:ee,sourcePosition:F,targetPosition:$,elementsSelectable:m,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,onClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,rfId:n,ariaLabel:w.ariaLabel,isFocusable:j,isReconnectable:Z,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:p})})))),v):null};Rg.displayName="EdgeRenderer";var u1=k.memo(Rg);const c1=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function l1({children:e}){const t=ne(c1);return L.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function f1(e){const t=Uu(),r=k.useRef(!1);k.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const d1={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top},Cg=({nodeId:e,handleType:t,style:r,type:n=Xe.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:o,handleId:s,toX:u,toY:l,connectionMode:c}=ne(k.useCallback(x=>({fromNode:x.nodeInternals.get(e),handleId:x.connectionHandleId,toX:(x.connectionPosition.x-x.transform[0])/x.transform[2],toY:(x.connectionPosition.y-x.transform[1])/x.transform[2],connectionMode:x.connectionMode}),[e]),he),f=o?.[se]?.handleBounds;let d=f?.[t];if(c===ot.Loose&&(d=d||f?.[t==="source"?"target":"source"]),!o||!d)return null;const h=s?d.find(x=>x.id===s):d[0],_=h?h.x+h.width/2:(o.width??0)/2,g=h?h.y+h.height/2:o.height??0,v=(o.positionAbsolute?.x??0)+_,p=(o.positionAbsolute?.y??0)+g,y=h?.position,b=y?d1[y]:null;if(!y||!b)return null;if(i)return L.createElement(i,{connectionLineType:n,connectionLineStyle:r,fromNode:o,fromHandle:h,fromX:v,fromY:p,toX:u,toY:l,fromPosition:y,toPosition:b,connectionStatus:a});let m="";const E={sourceX:v,sourceY:p,sourcePosition:y,targetX:u,targetY:l,targetPosition:b};return n===Xe.Bezier?[m]=Zv(E):n===Xe.Step?[m]=qu({...E,borderRadius:0}):n===Xe.SmoothStep?[m]=qu(E):n===Xe.SimpleBezier?[m]=Wv(E):m=`M${v},${p} ${u},${l}`,L.createElement("path",{d:m,fill:"none",className:"react-flow__connection-path",style:r})};Cg.displayName="ConnectionLine";const h1=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function p1({containerStyle:e,style:t,type:r,component:n}){const{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:u,connectionStatus:l}=ne(h1,he);return!(i&&a&&s&&o)?null:L.createElement("svg",{style:e,width:s,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},L.createElement("g",{className:pe(["react-flow__connection",l])},L.createElement(Cg,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:n,connectionStatus:l})))}function sl(e,t){return k.useRef(null),fe(),k.useMemo(()=>t(e),[e])}const Ag=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:n,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:v,connectionLineType:p,connectionLineStyle:y,connectionLineComponent:b,connectionLineContainerStyle:m,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:O,selectNodesOnDrag:w,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,preventScrolling:M,defaultMarkerColor:B,zoomOnScroll:G,zoomOnPinch:V,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:$,onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneScroll:ie,onPaneContextMenu:re,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,elevateEdgesOnSelect:Ae,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})=>{const Ye=sl(e,$w),de=sl(t,Ww);return f1(a),L.createElement(Bw,{onPaneClick:j,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneContextMenu:re,onPaneScroll:ie,deleteKeyCode:I,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,elementsSelectable:O,onMove:r,onMoveStart:n,onMoveEnd:i,zoomOnScroll:G,zoomOnPinch:V,zoomOnDoubleClick:F,panOnScroll:U,panOnScrollSpeed:R,panOnScrollMode:P,panOnDrag:$,defaultViewport:T,translateExtent:C,minZoom:z,maxZoom:H,onSelectionContextMenu:_,preventScrolling:M,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,disableKeyboardA11y:ze},L.createElement(l1,null,L.createElement(u1,{edgeTypes:de,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:D,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:K,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Oe,defaultMarkerColor:B,noPanClassName:me,elevateEdgesOnSelect:!!Ae,disableKeyboardA11y:ze,rfId:Be},L.createElement(p1,{style:y,type:p,component:b,containerStyle:m})),L.createElement("div",{className:"react-flow__edgelabel-renderer"}),L.createElement(Uw,{nodeTypes:Ye,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,selectNodesOnDrag:w,onlyRenderVisibleElements:D,noPanClassName:me,noDragClassName:ge,disableKeyboardA11y:ze,nodeOrigin:ke,nodeExtent:be,rfId:Be})))};Ag.displayName="GraphView";var v1=k.memo(Ag);const Iu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],We={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Iu,nodeExtent:Iu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:G0,isValidConnection:void 0},g1=()=>Im((e,t)=>({...We,setNodes:r=>{const{nodeInternals:n,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:un(r,n,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:n={}}=t();e({edges:r.map(i=>({...n,...i}))})},setDefaultNodesAndEdges:(r,n)=>{const i=typeof r<"u",a=typeof n<"u",o=i?un(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:o,edges:a?n:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:n,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:u,nodeOrigin:l}=t(),c=u?.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=r.reduce((g,v)=>{const p=i.get(v.id);if(p?.hidden)i.set(p.id,{...p,[se]:{...p[se],handleBounds:void 0}});else if(p){const y=Lu(v.nodeElement);!!(y.width&&y.height&&(p.width!==y.width||p.height!==y.height||v.forceUpdate))&&(i.set(p.id,{...p,[se]:{...p[se],handleBounds:{source:el(".source",v.nodeElement,d,l),target:el(".target",v.nodeElement,d,l)}},...y}),g.push({id:p.id,type:"dimensions",dimensions:y}))}return g},[]);pg(i,l);const _=o||a&&!o&&vg(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),h?.length>0&&n?.(h)},updateNodePositions:(r,n=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),o=r.map(s=>{const u={id:s.id,type:"position",dragging:i};return n&&(u.positionAbsolute=s.positionAbsolute,u.position=s.position),u});a(o)},triggerNodeChanges:r=>{const{onNodesChange:n,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:u}=t();if(r?.length){if(a){const l=yg(r,s()),c=un(l,i,o,u);e({nodeInternals:c})}n?.(r)}},addSelectedNodes:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(a(),r),s=gt(i,[])),rr({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=gt(i,r),s=gt(a(),[])),rr({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:n}={})=>{const{edges:i,getNodes:a}=t(),o=r||a(),s=n||i,u=o.map(c=>(c.selected=!1,Ze(c.id,!1))),l=s.map(c=>Ze(c.id,!1));rr({changedNodes:u,changedEdges:l,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:n,maxZoom:i}=t();n?.scaleExtent([r,i]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:n,minZoom:i}=t();n?.scaleExtent([i,r]),e({maxZoom:r})},setTranslateExtent:r=>{t().d3Zoom?.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:n}=t(),a=n().filter(s=>s.selected).map(s=>Ze(s.id,!1)),o=r.filter(s=>s.selected).map(s=>Ze(s.id,!1));rr({changedNodes:a,changedEdges:o,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:n}=t();n.forEach(i=>{i.positionAbsolute=Fu(i.position,r)}),e({nodeExtent:r,nodeInternals:new Map(n)})},panBy:r=>{const{transform:n,width:i,height:a,d3Zoom:o,d3Selection:s,translateExtent:u}=t();if(!o||!s||!r.x&&!r.y)return!1;const l=Ge.translate(n[0]+r.x,n[1]+r.y).scale(n[2]),c=[[0,0],[i,a]],f=o?.constrain()(l,c,u);return o.transform(s,f),n[0]!==f.x||n[1]!==f.y||n[2]!==f.k},cancelConnection:()=>e({connectionNodeId:We.connectionNodeId,connectionHandleId:We.connectionHandleId,connectionHandleType:We.connectionHandleType,connectionStatus:We.connectionStatus,connectionStartHandle:We.connectionStartHandle,connectionEndHandle:We.connectionEndHandle}),reset:()=>e({...We})}),Object.is),Ng=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=g1()),L.createElement(D0,{value:t.current},e)};Ng.displayName="ReactFlowProvider";const Ig=({children:e})=>k.useContext(wr)?L.createElement(L.Fragment,null,e):L.createElement(Ng,null,e);Ig.displayName="ReactFlowWrapper";const y1={input:sg,default:Au,output:cg,group:Vu},m1={default:pr,straight:Hu,step:Bu,smoothstep:Er,simplebezier:zu},_1=[0,0],b1=[15,15],w1={x:0,y:0,zoom:1},E1={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},x1=k.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,className:i,nodeTypes:a=y1,edgeTypes:o=m1,onNodeClick:s,onEdgeClick:u,onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:D,onSelectionDragStart:O,onSelectionDrag:w,onSelectionDragStop:T,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,connectionMode:M=ot.Strict,connectionLineType:B=Xe.Bezier,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:R="Backspace",selectionKeyCode:P="Shift",selectionOnDrag:F=!1,selectionMode:$=$t.Full,panActivationKeyCode:j="Space",multiSelectionKeyCode:W=dr()?"Meta":"Control",zoomActivationKeyCode:Z=dr()?"Meta":"Control",snapToGrid:te=!1,snapGrid:ie=b1,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ee=!0,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,nodeOrigin:Y=_1,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,defaultViewport:ge=w1,minZoom:ce=.5,maxZoom:me=2,translateExtent:Ae=Iu,preventScrolling:ze=!0,nodeExtent:ke,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:Be=!0,zoomOnPinch:Ye=!0,panOnScroll:de=!1,panOnScrollSpeed:we=.5,panOnScrollMode:ve=nt.Free,zoomOnDoubleClick:ye=!0,panOnDrag:ft=!0,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,children:fc,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onEdgeUpdate:Fy,onEdgeUpdateStart:zy,onEdgeUpdateEnd:By,onReconnect:Hy,onReconnectStart:$y,onReconnectEnd:Gy,reconnectRadius:Vy=10,edgeUpdaterRadius:Uy=10,onNodesChange:jy,onEdgesChange:Ky,noDragClassName:Yy="nodrag",noWheelClassName:Wy="nowheel",noPanClassName:dc="nopan",fitView:Zy=!1,fitViewOptions:Xy,connectOnClick:Jy=!0,attributionPosition:Qy,proOptions:em,defaultEdgeOptions:tm,elevateNodesOnSelect:rm=!0,elevateEdgesOnSelect:nm=!1,disableKeyboardA11y:hc=!1,autoPanOnConnect:im=!0,autoPanOnNodeDrag:am=!0,connectionRadius:om=20,isValidConnection:sm,onError:um,style:cm,id:pc,nodeDragThreshold:lm,...fm},dm)=>{const Vr=pc||"1";return L.createElement("div",{...fm,style:{...cm,...E1},ref:dm,className:pe(["react-flow",i]),"data-testid":"rf__wrapper",id:pc},L.createElement(Ig,null,L.createElement(v1,{onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,nodeTypes:a,edgeTypes:o,connectionLineType:B,connectionLineStyle:G,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:P,selectionOnDrag:F,selectionMode:$,deleteKeyCode:R,multiSelectionKeyCode:W,panActivationKeyCode:j,zoomActivationKeyCode:Z,onlyRenderVisibleElements:re,selectNodesOnDrag:ee,defaultViewport:ge,translateExtent:Ae,minZoom:ce,maxZoom:me,preventScrolling:ze,zoomOnScroll:Be,zoomOnPinch:Ye,zoomOnDoubleClick:ye,panOnScroll:de,panOnScrollSpeed:we,panOnScrollMode:ve,panOnDrag:ft,onPaneClick:De,onPaneMouseEnter:et,onPaneMouseMove:Hr,onPaneMouseLeave:$r,onPaneScroll:Ct,onPaneContextMenu:Gr,onSelectionContextMenu:C,onSelectionStart:z,onSelectionEnd:H,onEdgeContextMenu:tt,onEdgeDoubleClick:Oy,onEdgeMouseEnter:ky,onEdgeMouseMove:Dy,onEdgeMouseLeave:Ly,onReconnect:Hy??Fy,onReconnectStart:$y??zy,onReconnectEnd:Gy??By,reconnectRadius:Vy??Uy,defaultMarkerColor:be,noDragClassName:Yy,noWheelClassName:Wy,noPanClassName:dc,elevateEdgesOnSelect:nm,rfId:Vr,disableKeyboardA11y:hc,nodeOrigin:Y,nodeExtent:ke}),L.createElement(dw,{nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:K,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Oe,elevateNodesOnSelect:rm,minZoom:ce,maxZoom:me,nodeExtent:ke,onNodesChange:jy,onEdgesChange:Ky,snapToGrid:te,snapGrid:ie,connectionMode:M,translateExtent:Ae,connectOnClick:Jy,defaultEdgeOptions:tm,fitView:Zy,fitViewOptions:Xy,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onSelectionDrag:w,onSelectionDragStart:O,onSelectionDragStop:T,noPanClassName:dc,nodeOrigin:Y,rfId:Vr,autoPanOnConnect:im,autoPanOnNodeDrag:am,onError:um,connectionRadius:om,isValidConnection:sm,nodeDragThreshold:lm}),L.createElement(lw,{onSelectionChange:D}),fc,L.createElement(F0,{proOptions:em,position:Qy}),L.createElement(yw,{rfId:Vr,disableKeyboardA11y:hc})))});x1.displayName="ReactFlow";function Tg(e){return t=>{const[r,n]=k.useState(t),i=k.useCallback(a=>n(o=>e(a,o)),[]);return[r,n,i]}}const tq=Tg(yg),rq=Tg(Tw),Mg=({id:e,x:t,y:r,width:n,height:i,style:a,color:o,strokeColor:s,strokeWidth:u,className:l,borderRadius:c,shapeRendering:f,onClick:d,selected:h})=>{const{background:_,backgroundColor:g}=a||{},v=o||_||g;return L.createElement("rect",{className:pe(["react-flow__minimap-node",{selected:h},l]),x:t,y:r,rx:c,ry:c,width:n,height:i,fill:v,stroke:s,strokeWidth:u,shapeRendering:f,onClick:d?p=>d(p,e):void 0})};Mg.displayName="MiniMapNode";var S1=k.memo(Mg);const q1=e=>e.nodeOrigin,R1=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),dn=e=>e instanceof Function?e:()=>e;function C1({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:n=5,nodeStrokeWidth:i=2,nodeComponent:a=S1,onClick:o}){const s=ne(R1,he),u=ne(q1),l=dn(t),c=dn(e),f=dn(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return L.createElement(L.Fragment,null,s.map(h=>{const{x:_,y:g}=it(h,u).positionAbsolute;return L.createElement(a,{key:h.id,x:_,y:g,width:h.width,height:h.height,style:h.style,selected:h.selected,className:f(h),color:l(h),borderRadius:n,strokeColor:c(h),strokeWidth:i,shapeRendering:d,onClick:o,id:h.id})}))}var A1=k.memo(C1);const N1=200,I1=150,T1=e=>{const t=e.getNodes(),r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:t.length>0?H0(xr(t,e.nodeOrigin),r):r,rfId:e.rfId}},M1="react-flow__minimap-desc";function Pg({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:n="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o=2,nodeComponent:s,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:l="none",maskStrokeWidth:c=1,position:f="bottom-right",onClick:d,onNodeClick:h,pannable:_=!1,zoomable:g=!1,ariaLabel:v="React Flow mini map",inversePan:p=!1,zoomStep:y=10,offsetScale:b=5}){const m=fe(),E=k.useRef(null),{boundingRect:x,viewBB:S,rfId:N}=ne(T1,he),q=e?.width??N1,A=e?.height??I1,I=x.width/q,D=x.height/A,O=Math.max(I,D),w=O*q,T=O*A,C=b*O,z=x.x-(w-x.width)/2-C,H=x.y-(T-x.height)/2-C,M=w+C*2,B=T+C*2,G=`${M1}-${N}`,V=k.useRef(0);V.current=O,k.useEffect(()=>{if(E.current){const P=xe(E.current),F=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie}=m.getState();if(W.sourceEvent.type!=="wheel"||!te||!ie)return;const re=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*y,ee=Z[2]*Math.pow(2,re);ie.scaleTo(te,ee)},$=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie,translateExtent:re,width:ee,height:X}=m.getState();if(W.sourceEvent.type!=="mousemove"||!te||!ie)return;const ue=V.current*Math.max(1,Z[2])*(p?-1:1),K={x:Z[0]-W.sourceEvent.movementX*ue,y:Z[1]-W.sourceEvent.movementY*ue},Y=[[0,0],[ee,X]],oe=Ge.translate(K.x,K.y).scale(Z[2]),Ce=ie.constrain()(oe,Y,re);ie.transform(te,Ce)},j=zv().on("zoom",_?$:null).on("zoom.wheel",g?F:null);return P.call(j),()=>{P.on("zoom",null)}}},[_,g,p,y]);const U=d?P=>{const F=Ne(P);d(P,{x:F[0],y:F[1]})}:void 0,R=h?(P,F)=>{const $=m.getState().nodeInternals.get(F);h(P,$)}:void 0;return L.createElement(Du,{position:f,style:e,className:pe(["react-flow__minimap",t]),"data-testid":"rf__minimap"},L.createElement("svg",{width:q,height:A,viewBox:`${z} ${H} ${M} ${B}`,role:"img","aria-labelledby":G,ref:E,onClick:U},v&&L.createElement("title",{id:G},v),L.createElement(A1,{onClick:R,nodeColor:n,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),L.createElement("path",{className:"react-flow__minimap-mask",d:`M${z-C},${H-C}h${M+C*2}v${B+C*2}h${-M-C*2}z - M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fill:u,fillRule:"evenodd",stroke:l,strokeWidth:c,pointerEvents:"none"})))}Pg.displayName="MiniMap";var nq=k.memo(Pg);function P1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},L.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function O1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},L.createElement("path",{d:"M0 0h32v4.2H0z"}))}function k1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},L.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function D1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function L1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const kt=({children:e,className:t,...r})=>L.createElement("button",{type:"button",className:pe(["react-flow__controls-button",t]),...r},e);kt.displayName="ControlButton";const F1=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Og=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:n=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:u,className:l,children:c,position:f="bottom-left"})=>{const d=fe(),[h,_]=k.useState(!1),{isInteractive:g,minZoomReached:v,maxZoomReached:p}=ne(F1,he),{zoomIn:y,zoomOut:b,fitView:m}=Uu();if(k.useEffect(()=>{_(!0)},[]),!h)return null;const E=()=>{y(),a?.()},x=()=>{b(),o?.()},S=()=>{m(i),s?.()},N=()=>{d.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),u?.(!g)};return L.createElement(Du,{className:pe(["react-flow__controls",l]),position:f,style:e,"data-testid":"rf__controls"},t&&L.createElement(L.Fragment,null,L.createElement(kt,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},L.createElement(P1,null)),L.createElement(kt,{onClick:x,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v},L.createElement(O1,null))),r&&L.createElement(kt,{className:"react-flow__controls-fitview",onClick:S,title:"fit view","aria-label":"fit view"},L.createElement(k1,null)),n&&L.createElement(kt,{className:"react-flow__controls-interactive",onClick:N,title:"toggle interactivity","aria-label":"toggle interactivity"},g?L.createElement(L1,null):L.createElement(D1,null)),c)};Og.displayName="Controls";var iq=k.memo(Og),Ie;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ie||(Ie={}));function z1({color:e,dimensions:t,lineWidth:r}){return L.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function B1({color:e,radius:t}){return L.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const H1={[Ie.Dots]:"#91919a",[Ie.Lines]:"#eee",[Ie.Cross]:"#e2e2e2"},$1={[Ie.Dots]:1,[Ie.Lines]:1,[Ie.Cross]:6},G1=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function kg({id:e,variant:t=Ie.Dots,gap:r=20,size:n,lineWidth:i=1,offset:a=2,color:o,style:s,className:u}){const l=k.useRef(null),{transform:c,patternId:f}=ne(G1,he),d=o||H1[t],h=n||$1[t],_=t===Ie.Dots,g=t===Ie.Cross,v=Array.isArray(r)?r:[r,r],p=[v[0]*c[2]||1,v[1]*c[2]||1],y=h*c[2],b=g?[y,y]:p,m=_?[y/a,y/a]:[b[0]/a,b[1]/a];return L.createElement("svg",{className:pe(["react-flow__background",u]),style:{...s,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:l,"data-testid":"rf__background"},L.createElement("pattern",{id:f+e,x:c[0]%p[0],y:c[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${m[0]},-${m[1]})`},_?L.createElement(B1,{color:d,radius:y/a}):L.createElement(z1,{dimensions:b,color:d,lineWidth:i})),L.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f+e})`}))}kg.displayName="Background";var aq=k.memo(kg);function Ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var hn,ul;function V1(){if(ul)return hn;ul=1;function e(){this.__data__=[],this.size=0}return hn=e,hn}var pn,cl;function St(){if(cl)return pn;cl=1;function e(t,r){return t===r||t!==t&&r!==r}return pn=e,pn}var vn,ll;function Sr(){if(ll)return vn;ll=1;var e=St();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return vn=t,vn}var gn,fl;function U1(){if(fl)return gn;fl=1;var e=Sr(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return gn=n,gn}var yn,dl;function j1(){if(dl)return yn;dl=1;var e=Sr();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return yn=t,yn}var mn,hl;function K1(){if(hl)return mn;hl=1;var e=Sr();function t(r){return e(this.__data__,r)>-1}return mn=t,mn}var _n,pl;function Y1(){if(pl)return _n;pl=1;var e=Sr();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return _n=t,_n}var bn,vl;function qr(){if(vl)return bn;vl=1;var e=V1(),t=U1(),r=j1(),n=K1(),i=Y1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s-1&&n%1==0&&n-1&&r%1==0&&r<=e}return si=t,si}var ui,af;function _E(){if(af)return ui;af=1;var e=st(),t=Xu(),r=Le(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",c="[object Number]",f="[object Object]",d="[object RegExp]",h="[object Set]",_="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",p="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",m="[object Int8Array]",E="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",N="[object Uint8ClampedArray]",q="[object Uint16Array]",A="[object Uint32Array]",I={};I[y]=I[b]=I[m]=I[E]=I[x]=I[S]=I[N]=I[q]=I[A]=!0,I[n]=I[i]=I[v]=I[a]=I[p]=I[o]=I[s]=I[u]=I[l]=I[c]=I[f]=I[d]=I[h]=I[_]=I[g]=!1;function D(O){return r(O)&&t(O.length)&&!!I[e(O)]}return ui=D,ui}var ci,of;function Mr(){if(of)return ci;of=1;function e(t){return function(r){return t(r)}}return ci=e,ci}var Lt={exports:{}};Lt.exports;var sf;function Ju(){return sf||(sf=1,(function(e,t){var r=gv(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,s=(function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();e.exports=s})(Lt,Lt.exports)),Lt.exports}var li,uf;function Wt(){if(uf)return li;uf=1;var e=_E(),t=Mr(),r=Ju(),n=r&&r.isTypedArray,i=n?t(n):e;return li=i,li}var fi,cf;function Fg(){if(cf)return fi;cf=1;var e=gE(),t=Yt(),r=le(),n=qt(),i=Tr(),a=Wt(),o=Object.prototype,s=o.hasOwnProperty;function u(l,c){var f=r(l),d=!f&&t(l),h=!f&&!d&&n(l),_=!f&&!d&&!h&&a(l),g=f||d||h||_,v=g?e(l.length,String):[],p=v.length;for(var y in l)(c||s.call(l,y))&&!(g&&(y=="length"||h&&(y=="offset"||y=="parent")||_&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,p)))&&v.push(y);return v}return fi=u,fi}var di,lf;function Pr(){if(lf)return di;lf=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return di=t,di}var hi,ff;function zg(){if(ff)return hi;ff=1;function e(t,r){return function(n){return t(r(n))}}return hi=e,hi}var pi,df;function bE(){if(df)return pi;df=1;var e=zg(),t=e(Object.keys,Object);return pi=t,pi}var vi,hf;function Qu(){if(hf)return vi;hf=1;var e=Pr(),t=bE(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&o.push(s);return o}return vi=i,vi}var gi,pf;function je(){if(pf)return gi;pf=1;var e=jt(),t=Xu();function r(n){return n!=null&&t(n.length)&&!e(n)}return gi=r,gi}var yi,vf;function Qe(){if(vf)return yi;vf=1;var e=Fg(),t=Qu(),r=je();function n(i){return r(i)?e(i):t(i)}return yi=n,yi}var mi,gf;function wE(){if(gf)return mi;gf=1;var e=Kt(),t=Qe();function r(n,i){return n&&e(i,t(i),n)}return mi=r,mi}var _i,yf;function EE(){if(yf)return _i;yf=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return _i=e,_i}var bi,mf;function xE(){if(mf)return bi;mf=1;var e=qe(),t=Pr(),r=EE(),n=Object.prototype,i=n.hasOwnProperty;function a(o){if(!e(o))return r(o);var s=t(o),u=[];for(var l in o)l=="constructor"&&(s||!i.call(o,l))||u.push(l);return u}return bi=a,bi}var wi,_f;function ct(){if(_f)return wi;_f=1;var e=Fg(),t=xE(),r=je();function n(i){return r(i)?e(i,!0):t(i)}return wi=n,wi}var Ei,bf;function SE(){if(bf)return Ei;bf=1;var e=Kt(),t=ct();function r(n,i){return n&&e(i,t(i),n)}return Ei=r,Ei}var Ft={exports:{}};Ft.exports;var wf;function Bg(){return wf||(wf=1,(function(e,t){var r=Me(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(l,c){if(c)return l.slice();var f=l.length,d=s?s(f):new l.constructor(f);return l.copy(d),d}e.exports=u})(Ft,Ft.exports)),Ft.exports}var xi,Ef;function Hg(){if(Ef)return xi;Ef=1;function e(t,r){var n=-1,i=t.length;for(r||(r=Array(i));++nh))return!1;var g=f.get(o),v=f.get(s);if(g&&v)return g==s&&v==o;var p=-1,y=!0,b=u&i?new e:void 0;for(f.set(o,s),f.set(s,o);++p0&&a(c)?i>1?r(c,i-1,a,o,s):e(s,c):o||(s[s.length]=c)}return s}return po=r,po}var vo,hh;function wx(){if(hh)return vo;hh=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return vo=e,vo}var go,ph;function my(){if(ph)return go;ph=1;var e=wx(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,s=-1,u=t(o.length-i,0),l=Array(u);++s0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return mo=n,mo}var _o,yh;function _y(){if(yh)return _o;yh=1;var e=Ex(),t=xx(),r=t(e);return _o=r,_o}var bo,mh;function zr(){if(mh)return bo;mh=1;var e=lt(),t=my(),r=_y();function n(i,a){return r(t(i,a,e),i+"")}return bo=n,bo}var wo,_h;function by(){if(_h)return wo;_h=1;function e(t,r,n,i){for(var a=t.length,o=n+(i?1:-1);i?o--:++o-1}return qo=t,qo}var Ro,Sh;function Ax(){if(Sh)return Ro;Sh=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var p=l?null:i(u);if(p)return a(p);_=!1,d=n,v=new e}else v=l?[]:g;e:for(;++f1?h.setNode(_,f):h.setNode(_)}),this},i.prototype.setNode=function(c,f){return e.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=f),this):(this._nodes[c]=arguments.length>1?f:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=r,this._children[c]={},this._children[r][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return e.has(this._nodes,c)},i.prototype.removeNode=function(c){var f=this;if(e.has(this._nodes,c)){var d=function(h){f.removeEdge(f._edgeObjs[h])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],e.each(this.children(c),function(h){f.setParent(h)}),delete this._children[c]),e.each(e.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],e.each(e.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=r;else{f+="";for(var d=f;!e.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+f+" as parent of "+c+" would create a cycle");this.setNode(f)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=f,this._children[f][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var f=this._parent[c];if(f!==r)return f}},i.prototype.children=function(c){if(e.isUndefined(c)&&(c=r),this._isCompound){var f=this._children[c];if(f)return e.keys(f)}else{if(c===r)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var f=this._preds[c];if(f)return e.keys(f)},i.prototype.successors=function(c){var f=this._sucs[c];if(f)return e.keys(f)},i.prototype.neighbors=function(c){var f=this.predecessors(c);if(f)return e.union(f,this.successors(c))},i.prototype.isLeaf=function(c){var f;return this.isDirected()?f=this.successors(c):f=this.neighbors(c),f.length===0},i.prototype.filterNodes=function(c){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var d=this;e.each(this._nodes,function(g,v){c(v)&&f.setNode(v,g)}),e.each(this._edgeObjs,function(g){f.hasNode(g.v)&&f.hasNode(g.w)&&f.setEdge(g,d.edge(g))});var h={};function _(g){var v=d.parent(g);return v===void 0||f.hasNode(v)?(h[g]=v,v):v in h?h[v]:_(v)}return this._isCompound&&e.each(f.nodes(),function(g){f.setParent(g,_(g))}),f},i.prototype.setDefaultEdgeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(c,f){var d=this,h=arguments;return e.reduce(c,function(_,g){return h.length>1?d.setEdge(_,g,f):d.setEdge(_,g),g}),this},i.prototype.setEdge=function(){var c,f,d,h,_=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,f=g.w,d=g.name,arguments.length===2&&(h=arguments[1],_=!0)):(c=g,f=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],_=!0)),c=""+c,f=""+f,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,c,f,d);if(e.has(this._edgeLabels,v))return _&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(f),this._edgeLabels[v]=_?h:this._defaultEdgeLabelFn(c,f,d);var p=u(this._isDirected,c,f,d);return c=p.v,f=p.w,Object.freeze(p),this._edgeObjs[v]=p,a(this._preds[f],c),a(this._sucs[c],f),this._in[f][v]=p,this._out[c][v]=p,this._edgeCount++,this},i.prototype.edge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d),_=this._edgeObjs[h];return _&&(c=_.v,f=_.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[f],c),o(this._sucs[c],f),delete this._in[f][h],delete this._out[c][h],this._edgeCount--),this},i.prototype.inEdges=function(c,f){var d=this._in[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.v===f}):h}},i.prototype.outEdges=function(c,f){var d=this._out[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.w===f}):h}},i.prototype.nodeEdges=function(c,f){var d=this.inEdges(c,f);if(d)return d.concat(this.outEdges(c,f))};function a(c,f){c[f]?c[f]++:c[f]=1}function o(c,f){--c[f]||delete c[f]}function s(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}return _+n+g+n+(e.isUndefined(h)?t:h)}function u(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}var p={v:_,w:g};return h&&(p.name=h),p}function l(c,f){return s(c,f.v,f.w,f.name)}return ko}var Do,Oh;function Ox(){return Oh||(Oh=1,Do="2.1.8"),Do}var Lo,kh;function kx(){return kh||(kh=1,Lo={Graph:cc(),version:Ox()}),Lo}var Fo,Dh;function Dx(){if(Dh)return Fo;Dh=1;var e=Re(),t=cc();Fo={write:r,read:a};function r(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:i(o)};return e.isUndefined(o.graph())||(s.value=e.clone(o.graph())),s}function n(o){return e.map(o.nodes(),function(s){var u=o.node(s),l=o.parent(s),c={v:s};return e.isUndefined(u)||(c.value=u),e.isUndefined(l)||(c.parent=l),c})}function i(o){return e.map(o.edges(),function(s){var u=o.edge(s),l={v:s.v,w:s.w};return e.isUndefined(s.name)||(l.name=s.name),e.isUndefined(u)||(l.value=u),l})}function a(o){var s=new t(o.options).setGraph(o.value);return e.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),e.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return Fo}var zo,Lh;function Lx(){if(Lh)return zo;Lh=1;var e=Re();zo=t;function t(r){var n={},i=[],a;function o(s){e.has(n,s)||(n[s]=!0,a.push(s),e.each(r.successors(s),o),e.each(r.predecessors(s),o))}return e.each(r.nodes(),function(s){a=[],o(s),a.length&&i.push(a)}),i}return zo}var Bo,Fh;function xy(){if(Fh)return Bo;Fh=1;var e=Re();Bo=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,n){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var a=this._arr,o=a.length;return i[r]=o,a.push({key:r,priority:n}),this._decrease(o),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,n){var i=this._keyIndices[r];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(r){var n=this._arr,i=2*r,a=i+1,o=r;i>1,!(n[a].priority0&&(f=c.removeMin(),d=l[f],d.distance!==Number.POSITIVE_INFINITY);)u(f).forEach(h);return l}return Ho}var $o,Bh;function Fx(){if(Bh)return $o;Bh=1;var e=Sy(),t=Re();$o=r;function r(n,i,a){return t.transform(n.nodes(),function(o,s){o[s]=e(n,s,i,a)},{})}return $o}var Go,Hh;function qy(){if(Hh)return Go;Hh=1;var e=Re();Go=t;function t(r){var n=0,i=[],a={},o=[];function s(u){var l=a[u]={onStack:!0,lowlink:n,index:n++};if(i.push(u),r.successors(u).forEach(function(d){e.has(a,d)?a[d].onStack&&(l.lowlink=Math.min(l.lowlink,a[d].index)):(s(d),l.lowlink=Math.min(l.lowlink,a[d].lowlink))}),l.lowlink===l.index){var c=[],f;do f=i.pop(),a[f].onStack=!1,c.push(f);while(u!==f);o.push(c)}}return r.nodes().forEach(function(u){e.has(a,u)||s(u)}),o}return Go}var Vo,$h;function zx(){if($h)return Vo;$h=1;var e=Re(),t=qy();Vo=r;function r(n){return e.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return Vo}var Uo,Gh;function Bx(){if(Gh)return Uo;Gh=1;var e=Re();Uo=r;var t=e.constant(1);function r(i,a,o){return n(i,a||t,o||function(s){return i.outEdges(s)})}function n(i,a,o){var s={},u=i.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(c){l!==c&&(s[l][c]={distance:Number.POSITIVE_INFINITY})}),o(l).forEach(function(c){var f=c.v===l?c.w:c.v,d=a(c);s[l][f]={distance:d,predecessor:l}})}),u.forEach(function(l){var c=s[l];u.forEach(function(f){var d=s[f];u.forEach(function(h){var _=d[l],g=c[h],v=d[h],p=_.distance+g.distance;p0;){if(l=u.removeMin(),e.has(s,l))o.setEdge(l,s[l]);else{if(f)throw new Error("Input graph is not connected: "+i);f=!0}i.nodeEdges(l).forEach(c)}return o}return Xo}var Jo,Zh;function Ux(){return Zh||(Zh=1,Jo={components:Lx(),dijkstra:Sy(),dijkstraAll:Fx(),findCycles:zx(),floydWarshall:Bx(),isAcyclic:Hx(),postorder:$x(),preorder:Gx(),prim:Vx(),tarjan:qy(),topsort:Ry()}),Jo}var Qo,Xh;function jx(){if(Xh)return Qo;Xh=1;var e=kx();return Qo={Graph:e.Graph,json:Dx(),alg:Ux(),version:e.version},Qo}var es,Jh;function Te(){if(Jh)return es;Jh=1;var e;if(typeof Ku=="function")try{e=jx()}catch{}return e||(e=window.graphlib),es=e,es}var ts,Qh;function Kx(){if(Qh)return ts;Qh=1;var e=Jg(),t=1,r=4;function n(i){return e(i,t|r)}return ts=n,ts}var rs,ep;function Br(){if(ep)return rs;ep=1;var e=St(),t=je(),r=Tr(),n=qe();function i(a,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?t(s)&&r(o,s.length):u=="string"&&o in s)?e(s[o],a):!1}return rs=i,rs}var ns,tp;function Yx(){if(tp)return ns;tp=1;var e=zr(),t=St(),r=Br(),n=ct(),i=Object.prototype,a=i.hasOwnProperty,o=e(function(s,u){s=Object(s);var l=-1,c=u.length,f=c>2?u[2]:void 0;for(f&&r(u[0],u[1],f)&&(c=1);++l-1?u[l?a[c]:c]:void 0}}return is=n,is}var as,np;function Ay(){if(np)return as;np=1;var e=Sm(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return as=n,as}var os,ip;function Zx(){if(ip)return os;ip=1;var e=Ay();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return os=t,os}var ss,ap;function Xx(){if(ap)return ss;ap=1;var e=by(),t=Ke(),r=Zx(),n=Math.max;function i(a,o,s){var u=a==null?0:a.length;if(!u)return-1;var l=s==null?0:r(s);return l<0&&(l=n(u+l,0)),e(a,t(o,3),l)}return ss=i,ss}var us,op;function Jx(){if(op)return us;op=1;var e=Wx(),t=Xx(),r=e(t);return us=r,us}var cs,sp;function Ny(){if(sp)return cs;sp=1;var e=uc();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return cs=t,cs}var ls,up;function Qx(){if(up)return ls;up=1;var e=ic(),t=Qg(),r=ct();function n(i,a){return i==null?i:e(i,t(a),r)}return ls=n,ls}var fs,cp;function eS(){if(cp)return fs;cp=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return fs=e,fs}var ds,lp;function tS(){if(lp)return ds;lp=1;var e=Nr(),t=ac(),r=Ke();function n(i,a){var o={};return a=r(a,3),t(i,function(s,u,l){e(o,u,a(s,u,l))}),o}return ds=n,ds}var hs,fp;function lc(){if(fp)return hs;fp=1;var e=xt();function t(r,n,i){for(var a=-1,o=r.length;++ar}return ps=e,ps}var vs,hp;function nS(){if(hp)return vs;hp=1;var e=lc(),t=rS(),r=lt();function n(i){return i&&i.length?e(i,r,t):void 0}return vs=n,vs}var gs,pp;function Iy(){if(pp)return gs;pp=1;var e=Nr(),t=St();function r(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&e(n,i,a)}return gs=r,gs}var ys,vp;function iS(){if(vp)return ys;vp=1;var e=st(),t=Or(),r=Le(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,u=o.call(Object);function l(c){if(!r(c)||e(c)!=n)return!1;var f=t(c);if(f===null)return!0;var d=s.call(f,"constructor")&&f.constructor;return typeof d=="function"&&d instanceof d&&o.call(d)==u}return ys=l,ys}var ms,gp;function Ty(){if(gp)return ms;gp=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return ms=e,ms}var _s,yp;function aS(){if(yp)return _s;yp=1;var e=Kt(),t=ct();function r(n){return e(n,t(n))}return _s=r,_s}var bs,mp;function oS(){if(mp)return bs;mp=1;var e=Iy(),t=Bg(),r=Wg(),n=Hg(),i=Xg(),a=Yt(),o=le(),s=wy(),u=qt(),l=jt(),c=qe(),f=iS(),d=Wt(),h=Ty(),_=aS();function g(v,p,y,b,m,E,x){var S=h(v,y),N=h(p,y),q=x.get(N);if(q){e(v,y,q);return}var A=E?E(S,N,y+"",v,p,x):void 0,I=A===void 0;if(I){var D=o(N),O=!D&&u(N),w=!D&&!O&&d(N);A=N,D||O||w?o(S)?A=S:s(S)?A=n(S):O?(I=!1,A=t(N,!0)):w?(I=!1,A=r(N,!0)):A=[]:f(N)||a(N)?(A=S,a(S)?A=_(S):(!c(S)||l(S))&&(A=i(N))):I=!1}I&&(x.set(N,A),m(A,N,b,E,x),x.delete(N)),e(v,y,A)}return bs=g,bs}var ws,_p;function sS(){if(_p)return ws;_p=1;var e=Ar(),t=Iy(),r=ic(),n=oS(),i=qe(),a=ct(),o=Ty();function s(u,l,c,f,d){u!==l&&r(l,function(h,_){if(d||(d=new e),i(h))n(u,l,_,c,s,f,d);else{var g=f?f(o(u,_),h,_+"",u,l,d):void 0;g===void 0&&(g=h),t(u,_,g)}},a)}return ws=s,ws}var Es,bp;function uS(){if(bp)return Es;bp=1;var e=zr(),t=Br();function r(n){return e(function(i,a){var o=-1,s=a.length,u=s>1?a[s-1]:void 0,l=s>2?a[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,l&&t(a[0],a[1],l)&&(u=s<3?void 0:u,s=1),i=Object(i);++on||s&&u&&c&&!l&&!f||a&&u&&c||!i&&c||!o)return 1;if(!a&&!s&&!f&&r=l)return c;var f=i[a];return c*(f=="desc"?-1:1)}}return r.index-n.index}return Ls=t,Ls}var Fs,Dp;function xS(){if(Dp)return Fs;Dp=1;var e=Dr(),t=Fr(),r=Ke(),n=vy(),i=bS(),a=Mr(),o=ES(),s=lt(),u=le();function l(c,f,d){f.length?f=e(f,function(g){return u(g)?function(v){return t(v,g.length===1?g[0]:g)}:g}):f=[s];var h=-1;f=e(f,a(r));var _=n(c,function(g,v,p){var y=e(f,function(b){return b(g)});return{criteria:y,index:++h,value:g}});return i(_,function(g,v){return o(g,v,d)})}return Fs=l,Fs}var zs,Lp;function SS(){if(Lp)return zs;Lp=1;var e=uc(),t=xS(),r=zr(),n=Br(),i=r(function(a,o){if(a==null)return[];var s=o.length;return s>1&&n(a,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return zs=i,zs}var Bs,Fp;function qS(){if(Fp)return Bs;Fp=1;var e=uy(),t=0;function r(n){var i=++t;return e(n)+i}return Bs=r,Bs}var Hs,zp;function RS(){if(zp)return Hs;zp=1;function e(t,r,n){for(var i=-1,a=t.length,o=r.length,s={};++i0;--v)if(g=c[v].dequeue(),g){d=d.concat(o(l,c,f,g,!0));break}}}return d}function o(l,c,f,d,h){var _=h?[]:void 0;return e.forEach(l.inEdges(d.v),function(g){var v=l.edge(g),p=l.node(g.v);h&&_.push({v:g.v,w:g.w}),p.out-=v,u(c,f,p)}),e.forEach(l.outEdges(d.v),function(g){var v=l.edge(g),p=g.w,y=l.node(p);y.in-=v,u(c,f,y)}),l.removeNode(d.v),_}function s(l,c){var f=new t,d=0,h=0;e.forEach(l.nodes(),function(v){f.setNode(v,{v,in:0,out:0})}),e.forEach(l.edges(),function(v){var p=f.edge(v.v,v.w)||0,y=c(v),b=p+y;f.setEdge(v.v,v.w,b),h=Math.max(h,f.node(v.v).out+=y),d=Math.max(d,f.node(v.w).in+=y)});var _=e.range(h+d+3).map(function(){return new r}),g=d+1;return e.forEach(f.nodes(),function(v){u(_,g,f.node(v))}),{graph:f,buckets:_,zeroIdx:g}}function u(l,c,f){f.out?f.in?l[f.out-f.in+c].enqueue(f):l[l.length-1].enqueue(f):l[0].enqueue(f)}return Us}var js,Vp;function IS(){if(Vp)return js;Vp=1;var e=ae(),t=NS();js={run:r,undo:i};function r(a){var o=a.graph().acyclicer==="greedy"?t(a,s(a)):n(a);e.forEach(o,function(u){var l=a.edge(u);a.removeEdge(u),l.forwardName=u.name,l.reversed=!0,a.setEdge(u.w,u.v,l,e.uniqueId("rev"))});function s(u){return function(l){return u.edge(l).weight}}}function n(a){var o=[],s={},u={};function l(c){e.has(u,c)||(u[c]=!0,s[c]=!0,e.forEach(a.outEdges(c),function(f){e.has(s,f.w)?o.push(f):l(f.w)}),delete s[c])}return e.forEach(a.nodes(),l),o}function i(a){e.forEach(a.edges(),function(o){var s=a.edge(o);if(s.reversed){a.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,a.setEdge(o.w,o.v,s,u)}})}return js}var Ks,Up;function _e(){if(Up)return Ks;Up=1;var e=ae(),t=Te().Graph;Ks={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:f,maxRank:d,partition:h,time:_,notime:g};function r(v,p,y,b){var m;do m=e.uniqueId(b);while(v.hasNode(m));return y.dummy=p,v.setNode(m,y),m}function n(v){var p=new t().setGraph(v.graph());return e.forEach(v.nodes(),function(y){p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){var b=p.edge(y.v,y.w)||{weight:0,minlen:1},m=v.edge(y);p.setEdge(y.v,y.w,{weight:b.weight+m.weight,minlen:Math.max(b.minlen,m.minlen)})}),p}function i(v){var p=new t({multigraph:v.isMultigraph()}).setGraph(v.graph());return e.forEach(v.nodes(),function(y){v.children(y).length||p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){p.setEdge(y,v.edge(y))}),p}function a(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.outEdges(y),function(m){b[m.w]=(b[m.w]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function o(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.inEdges(y),function(m){b[m.v]=(b[m.v]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function s(v,p){var y=v.x,b=v.y,m=p.x-y,E=p.y-b,x=v.width/2,S=v.height/2;if(!m&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var N,q;return Math.abs(E)*x>Math.abs(m)*S?(E<0&&(S=-S),N=S*m/E,q=S):(m<0&&(x=-x),N=x,q=x*E/m),{x:y+N,y:b+q}}function u(v){var p=e.map(e.range(d(v)+1),function(){return[]});return e.forEach(v.nodes(),function(y){var b=v.node(y),m=b.rank;e.isUndefined(m)||(p[m][b.order]=y)}),p}function l(v){var p=e.min(e.map(v.nodes(),function(y){return v.node(y).rank}));e.forEach(v.nodes(),function(y){var b=v.node(y);e.has(b,"rank")&&(b.rank-=p)})}function c(v){var p=e.min(e.map(v.nodes(),function(E){return v.node(E).rank})),y=[];e.forEach(v.nodes(),function(E){var x=v.node(E).rank-p;y[x]||(y[x]=[]),y[x].push(E)});var b=0,m=v.graph().nodeRankFactor;e.forEach(y,function(E,x){e.isUndefined(E)&&x%m!==0?--b:b&&e.forEach(E,function(S){v.node(S).rank+=b})})}function f(v,p,y,b){var m={width:0,height:0};return arguments.length>=4&&(m.rank=y,m.order=b),r(v,"border",m,p)}function d(v){return e.max(e.map(v.nodes(),function(p){var y=v.node(p).rank;if(!e.isUndefined(y))return y}))}function h(v,p){var y={lhs:[],rhs:[]};return e.forEach(v,function(b){p(b)?y.lhs.push(b):y.rhs.push(b)}),y}function _(v,p){var y=e.now();try{return p()}finally{console.log(v+" time: "+(e.now()-y)+"ms")}}function g(v,p){return p()}return Ks}var Ys,jp;function TS(){if(jp)return Ys;jp=1;var e=ae(),t=_e();Ys={run:r,undo:i};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(o){n(a,o)})}function n(a,o){var s=o.v,u=a.node(s).rank,l=o.w,c=a.node(l).rank,f=o.name,d=a.edge(o),h=d.labelRank;if(c!==u+1){a.removeEdge(o);var _,g,v;for(v=0,++u;uq.lim&&(A=q,I=!0);var D=e.filter(m.edges(),function(O){return I===y(b,b.node(O.v),A)&&I!==y(b,b.node(O.w),A)});return e.minBy(D,function(O){return r(m,O)})}function g(b,m,E,x){var S=E.v,N=E.w;b.removeEdge(S,N),b.setEdge(x.v,x.w,{}),f(b),u(b,m),v(b,m)}function v(b,m){var E=e.find(b.nodes(),function(S){return!m.node(S).parent}),x=i(b,E);x=x.slice(1),e.forEach(x,function(S){var N=b.node(S).parent,q=m.edge(S,N),A=!1;q||(q=m.edge(N,S),A=!0),m.node(S).rank=m.node(N).rank+(A?q.minlen:-q.minlen)})}function p(b,m,E){return b.hasEdge(m,E)}function y(b,m,E){return E.low<=m.lim&&m.lim<=E.lim}return Xs}var Js,Zp;function PS(){if(Zp)return Js;Zp=1;var e=gr(),t=e.longestPath,r=Py(),n=MS();Js=i;function i(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":a(u);break;default:s(u)}}var a=t;function o(u){t(u),r(u)}function s(u){n(u)}return Js}var Qs,Xp;function OS(){if(Xp)return Qs;Xp=1;var e=ae();Qs=t;function t(i){var a=n(i);e.forEach(i.graph().dummyChains,function(o){for(var s=i.node(o),u=s.edgeObj,l=r(i,a,u.v,u.w),c=l.path,f=l.lca,d=0,h=c[d],_=!0;o!==u.w;){if(s=i.node(o),_){for(;(h=c[d])!==f&&i.node(h).maxRankc||f>a[d].lim));for(h=d,d=s;(d=i.parent(d))!==h;)l.push(d);return{path:u.concat(l.reverse()),lca:h}}function n(i){var a={},o=0;function s(u){var l=o;e.forEach(i.children(u),s),a[u]={low:l,lim:o++}}return e.forEach(i.children(),s),a}return Qs}var eu,Jp;function kS(){if(Jp)return eu;Jp=1;var e=ae(),t=_e();eu={run:r,cleanup:o};function r(s){var u=t.addDummyNode(s,"root",{},"_root"),l=i(s),c=e.max(e.values(l))-1,f=2*c+1;s.graph().nestingRoot=u,e.forEach(s.edges(),function(h){s.edge(h).minlen*=f});var d=a(s)+1;e.forEach(s.children(),function(h){n(s,u,f,d,c,l,h)}),s.graph().nodeRankFactor=f}function n(s,u,l,c,f,d,h){var _=s.children(h);if(!_.length){h!==u&&s.setEdge(u,h,{weight:0,minlen:l});return}var g=t.addBorderNode(s,"_bt"),v=t.addBorderNode(s,"_bb"),p=s.node(h);s.setParent(g,h),p.borderTop=g,s.setParent(v,h),p.borderBottom=v,e.forEach(_,function(y){n(s,u,l,c,f,d,y);var b=s.node(y),m=b.borderTop?b.borderTop:y,E=b.borderBottom?b.borderBottom:y,x=b.borderTop?c:2*c,S=m!==E?1:f-d[h]+1;s.setEdge(g,m,{weight:x,minlen:S,nestingEdge:!0}),s.setEdge(E,v,{weight:x,minlen:S,nestingEdge:!0})}),s.parent(h)||s.setEdge(u,g,{weight:0,minlen:f+d[h]})}function i(s){var u={};function l(c,f){var d=s.children(c);d&&d.length&&e.forEach(d,function(h){l(h,f+1)}),u[c]=f}return e.forEach(s.children(),function(c){l(c,1)}),u}function a(s){return e.reduce(s.edges(),function(u,l){return u+s.edge(l).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,e.forEach(s.edges(),function(l){var c=s.edge(l);c.nestingEdge&&s.removeEdge(l)})}return eu}var tu,Qp;function DS(){if(Qp)return tu;Qp=1;var e=ae(),t=_e();tu=r;function r(i){function a(o){var s=i.children(o),u=i.node(o);if(s.length&&e.forEach(s,a),e.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var l=u.minRank,c=u.maxRank+1;l0;)h%2&&(_+=c[h+1]),h=h-1>>1,c[h]+=d.weight;f+=d.weight*_})),f}return iu}var au,nv;function BS(){if(nv)return au;nv=1;var e=ae();au=t;function t(r,n){return e.map(n,function(i){var a=r.inEdges(i);if(a.length){var o=e.reduce(a,function(s,u){var l=r.edge(u),c=r.node(u.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:i,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:i}})}return au}var ou,iv;function HS(){if(iv)return ou;iv=1;var e=ae();ou=t;function t(i,a){var o={};e.forEach(i,function(u,l){var c=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:l};e.isUndefined(u.barycenter)||(c.barycenter=u.barycenter,c.weight=u.weight)}),e.forEach(a.edges(),function(u){var l=o[u.v],c=o[u.w];!e.isUndefined(l)&&!e.isUndefined(c)&&(c.indegree++,l.out.push(o[u.w]))});var s=e.filter(o,function(u){return!u.indegree});return r(s)}function r(i){var a=[];function o(l){return function(c){c.merged||(e.isUndefined(c.barycenter)||e.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function s(l){return function(c){c.in.push(l),--c.indegree===0&&i.push(c)}}for(;i.length;){var u=i.pop();a.push(u),e.forEach(u.in.reverse(),o(u)),e.forEach(u.out,s(u))}return e.map(e.filter(a,function(l){return!l.merged}),function(l){return e.pick(l,["vs","i","barycenter","weight"])})}function n(i,a){var o=0,s=0;i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=o/s,i.weight=s,i.i=Math.min(a.i,i.i),a.merged=!0}return ou}var su,av;function $S(){if(av)return su;av=1;var e=ae(),t=_e();su=r;function r(a,o){var s=t.partition(a,function(g){return e.has(g,"barycenter")}),u=s.lhs,l=e.sortBy(s.rhs,function(g){return-g.i}),c=[],f=0,d=0,h=0;u.sort(i(!!o)),h=n(c,l,h),e.forEach(u,function(g){h+=g.vs.length,c.push(g.vs),f+=g.barycenter*g.weight,d+=g.weight,h=n(c,l,h)});var _={vs:e.flatten(c,!0)};return d&&(_.barycenter=f/d,_.weight=d),_}function n(a,o,s){for(var u;o.length&&(u=e.last(o)).i<=s;)o.pop(),a.push(u.vs),s++;return s}function i(a){return function(o,s){return o.barycenters.barycenter?1:a?s.i-o.i:o.i-s.i}}return su}var uu,ov;function GS(){if(ov)return uu;ov=1;var e=ae(),t=BS(),r=HS(),n=$S();uu=i;function i(s,u,l,c){var f=s.children(u),d=s.node(u),h=d?d.borderLeft:void 0,_=d?d.borderRight:void 0,g={};h&&(f=e.filter(f,function(E){return E!==h&&E!==_}));var v=t(s,f);e.forEach(v,function(E){if(s.children(E.v).length){var x=i(s,E.v,l,c);g[E.v]=x,e.has(x,"barycenter")&&o(E,x)}});var p=r(v,l);a(p,g);var y=n(p,c);if(h&&(y.vs=e.flatten([h,y.vs,_],!0),s.predecessors(h).length)){var b=s.node(s.predecessors(h)[0]),m=s.node(s.predecessors(_)[0]);e.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.order+m.order)/(y.weight+2),y.weight+=2}return y}function a(s,u){e.forEach(s,function(l){l.vs=e.flatten(l.vs.map(function(c){return u[c]?u[c].vs:c}),!0)})}function o(s,u){e.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return uu}var cu,sv;function VS(){if(sv)return cu;sv=1;var e=ae(),t=Te().Graph;cu=r;function r(i,a,o){var s=n(i),u=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(l){return i.node(l)});return e.forEach(i.nodes(),function(l){var c=i.node(l),f=i.parent(l);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(u.setNode(l),u.setParent(l,f||s),e.forEach(i[o](l),function(d){var h=d.v===l?d.w:d.v,_=u.edge(h,l),g=e.isUndefined(_)?0:_.weight;u.setEdge(h,l,{weight:i.edge(d).weight+g})}),e.has(c,"minRank")&&u.setNode(l,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),u}function n(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return cu}var lu,uv;function US(){if(uv)return lu;uv=1;var e=ae();lu=t;function t(r,n,i){var a={},o;e.forEach(i,function(s){for(var u=r.parent(s),l,c;u;){if(l=r.parent(u),l?(c=a[l],a[l]=u):(c=o,o=u),c&&c!==u){n.setEdge(c,u);return}u=l}})}return lu}var fu,cv;function jS(){if(cv)return fu;cv=1;var e=ae(),t=FS(),r=zS(),n=GS(),i=VS(),a=US(),o=Te().Graph,s=_e();fu=u;function u(d){var h=s.maxRank(d),_=l(d,e.range(1,h+1),"inEdges"),g=l(d,e.range(h-1,-1,-1),"outEdges"),v=t(d);f(d,v);for(var p=Number.POSITIVE_INFINITY,y,b=0,m=0;m<4;++b,++m){c(b%2?_:g,b%4>=2),v=s.buildLayerMatrix(d);var E=r(d,v);EA)&&o(b,O,I)})})}function E(x,S){var N=-1,q,A=0;return e.forEach(S,function(I,D){if(p.node(I).dummy==="border"){var O=p.predecessors(I);O.length&&(q=p.node(O[0]).order,m(S,A,D,N,q),A=D,N=q)}m(S,A,S.length,q,x.length)}),S}return e.reduce(y,E),b}function a(p,y){if(p.node(y).dummy)return e.find(p.predecessors(y),function(b){return p.node(b).dummy})}function o(p,y,b){if(y>b){var m=y;y=b,b=m}var E=p[y];E||(p[y]=E={}),E[b]=!0}function s(p,y,b){if(y>b){var m=y;y=b,b=m}return e.has(p[y],b)}function u(p,y,b,m){var E={},x={},S={};return e.forEach(y,function(N){e.forEach(N,function(q,A){E[q]=q,x[q]=q,S[q]=A})}),e.forEach(y,function(N){var q=-1;e.forEach(N,function(A){var I=m(A);if(I.length){I=e.sortBy(I,function(C){return S[C]});for(var D=(I.length-1)/2,O=Math.floor(D),w=Math.ceil(D);O<=w;++O){var T=I[O];x[A]===A&&qn[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Cs(),b=le();const at=ue(b),Co=Ms({__proto__:null,default:at},[b]),re=new WeakMap,Is=new WeakMap,Tt={current:[]};let qt=!1,mt=0;const pt=new Set,Pt=new Map;function Qe(t){for(const s of t){if(Tt.current.includes(s))continue;Tt.current.push(s),s.recompute();const e=Is.get(s);if(e)for(const n of e){const o=re.get(n);o?.length&&Qe(o)}}}function Es(t){const s={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(s)}function ks(t){const s={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(s)}function ts(t){if(mt>0&&!Pt.has(t)&&Pt.set(t,t.prevState),pt.add(t),!(mt>0)&&!qt)try{for(qt=!0;pt.size>0;){const s=Array.from(pt);pt.clear();for(const e of s){const n=Pt.get(e)??e.prevState;e.prevState=n,Es(e)}for(const e of s){const n=re.get(e);n&&(Tt.current.push(e),Qe(n))}for(const e of s){const n=re.get(e);if(n)for(const o of n)ks(o)}}}finally{qt=!1,Tt.current=[],Pt.clear()}}function gt(t){mt++;try{t()}finally{if(mt--,mt===0){const s=pt.values().next().value;s&&ts(s)}}}function Ts(t){return typeof t=="function"}class Os{constructor(s,e){this.listeners=new Set,this.subscribe=n=>{var o,i;this.listeners.add(n);const r=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,n,this);return()=>{this.listeners.delete(n),r?.()}},this.prevState=s,this.state=s,this.options=e}setState(s){var e,n,o;this.prevState=this.state,(e=this.options)!=null&&e.updateFn?this.state=this.options.updateFn(this.prevState)(s):Ts(s)?this.state=s(this.prevState):this.state=s,(o=(n=this.options)==null?void 0:n.onUpdate)==null||o.call(n),ts(this)}}const G="__TSR_index",Me="popstate",Ie="beforeunload";function Fs(t){let s=t.getLocation();const e=new Set,n=r=>{s=t.getLocation(),e.forEach(a=>a({location:s,action:r}))},o=r=>{t.notifyOnIndexChange??!0?n(r):s=t.getLocation()},i=async({task:r,navigateOpts:a,...c})=>{if(a?.ignoreBlocker??!1){r();return}const d=t.getBlockers?.()??[],l=c.type==="PUSH"||c.type==="REPLACE";if(typeof document<"u"&&d.length&&l)for(const u of d){const f=Ot(c.path,c.state);if(await u.blockerFn({currentLocation:s,nextLocation:f,action:c.type})){t.onBlocked?.();return}}r()};return{get location(){return s},get length(){return t.getLength()},subscribers:e,subscribe:r=>(e.add(r),()=>{e.delete(r)}),push:(r,a,c)=>{const h=s.state[G];a=Ee(h+1,a),i({task:()=>{t.pushState(r,a),n({type:"PUSH"})},navigateOpts:c,type:"PUSH",path:r,state:a})},replace:(r,a,c)=>{const h=s.state[G];a=Ee(h,a),i({task:()=>{t.replaceState(r,a),n({type:"REPLACE"})},navigateOpts:c,type:"REPLACE",path:r,state:a})},go:(r,a)=>{i({task:()=>{t.go(r),o({type:"GO",index:r})},navigateOpts:a,type:"GO"})},back:r=>{i({task:()=>{t.back(r?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:r,type:"BACK"})},forward:r=>{i({task:()=>{t.forward(r?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:r,type:"FORWARD"})},canGoBack:()=>s.state[G]!==0,createHref:r=>t.createHref(r),block:r=>{if(!t.setBlockers)return()=>{};const a=t.getBlockers?.()??[];return t.setBlockers([...a,r]),()=>{const c=t.getBlockers?.()??[];t.setBlockers?.(c.filter(h=>h!==r))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function Ee(t,s){s||(s={});const e=he();return{...s,key:e,__TSR_key:e,[G]:t}}function As(t){const s=typeof document<"u"?window:void 0,e=s.history.pushState,n=s.history.replaceState;let o=[];const i=()=>o,r=w=>o=w,a=(w=>w),c=(()=>Ot(`${s.location.pathname}${s.location.search}${s.location.hash}`,s.history.state));if(!s.history.state?.__TSR_key&&!s.history.state?.key){const w=he();s.history.replaceState({[G]:0,key:w,__TSR_key:w},"")}let h=c(),d,l=!1,u=!1,f=!1,p=!1;const g=()=>h;let m,y;const v=()=>{m&&(R._ignoreSubscribers=!0,(m.isPush?s.history.pushState:s.history.replaceState)(m.state,"",m.href),R._ignoreSubscribers=!1,m=void 0,y=void 0,d=void 0)},S=(w,C,M)=>{const I=a(C);y||(d=h),h=Ot(C,M),m={href:I,state:M,isPush:m?.isPush||w==="push"},y||(y=Promise.resolve().then(()=>v()))},x=w=>{h=c(),R.notify({type:w})},L=async()=>{if(u){u=!1;return}const w=c(),C=w.state[G]-h.state[G],M=C===1,I=C===-1,F=!M&&!I||l;l=!1;const A=F?"GO":I?"BACK":"FORWARD",j=F?{type:"GO",index:C}:{type:I?"BACK":"FORWARD"};if(f)f=!1;else{const N=i();if(typeof document<"u"&&N.length){for(const nt of N)if(await nt.blockerFn({currentLocation:h,nextLocation:w,action:A})){u=!0,s.history.go(1),R.notify(j);return}}}h=c(),R.notify(j)},_=w=>{if(p){p=!1;return}let C=!1;const M=i();if(typeof document<"u"&&M.length)for(const I of M){const F=I.enableBeforeUnload??!0;if(F===!0){C=!0;break}if(typeof F=="function"&&F()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},R=Fs({getLocation:g,getLength:()=>s.history.length,pushState:(w,C)=>S("push",w,C),replaceState:(w,C)=>S("replace",w,C),back:w=>(w&&(f=!0),p=!0,s.history.back()),forward:w=>{w&&(f=!0),p=!0,s.history.forward()},go:w=>{l=!0,s.history.go(w)},createHref:w=>a(w),flush:v,destroy:()=>{s.history.pushState=e,s.history.replaceState=n,s.removeEventListener(Ie,_,{capture:!0}),s.removeEventListener(Me,L)},onBlocked:()=>{d&&h!==d&&(h=d)},getBlockers:i,setBlockers:r,notifyOnIndexChange:!1});return s.addEventListener(Ie,_,{capture:!0}),s.addEventListener(Me,L),s.history.pushState=function(...w){const C=e.apply(s.history,w);return R._ignoreSubscribers||x("PUSH"),C},s.history.replaceState=function(...w){const C=n.apply(s.history,w);return R._ignoreSubscribers||x("REPLACE"),C},R}function Ot(t,s){const e=t.indexOf("#"),n=t.indexOf("?"),o=he();return{href:t,pathname:t.substring(0,e>0?n>0?Math.min(e,n):e:n>0?n:t.length),hash:e>-1?t.substring(e):"",search:n>-1?t.slice(n,e===-1?void 0:e):"",state:s||{[G]:0,key:o,__TSR_key:o}}}function he(){return(Math.random()+1).toString(36).substring(7)}function Ft(t){return t[t.length-1]}function Bs(t){return typeof t=="function"}function H(t,s){return Bs(t)?t(s):t}const zs=Object.prototype.hasOwnProperty;function z(t,s){if(t===s)return t;const e=s,n=Oe(t)&&Oe(e);if(!n&&!(At(t)&&At(e)))return e;const o=n?t:ke(t);if(!o)return e;const i=n?e:ke(e);if(!i)return e;const r=o.length,a=i.length,c=n?new Array(a):{};let h=0;for(let d=0;d"u")return!0;const e=s.prototype;return!(!Te(e)||!e.hasOwnProperty("isPrototypeOf"))}function Te(t){return Object.prototype.toString.call(t)==="[object Object]"}function Oe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Z(t,s,e){if(t===s)return!0;if(typeof t!=typeof s)return!1;if(Array.isArray(t)&&Array.isArray(s)){if(t.length!==s.length)return!1;for(let n=0,o=t.length;no||!Z(t[r],s[r],e)))return!1;return o===i}return!1}function ct(t){let s,e;const n=new Promise((o,i)=>{s=o,e=i});return n.status="pending",n.resolve=o=>{n.status="resolved",n.value=o,s(o),t?.(o)},n.reject=o=>{n.status="rejected",e(o)},n}function J(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}function Fe(t){try{return decodeURI(t)}catch{return t.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}}function Ae(t,s){if(!t)return t;const e=/%25|%5C/gi;let n=0,o="",i;for(;(i=e.exec(t))!==null;)o+=Fe(t.slice(n,i.index))+i[0],n=e.lastIndex;return o+Fe(n?t.slice(n):t)}var Ds="Invariant failed";function K(t,s){if(!t)throw new Error(Ds)}function Bt(t){const s=new Map;let e,n;const o=i=>{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,n&&(n.next=i,i.prev=n)):(i.next.prev=void 0,e=i.next,i.next=void 0,n&&(i.prev=n,n.next=i)),n=i)};return{get(i){const r=s.get(i);if(r)return o(r),r.value},set(i,r){if(s.size>=t&&e){const c=e;s.delete(c.key),c.next&&(e=c.next,c.next.prev=void 0),c===n&&(n=void 0)}const a=s.get(i);if(a)a.value=r,o(a);else{const c={key:i,value:r,prev:n};n&&(n.next=c),n=c,e||(e=c),s.set(i,c)}},clear(){s.clear(),e=void 0,n=void 0}}}const lt=0,et=1,st=2,vt=3,js=/^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,Ns=/^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,Ws=/^([^{]*)\{\$\}([^}]*)$/;function de(t,s,e=new Uint16Array(6)){const n=t.indexOf("/",s),o=n===-1?t.length:n,i=t.substring(s,o);if(!i||!i.includes("$"))return e[0]=lt,e[1]=s,e[2]=s,e[3]=o,e[4]=o,e[5]=o,e;if(i==="$"){const h=t.length;return e[0]=st,e[1]=s,e[2]=s,e[3]=h,e[4]=h,e[5]=h,e}if(i.charCodeAt(0)===36)return e[0]=et,e[1]=s,e[2]=s+1,e[3]=o,e[4]=o,e[5]=o,e;const r=i.match(Ws);if(r){const d=r[1].length;return e[0]=st,e[1]=s+d,e[2]=s+d+1,e[3]=s+d+2,e[4]=s+d+3,e[5]=t.length,e}const a=i.match(Ns);if(a){const h=a[1],d=a[2],l=a[3],u=h.length;return e[0]=vt,e[1]=s+u,e[2]=s+u+3,e[3]=s+u+3+d.length,e[4]=o-l.length,e[5]=o,e}const c=i.match(js);if(c){const h=c[1],d=c[2],l=c[3],u=h.length;return e[0]=et,e[1]=s+u,e[2]=s+u+2,e[3]=s+u+2+d.length,e[4]=o-l.length,e[5]=o,e}return e[0]=lt,e[1]=s,e[2]=s,e[3]=o,e[4]=o,e[5]=o,e}function Wt(t,s,e,n,o,i,r){r?.(e);let a=n;{const c=e.fullPath??e.from,h=c.length,d=e.options?.caseSensitive??t;for(;a_.caseSensitive===v&&_.prefix===S&&_.suffix===x);if(L)u=L;else{const _=Jt(et,e.fullPath??e.from,v,S,x);u=_,_.depth=i,_.parent=o,o.dynamic??=[],o.dynamic.push(_)}break}case vt:{const m=c.substring(f,l[1]),y=c.substring(l[4],p),v=d&&!!(m||y),S=m?v?m:m.toLowerCase():void 0,x=y?v?y:y.toLowerCase():void 0,L=o.optional?.find(_=>_.caseSensitive===v&&_.prefix===S&&_.suffix===x);if(L)u=L;else{const _=Jt(vt,e.fullPath??e.from,v,S,x);u=_,_.parent=o,_.depth=i,o.optional??=[],o.optional.push(_)}break}case st:{const m=c.substring(f,l[1]),y=c.substring(l[4],p),v=d&&!!(m||y),S=m?v?m:m.toLowerCase():void 0,x=y?v?y:y.toLowerCase():void 0,L=Jt(st,e.fullPath??e.from,v,S,x);u=L,L.parent=o,L.depth=i,o.wildcard??=[],o.wildcard.push(L)}}o=u}if((e.path||!e.children)&&!e.isRoot){const l=c.endsWith("/");l||(o.notFound=e),(!o.route||!o.isIndex&&l)&&(o.route=e,o.fullPath=e.fullPath??e.from),o.isIndex||=l}}if(e.children)for(const c of e.children)Wt(t,s,c,a,o,i,r)}function Gt(t,s){if(t.prefix&&s.prefix&&t.prefix!==s.prefix){if(t.prefix.startsWith(s.prefix))return-1;if(s.prefix.startsWith(t.prefix))return 1}if(t.suffix&&s.suffix&&t.suffix!==s.suffix){if(t.suffix.endsWith(s.suffix))return-1;if(s.suffix.endsWith(t.suffix))return 1}return t.prefix&&!s.prefix?-1:!t.prefix&&s.prefix?1:t.suffix&&!s.suffix?-1:!t.suffix&&s.suffix?1:t.caseSensitive&&!s.caseSensitive?-1:!t.caseSensitive&&s.caseSensitive?1:0}function X(t){if(t.static)for(const s of t.static.values())X(s);if(t.staticInsensitive)for(const s of t.staticInsensitive.values())X(s);if(t.dynamic?.length){t.dynamic.sort(Gt);for(const s of t.dynamic)X(s)}if(t.optional?.length){t.optional.sort(Gt);for(const s of t.optional)X(s)}if(t.wildcard?.length){t.wildcard.sort(Gt);for(const s of t.wildcard)X(s)}}function St(t){return{kind:lt,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,isIndex:!1,notFound:null}}function Jt(t,s,e,n,o){return{kind:t,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:s,parent:null,isIndex:!1,notFound:null,caseSensitive:e,prefix:n,suffix:o}}function $s(t,s){const e=St("/"),n=new Uint16Array(6);for(const o of t)Wt(!1,n,o,1,e,0);X(e),s.masksTree=e,s.flatCache=Bt(1e3)}function Us(t,s){t||="/";const e=s.flatCache.get(t);if(e)return e;const n=fe(t,s.masksTree);return s.flatCache.set(t,n),n}function Vs(t,s,e,n,o){t||="/",n||="/";const i=s?`case\0${t}`:t;let r=o.singleCache.get(i);if(!r){r=St("/");const a=new Uint16Array(6);Wt(s,a,{from:t},1,r,0),o.singleCache.set(i,r)}return fe(n,r,e)}function Ks(t,s,e=!1){const n=e?t:`nofuzz\0${t}`,o=s.matchCache.get(n);if(o!==void 0)return o;t||="/";const i=fe(t,s.segmentTree,e);return i&&(i.branch=Js(i.route)),s.matchCache.set(n,i),i}function Hs(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function qs(t,s=!1,e){const n=St(t.fullPath),o=new Uint16Array(6),i={},r={};let a=0;return Wt(s,o,t,1,n,0,h=>{if(e?.(h,a),K(!(h.id in i),`Duplicate routes found with id: ${String(h.id)}`),i[h.id]=h,a!==0&&h.path){const d=Hs(h.fullPath);(!r[d]||h.fullPath.endsWith("/"))&&(r[d]=h)}a++}),X(n),{processedTree:{segmentTree:n,singleCache:Bt(1e3),matchCache:Bt(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:r}}function fe(t,s,e=!1){const n=t.split("/"),o=Xs(t,n,s,e);if(!o)return null;const i=Gs(t,n,o),r="**"in o;return r&&(i["**"]=o["**"]),{route:r?o.node.notFound??o.node.route:o.node.route,params:i}}function Gs(t,s,e){const n=Ys(e.node);let o=null;const i={};for(let r=0,a=0,c=0;a=0;w--){const C=u.optional[w];a.push({node:C,index:f,skipped:_,depth:R,statics:m,dynamics:y,optionals:v})}if(!S)for(let w=u.optional.length-1;w>=0;w--){const C=u.optional[w],{prefix:M,suffix:I}=C;if(M||I){const F=C.caseSensitive?x:L??=x.toLowerCase();if(M&&!F.startsWith(M)||I&&!F.endsWith(I))continue}a.push({node:C,index:f+1,skipped:p,depth:R,statics:m,dynamics:y,optionals:v+1})}}if(!S&&u.dynamic&&x)for(let _=u.dynamic.length-1;_>=0;_--){const R=u.dynamic[_],{prefix:w,suffix:C}=R;if(w||C){const M=R.caseSensitive?x:L??=x.toLowerCase();if(w&&!M.startsWith(w)||C&&!M.endsWith(C))continue}a.push({node:R,index:f+1,skipped:p,depth:g+1,statics:m,dynamics:y+1,optionals:v})}if(!S&&u.staticInsensitive){const _=u.staticInsensitive.get(L??=x.toLowerCase());_&&a.push({node:_,index:f+1,skipped:p,depth:g+1,statics:m+1,dynamics:y,optionals:v})}if(!S&&u.static){const _=u.static.get(x);_&&a.push({node:_,index:f+1,skipped:p,depth:g+1,statics:m+1,dynamics:y,optionals:v})}}if(d&&c)return bt(c,d)?d:c;if(d)return d;if(c)return c;if(n&&h){let l=h.index;for(let f=0;ft.statics||s.statics===t.statics&&(s.dynamics>t.dynamics||s.dynamics===t.dynamics&&(s.optionals>t.optionals||s.optionals===t.optionals&&(s.node.isIndex>t.node.isIndex||s.node.isIndex===t.node.isIndex&&s.depth>t.depth))):!0}function It(t){return pe(t.filter(s=>s!==void 0).join("/"))}function pe(t){return t.replace(/\/{2,}/g,"/")}function es(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function Q(t){const s=t.length;return s>1&&t[s-1]==="/"?t.replace(/\/{1,}$/,""):t}function Et(t){return Q(es(t))}function zt(t,s){return t?.endsWith("/")&&t!=="/"&&t!==`${s}/`?t.slice(0,-1):t}function Zs(t,s,e){return zt(t,e)===zt(s,e)}function Qs({base:t,to:s,trailingSlash:e="never",cache:n}){const o=s.startsWith("/"),i=!o&&s===".";let r;if(n){r=o?s:i?t:t+"\0"+s;const l=n.get(r);if(l)return l}let a;if(i)a=t.split("/");else if(o)a=s.split("/");else{for(a=t.split("/");a.length>1&&Ft(a)==="";)a.pop();const l=s.split("/");for(let u=0,f=l.length;u1&&(Ft(a)===""?e==="never"&&a.pop():e==="always"&&a.push(""));let c,h="";for(let l=0;l0&&(h+="/");const u=a[l];if(!u)continue;c=de(u,0,c);const f=c[0];if(f===lt){h+=u;continue}const p=c[5],g=u.substring(0,c[1]),m=u.substring(c[4],p),y=u.substring(c[2],c[3]);f===et?h+=g||m?`${g}{$${y}}${m}`:`$${y}`:f===st?h+=g||m?`${g}{$}${m}`:"$":h+=`${g}{-$${y}}${m}`}h=pe(h);const d=h||"/";return r&&n&&n.set(r,d),d}function Yt(t,s,e){const n=s[t];return typeof n!="string"?n:t==="_splat"?encodeURI(n):tn(n,e)}function Xt({path:t,params:s,decodeCharMap:e}){let n=!1;const o={};if(!t||t==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:n};if(!t.includes("$"))return{interpolatedPath:t,usedParams:o,isMissingParams:n};const i=t.length;let r=0,a,c="";for(;r{let e;return(...n)=>{e||(e=setTimeout(()=>{t(...n),e=null},s))}};function nn(){const t=en();if(!t)return null;const s=t.getItem(Dt);let e=s?JSON.parse(s):{};return{state:e,set:n=>(e=H(n,e)||e,t.setItem(Dt,JSON.stringify(e)))}}const Ct=nn(),ae=t=>t.state.__TSR_key||t.href;function on(t){const s=[];let e;for(;e=t.parentNode;)s.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(e.children,t)+1})`),t=e;return`${s.reverse().join(" > ")}`.toLowerCase()}let jt=!1;function ss({storageKey:t,key:s,behavior:e,shouldScrollRestoration:n,scrollToTopSelectors:o,location:i}){let r;try{r=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(h){console.error(h);return}const a=s||window.history.state?.__TSR_key,c=r[a];jt=!0;t:{if(n&&c&&Object.keys(c).length>0){for(const l in c){const u=c[l];if(l==="window")window.scrollTo({top:u.scrollY,left:u.scrollX,behavior:e});else if(l){const f=document.querySelector(l);f&&(f.scrollLeft=u.scrollX,f.scrollTop=u.scrollY)}}break t}const h=(i??window.location).hash.split("#",2)[1];if(h){const l=window.history.state?.__hashScrollIntoViewOptions??!0;if(l){const u=document.getElementById(h);u&&u.scrollIntoView(l)}break t}const d={top:0,left:0,behavior:e};if(window.scrollTo(d),o)for(const l of o){if(l==="window")continue;const u=typeof l=="function"?l():document.querySelector(l);u&&u.scrollTo(d)}}jt=!1}function rn(t,s){if(!Ct&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!Ct))return;t.isScrollRestorationSetup=!0,jt=!1;const n=t.options.getScrollRestorationKey||ae;window.history.scrollRestoration="manual";const o=i=>{if(jt||!t.isScrollRestoring)return;let r="";if(i.target===document||i.target===window)r="window";else{const c=i.target.getAttribute("data-scroll-restoration-id");c?r=`[data-scroll-restoration-id="${c}"]`:r=on(i.target)}const a=n(t.state.location);Ct.set(c=>{const h=c[a]||={},d=h[r]||={};if(r==="window")d.scrollX=window.scrollX||0,d.scrollY=window.scrollY||0;else if(r){const l=document.querySelector(r);l&&(d.scrollX=l.scrollLeft||0,d.scrollY=l.scrollTop||0)}return c})};typeof document<"u"&&document.addEventListener("scroll",sn(o,100),!0),t.subscribe("onRendered",i=>{const r=n(i.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(ss({storageKey:Dt,key:r,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Ct.set(a=>(a[r]||={},a)))})}function an(t){if(typeof document<"u"&&document.querySelector){const s=t.state.location.state.__hashScrollIntoViewOptions??!0;if(s&&t.state.location.hash!==""){const e=document.getElementById(t.state.location.hash);e&&e.scrollIntoView(s)}}}function cn(t,s=String){const e=new URLSearchParams;for(const n in t){const o=t[n];o!==void 0&&e.set(n,s(o))}return e.toString()}function Zt(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function ln(t){const s=new URLSearchParams(t),e={};for(const[n,o]of s.entries()){const i=e[n];i==null?e[n]=Zt(o):Array.isArray(i)?i.push(Zt(o)):e[n]=[i,Zt(o)]}return e}const un=dn(JSON.parse),hn=fn(JSON.stringify,JSON.parse);function dn(t){return s=>{s[0]==="?"&&(s=s.substring(1));const e=ln(s);for(const n in e){const o=e[n];if(typeof o=="string")try{e[n]=t(o)}catch{}}return e}}function fn(t,s){const e=typeof s=="function";function n(o){if(typeof o=="object"&&o!==null)try{return t(o)}catch{}else if(e&&typeof o=="string")try{return s(o),t(o)}catch{}return o}return o=>{const i=cn(o,n);return i?`?${i}`:""}}const B="__root__";function pn(t){if(t.statusCode=t.statusCode||t.code||307,!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const s=new Headers(t.headers);t.href&&s.get("Location")===null&&s.set("Location",t.href);const e=new Response(null,{status:t.statusCode,headers:s});if(e.options=t,t.throw)throw e;return e}function $(t){return t instanceof Response&&!!t.options}const kt=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},$t=(t,s)=>!!(t.preload&&!t.router.state.matches.some(e=>e.id===s)),ns=(t,s)=>{const e=t.router.routesById[s.routeId??""]??t.router.routeTree;!e.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(e.options.notFoundComponent=t.router.options.defaultNotFoundComponent),K(e.options.notFoundComponent);const n=t.matches.find(o=>o.routeId===e.id);K(n,"Could not find match for route: "+e.id),t.updateMatch(n.id,o=>({...o,status:"notFound",error:s,isFetching:!1})),s.routerCode==="BEFORE_LOAD"&&e.parentRoute&&(s.routeId=e.parentRoute.id,ns(t,s))},q=(t,s,e)=>{if(!(!$(e)&&!D(e))){if($(e)&&e.redirectHandled&&!e.options.reloadDocument)throw e;if(s){s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.loaderPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,s._nonReactive.loaderPromise=void 0;const n=$(e)?"redirected":"notFound";s._nonReactive.error=e,t.updateMatch(s.id,o=>({...o,status:n,isFetching:!1,error:e})),D(e)&&!e.routeId&&(e.routeId=s.routeId),s._nonReactive.loadPromise?.resolve()}throw $(e)?(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e),e):(ns(t,e),e)}},os=(t,s)=>{const e=t.router.getMatch(s);return!!(!t.router.isServer&&e._nonReactive.dehydrated||t.router.isServer&&e.ssr===!1)},ht=(t,s,e,n)=>{const{id:o,routeId:i}=t.matches[s],r=t.router.looseRoutesById[i];if(e instanceof Promise)throw e;e.routerCode=n,t.firstBadMatchIndex??=s,q(t,t.router.getMatch(o),e);try{r.options.onError?.(e)}catch(a){e=a,q(t,t.router.getMatch(o),e)}t.updateMatch(o,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},mn=(t,s,e,n)=>{const o=t.router.getMatch(s),i=t.matches[e-1]?.id,r=i?t.router.getMatch(i):void 0;if(t.router.isShell()){o.ssr=n.id===B;return}if(r?.ssr===!1){o.ssr=!1;return}const a=f=>f===!0&&r?.ssr==="data-only"?"data-only":f,c=t.router.options.defaultSsr??!0;if(n.options.ssr===void 0){o.ssr=a(c);return}if(typeof n.options.ssr!="function"){o.ssr=a(n.options.ssr);return}const{search:h,params:d}=o,l={search:Lt(h,o.searchError),params:Lt(d,o.paramsError),location:t.location,matches:t.matches.map(f=>({index:f.index,pathname:f.pathname,fullPath:f.fullPath,staticData:f.staticData,id:f.id,routeId:f.routeId,search:Lt(f.search,f.searchError),params:Lt(f.params,f.paramsError),ssr:f.ssr}))},u=n.options.ssr(l);if(J(u))return u.then(f=>{o.ssr=a(f??c)});o.ssr=a(u??c)},is=(t,s,e,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const o=e.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!$t(t,s)&&(e.options.loader||e.options.beforeLoad||cs(e))&&typeof o=="number"&&o!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent))){const r=setTimeout(()=>{kt(t)},o);n._nonReactive.pendingTimeout=r}},gn=(t,s,e)=>{const n=t.router.getMatch(s);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;is(t,s,e,n);const o=()=>{const i=t.router.getMatch(s);i.preload&&(i.status==="redirected"||i.status==="notFound")&&q(t,i,i.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(o):o()},yn=(t,s,e,n)=>{const o=t.router.getMatch(s),i=o._nonReactive.loadPromise;o._nonReactive.loadPromise=ct(()=>{i?.resolve()});const{paramsError:r,searchError:a}=o;r&&ht(t,e,r,"PARSE_PARAMS"),a&&ht(t,e,a,"VALIDATE_SEARCH"),is(t,s,n,o);const c=new AbortController,h=t.matches[e-1]?.id,u={...(h?t.router.getMatch(h):void 0)?.context??t.router.options.context??void 0,...o.__routeContext};let f=!1;const p=()=>{f||(f=!0,t.updateMatch(s,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:c,context:u})))},g=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,t.updateMatch(s,R=>({...R,isFetching:!1}))};if(!n.options.beforeLoad){gt(()=>{p(),g()});return}o._nonReactive.beforeLoadPromise=ct();const{search:m,params:y,cause:v}=o,S=$t(t,s),x={search:m,abortController:c,params:y,preload:S,context:u,location:t.location,navigate:R=>t.router.navigate({...R,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:S?"preload":v,matches:t.matches,...t.router.options.additionalContext},L=R=>{if(R===void 0){gt(()=>{p(),g()});return}($(R)||D(R))&&(p(),ht(t,e,R,"BEFORE_LOAD")),gt(()=>{p(),t.updateMatch(s,w=>({...w,__beforeLoadContext:R,context:{...w.context,...R}})),g()})};let _;try{if(_=n.options.beforeLoad(x),J(_))return p(),_.catch(R=>{ht(t,e,R,"BEFORE_LOAD")}).then(L)}catch(R){p(),ht(t,e,R,"BEFORE_LOAD")}L(_)},vn=(t,s)=>{const{id:e,routeId:n}=t.matches[s],o=t.router.looseRoutesById[n],i=()=>{if(t.router.isServer){const c=mn(t,e,s,o);if(J(c))return c.then(a)}return a()},r=()=>yn(t,e,s,o),a=()=>{if(os(t,e))return;const c=gn(t,e,o);return J(c)?c.then(r):r()};return i()},yt=(t,s,e)=>{const n=t.router.getMatch(s);if(!n||!e.options.head&&!e.options.scripts&&!e.options.headers)return;const o={matches:t.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([e.options.head?.(o),e.options.scripts?.(o),e.options.headers?.(o)]).then(([i,r,a])=>{const c=i?.meta,h=i?.links,d=i?.scripts,l=i?.styles;return{meta:c,links:h,headScripts:d,headers:a,scripts:r,styles:l}})},rs=(t,s,e,n)=>{const o=t.matchPromises[e-1],{params:i,loaderDeps:r,abortController:a,cause:c}=t.router.getMatch(s);let h=t.router.options.context??{};for(let l=0;l<=e;l++){const u=t.matches[l];if(!u)continue;const f=t.router.getMatch(u.id);f&&(h={...h,...f.__routeContext??{},...f.__beforeLoadContext??{}})}const d=$t(t,s);return{params:i,deps:r,preload:!!d,parentMatchPromise:o,abortController:a,context:h,location:t.location,navigate:l=>t.router.navigate({...l,_fromLocation:t.location}),cause:d?"preload":c,route:n,...t.router.options.additionalContext}},Be=async(t,s,e,n)=>{try{const o=t.router.getMatch(s);try{(!t.router.isServer||o.ssr===!0)&&as(n);const i=n.options.loader?.(rs(t,s,e,n)),r=n.options.loader&&J(i);if(!!(r||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||o._nonReactive.minPendingPromise)&&t.updateMatch(s,l=>({...l,isFetching:"loader"})),n.options.loader){const l=r?await i:i;q(t,t.router.getMatch(s),l),l!==void 0&&t.updateMatch(s,u=>({...u,loaderData:l}))}n._lazyPromise&&await n._lazyPromise;const c=yt(t,s,n),h=c?await c:void 0,d=o._nonReactive.minPendingPromise;d&&await d,n._componentsPromise&&await n._componentsPromise,t.updateMatch(s,l=>({...l,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...h}))}catch(i){let r=i;const a=o._nonReactive.minPendingPromise;a&&await a,D(i)&&await n.options.notFoundComponent?.preload?.(),q(t,t.router.getMatch(s),i);try{n.options.onError?.(i)}catch(d){r=d,q(t,t.router.getMatch(s),d)}const c=yt(t,s,n),h=c?await c:void 0;t.updateMatch(s,d=>({...d,error:r,status:"error",isFetching:!1,...h}))}}catch(o){const i=t.router.getMatch(s);if(i){const r=yt(t,s,n);if(r){const a=await r;t.updateMatch(s,c=>({...c,...a}))}i._nonReactive.loaderPromise=void 0}q(t,i,o)}},Sn=async(t,s)=>{const{id:e,routeId:n}=t.matches[s];let o=!1,i=!1;const r=t.router.looseRoutesById[n];if(os(t,e)){if(t.router.isServer){const h=yt(t,e,r);if(h){const d=await h;t.updateMatch(e,l=>({...l,...d}))}return t.router.getMatch(e)}}else{const h=t.router.getMatch(e);if(h._nonReactive.loaderPromise){if(h.status==="success"&&!t.sync&&!h.preload)return h;await h._nonReactive.loaderPromise;const d=t.router.getMatch(e),l=d._nonReactive.error||d.error;l&&q(t,d,l)}else{const d=Date.now()-h.updatedAt,l=$t(t,e),u=l?r.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:r.options.staleTime??t.router.options.defaultStaleTime??0,f=r.options.shouldReload,p=typeof f=="function"?f(rs(t,e,s,r)):f,g=!!l&&!t.router.state.matches.some(S=>S.id===e),m=t.router.getMatch(e);m._nonReactive.loaderPromise=ct(),g!==m.preload&&t.updateMatch(e,S=>({...S,preload:g}));const{status:y,invalid:v}=m;if(o=y==="success"&&(v||(p??d>u)),!(l&&r.options.preload===!1))if(o&&!t.sync)i=!0,(async()=>{try{await Be(t,e,s,r);const S=t.router.getMatch(e);S._nonReactive.loaderPromise?.resolve(),S._nonReactive.loadPromise?.resolve(),S._nonReactive.loaderPromise=void 0}catch(S){$(S)&&await t.router.navigate(S.options)}})();else if(y!=="success"||o&&t.sync)await Be(t,e,s,r);else{const S=yt(t,e,r);if(S){const x=await S;t.updateMatch(e,L=>({...L,...x}))}}}}const a=t.router.getMatch(e);i||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,i||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const c=i?a.isFetching:!1;return c!==a.isFetching||a.invalid!==!1?(t.updateMatch(e,h=>({...h,isFetching:c,invalid:!1})),t.router.getMatch(e)):a};async function ze(t){const s=Object.assign(t,{matchPromises:[]});!s.router.isServer&&s.router.state.matches.some(e=>e._forcePending)&&kt(s);try{for(let o=0;o{const{id:e,...n}=s.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const s=()=>{const e=[];for(const n of ls){const o=t.options[n]?.preload;o&&e.push(o())}if(e.length)return Promise.all(e).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(s):s()}return t._componentsPromise}function Lt(t,s){return s?{status:"error",error:s}:{status:"success",value:t}}function cs(t){for(const s of ls)if(t.options[s]?.preload)return!0;return!1}const ls=["component","errorComponent","pendingComponent","notFoundComponent"];function _n(t){return{input:({url:s})=>{for(const e of t)s=us(e,s);return s},output:({url:s})=>{for(let e=t.length-1;e>=0;e--)s=hs(t[e],s);return s}}}function wn(t){const s=Et(t.basepath),e=`/${s}`,n=`${e}/`,o=t.caseSensitive?e:e.toLowerCase(),i=t.caseSensitive?n:n.toLowerCase();return{input:({url:r})=>{const a=t.caseSensitive?r.pathname:r.pathname.toLowerCase();return a===o?r.pathname="/":a.startsWith(i)&&(r.pathname=r.pathname.slice(e.length)),r},output:({url:r})=>(r.pathname=It(["/",s,r.pathname]),r)}}function us(t,s){const e=t?.input?.({url:s});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return s}function hs(t,s){const e=t?.output?.({url:s});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return s}function tt(t){const s=t.resolvedLocation,e=t.location,n=s?.pathname!==e.pathname,o=s?.href!==e.href,i=s?.hash!==e.hash;return{fromLocation:s,toLocation:e,pathChanged:n,hrefChanged:o,hashChanged:i}}class Rn{constructor(s){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,o=this.basepath??n?.basepath??"/",i=this.basepath===void 0,r=n?.rewrite;this.options={...n,...e},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(u=>[encodeURIComponent(u),u])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=As())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Os(Pn(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(u=>!["redirected"].includes(u.status))}}}),rn(this));let a=!1;const c=this.options.basepath??"/",h=this.options.rewrite;if(i||o!==c||r!==h){this.basepath=c;const u=[];Et(c)!==""&&u.push(wn({basepath:c})),h&&u.push(h),this.rewrite=u.length===0?void 0:u.length===1?u[0]:_n(u),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:n,processedTree:o}=qs(this.routeTree,this.options.caseSensitive,(r,a)=>{r.init({originalIndex:a})});this.options.routeMasks&&$s(this.options.routeMasks,o),this.routesById=e,this.routesByPath=n,this.processedTree=o;const i=this.options.notFoundRoute;i&&(i.init({originalIndex:99999999999}),this.routesById[i.id]=i)},this.subscribe=(e,n)=>{const o={eventType:e,fn:n};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=e=>{this.subscribers.forEach(n=>{n.eventType===e.type&&n.fn(e)})},this.parseLocation=(e,n)=>{const o=({href:c,state:h})=>{const d=new URL(c,this.origin),l=us(this.rewrite,d),u=this.options.parseSearch(l.search),f=this.options.stringifySearch(u);l.search=f;const p=l.href.replace(l.origin,""),{pathname:g,hash:m}=l;return{href:p,publicHref:c,url:l.href,pathname:Ae(g),searchStr:f,search:z(n?.search,u),hash:m.split("#").reverse()[0]??"",state:z(n?.state,h)}},i=o(e),{__tempLocation:r,__tempKey:a}=i.state;if(r&&(!a||a===this.tempLocationKey)){const c=o(r);return c.state.key=i.state.key,c.state.__TSR_key=i.state.__TSR_key,delete c.state.__tempLocation,{...c,maskedLocation:i}}return i},this.resolvePathCache=Bt(1e3),this.resolvePathWithBase=(e,n)=>Qs({base:e,to:pe(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,n,o)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:n},o):this.matchRoutesInternal(e,n),this.getMatchedRoutes=e=>bn({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{const n=this.getMatch(e);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const e=this.state.matches.filter(i=>i.status==="pending"),n=this.state.matches.filter(i=>i.isFetching==="loader");new Set([...this.state.pendingMatches??[],...e,...n]).forEach(i=>{this.cancelMatch(i.id)})},this.buildLocation=e=>{const n=(i={})=>{const r=i._fromLocation||this.pendingBuiltLocation||this.latestLocation,a=this.matchRoutes(r,{_buildLocation:!0}),c=Ft(a);i.from;const h=i.unsafeRelative==="path"?r.pathname:i.from??c.fullPath,d=this.resolvePathWithBase(h,"."),l=c.search,u={...c.params},f=i.to?this.resolvePathWithBase(d,`${i.to}`):this.resolvePathWithBase(d,"."),p=i.params===!1||i.params===null?{}:(i.params??!0)===!0?u:Object.assign(u,H(i.params,u)),g=Xt({path:f,params:p}).interpolatedPath,m=this.matchRoutes(g,void 0,{_buildLocation:!0}).map(M=>this.looseRoutesById[M.routeId]);if(Object.keys(p).length>0)for(const M of m){const I=M.options.params?.stringify??M.options.stringifyParams;I&&Object.assign(p,I(p))}const y=e.leaveParams?f:Ae(Xt({path:f,params:p,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath);let v=l;if(e._includeValidateSearch&&this.options.search?.strict){const M={};m.forEach(I=>{if(I.options.validateSearch)try{Object.assign(M,ce(I.options.validateSearch,{...M,...v}))}catch{}}),v=M}v=Cn({search:v,dest:i,destRoutes:m,_includeValidateSearch:e._includeValidateSearch}),v=z(l,v);const S=this.options.stringifySearch(v),x=i.hash===!0?r.hash:i.hash?H(i.hash,r.hash):void 0,L=x?`#${x}`:"";let _=i.state===!0?r.state:i.state?H(i.state,r.state):{};_=z(r.state,_);const R=`${y}${S}${L}`,w=new URL(R,this.origin),C=hs(this.rewrite,w);return{publicHref:C.pathname+C.search+C.hash,href:R,url:C.href,pathname:y,search:v,searchStr:S,state:_,hash:x??"",unmaskOnReload:i.unmaskOnReload}},o=(i={},r)=>{const a=n(i);let c=r?n(r):void 0;if(!c){const h={};if(this.options.routeMasks){const d=Us(a.pathname,this.processedTree);if(d){Object.assign(h,d.params);const{from:l,params:u,...f}=d.route,p=u===!1||u===null?{}:(u??!0)===!0?h:Object.assign(h,H(u,h));r={from:e.from,...f,params:p},c=n(r)}}}return c&&(a.maskedLocation=c),a};return e.mask?o(e,{from:e.from,...e.mask}):o(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:n,...o})=>{const i=()=>{const c=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];c.forEach(d=>{o.state[d]=this.latestLocation.state[d]});const h=Z(o.state,this.latestLocation.state);return c.forEach(d=>{delete o.state[d]}),h},r=Q(this.latestLocation.href)===Q(o.href),a=this.commitLocationPromise;if(this.commitLocationPromise=ct(()=>{a?.resolve()}),r&&i())this.load();else{let{maskedLocation:c,hashScrollIntoView:h,...d}=o;c&&(d={...c,state:{...c.state,__tempKey:void 0,__tempLocation:{...d,search:d.searchStr,state:{...d.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(d.unmaskOnReload??this.options.unmaskOnReload??!1)&&(d.state.__tempKey=this.tempLocationKey)),d.state.__hashScrollIntoViewOptions=h??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[o.replace?"replace":"push"](d.publicHref,d.state,{ignoreBlocker:n})}return this.resetNextScroll=o.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:n,hashScrollIntoView:o,viewTransition:i,ignoreBlocker:r,href:a,...c}={})=>{if(a){const l=this.history.location.state.__TSR_index,u=Ot(a,{__TSR_index:e?l:l+1});c.to=u.pathname,c.search=this.options.parseSearch(u.search),c.hash=u.hash.slice(1)}const h=this.buildLocation({...c,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const d=this.commitLocation({...h,viewTransition:i,replace:e,resetScroll:n,hashScrollIntoView:o,ignoreBlocker:r});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),d},this.navigate=async({to:e,reloadDocument:n,href:o,...i})=>{if(!n&&o)try{new URL(`${o}`),n=!0}catch{}if(n){if(o||(o=this.buildLocation({to:e,...i}).url),!i.ignoreBlocker){const a=this.history.getBlockers?.()??[];for(const c of a)if(c?.blockerFn&&await c.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return i.replace?window.location.replace(o):window.location.href=o,Promise.resolve()}return this.buildAndCommitLocation({...i,href:o,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const n=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),o=i=>{try{return encodeURI(decodeURI(i))}catch{return i}};if(Et(o(this.latestLocation.href))!==Et(o(n.href))){let i=n.url;throw this.origin&&i.startsWith(this.origin)&&(i=i.replace(this.origin,"")||"/"),pn({href:i})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:n.cachedMatches.filter(o=>!e.some(i=>i.id===o.id))}))},this.load=async e=>{let n,o,i;for(i=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();const c=this.latestLocation,h=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...tt({resolvedLocation:h,location:c})}),this.emit({type:"onBeforeLoad",...tt({resolvedLocation:h,location:c})}),await ze({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:c,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let d=[],l=[],u=[];gt(()=>{this.__store.setState(f=>{const p=f.matches,g=f.pendingMatches||f.matches;return d=p.filter(m=>!g.some(y=>y.id===m.id)),l=g.filter(m=>!p.some(y=>y.id===m.id)),u=g.filter(m=>p.some(y=>y.id===m.id)),{...f,isLoading:!1,loadedAt:Date.now(),matches:g,pendingMatches:void 0,cachedMatches:[...f.cachedMatches,...d.filter(m=>m.status!=="error"&&m.status!=="notFound")]}}),this.clearExpiredCache()}),[[d,"onLeave"],[l,"onEnter"],[u,"onStay"]].forEach(([f,p])=>{f.forEach(g=>{this.looseRoutesById[g.routeId].options[p]?.(g)})})})})}})}catch(c){$(c)?(n=c,this.isServer||this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):D(c)&&(o=c),this.__store.setState(h=>({...h,statusCode:n?n.status:o?404:h.matches.some(d=>d.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let r;this.hasNotFoundMatch()?r=404:this.__store.state.matches.some(a=>a.status==="error")&&(r=500),r!==void 0&&this.__store.setState(a=>({...a,statusCode:r}))},this.startViewTransition=e=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const i=this.latestLocation,r=this.state.resolvedLocation,a=typeof n.types=="function"?n.types(tt({resolvedLocation:r,location:i})):n.types;if(a===!1){e();return}o={update:e,types:a}}else o=e;document.startViewTransition(o)}else e()},this.updateMatch=(e,n)=>{this.startTransition(()=>{const o=this.state.pendingMatches?.some(i=>i.id===e)?"pendingMatches":this.state.matches.some(i=>i.id===e)?"matches":this.state.cachedMatches.some(i=>i.id===e)?"cachedMatches":"";o&&this.__store.setState(i=>({...i,[o]:i[o]?.map(r=>r.id===e?n(r):r)}))})},this.getMatch=e=>{const n=o=>o.id===e;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=e=>{const n=o=>e?.filter?.(o)??!0?{...o,invalid:!0,...e?.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o;return this.__store.setState(o=>({...o,matches:o.matches.map(n),cachedMatches:o.cachedMatches.map(n),pendingMatches:o.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const n=this.buildLocation(e.options);let o=n.url;this.origin&&o.startsWith(this.origin)&&(o=o.replace(this.origin,"")||"/"),e.options.href=n.href,e.headers.set("Location",o)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const n=e?.filter;n!==void 0?this.__store.setState(o=>({...o,cachedMatches:o.cachedMatches.filter(i=>!n(i))})):this.__store.setState(o=>({...o,cachedMatches:[]}))},this.clearExpiredCache=()=>{const e=n=>{const o=this.looseRoutesById[n.routeId];if(!o.options.loader)return!0;const i=(n.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=i};this.clearCache({filter:e})},this.loadRouteChunk=as,this.preloadRoute=async e=>{const n=this.buildLocation(e);let o=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:e});const i=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(a=>a.id)),r=new Set([...i,...this.state.cachedMatches.map(a=>a.id)]);gt(()=>{o.forEach(a=>{r.has(a.id)||this.__store.setState(c=>({...c,cachedMatches:[...c.cachedMatches,a]}))})});try{return o=await ze({router:this,matches:o,location:n,preload:!0,updateMatch:(a,c)=>{i.has(a)?o=o.map(h=>h.id===a?c(h):h):this.updateMatch(a,c)}}),o}catch(a){if($(a))return a.options.reloadDocument?void 0:await this.preloadRoute({...a.options,_fromLocation:n});D(a)||console.error(a);return}},this.matchRoute=(e,n)=>{const o={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},i=this.buildLocation(o);if(n?.pending&&this.state.status!=="pending")return!1;const a=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,c=Vs(i.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,a.pathname,this.processedTree);return!c||e.params&&!Z(c.params,e.params,{partial:!0})?!1:n?.includeSearch??!0?Z(a.search,i.search,{partial:!0})?c.params:!1:c.params},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status==="notFound"||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...s,caseSensitive:s.caseSensitive??!1,notFoundMode:s.notFoundMode??"fuzzy",stringifySearch:s.stringifySearch??hn,parseSearch:s.parseSearch??un}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(s,e){const n=this.getMatchedRoutes(s.pathname),{foundRoute:o,routeParams:i}=n;let{matchedRoutes:r}=n,a=!1;(o?o.path!=="/"&&i["**"]:Q(s.pathname))&&(this.options.notFoundRoute?r=[...r,this.options.notFoundRoute]:a=!0);const c=(()=>{if(a){if(this.options.notFoundMode!=="root")for(let l=r.length-1;l>=0;l--){const u=r[l];if(u.children)return u.id}return B}})(),h=[],d=l=>l?.id?l.context??this.options.context??void 0:this.options.context??void 0;return r.forEach((l,u)=>{const f=h[u-1],[p,g,m]=(()=>{const A=f?.search??s.search,j=f?._strictSearch??void 0;try{const N=ce(l.options.validateSearch,{...A})??void 0;return[{...A,...N},{...j,...N},void 0]}catch(N){let nt=N;if(N instanceof Nt||(nt=new Nt(N.message,{cause:N})),e?.throwOnError)throw nt;return[A,{},nt]}})(),y=l.options.loaderDeps?.({search:p})??"",v=y?JSON.stringify(y):"",{interpolatedPath:S,usedParams:x}=Xt({path:l.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),L=l.id+S+v,_=this.getMatch(L),R=this.state.matches.find(A=>A.routeId===l.id),w=_?._strictParams??x;let C;if(!_){const A=l.options.params?.parse??l.options.parseParams;if(A)try{Object.assign(w,A(w))}catch(j){if(D(j)||$(j)?C=j:C=new xn(j.message,{cause:j}),e?.throwOnError)throw C}}Object.assign(i,w);const M=R?"stay":"enter";let I;if(_)I={..._,cause:M,params:R?z(R.params,i):i,_strictParams:w,search:z(R?R.search:_.search,p),_strictSearch:g};else{const A=l.options.loader||l.options.beforeLoad||l.lazyFn||cs(l)?"pending":"success";I={id:L,ssr:this.isServer?void 0:l.options.ssr,index:u,routeId:l.id,params:R?z(R.params,i):i,_strictParams:w,pathname:S,updatedAt:Date.now(),search:R?z(R.search,p):p,_strictSearch:g,searchError:void 0,status:A,isFetching:!1,error:void 0,paramsError:C,__routeContext:void 0,_nonReactive:{loadPromise:ct()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:M,loaderDeps:R?z(R.loaderDeps,y):y,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}e?.preload||(I.globalNotFound=c===l.id),I.searchError=m;const F=d(f);I.context={...F,...I.__routeContext,...I.__beforeLoadContext},h.push(I)}),h.forEach((l,u)=>{const f=this.looseRoutesById[l.routeId];if(!this.getMatch(l.id)&&e?._buildLocation!==!0){const g=h[u-1],m=d(g);if(f.options.context){const y={deps:l.loaderDeps,params:l.params,context:m??{},location:s,navigate:v=>this.navigate({...v,_fromLocation:s}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:h};l.__routeContext=f.options.context(y)??void 0}l.context={...m,...l.__routeContext,...l.__beforeLoadContext}}}),h}}class Nt extends Error{}class xn extends Error{}function Pn(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ce(t,s){if(t==null)return{};if("~standard"in t){const e=t["~standard"].validate(s);if(e instanceof Promise)throw new Nt("Async validation not supported");if(e.issues)throw new Nt(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(s):typeof t=="function"?t(s):{}}function bn({pathname:t,routesById:s,processedTree:e}){const n={},o=Q(t);let i;const r=Ks(o,e,!0);return r&&(i=r.route,Object.assign(n,r.params)),{matchedRoutes:r?.branch||[s[B]],routeParams:n,foundRoute:i}}function Cn({search:t,dest:s,destRoutes:e,_includeValidateSearch:n}){const o=e.reduce((a,c)=>{const h=[];if("search"in c.options)c.options.search?.middlewares&&h.push(...c.options.search.middlewares);else if(c.options.preSearchFilters||c.options.postSearchFilters){const d=({search:l,next:u})=>{let f=l;"preSearchFilters"in c.options&&c.options.preSearchFilters&&(f=c.options.preSearchFilters.reduce((g,m)=>m(g),l));const p=u(f);return"postSearchFilters"in c.options&&c.options.postSearchFilters?c.options.postSearchFilters.reduce((g,m)=>m(g),p):p};h.push(d)}if(n&&c.options.validateSearch){const d=({search:l,next:u})=>{const f=u(l);try{return{...f,...ce(c.options.validateSearch,f)??void 0}}catch{return f}};h.push(d)}return a.concat(h)},[])??[],i=({search:a})=>s.search?s.search===!0?a:H(s.search,a):{};o.push(i);const r=(a,c)=>{if(a>=o.length)return c;const h=o[a];return h({search:c,next:l=>r(a+1,l)})};return r(0,t)}const Ln="Error preloading route! ☝️";class ds{constructor(s){if(this.init=e=>{this.originalIndex=e.originalIndex;const n=this.options,o=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),o?this._path=B:this.parentRoute||K(!1);let i=o?B:n?.path;i&&i!=="/"&&(i=es(i));const r=n?.id||i;let a=o?B:It([this.parentRoute.id===B?"":this.parentRoute.id,r]);i===B&&(i="/"),a!==B&&(a=It(["/",a]));const c=a===B?"/":It([this.parentRoute.fullPath,i]);this._path=i,this._id=a,this._fullPath=c,this._to=c},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=s||{},this.isRoot=!s?.getParentRoute,s?.id&&s?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Mn extends ds{constructor(s){super(s)}}function me(t){const s=t.errorComponent??Ut;return P.jsx(In,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:e,reset:n})=>e?b.createElement(s,{error:e,reset:n}):t.children})}class In extends b.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(s){return{resetKey:s.getResetKey()}}static getDerivedStateFromError(s){return{error:s}}reset(){this.setState({error:null})}componentDidUpdate(s,e){e.error&&e.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(s,e){this.props.onCatch&&this.props.onCatch(s,e)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Ut({error:t}){const[s,e]=b.useState(!1);return P.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[P.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),P.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>e(n=>!n),children:s?"Hide Error":"Show Error"})]}),P.jsx("div",{style:{height:".25rem"}}),s?P.jsx("div",{children:P.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?P.jsx("code",{children:t.message}):null})}):null]})}function En({children:t,fallback:s=null}){return kn()?P.jsx(at.Fragment,{children:t}):P.jsx(at.Fragment,{children:s})}function kn(){return at.useSyncExternalStore(Tn,()=>!0,()=>!1)}function Tn(){return()=>{}}var Qt={exports:{}},te={},ee={exports:{}},se={};var De;function On(){if(De)return se;De=1;var t=le();function s(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var e=typeof Object.is=="function"?Object.is:s,n=t.useState,o=t.useEffect,i=t.useLayoutEffect,r=t.useDebugValue;function a(l,u){var f=u(),p=n({inst:{value:f,getSnapshot:u}}),g=p[0].inst,m=p[1];return i(function(){g.value=f,g.getSnapshot=u,c(g)&&m({inst:g})},[l,f,u]),o(function(){return c(g)&&m({inst:g}),l(function(){c(g)&&m({inst:g})})},[l]),r(f),f}function c(l){var u=l.getSnapshot;l=l.value;try{var f=u();return!e(l,f)}catch{return!0}}function h(l,u){return u()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:a;return se.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,se}var je;function Fn(){return je||(je=1,ee.exports=On()),ee.exports}var Ne;function An(){if(Ne)return te;Ne=1;var t=le(),s=Fn();function e(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:e,o=s.useSyncExternalStore,i=t.useRef,r=t.useEffect,a=t.useMemo,c=t.useDebugValue;return te.useSyncExternalStoreWithSelector=function(h,d,l,u,f){var p=i(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=a(function(){function y(_){if(!v){if(v=!0,S=_,_=u(_),f!==void 0&&g.hasValue){var R=g.value;if(f(R,_))return x=R}return x=_}if(R=x,n(S,_))return R;var w=u(_);return f!==void 0&&f(R,w)?(S=_,R):(S=_,x=w)}var v=!1,S,x,L=l===void 0?null:l;return[function(){return y(d())},L===null?void 0:function(){return y(L())}]},[d,l,u,f]);var m=o(h,p[0],p[1]);return r(function(){g.hasValue=!0,g.value=m},[m]),c(m),m},te}var We;function Bn(){return We||(We=1,Qt.exports=An()),Qt.exports}var fs=Bn();const Lo=ue(fs);function zn(t,s=n=>n,e={}){const n=e.equal??Dn;return fs.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,s,n)}function Dn(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;if(t instanceof Map&&s instanceof Map){if(t.size!==s.size)return!1;for(const[n,o]of t)if(!s.has(n)||!Object.is(o,s.get(n)))return!1;return!0}if(t instanceof Set&&s instanceof Set){if(t.size!==s.size)return!1;for(const n of t)if(!s.has(n))return!1;return!0}if(t instanceof Date&&s instanceof Date)return t.getTime()===s.getTime();const e=$e(t);if(e.length!==$e(s).length)return!1;for(let n=0;n"u"?ne:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=ne,ne)}function O(t){const s=b.useContext(ps());return t?.warn,s}function T(t){const s=O({warn:t?.router===void 0}),e=t?.router||s,n=b.useRef(void 0);return zn(e.__store,o=>{if(t?.select){if(t.structuralSharing??e.options.defaultStructuralSharing){const i=z(n.current,t.select(o));return n.current=i,i}return t.select(o)}return o})}const Vt=b.createContext(void 0),jn=b.createContext(void 0);function U(t){const s=b.useContext(t.from?jn:Vt);return T({select:n=>{const o=n.matches.find(i=>t.from?t.from===i.routeId:i.id===s);if(K(!((t.shouldThrow??!0)&&!o),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),o!==void 0)return t.select?t.select(o):o},structuralSharing:t.structuralSharing})}function ge(t){return U({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:s=>t.select?t.select(s.loaderData):s.loaderData})}function ye(t){const{select:s,...e}=t;return U({...e,select:n=>s?s(n.loaderDeps):n.loaderDeps})}function ve(t){return U({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:s=>{const e=t.strict===!1?s.params:s._strictParams;return t.select?t.select(e):e}})}function Se(t){return U({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:s=>t.select?t.select(s.search):s.search})}const Mt=typeof window<"u"?b.useLayoutEffect:b.useEffect;function oe(t){const s=b.useRef({value:t,prev:null}),e=s.current.value;return t!==e&&(s.current={value:t,prev:e}),s.current.prev}function Nn(t,s,e={},n={}){b.useEffect(()=>{if(!t.current||n.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([i])=>{s(i)},e);return o.observe(t.current),()=>{o.disconnect()}},[s,e,n.disabled,t])}function Wn(t){const s=b.useRef(null);return b.useImperativeHandle(t,()=>s.current,[]),s}function _e(t){const s=O();return b.useCallback(e=>s.navigate({...e,from:e.from??t?.from}),[t?.from,s])}var we=Ls();const Mo=ue(we);function $n(t,s){const e=O(),[n,o]=b.useState(!1),i=b.useRef(!1),r=Wn(s),{activeProps:a,inactiveProps:c,activeOptions:h,to:d,preload:l,preloadDelay:u,hashScrollIntoView:f,replace:p,startTransition:g,resetScroll:m,viewTransition:y,children:v,target:S,disabled:x,style:L,className:_,onClick:R,onFocus:w,onMouseEnter:C,onMouseLeave:M,onTouchStart:I,ignoreBlocker:F,params:A,search:j,hash:N,state:nt,mask:Ss,reloadDocument:wo,unsafeRelative:Ro,from:xo,_fromLocation:Po,...Re}=t,_s=T({select:E=>E.location.search,structuralSharing:!0}),xe=t.from,ut=b.useMemo(()=>({...t,from:xe}),[e,_s,xe,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),V=b.useMemo(()=>e.buildLocation({...ut}),[e,ut]),_t=b.useMemo(()=>{if(x)return;let E=V.maskedLocation?V.maskedLocation.url:V.url,k=!1;return e.origin&&(E.startsWith(e.origin)?E=e.history.createHref(E.replace(e.origin,""))||"/":k=!0),{href:E,external:k}},[x,V.maskedLocation,V.url,e.origin,e.history]),wt=b.useMemo(()=>{if(_t?.external)return _t.href;try{return new URL(d),d}catch{}},[d,_t]),ot=t.reloadDocument||wt?!1:l??e.options.defaultPreload,Kt=u??e.options.defaultPreloadDelay??0,Ht=T({select:E=>{if(wt)return!1;if(h?.exact){if(!Zs(E.location.pathname,V.pathname,e.basepath))return!1}else{const k=zt(E.location.pathname,e.basepath),W=zt(V.pathname,e.basepath);if(!(k.startsWith(W)&&(k.length===W.length||k[W.length]==="/")))return!1}return(h?.includeSearch??!0)&&!Z(E.location.search,V.search,{partial:!h?.exact,ignoreUndefined:!h?.explicitUndefined})?!1:h?.includeHash?E.location.hash===V.hash:!0}}),Y=b.useCallback(()=>{e.preloadRoute({...ut}).catch(E=>{console.warn(E),console.warn(Ln)})},[e,ut]),ws=b.useCallback(E=>{E?.isIntersecting&&Y()},[Y]);Nn(r,ws,qn,{disabled:!!x||ot!=="viewport"}),b.useEffect(()=>{i.current||!x&&ot==="render"&&(Y(),i.current=!0)},[x,Y,ot]);const Rs=E=>{const k=E.currentTarget.getAttribute("target"),W=S!==void 0?S:k;if(!x&&!Gn(E)&&!E.defaultPrevented&&(!W||W==="_self")&&E.button===0){E.preventDefault(),we.flushSync(()=>{o(!0)});const Le=e.subscribe("onResolved",()=>{Le(),o(!1)});e.navigate({...ut,replace:p,resetScroll:m,hashScrollIntoView:f,startTransition:g,viewTransition:y,ignoreBlocker:F})}};if(wt)return{...Re,ref:r,href:wt,...v&&{children:v},...S&&{target:S},...x&&{disabled:x},...L&&{style:L},..._&&{className:_},...R&&{onClick:R},...w&&{onFocus:w},...C&&{onMouseEnter:C},...M&&{onMouseLeave:M},...I&&{onTouchStart:I}};const Pe=E=>{x||ot&&Y()},xs=Pe,Ps=E=>{if(!(x||!ot))if(!Kt)Y();else{const k=E.target;if(dt.has(k))return;const W=setTimeout(()=>{dt.delete(k),Y()},Kt);dt.set(k,W)}},bs=E=>{if(x||!ot||!Kt)return;const k=E.target,W=dt.get(k);W&&(clearTimeout(W),dt.delete(k))},Rt=Ht?H(a,{})??Un:ie,xt=Ht?ie:H(c,{})??ie,be=[_,Rt.className,xt.className].filter(Boolean).join(" "),Ce=(L||Rt.style||xt.style)&&{...L,...Rt.style,...xt.style};return{...Re,...Rt,...xt,href:_t?.href,ref:r,onClick:ft([R,Rs]),onFocus:ft([w,Pe]),onMouseEnter:ft([C,Ps]),onMouseLeave:ft([M,bs]),onTouchStart:ft([I,xs]),disabled:!!x,target:S,...Ce&&{style:Ce},...be&&{className:be},...x&&Vn,...Ht&&Kn,...n&&Hn}}const ie={},Un={className:"active"},Vn={role:"link","aria-disabled":!0},Kn={"data-status":"active","aria-current":"page"},Hn={"data-transitioning":"transitioning"},dt=new WeakMap,qn={rootMargin:"100px"},ft=t=>s=>{for(const e of t)if(e){if(s.defaultPrevented)return;e(s)}},ms=b.forwardRef((t,s)=>{const{_asChild:e,...n}=t,{type:o,ref:i,...r}=$n(n,s),a=typeof n.children=="function"?n.children({isActive:r["data-status"]==="active"}):n.children;return e===void 0&&delete r.disabled,b.createElement(e||"a",{...r,ref:i},a)});function Gn(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Jn extends ds{constructor(s){super(s),this.useMatch=e=>U({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({...e,from:this.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ye({...e,from:this.id}),this.useLoaderData=e=>ge({...e,from:this.id}),this.useNavigate=()=>_e({from:this.fullPath}),this.Link=at.forwardRef((e,n)=>P.jsx(ms,{ref:n,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Yn(t){return new Jn(t)}class Xn extends Mn{constructor(s){super(s),this.useMatch=e=>U({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({...e,from:this.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ye({...e,from:this.id}),this.useLoaderData=e=>ge({...e,from:this.id}),this.useNavigate=()=>_e({from:this.fullPath}),this.Link=at.forwardRef((e,n)=>P.jsx(ms,{ref:n,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function Io(t){return new Xn(t)}function Ue(t){return typeof t=="object"?new Ve(t,{silent:!0}).createRoute(t):new Ve(t,{silent:!0}).createRoute}class Ve{constructor(s,e){this.path=s,this.createRoute=n=>{this.silent;const o=Yn(n);return o.isRoot=!1,o},this.silent=e?.silent}}class Ke{constructor(s){this.useMatch=e=>U({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>U({from:this.options.id,select:n=>e?.select?e.select(n.context):n.context}),this.useSearch=e=>Se({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>ve({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>ye({...e,from:this.options.id}),this.useLoaderData=e=>ge({...e,from:this.options.id}),this.useNavigate=()=>{const e=O();return _e({from:e.routesById[this.options.id].fullPath})},this.options=s,this.$$typeof=Symbol.for("react.memo")}}function He(t){return typeof t=="object"?new Ke(t):s=>new Ke({id:t,...s})}function Zn(){const t=O(),s=b.useRef({router:t,mounted:!1}),[e,n]=b.useState(!1),{hasPendingMatches:o,isLoading:i}=T({select:l=>({isLoading:l.isLoading,hasPendingMatches:l.matches.some(u=>u.status==="pending")}),structuralSharing:!0}),r=oe(i),a=i||e||o,c=oe(a),h=i||o,d=oe(h);return t.startTransition=l=>{n(!0),b.startTransition(()=>{l(),n(!1)})},b.useEffect(()=>{const l=t.history.subscribe(t.load),u=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Q(t.latestLocation.href)!==Q(u.href)&&t.commitLocation({...u,replace:!0}),()=>{l()}},[t,t.history]),Mt(()=>{if(typeof window<"u"&&t.ssr||s.current.router===t&&s.current.mounted)return;s.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(u){console.error(u)}})()},[t]),Mt(()=>{r&&!i&&t.emit({type:"onLoad",...tt(t.state)})},[r,t,i]),Mt(()=>{d&&!h&&t.emit({type:"onBeforeRouteMount",...tt(t.state)})},[h,d,t]),Mt(()=>{if(c&&!a){const l=tt(t.state);t.emit({type:"onResolved",...l}),t.__store.setState(u=>({...u,status:"idle",resolvedLocation:u.location})),l.hrefChanged&&an(t)}},[a,c,t]),null}function Qn(t){const s=T({select:e=>`not-found-${e.location.pathname}-${e.status}`});return P.jsx(me,{getResetKey:()=>s,onCatch:(e,n)=>{if(D(e))t.onCatch?.(e,n);else throw e},errorComponent:({error:e})=>{if(D(e))return t.fallback?.(e);throw e},children:t.children})}function to(){return P.jsx("p",{children:"Not Found"})}function rt(t){return P.jsx(P.Fragment,{children:t.children})}function gs(t,s,e){return s.options.notFoundComponent?P.jsx(s.options.notFoundComponent,{...e}):t.options.defaultNotFoundComponent?P.jsx(t.options.defaultNotFoundComponent,{...e}):P.jsx(to,{})}function eo({children:t}){const s=O();return s.isServer?P.jsx("script",{nonce:s.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:t+';typeof $_TSR !== "undefined" && $_TSR.c()'}}):null}function so(){const t=O();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const e=(t.options.getScrollRestorationKey||ae)(t.latestLocation),n=e!==ae(t.latestLocation)?e:void 0,o={storageKey:Dt,shouldScrollRestoration:!0};return n&&(o.key=n),P.jsx(eo,{children:`(${ss.toString()})(${JSON.stringify(o)})`})}const ys=b.memo(function({matchId:s}){const e=O(),n=T({select:y=>{const v=y.matches.find(S=>S.id===s);return K(v),{routeId:v.routeId,ssr:v.ssr,_displayPending:v._displayPending}},structuralSharing:!0}),o=e.routesById[n.routeId],i=o.options.pendingComponent??e.options.defaultPendingComponent,r=i?P.jsx(i,{}):null,a=o.options.errorComponent??e.options.defaultErrorComponent,c=o.options.onCatch??e.options.defaultOnCatch,h=o.isRoot?o.options.notFoundComponent??e.options.notFoundRoute?.options.component:o.options.notFoundComponent,d=n.ssr===!1||n.ssr==="data-only",l=(!o.isRoot||o.options.wrapInSuspense||d)&&(o.options.wrapInSuspense??i??(o.options.errorComponent?.preload||d))?b.Suspense:rt,u=a?me:rt,f=h?Qn:rt,p=T({select:y=>y.loadedAt}),g=T({select:y=>{const v=y.matches.findIndex(S=>S.id===s);return y.matches[v-1]?.routeId}}),m=o.isRoot?o.options.shellComponent??rt:rt;return P.jsxs(m,{children:[P.jsx(Vt.Provider,{value:s,children:P.jsx(l,{fallback:r,children:P.jsx(u,{getResetKey:()=>p,errorComponent:a||Ut,onCatch:(y,v)=>{if(D(y))throw y;c?.(y,v)},children:P.jsx(f,{fallback:y=>{if(!h||y.routeId&&y.routeId!==n.routeId||!y.routeId&&!o.isRoot)throw y;return b.createElement(h,y)},children:d||n._displayPending?P.jsx(En,{fallback:r,children:P.jsx(qe,{matchId:s})}):P.jsx(qe,{matchId:s})})})})}),g===B&&e.options.scrollRestoration?P.jsxs(P.Fragment,{children:[P.jsx(no,{}),P.jsx(so,{})]}):null]})});function no(){const t=O(),s=b.useRef(void 0);return P.jsx("script",{suppressHydrationWarning:!0,ref:e=>{e&&(s.current===void 0||s.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...tt(t.state)}),s.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const qe=b.memo(function({matchId:s}){const e=O(),{match:n,key:o,routeId:i}=T({select:c=>{const h=c.matches.find(p=>p.id===s),d=h.routeId,u=(e.routesById[d].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:d,loaderDeps:h.loaderDeps,params:h._strictParams,search:h._strictSearch});return{key:u?JSON.stringify(u):void 0,routeId:d,match:{id:h.id,status:h.status,error:h.error,_forcePending:h._forcePending,_displayPending:h._displayPending}}},structuralSharing:!0}),r=e.routesById[i],a=b.useMemo(()=>{const c=r.options.component??e.options.defaultComponent;return c?P.jsx(c,{},o):P.jsx(oo,{})},[o,r.options.component,e.options.defaultComponent]);if(n._displayPending)throw e.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw e.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const c=r.options.pendingMinMs??e.options.defaultPendingMinMs;if(c){const h=e.getMatch(n.id);if(h&&!h._nonReactive.minPendingPromise&&!e.isServer){const d=ct();h._nonReactive.minPendingPromise=d,setTimeout(()=>{d.resolve(),h._nonReactive.minPendingPromise=void 0},c)}}throw e.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return K(D(n.error)),gs(e,r,n.error);if(n.status==="redirected")throw K($(n.error)),e.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error"){if(e.isServer){const c=(r.options.errorComponent??e.options.defaultErrorComponent)||Ut;return P.jsx(c,{error:n.error,reset:void 0,info:{componentStack:""}})}throw n.error}return a}),oo=b.memo(function(){const s=O(),e=b.useContext(Vt),n=T({select:h=>h.matches.find(d=>d.id===e)?.routeId}),o=s.routesById[n],i=T({select:h=>{const l=h.matches.find(u=>u.id===e);return K(l),l.globalNotFound}}),r=T({select:h=>{const d=h.matches,l=d.findIndex(u=>u.id===e);return d[l+1]?.id}}),a=s.options.defaultPendingComponent?P.jsx(s.options.defaultPendingComponent,{}):null;if(i)return gs(s,o,void 0);if(!r)return null;const c=P.jsx(ys,{matchId:r});return n===B?P.jsx(b.Suspense,{fallback:a,children:c}):c});function io(){const t=O(),e=t.routesById[B].options.pendingComponent??t.options.defaultPendingComponent,n=e?P.jsx(e,{}):null,o=t.isServer||typeof document<"u"&&t.ssr?rt:b.Suspense,i=P.jsxs(o,{fallback:n,children:[!t.isServer&&P.jsx(Zn,{}),P.jsx(ro,{})]});return t.options.InnerWrap?P.jsx(t.options.InnerWrap,{children:i}):i}function ro(){const t=O(),s=T({select:o=>o.matches[0]?.id}),e=T({select:o=>o.loadedAt}),n=s?P.jsx(ys,{matchId:s}):null;return P.jsx(Vt.Provider,{value:s,children:t.options.disableGlobalCatchBoundary?n:P.jsx(me,{getResetKey:()=>e,errorComponent:Ut,onCatch:o=>{o.message||o.toString()},children:n})})}function Eo(){const t=O();return T({select:s=>[s.location.href,s.resolvedLocation?.href,s.status],structuralSharing:!0}),b.useCallback(s=>{const{pending:e,caseSensitive:n,fuzzy:o,includeSearch:i,...r}=s;return t.matchRoute(r,{pending:e,caseSensitive:n,fuzzy:o,includeSearch:i})},[t])}const ko=t=>new ao(t);class ao extends Rn{constructor(s){super(s)}}typeof globalThis<"u"?(globalThis.createFileRoute=Ue,globalThis.createLazyFileRoute=He):typeof window<"u"&&(window.createFileRoute=Ue,window.createLazyFileRoute=He);function co({router:t,children:s,...e}){Object.keys(e).length>0&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});const n=ps(),o=P.jsx(n.Provider,{value:t,children:s});return t.options.Wrap?P.jsx(t.options.Wrap,{children:o}):o}function To({router:t,...s}){return P.jsx(co,{router:t,...s,children:P.jsx(io,{})})}function it(t,s,e){let n=e.initialDeps??[],o,i=!0;function r(){var a,c,h;let d;e.key&&((a=e.debug)!=null&&a.call(e))&&(d=Date.now());const l=t();if(!(l.length!==n.length||l.some((p,g)=>n[g]!==p)))return o;n=l;let f;if(e.key&&((c=e.debug)!=null&&c.call(e))&&(f=Date.now()),o=s(...l),e.key&&((h=e.debug)!=null&&h.call(e))){const p=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-f)*100)/100,m=g/16,y=(v,S)=>{for(v=String(v);v.length{n=a},r}function Ge(t,s){if(t===void 0)throw new Error("Unexpected undefined");return t}const lo=(t,s)=>Math.abs(t-s)<1.01,uo=(t,s,e)=>{let n;return function(...o){t.clearTimeout(n),n=t.setTimeout(()=>s.apply(this,o),e)}},Je=t=>{const{offsetWidth:s,offsetHeight:e}=t;return{width:s,height:e}},ho=t=>t,fo=t=>{const s=Math.max(t.startIndex-t.overscan,0),e=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let o=s;o<=e;o++)n.push(o);return n},po=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;const o=r=>{const{width:a,height:c}=r;s({width:Math.round(a),height:Math.round(c)})};if(o(Je(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(r=>{const a=()=>{const c=r[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){o({width:h.inlineSize,height:h.blockSize});return}}o(Je(e))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},Ye={passive:!0},Xe=typeof window>"u"?!0:"onscrollend"in window,mo=(t,s)=>{const e=t.scrollElement;if(!e)return;const n=t.targetWindow;if(!n)return;let o=0;const i=t.options.useScrollendEvent&&Xe?()=>{}:uo(n,()=>{s(o,!1)},t.options.isScrollingResetDelay),r=d=>()=>{const{horizontal:l,isRtl:u}=t.options;o=l?e.scrollLeft*(u&&-1||1):e.scrollTop,i(),s(o,d)},a=r(!0),c=r(!1);c(),e.addEventListener("scroll",a,Ye);const h=t.options.useScrollendEvent&&Xe;return h&&e.addEventListener("scrollend",c,Ye),()=>{e.removeEventListener("scroll",a),h&&e.removeEventListener("scrollend",c)}},go=(t,s,e)=>{if(s?.borderBoxSize){const n=s.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return t[e.options.horizontal?"offsetWidth":"offsetHeight"]},yo=(t,{adjustments:s=0,behavior:e},n)=>{var o,i;const r=t+s;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:r,behavior:e})};class vo{constructor(s){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const r=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ho,rangeExtractor:fo,onChange:()=>{},measureElement:go,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=it(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let r=n-1;r>=0;r--){const a=e[r];if(o.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.endr.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=it(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,r,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a}),{key:!1,skipInitialOnChange:!0,onChange:()=>{this.notify(this.isScrolling)}}),this.getMeasurements=it(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:a},c)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const u of this.laneAssignments.keys())u>=e&&this.laneAssignments.delete(u);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const h=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,h),l=new Array(a).fill(void 0);for(let u=0;u1){g=p;const x=l[g],L=x!==void 0?d[x]:void 0;m=L?L.end+this.options.gap:n+o}else{const x=this.options.lanes===1?d[u-1]:this.getFurthestMeasurement(d,u);m=x?x.end+this.options.gap:n+o,g=x?x.lane:u%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(u,g)}const y=c.get(f),v=typeof y=="number"?y:this.options.estimateSize(u),S=m+v;d[u]={index:u,start:m,size:v,end:S,key:f,lane:g},l[g]=u}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=it(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?So({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=it(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,r)=>i===null||r===null?[]:e({startIndex:i,endIndex:r,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(e,n)=>{const o=this.indexFromElement(e),i=this.measurementsCache[o];if(!i)return;const r=i.key,a=this.elementsCache.get(r);a!==e&&(a&&this.observer.unobserve(a),this.observer.observe(e),this.elementsCache.set(r,e)),e.isConnected&&this.resizeItem(o,this.options.measureElement(e,n,this))},this.resizeItem=(e,n)=>{const o=this.measurementsCache[e];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,r=n-i;r!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,r,this):o.start{if(!e){this.elementsCache.forEach((n,o)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(o))});return}this._measureElement(e,void 0)},this.getVirtualItems=it(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,r=e.length;ithis.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Ge(n[vs(0,n.length-1,o=>Ge(n[o]).start,e)])},this.getOffsetForAlignment=(e,n,o=0)=>{const i=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const a=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.measurementsCache[e];if(!o)return;const i=this.getSize(),r=this.getScrollOffset();if(n==="auto")if(o.end>=r+i-this.options.scrollPaddingEnd)n="end";else if(o.start<=r+this.options.scrollPaddingStart)n="start";else return[r,n];const a=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,o.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:n="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,n),{adjustments:void 0,behavior:o})},this.scrollToIndex=(e,{align:n="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let i=0;const r=10,a=h=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(e,h);if(!d){console.warn("Failed to get offset for index:",e);return}const[l,u]=d;this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const f=this.getScrollOffset(),p=this.getOffsetForIndex(e,u);if(!p){console.warn("Failed to get offset for index:",e);return}lo(p[0],f)||c(u)})},c=h=>{this.targetWindow&&(i++,ia(h)):console.warn(`Failed to scroll to index ${e} after ${r} attempts.`))};a(n)},this.scrollBy=(e,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&i.some(a=>a===null);){const a=n[r];i[a.lane]===null&&(i[a.lane]=a.end),r--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(s)}}const vs=(t,s,e,n)=>{for(;t<=s;){const o=(t+s)/2|0,i=e(o);if(in)s=o-1;else return o}return t>0?t-1:0};function So({measurements:t,outerSize:s,scrollOffset:e,lanes:n}){const o=t.length-1,i=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:o};let r=vs(0,o,i,e),a=r;if(n===1)for(;a1){const c=Array(n).fill(0);for(;ad=0&&h.some(d=>d>=e);){const d=t[r];h[d.lane]=d.start,r--}r=Math.max(0,r-r%n),a=Math.min(o,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Ze=typeof document<"u"?b.useLayoutEffect:b.useEffect;function _o(t){const s=b.useReducer(()=>({}),{})[1],e={...t,onChange:(o,i)=>{var r;i?we.flushSync(s):s(),(r=t.onChange)==null||r.call(t,o,i)}},[n]=b.useState(()=>new vo(e));return n.setOptions(e),Ze(()=>n._didMount(),[]),Ze(()=>n._willUpdate()),n}function Oo(t){return _o({observeElementRect:po,observeElementOffset:mo,scrollToFn:yo,...t})}export{ms as L,oo as O,at as R,Co as a,we as b,Mo as c,Fn as d,_e as e,Oo as f,Se as g,Eo as h,K as i,P as j,Io as k,Yn as l,ko as m,pn as n,To as o,b as r,Lo as u,fs as w}; diff --git a/webui/dist/assets/uppy-DFP_VzYR.js b/webui/dist/assets/uppy-DFP_VzYR.js deleted file mode 100644 index 9dad4932..00000000 --- a/webui/dist/assets/uppy-DFP_VzYR.js +++ /dev/null @@ -1,11 +0,0 @@ -import{g as re}from"./react-vendor-BmxF9s7Q.js";import{r as Ti,a as gs,b as ys}from"./reactflow-DtsZHOR4.js";import"./router-9vIXuQkh.js";import"./charts-simvewUa.js";import"./radix-extra-DmmnfeQE.js";const bs=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function vs(i,e,t){const s=bs.exec(i),n=e.mimeType??s?.[1]??"plain/text";let r;if(s?.[2]!=null){const a=atob(decodeURIComponent(s[3])),o=new Uint8Array(a.length);for(let d=0;d(e+=`-${_s(t)}`,"/"))+e}function Fs(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Nt(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Nt(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ss(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Ts(i,e){if(Ss(i))return i.id;const t=ki(i);return Fs({...i,type:t},e)}const ue=Array.from;function Ps(i){const e=ue(i.files);return Promise.resolve(e)}function Ai(i,e,t,{onSuccess:s}){i.readEntries(n=>{const r=[...e,...n];n.length?queueMicrotask(()=>{Ai(i,r,t,{onSuccess:s})}):s(r)},n=>{t(n),s(e)})}function Oi(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,s)=>i.file(t,s))},async*values(){const t=i.createReader();yield*await new Promise(n=>{Ai(t,[],e,{onSuccess:r=>n(r.map(a=>Oi(a,e)))})})},isSameEntry:void 0}}async function*Ui(i,e,t=void 0){const s=()=>`${e}/${i.name}`;if(i.kind==="file"){const n=await i.getFile();n!=null?(n.relativePath=e?s():null,yield n):t!=null&&(yield t)}else if(i.kind==="directory")for await(const n of i.values())yield*Ui(n,e?s():i.name);else t!=null&&(yield t)}async function*Cs(i,e){const t=await Promise.all(Array.from(i.items,async s=>{let n;return n??=Oi(typeof s.getAsEntry=="function"?s.getAsEntry():s.webkitGetAsEntry(),e),{fileSystemHandle:n,lastResortFile:s.getAsFile()}}));for(const{lastResortFile:s,fileSystemHandle:n}of t)if(n!=null)try{yield*Ui(n,"",s)}catch(r){s!=null?yield s:e(r)}else s!=null&&(yield s)}async function Es(i,e){const t=e?.logDropError??Function.prototype;try{const s=[];for await(const n of Cs(i,t))s.push(n);return s}catch{return Ps(i)}}function ks(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}function Me(i){return i<10?`0${i}`:i.toString()}function Oe(){const i=new Date,e=Me(i.getHours()),t=Me(i.getMinutes()),s=Me(i.getSeconds());return`${e}:${t}:${s}`}function As(){if(typeof window>"u")return!1;const i=document.body;return!(i==null||window==null||!("draggable"in i)||!("ondragstart"in i)||!("ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}function Dt(i){return i.startsWith("blob:")}function It(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function Os(i){const e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,s=Math.floor(i%60);return{hours:e,minutes:t,seconds:s}}function Us(i){const e=Os(i),t=e.hours===0?"":`${e.hours}h`,s=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,n=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${s}${n}`}function Ns(i,e,t){const s=[];return i.forEach(n=>typeof n!="string"?s.push(n):e[Symbol.split](n).forEach((r,a,o)=>{r!==""&&s.push(r),a{throw new Error(`missing string: ${i}`)};class Ni{locale;constructor(e,{onMissingKey:t=Ds}={}){this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let s=this.locale.strings[e];if(s==null&&(this.#e(e),s=e),typeof s=="object"){if(t&&typeof t.smart_count<"u"){const r=this.locale.pluralize(t.smart_count);return xt(s[r],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof s!="string")throw new Error("string was not a string");return xt(s,t)}}const Be="...";function Di(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Be.length+1)return`${i.slice(0,e-1)}…`;const t=e-Be.length,s=Math.ceil(t/2),n=Math.floor(t/2);return i.slice(0,s)+Be+i.slice(-n)}var ye,T,Ii,Q,Mt,xi,Mi,Bi,ut,tt,it,ce={},Ri=[],Is=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,be=Array.isArray;function V(i,e){for(var t in e)i[t]=e[t];return i}function ht(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function ct(i,e,t){var s,n,r,a={};for(r in e)r=="key"?s=e[r]:r=="ref"?n=e[r]:a[r]=e[r];if(arguments.length>2&&(a.children=arguments.length>3?ye.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(r in i.defaultProps)a[r]===void 0&&(a[r]=i.defaultProps[r]);return he(i,a,s,n,null)}function he(i,e,t,s,n){var r={type:i,props:e,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Ii,__i:-1,__u:0};return n==null&&T.vnode!=null&&T.vnode(r),r}function xs(){return{current:null}}function G(i){return i.children}function W(i,e){this.props=i,this.context=e}function se(i,e){if(e==null)return i.__?se(i.__,i.__i+1):null;for(var t;eo&&Q.sort(Mi),i=Q.shift(),o=Q.length,i.__d&&(t=void 0,s=void 0,n=(s=(e=i).__v).__e,r=[],a=[],e.__P&&((t=V({},s)).__v=s.__v+1,T.vnode&&T.vnode(t),pt(e.__P,t,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??se(s),!!(32&s.__u),a),t.__v=s.__v,t.__.__k[t.__i]=t,Hi(r,t,a),s.__e=s.__=null,t.__e!=n&&Li(t)));Ne.__r=0}function zi(i,e,t,s,n,r,a,o,d,u,c){var h,p,f,m,y,v,b,g=s&&s.__k||Ri,w=e.length;for(d=Ms(t,e,g,d,w),h=0;h0?he(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=i,a.__b=i.__b+1,o=null,(u=a.__i=Bs(a,t,d,h))!=-1&&(h--,(o=t[u])&&(o.__u|=2)),o==null||o.__v==null?(u==-1&&(n>c?p--:nd?p--:p++,a.__u|=4))):i.__k[r]=null;if(h)for(r=0;r(c?1:0)){for(n=t-1,r=t+1;n>=0||r=0?n--:r++])!=null&&(2&u.__u)==0&&o==u.key&&d==u.type)return a}return-1}function Rt(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Is.test(e)?t:t+"px"}function we(i,e,t,s,n){var r,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof s=="string"&&(i.style.cssText=s=""),s)for(e in s)t&&e in t||Rt(i.style,e,"");if(t)for(e in t)s&&t[e]==s[e]||Rt(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Bi,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+r]=t,t?s?t.u=s.u:(t.u=ut,i.addEventListener(e,r?it:tt,r)):i.removeEventListener(e,r?it:tt,r);else{if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Lt(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=ut++;else if(e.t0?i:be(i)?i.map(qi):V({},i)}function Rs(i,e,t,s,n,r,a,o,d){var u,c,h,p,f,m,y,v=t.props,b=e.props,g=e.type;if(g=="svg"?n="http://www.w3.org/2000/svg":g=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u2&&(o.children=arguments.length>3?ye.call(arguments,2):t),he(i.type,o,s||i.key,n||i.ref,null)}ye=Ri.slice,T={__e:function(i,e,t,s){for(var n,r,a;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(i)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,s||{}),a=n.__d),a)return n.__E=n}catch(o){i=o}throw i}},Ii=0,W.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=V({},this.state),typeof i=="function"&&(i=i(V({},t),this.props)),i&&V(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Bt(this))},W.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Bt(this))},W.prototype.render=G,Q=[],xi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mi=function(i,e){return i.__v.__b-e.__v.__b},Ne.__r=0,Bi=/(PointerCapture)$|Capture$/i,ut=0,tt=Lt(!1),it=Lt(!0);var zs=0;function l(i,e,t,s,n,r){e||(e={});var a,o,d=e;if("ref"in d)for(o in d={},e)o=="ref"?a=e[o]:d[o]=e[o];var u={type:i,props:d,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zs,__i:-1,__u:0,__source:n,__self:r};if(typeof i=="function"&&(a=i.defaultProps))for(o in a)d[o]===void 0&&(d[o]=a[o]);return T.vnode&&T.vnode(u),u}var pe,k,Re,$t,fe=0,Wi=[],O=T,Ht=O.__b,qt=O.__r,jt=O.diffed,Vt=O.__c,Wt=O.unmount,Gt=O.__;function mt(i,e){O.__h&&O.__h(k,i,fe||e),fe=0;var t=k.__H||(k.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function ne(i){return fe=1,$s(Ki,i)}function $s(i,e,t){var s=mt(pe++,2);if(s.t=i,!s.__c&&(s.__=[Ki(void 0,e),function(o){var d=s.__N?s.__N[0]:s.__[0],u=s.t(d,o);d!==u&&(s.__N=[u,s.__[1]],s.__c.setState({}))}],s.__c=k,!k.__f)){var n=function(o,d,u){if(!s.__c.__H)return!0;var c=s.__c.__H.__.filter(function(p){return!!p.__c});if(c.every(function(p){return!p.__N}))return!r||r.call(this,o,d,u);var h=s.__c.props!==o;return c.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(h=!0)}}),r&&r.call(this,o,d,u)||h};k.__f=!0;var r=k.shouldComponentUpdate,a=k.componentWillUpdate;k.componentWillUpdate=function(o,d,u){if(this.__e){var c=r;r=void 0,n(o,d,u),r=c}a&&a.call(this,o,d,u)},k.shouldComponentUpdate=n}return s.__N||s.__}function De(i,e){var t=mt(pe++,3);!O.__s&&Gi(t.__H,e)&&(t.__=i,t.u=e,k.__H.__h.push(t))}function ie(i){return fe=5,gt(function(){return{current:i}},[])}function gt(i,e){var t=mt(pe++,7);return Gi(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Ie(i,e){return fe=8,gt(function(){return i},e)}function Hs(){for(var i;i=Wi.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Ue),i.__H.__h.forEach(nt),i.__H.__h=[]}catch(e){i.__H.__h=[],O.__e(e,i.__v)}}O.__b=function(i){k=null,Ht&&Ht(i)},O.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Gt&&Gt(i,e)},O.__r=function(i){qt&&qt(i),pe=0;var e=(k=i.__c).__H;e&&(Re===k?(e.__h=[],k.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Ue),e.__h.forEach(nt),e.__h=[],pe=0)),Re=k},O.diffed=function(i){jt&&jt(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Wi.push(e)!==1&&$t===O.requestAnimationFrame||(($t=O.requestAnimationFrame)||qs)(Hs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Re=k=null},O.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Ue),t.__h=t.__h.filter(function(s){return!s.__||nt(s)})}catch(s){e.some(function(n){n.__h&&(n.__h=[])}),e=[],O.__e(s,t.__v)}}),Vt&&Vt(i,e)},O.unmount=function(i){Wt&&Wt(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(s){try{Ue(s)}catch(n){e=n}}),t.__H=void 0,e&&O.__e(e,t.__v))};var Kt=typeof requestAnimationFrame=="function";function qs(i){var e,t=function(){clearTimeout(s),Kt&&cancelAnimationFrame(e),setTimeout(i)},s=setTimeout(t,35);Kt&&(e=requestAnimationFrame(t))}function Ue(i){var e=k,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),k=e}function nt(i){var e=k;i.__c=i.__(),k=e}function Gi(i,e){return!i||i.length!==e.length||e.some(function(t,s){return t!==i[s]})}function Ki(i,e){return typeof e=="function"?e(i):e}const js={position:"relative",width:"100%",minHeight:"100%"},Vs={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function Ws({data:i,rowHeight:e,renderRow:t,overscanCount:s=10,padding:n=4,...r}){const a=ie(null),[o,d]=ne(0),[u,c]=ne(0);De(()=>{function g(){a.current!=null&&u!==a.current.offsetHeight&&c(a.current.offsetHeight)}return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[u]);const h=Ie(()=>{a.current&&d(a.current.scrollTop)},[]);let p=Math.floor(o/e),f=Math.floor(u/e);s&&(p=Math.max(0,p-p%s),f+=s);const m=p+f+n,y=i.slice(p,m),v={...js,height:i.length*e},b={...Vs,top:p*e};return l("div",{onScroll:h,ref:a,...r,children:l("div",{role:"presentation",style:v,children:l("div",{role:"presentation",style:b,children:y.map(t)})})})}class Gs{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new Ni([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}const Ks={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)},Xs={debug:(...i)=>console.debug(`[Uppy] [${Oe()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Oe()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)};var Le,Xt;function Ys(){return Xt||(Xt=1,Le=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0;let s=Math.abs(e);if(t&&(s=-s),s===0)return"0 B";const n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.min(Math.floor(Math.log(s)/Math.log(1024)),n.length-1),a=Number(s/1024**r),o=n[r];return`${a>=10||a%1===0?Math.round(a):a.toFixed(1)} ${o}`}),Le}var Qs=Ys();const J=re(Qs);var ze,Yt;function Js(){if(Yt)return ze;Yt=1;function i(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return i.prototype.match=function(e){var t=!0,s=this.parts,n,r=s.length,a;if(typeof e=="string"||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(a=(e||"").split(this.separator),n=0;t&&n=2}return s?n(s.split(";")[0]):n},$e}var en=Zs();const tn=re(en),sn={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class R extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0}class nn{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{const s=e();if(s.restrictions?.allowedFileTypes!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:s,maxNumberOfFiles:n}=this.getOpts().restrictions;if(n&&e.filter(a=>!a.isGhost).length+t.length>n)throw new R(`${this.getI18n()("youCanOnlyUploadX",{smart_count:n})}`);if(s){const r=[...e,...t].reduce((a,o)=>a+(o.size??0),0);if(r>s)throw new R(this.getI18n()("aggregateExceedsSize",{sizeAllowed:J(s),size:J(r)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:s,allowedFileTypes:n}=this.getOpts().restrictions;if(n&&!n.some(a=>a.includes("/")?e.type?tn(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){const a=n.join(", ");throw new R(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new R(this.getI18n()("exceedsSize",{size:J(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(s&&e.size!=null&&e.size{this.validateSingleFile(s)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length(t=s,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}class me extends Gs{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof me||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:me}}));else if(typeof e=="function"){const s=e;this.uppy.iteratePlugins(n=>{n instanceof s&&(t=n)})}return t}mount(e,t){const s=t.id,n=ws(e);if(n){this.isTargetDOMEl=!0;const o=document.createElement("div");return o.classList.add("uppy-Root"),this.#e=rn(d=>{this.uppy.getPlugin(this.id)&&(zt(this.render(d,o),o),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(n.innerHTML=""),zt(this.render(this.uppy.getState(),o),o),this.el=o,n.appendChild(o),o.dir=this.opts.direction||ks(o)||"ltr",this.onMount(),this.el}const r=this.getTargetPlugin(e);if(r)return this.uppy.log(`Installing ${s} to ${r.id}`),this.parent=r,this.el=r.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let a=`Invalid target option given to ${s}.`;throw typeof e=="function"?a+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":a+="If you meant to target an HTML element, please make sure that the element exists. Check that the - - - - - - - - - - - - - - - - -
- - diff --git a/webui/dist/maimai.ico b/webui/dist/maimai.ico deleted file mode 100644 index 3c1b131e..00000000 Binary files a/webui/dist/maimai.ico and /dev/null differ