diff --git a/.superpowers/brainstorm/1236-1782196029/content/overall-layout.html b/.superpowers/brainstorm/1236-1782196029/content/overall-layout.html new file mode 100644 index 0000000..29f8766 --- /dev/null +++ b/.superpowers/brainstorm/1236-1782196029/content/overall-layout.html @@ -0,0 +1,134 @@ +

整体布局方案

+

左侧双面板(笔记 + 网站管理) + 右侧内容区,类似飞书文档的简洁风格

+ +
+
MoKeeText — Web 记事本整体布局
+
+
+ + +
+ + +
+
📝 笔记
+
🔐 网站
+
+ + +
+ + +
+ +
+ + + + + +
+
文件夹
+ +
+ 📁 全部笔记 12 +
+ +
+ 📂 工作 5 +
+ +
+ 📂 个人 4 +
+ +
+ 📂 学习笔记 3 +
+ +
标签
+
+ python + mysql + 前端 + 部署 +
+
+
+
+ + +
+ + +
+
+ 📄 MySQL 索引优化笔记 + 已自动保存 +
+
+ 🏷️ python + 🏷️ mysql + +
+
+ + +
+ +
+
Markdown 编辑
+
+ # MySQL 索引优化

+ ## B+Tree 索引原理

+ ### 聚簇索引 vs 二级索引

+ - 聚簇索引的叶子节点存储整行数据
+ - 二级索引叶子节点存储主键值
+ - 回表查询通过二级索引找到主键
+   再到聚簇索引查找完整行

+ ## 最左前缀原则

+ 联合索引 (a, b, c) 等价于:
+ - 索引 a
+ - 索引 (a, b)
+ - 索引 (a, b, c)

+ // 无法使用索引的情况:
+ WHERE b = 1   // 跳过了 a
+ WHERE c = 1   // 跳过了 a, b +
+
+ +
+
预览
+
+

MySQL 索引优化

+

B+Tree 索引原理

+

聚簇索引 vs 二级索引

+
    +
  • 聚簇索引的 叶子节点存储整行数据
  • +
  • 二级索引叶子节点存储 主键值
  • +
  • 回表查询通过二级索引找到主键再到聚簇索引查找完整行
  • +
+

最左前缀原则

+

联合索引 (a, b, c) 等价于:

+
    +
  • 索引 a
  • +
  • 索引 (a, b)
  • +
  • 索引 (a, b, c)
  • +
+
+
+
+
+ +
+
+
+ +
+ 布局说明: + +
diff --git a/.superpowers/brainstorm/1236-1782196029/state/server-stopped b/.superpowers/brainstorm/1236-1782196029/state/server-stopped new file mode 100644 index 0000000..b7cfb47 --- /dev/null +++ b/.superpowers/brainstorm/1236-1782196029/state/server-stopped @@ -0,0 +1 @@ +{"reason":"idle timeout","timestamp":1782197830107} diff --git a/.superpowers/brainstorm/1236-1782196029/state/server.pid b/.superpowers/brainstorm/1236-1782196029/state/server.pid new file mode 100644 index 0000000..3961fb4 --- /dev/null +++ b/.superpowers/brainstorm/1236-1782196029/state/server.pid @@ -0,0 +1 @@ +1236 diff --git a/.superpowers/brainstorm/1938-1782198423/content/editor-comparison.html b/.superpowers/brainstorm/1938-1782198423/content/editor-comparison.html new file mode 100644 index 0000000..7445f75 --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/content/editor-comparison.html @@ -0,0 +1,113 @@ +

编辑器选型 — 你要的是哪种?

+

Markdown 原生有限,增强型编辑器才能满足图片/颜色/表情需求

+ +
+ +
+
+

🌟 增强型编辑器(推荐)— Tiptap / Milkdown

+

所见即所得,像飞书/Notion 一样。支持所有你想要的。

+ +
+ +
+ H1 + H2 + H3 + + B + I + S + + 🎨 文字颜色 + 🏷 背景色 + + 🖼 图片 + 😊 表情 + 📎 附件 + + 📋 表格 + 💻 代码块 + 📋 列表 + ✅ 任务 +
+ +
+

MySQL 索引优化

+

聚簇索引的 叶子节点存储整行数据

+

⚠ 回表查询会导致性能问题

+

示例代码:

+ SELECT * FROM users WHERE name = 'Tom' +

😊😂🔥✨💯 🖼️ [架构图.png]

+
+
+
+
+ + +
+
+

📝 纯 Markdown — EasyMDE / SimpleMDE

+

经典 Markdown 编辑器,简洁但功能受限。

+ +
+
+ B + I + H + 🖼 + 🔗 + 📋 +
+
+ // 纯文本,没有颜色
+ // 图片要手动填URL
+ // 表情只能用Unicode

+ # MySQL 索引优化

+ **回表查询**会导致性能问题

+ ![架构图](https://xxx.com/img.png)

+ 😊😂🔥 +
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
功能🌟 增强型📝 纯 Markdown
文字颜色 / 背景色
插入图片(上传/粘贴)✅ 直接粘贴/拖拽⚠ 手动写URL
表情面板✅ 选择器⚠ 快捷键
表格编辑✅ 可视化⚠ 手写语法
代码高亮
+
+ +
+ 💡 建议选增强型:Tiptap 是现代 Web 编辑器的事实标准,飞书/Notion 级别的体验。支持 Markdown 快捷输入(打 # 自动变标题),同时拥有完整的格式化工具栏。完全满足你"设置文字颜色、插入图片表情"的需求。 +
diff --git a/.superpowers/brainstorm/1938-1782198423/content/layout-v2.html b/.superpowers/brainstorm/1938-1782198423/content/layout-v2.html new file mode 100644 index 0000000..472fef2 --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/content/layout-v2.html @@ -0,0 +1,169 @@ +

布局 v2 — 笔记和网站管理分开

+

顶部导航切换「笔记」/「网站管理」,各自有独立的侧边栏和内容区

+ + +
+
📝 笔记视图 — 纯编辑模式(预览已关闭)
+
+
+ + +
+ 📝 MoKeeText + 📝 笔记 + 🔐 网站管理 + + 个人版 +
+ +
+ + +
+ + + +
+
📁 文件夹
+
📁 全部笔记 12
+
📂 工作 5
+
📂 个人 4
+
📂 学习 3
+ +
🏷️ 标签
+
+ python + mysql + 前端 +
+
+
+ + +
+
+ MySQL 索引优化笔记 +
+ + + +
+
+ 🏷️ mysql + 🏷️ python +
+
+
+ # MySQL 索引优化

+ ## B+Tree 索引原理

+ 聚簇索引的叶子节点存储整行数据
+ 二级索引叶子节点存储主键值
+ 回表查询通过二级索引找到主键再到聚簇索引查找完整行

+ ## 最左前缀原则

+ 联合索引 (a, b, c) 等价于:
+ - 索引 a
+ - 索引 (a, b)
+ - 索引 (a, b, c) +
+
+
+
+
+
+ + +
+
🔐 网站管理视图 — 账号密码列表
+
+
+ + +
+ 📝 MoKeeText + 📝 笔记 + 🔐 网站管理 +
+ +
+ + +
+ + + + + +
+
🌐 github.com 2个账号
+
🌐 gitee.com 1个账号
+
🌐 aliyun.com 1个账号
+
🌐 tencentcloud 2个账号
+
+
+ + +
+
+ 🌐 github.com + https://github.com +
+ + +
+
+ + +
+
+ 👤 主账号 + 备注: 个人开发用 +
+
+ 账号zhangsan@gmail.com + 密码•••••••• 👁 显示 📋 复制 + 说明GitHub 个人账号,用于开源项目 +
+
+ + +
+
+ 👤 工作账号 + 备注: 公司项目 +
+
+ 账号zhangsan@company.com + 密码•••••••• 👁 显示 📋 复制 + 说明公司 GitHub 账号 +
+
+ +
+
+
+
+
+
+
+ +
+

📐 结构调整说明

+
+
+ 📝 笔记 +
    +
  • 顶部导航栏切换
  • +
  • 左侧:文件夹树 + 标签
  • +
  • 右侧:编辑器,可切换 编辑/预览/分屏 三种模式
  • +
+
+
+ 🔐 网站管理 +
    +
  • 左侧:网站列表 + 添加/导入按钮
  • +
  • 右侧:选中网站的账号密码卡片
  • +
  • 密码默认隐藏,点击显示/复制
  • +
+
+
+
diff --git a/.superpowers/brainstorm/1938-1782198423/content/overall-layout.html b/.superpowers/brainstorm/1938-1782198423/content/overall-layout.html new file mode 100644 index 0000000..7004470 --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/content/overall-layout.html @@ -0,0 +1,131 @@ +

整体布局方案 — MoKeeText 记事本

+

左侧双面板切换(笔记 + 网站管理) + 右侧 Markdown 编辑/预览分屏

+ +
+
📝 笔记编辑模式 — 整体布局预览
+
+
+ + +
+ + +
+
📝 笔记
+
🔐 网站
+
+ + +
+ + + + + +
+
📁 文件夹
+ +
📁 全部笔记 12
+ +
📂 工作 5
+ +
📂 个人 4
+ +
📂 学习 3
+ +
🏷️ 标签
+
+ python + mysql + 前端 + 部署 +
+
+
+
+ + +
+ + +
+
+ MySQL 索引优化笔记 + ✅ 已保存 +
+
+ 🏷️ python + 🏷️ mysql + + 标签 +
+
+ + +
+ +
+
✏️ 编辑
+
+ # MySQL 索引优化

+ ## B+Tree 索引原理

+ 聚簇索引的叶子节点存储整行数据
+ 二级索引叶子节点存储主键值

+ 回表查询通过二级索引找到主键
+ 再到聚簇索引查找完整行

+ ## 最左前缀原则

+ 联合索引 (a, b, c) 等价于:
+ - 索引 a
+ - 索引 (a, b)
+ - 索引 (a, b, c)

+ // 无法使用索引的情况:
+ WHERE b = 1 — 跳过了 a
+ WHERE c = 1 — 跳过了 a, b +
+
+ +
+
👁️ 预览
+
+

MySQL 索引优化

+

B+Tree 索引原理

+

聚簇索引的 叶子节点存储整行数据

+

二级索引叶子节点存储 主键值

+

回表查询通过二级索引找到主键再到聚簇索引查找完整行

+

最左前缀原则

+

联合索引 (a, b, c) 等价于:

+
    +
  • 索引 a
  • +
  • 索引 (a, b)
  • +
  • 索引 (a, b, c)
  • +
+

⚠ WHERE b = 1

+

⚠ WHERE c = 1

+
+
+
+
+
+
+
+ +
+
+
+

✅ 布局要点

+
    +
  • 左侧 250px 固定宽度,笔记/网站一键切换
  • +
  • 文件夹树 + 标签筛选,双重组织
  • +
  • 右侧 Markdown 编辑/预览 左右分屏
  • +
  • 飞书风格:大量留白、轻量阴影、蓝色强调
  • +
+
+
+

❓ 待确认

+
    +
  • 分屏比例是否需要可调?
  • +
  • 是否需要纯编辑/纯预览的切换按钮?
  • +
  • 左侧面板宽度是否合适?
  • +
+
+
+
diff --git a/.superpowers/brainstorm/1938-1782198423/content/website-manager.html b/.superpowers/brainstorm/1938-1782198423/content/website-manager.html new file mode 100644 index 0000000..d729875 --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/content/website-manager.html @@ -0,0 +1,276 @@ +

🔐 网站管理 — 详细页面

+

网站列表 + 账号详情 + 智能导入,完整交互流程

+ + +
+
网站管理主界面 — 左侧网站列表,右侧账号详情
+
+
+ + +
+ 📝 MoKeeText + 📝 笔记 + 🔐 网站管理 +
+ +
+ +
+ + +
+
+
12
+
网站
+
+
+
18
+
账号
+
+
+ + + + + + + +
+
+ 🌐 +
+
github.com
+
2 个账号
+
+ +
+ +
+ 🌐 +
+
gitee.com
+
1 个账号
+
+
+ +
+ ☁️ +
+
aliyun.com
+
1 个账号
+
+
+ +
+ ☁️ +
+
cloud.tencent.com
+
2 个账号
+
+
+ +
+ 📦 +
+
npmjs.com
+
1 个账号
+
+
+ +
+ 🐳 +
+
hub.docker.com
+
1 个账号
+
+
+
+
+ + +
+ +
+
+ 🌐 github.com + 🔗 https://github.com +
+
+ + +
+
+ + +
+
+ + +
+
+
+ 👤 主账号 + 备注: 个人开发用 +
+
+ + +
+
+
+ 账号 + zhangsan@gmail.com + + + 密码 + + •••••••••• + +
+ + +
+ + 登录说明 + GitHub 个人账号,用于开源项目和 Issue 管理。开启了两步验证。 + + + 添加时间 + 2025-06-15 + +
+
+ + +
+
+
+ 👤 工作账号 + 备注: 公司项目 +
+
+ + +
+
+
+ 账号 + zhangsan@company.com + + + 密码 + •••••••••• +
+ + +
+ + 登录说明 + 公司 GitHub 组织账号,用于私有仓库和企业项目 + + + 添加时间 + 2025-08-20 + +
+
+
+
+
+
+
+
+
+ + +
+
📥 智能导入 — 粘贴文本自动识别
+
+
+ +
+ + +
+
+
1
+
粘贴原始文本
+
+
+
+
2
+
自动识别解析
+
+
+
+
3
+
确认插入
+
+
+ + +
+ + +
+ + + + +
+
✅ 识别结果预览
+
+ 🌐 网址 + https://github.com + 🏷 网站名 + github.com + 👤 账号 + zhangsan_new@qq.com + 🔑 密码 + Xyz789!@# + 📝 备注 + 新注册的开发账号 +
+ + +
+ ⚠️ github.com 已存在(2个账号),此账号将被添加到该网站下 +
+ + +
+ + +
+
+ +
+
+
+
+ +
+
+
+

✅ 交互流程

+
    +
  • 左侧网站列表,显示网站名 + 账号数量
  • +
  • 点击网站,右侧显示该网站所有账号卡片
  • +
  • 密码默认隐藏,点击👁显示,📋复制
  • +
  • 每个账号卡片独立编辑/删除
  • +
+
+
+

💡 智能导入逻辑

+
    +
  • 粘贴任意格式文本 → 自动提取字段
  • +
  • 根据网址匹配已有网站 → 存在则追加账号,不存在则新建
  • +
  • 确认前预览,防止解析错误
  • +
+
+
+
diff --git a/.superpowers/brainstorm/1938-1782198423/content/website-v2.html b/.superpowers/brainstorm/1938-1782198423/content/website-v2.html new file mode 100644 index 0000000..3f2dfce --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/content/website-v2.html @@ -0,0 +1,225 @@ +

🔐 网站管理 v2 — 文件夹 + 智能识别优化

+

网站按文件夹分组,导入支持自定义格式 + 选取文件夹

+ + +
+
网站管理 — 左侧文件夹 + 网站列表,右侧账号详情
+
+
+ + +
+ 📝 MoKeeText + 📝 笔记 + 🔐 网站管理 +
+ +
+ +
+ + + + + + + + +
+ + +
+
+ 📁 代码托管 + 3 +
+ +
+
🌐 github.com 2
+
🌐 gitee.com 1
+
🌐 gitlab.com 1
+
+
+ + +
+
+ ☁️ 云服务 + 3 +
+
+ + +
+
+ 🛠 开发工具 + 2 +
+
+ + +
未分类
+
🌐 example.com 1
+
+
+ + +
+
+
+ 📁 代码托管 / 🌐 github.com + 🔗 https://github.com +
+
+ + +
+
+ +
+
+ +
+
+ 👤 主账号 +
+ + +
+
+
+ 账号 + zhangsan@gmail.com + + 密码 + •••••••••• +
+ + +
+ 说明 + 个人开发用 + +
+
+ +
+
+ 👤 工作账号 +
+ + +
+
+
+ 账号 + zhangsan@company.com + + 密码 + •••••••••• +
+ + +
+ 说明 + 公司项目 + +
+
+
+
+
+
+
+
+
+ + +
+
📥 智能导入 v2 — 新格式 + 文件夹选择
+
+
+ +
+ + +
+ + +
+ 💡 识别规则:首行 = 网址 + 空格 + 网站名;第2行 = 账号;第3行 = 密码;第4行 = 备注(可选) +
+
+ + + + +
+
✅ 识别结果
+
+ 🌐 网址https://github.com + 🏷 网站名代码网站 + 👤 账号zhangsan_new@qq.com + 🔑 密码Xyz789!@# + 📝 备注新注册的开发账号 +
+
+ + +
+
📁 选择存放文件夹
+ +
+ + + +
+ + +
+ ⚠️ github.com 已在「代码托管」文件夹中存在(2个账号),将追加第3个账号 +
+
+ + +
+ + +
+ +
+
+
+
+ +
+

📐 v2 改动总结

+
+
+ 📁 网站文件夹 +
    +
  • 网站按文件夹展开/折叠
  • +
  • 「添加网站」时选文件夹
  • +
  • 拖拽网站到其他文件夹
  • +
  • 未分类网站单独显示
  • +
+
+
+ 📥 导入格式 +
    +
  • 网址 + 空格 + 网站名
  • +
  • 逐行:账号 → 密码 → 备注
  • +
  • 识别后选已有文件夹或新建
  • +
  • 同网址自动追加、不同网址自动新建
  • +
+
+
+
diff --git a/.superpowers/brainstorm/1938-1782198423/state/server-stopped b/.superpowers/brainstorm/1938-1782198423/state/server-stopped new file mode 100644 index 0000000..925e743 --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/state/server-stopped @@ -0,0 +1 @@ +{"reason":"idle timeout","timestamp":1782200884044} diff --git a/.superpowers/brainstorm/1938-1782198423/state/server.pid b/.superpowers/brainstorm/1938-1782198423/state/server.pid new file mode 100644 index 0000000..ccae752 --- /dev/null +++ b/.superpowers/brainstorm/1938-1782198423/state/server.pid @@ -0,0 +1 @@ +1938 diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..8d35cb3 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,2 @@ +__pycache__ +*.pyc diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..5c66beb --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.12-slim +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirements.txt +COPY app.py config.py models.py logger.py init_db.py file_service.py ./ +COPY routes/ ./routes/ +COPY middleware/ ./middleware/ +RUN mkdir -p /data/mokee/mokeetext/logs && mkdir -p static +EXPOSE 4006 +CMD sh -c "python init_db.py && uvicorn app:app --host 0.0.0.0 --port 4006" diff --git a/backend/app.py b/backend/app.py new file mode 100644 index 0000000..39fc754 --- /dev/null +++ b/backend/app.py @@ -0,0 +1,62 @@ +"""MoKeeText — FastAPI 入口""" +from fastapi import FastAPI, Request +from fastapi.middleware.cors import CORSMiddleware +from fastapi.staticfiles import StaticFiles +from fastapi.responses import FileResponse, Response +from logger import logger +from middleware.user_context import UserContextMiddleware +from routes.notes import router as notes_router +from routes.websites import router as websites_router +from routes.import_api import router as import_router +from routes.share import router as share_router +from routes.upload import router as upload_router + +app = FastAPI(title="MoKeeText", version="2.1.0") + +# CORS — 允许网关域名、前端域名、后端域名跨域 +# 注意:allow_credentials=True 时不能使用 allow_origins=["*"] +app.add_middleware( + CORSMiddleware, + allow_origins=[ + "https://mokeetext.zgitm.com", + "https://mokeetext.server.zgitm.com", # 分享页 + 图片直连 + "https://gw.server.zgitm.com", + "http://localhost:5173", + ], + allow_methods=["*"], + allow_headers=["*"], + allow_credentials=True, +) + +# 用户上下文中间件 — 在 CORS 之后注册,读取网关转发的 X-User-* 请求头 +app.add_middleware(UserContextMiddleware) + +@app.on_event("startup") +async def startup(): + logger.info("MoKeeText 服务启动") + +@app.on_event("shutdown") +async def shutdown(): + logger.info("MoKeeText 服务关闭") + +# 请求日志中间件 +@app.middleware("http") +async def log_requests(request: Request, call_next): + response = await call_next(request) + logger.info(f"{request.method} {request.url.path} → {response.status_code}") + return response + +# 静态文件 +app.mount("/static", StaticFiles(directory="static"), name="static") + +# API 路由 +app.include_router(notes_router) +app.include_router(websites_router) +app.include_router(import_router) +app.include_router(share_router) +app.include_router(upload_router) + + +@app.get("/favicon.ico") +async def favicon(): + return FileResponse("static/favicon.ico") if __import__('os').path.exists("static/favicon.ico") else Response(status_code=204) diff --git a/backend/config.py b/backend/config.py new file mode 100644 index 0000000..d33d148 --- /dev/null +++ b/backend/config.py @@ -0,0 +1,20 @@ +"""数据库与应用配置""" +import os + +# MySQL 数据库配置 +DB_CONFIG = { + "user": os.getenv("MYSQL_USER", "mokeetext"), + "password": os.getenv("MYSQL_PASSWORD", "mokee."), + "host": os.getenv("MYSQL_HOST", "10.20.1.122"), + "port": int(os.getenv("MYSQL_PORT", "3306")), + "database": os.getenv("MYSQL_DATABASE", "mokeetext"), +} + + +def get_db_url(): + """构建数据库连接 URL""" + return ( + f"mysql+pymysql://{DB_CONFIG['user']}:{DB_CONFIG['password']}" + f"@{DB_CONFIG['host']}:{DB_CONFIG['port']}/{DB_CONFIG['database']}" + f"?charset=utf8mb4" + ) diff --git a/backend/file_service.py b/backend/file_service.py new file mode 100644 index 0000000..b527417 --- /dev/null +++ b/backend/file_service.py @@ -0,0 +1,130 @@ +"""文件对象存储服务客户端 — https://file.wg.zgitm.com + +认证方式:一次性 Token,每次操作前获取 +系统编码:mokeetext-edit +""" + +import requests + +BASE_URL = "https://file.wg.zgitm.com" +SYSTEM_CODE = "mokeetext-edit" +FOLDER_PATH = "/mokeetext-images/" # 图片统一存放目录 + + +def get_token(system_code: str = SYSTEM_CODE) -> str: + """获取一次性 Token""" + resp = requests.post( + f"{BASE_URL}/api/token", + json={"systemCode": system_code}, + timeout=15, + ) + data = resp.json() + if data.get("code") != 200: + raise RuntimeError(f"获取文件服务 Token 失败: {data.get('message')}") + return data["data"]["token"] + + +def upload_file( + file_data: bytes, + filename: str, + content_type: str, + upload_user: str = "", +) -> dict: + """ + 上传文件到文件服务 + + 返回: {"fileId": "...", "fileName": "...", "fileSize": 123} + """ + token = get_token() + + resp = requests.post( + f"{BASE_URL}/api/upload", + headers={"Authorization": f"Bearer {token}"}, + files={"file": (filename, file_data, content_type)}, + data={ + "folderPath": FOLDER_PATH, + "uploadUser": upload_user, + }, + timeout=60, + ) + data = resp.json() + if data.get("code") != 200: + raise RuntimeError(f"上传文件失败: {data.get('message')}") + return data["data"] + + +def download_file(file_id: str) -> tuple[bytes, str, str]: + """ + 从文件服务下载文件 + + 返回: (binary_data, content_type, filename) + """ + token = get_token() + + resp = requests.get( + f"{BASE_URL}/api/download/{file_id}", + headers={"Authorization": f"Bearer {token}"}, + timeout=30, + ) + if resp.status_code == 404: + raise FileNotFoundError(f"文件不存在: {file_id}") + if resp.status_code != 200: + try: + err = resp.json() + raise RuntimeError(f"下载文件失败: {err.get('message', resp.text)}") + except ValueError: + raise RuntimeError(f"下载文件失败: HTTP {resp.status_code}") + + content_type = resp.headers.get("Content-Type", "application/octet-stream") + # 从 Content-Disposition 提取文件名 + filename = file_id + disposition = resp.headers.get("Content-Disposition", "") + if "filename*=" in disposition: + # filename*=UTF-8''原始文件名 + parts = disposition.split("filename*=") + if len(parts) > 1: + fname = parts[1].strip() + if "''" in fname: + filename = fname.split("''", 1)[1] + elif 'filename="' in disposition: + filename = disposition.split('filename="')[1].rstrip('"') + + return resp.content, content_type, filename + + +def delete_file(file_id: str) -> bool: + """删除文件服务中的文件""" + token = get_token() + + resp = requests.get( + f"{BASE_URL}/api/delete/{file_id}", + headers={"Authorization": f"Bearer {token}"}, + timeout=15, + ) + data = resp.json() + if data.get("code") == 404: + return False # 文件已不存在,也算删除成功 + if data.get("code") != 200: + raise RuntimeError(f"删除文件失败: {data.get('message')}") + return True + + +def ensure_folder() -> bool: + """确保图片存放目录存在""" + token = get_token() + + resp = requests.post( + f"{BASE_URL}/api/folder/create", + headers={"Authorization": f"Bearer {token}"}, + json={ + "folderPath": FOLDER_PATH, + "createdBy": SYSTEM_CODE, + }, + timeout=15, + ) + data = resp.json() + if data.get("code") == 400 and "已存在" in data.get("message", ""): + return True # 文件夹已存在,没问题 + if data.get("code") != 200: + raise RuntimeError(f"创建文件夹失败: {data.get('message')}") + return True diff --git a/backend/gateway-init.sql b/backend/gateway-init.sql new file mode 100644 index 0000000..9c96163 --- /dev/null +++ b/backend/gateway-init.sql @@ -0,0 +1,94 @@ +-- ============================================= +-- mokee编辑器 菜单 & 角色初始化 SQL +-- 系统编码: mokeetext-edit +-- 执行位置: 网关平台数据库 +-- ============================================= + +-- 0. 获取系统 ID +SET @system_id = (SELECT id FROM sys_system WHERE system_code = 'mokeetext-edit' AND is_deleted = 0 LIMIT 1); + +-- 1. 创建目录 +SET @menu_sys = REPLACE(UUID(),'-',''); + +INSERT INTO sys_menu (id, system_id, parent_id, menu_name, menu_path, component, icon, menu_type, sort_order, status, permission) VALUES +(@menu_sys, @system_id, '0', '内容管理', '/', 'Layout', 'Document', 1, 1, 1, NULL); + +-- 2. 创建页面菜单(对应实际路由: /notes, /websites, /shares) +INSERT INTO sys_menu (id, system_id, parent_id, menu_name, menu_path, component, icon, menu_type, sort_order, status, permission) VALUES +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '笔记', '/notes', 'notes/index', 'Edit', 2, 1, 1, 'notes:list'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '网站管理', '/websites', 'websites/index', 'Monitor', 2, 2, 1, 'websites:list'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '分享管理', '/shares', 'shares/index', 'Link', 2, 3, 1, 'shares:list'); + +-- 3. 创建按钮权限 +INSERT INTO sys_menu (id, system_id, parent_id, menu_name, menu_path, component, icon, menu_type, sort_order, status, permission) VALUES +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '创建笔记', NULL, NULL, '', 3, 1, 1, 'notes:add'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '编辑笔记', NULL, NULL, '', 3, 2, 1, 'notes:edit'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '删除笔记', NULL, NULL, '', 3, 3, 1, 'notes:delete'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '创建网站', NULL, NULL, '', 3, 1, 1, 'websites:add'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '编辑网站', NULL, NULL, '', 3, 2, 1, 'websites:edit'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '删除网站', NULL, NULL, '', 3, 3, 1, 'websites:delete'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '创建分享', NULL, NULL, '', 3, 1, 1, 'shares:add'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '删除分享', NULL, NULL, '', 3, 2, 1, 'shares:delete'); + +-- 4. 创建角色 +SET @role_admin = REPLACE(UUID(),'-',''); +SET @role_user = REPLACE(UUID(),'-',''); + +INSERT INTO sys_role (id, system_id, role_name, role_code, description, status) VALUES +(@role_admin, @system_id, '管理员', 'admin', '拥有全部权限', 1), +(@role_user, @system_id, '普通用户', 'user', '拥有基本权限', 1); + +-- 5. 管理员获得全部菜单权限 +INSERT INTO sys_role_menu (id, role_id, menu_id) +SELECT REPLACE(UUID(),'-',''), @role_admin, m.id +FROM sys_menu m WHERE m.system_id = @system_id; + +-- 6. 普通用户只分配页面菜单(不含按钮权限) +INSERT INTO sys_role_menu (id, role_id, menu_id) +SELECT REPLACE(UUID(),'-',''), @role_user, m.id +FROM sys_menu m WHERE m.system_id = @system_id + AND m.menu_type != 3; + +-- 7. 创建管理员账号(密码 admin123 的 BCrypt 密文) +INSERT INTO sys_user (id, username, password, real_name, email, phone, status, is_deleted) +SELECT REPLACE(UUID(),'-',''), 'admin_mokeetext-edit', + '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi', + 'mokee编辑器管理员', 'admin@mokeetext-edit.com', NULL, 1, 0 +FROM DUAL +WHERE NOT EXISTS (SELECT 1 FROM sys_user WHERE username = 'admin_mokeetext-edit'); + +-- 8. 绑定到 gateway 系统(用于登录管理后台) +INSERT INTO sys_user_system (id, user_id, system_id) +SELECT REPLACE(UUID(),'-',''), u.id, s.id +FROM sys_user u, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND s.system_code = 'gateway' + AND NOT EXISTS (SELECT 1 FROM sys_user_system us WHERE us.user_id = u.id AND us.system_id = s.id); + +-- 9. 分配 gateway-app-admin 角色 +INSERT INTO sys_user_role (id, user_id, role_id) +SELECT REPLACE(UUID(),'-',''), u.id, r.id +FROM sys_user u, sys_role r, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND r.role_code = 'gateway-app-admin' + AND r.system_id = s.id + AND s.system_code = 'gateway' + AND NOT EXISTS (SELECT 1 FROM sys_user_role ur WHERE ur.user_id = u.id AND ur.role_id = r.id); + +-- 10. 绑定到 mokeetext-edit 系统 +INSERT INTO sys_user_system (id, user_id, system_id) +SELECT REPLACE(UUID(),'-',''), u.id, s.id +FROM sys_user u, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND s.system_code = 'mokeetext-edit' + AND NOT EXISTS (SELECT 1 FROM sys_user_system us WHERE us.user_id = u.id AND us.system_id = s.id); + +-- 11. 分配本系统 admin 角色 +INSERT INTO sys_user_role (id, user_id, role_id) +SELECT REPLACE(UUID(),'-',''), u.id, r.id +FROM sys_user u, sys_role r, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND r.role_code = 'admin' + AND r.system_id = s.id + AND s.system_code = 'mokeetext-edit' + AND NOT EXISTS (SELECT 1 FROM sys_user_role ur WHERE ur.user_id = u.id AND ur.role_id = r.id); diff --git a/backend/init_db.py b/backend/init_db.py new file mode 100644 index 0000000..e03480d --- /dev/null +++ b/backend/init_db.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +"""数据库初始化 — 建表 + 插入默认数据""" +import sys +sys.stdout.reconfigure(encoding='utf-8') + +from models import engine, Base, SessionLocal, Folder + + +def migrate(): + """数据库迁移 — 处理表结构变更""" + from sqlalchemy import text + with engine.connect() as conn: + # V2.2: uploads 表新增 file_id 列,data 改为可空 + try: + conn.execute(text("ALTER TABLE uploads ADD COLUMN file_id VARCHAR(64) NULL AFTER content_type")) + except Exception: + pass # 列已存在则跳过 + try: + conn.execute(text("ALTER TABLE uploads MODIFY COLUMN data LONGBLOB NULL")) + except Exception: + pass + conn.commit() + print("[OK] 数据库迁移完成") + + +def init_database(): + """创建所有表,并插入默认文件夹""" + # 建表 + Base.metadata.create_all(bind=engine) + print("[OK] 数据库表创建完成") + + # 执行迁移 + migrate() + + # 插入默认数据 + db = SessionLocal() + try: + # 笔记默认文件夹 + if db.query(Folder).filter_by(type="note").count() == 0: + for name in ["工作", "个人", "学习"]: + db.add(Folder(name=name, type="note")) + db.add(Folder(name="未分类", type="note")) + print("[OK] 笔记文件夹已创建: 工作、个人、学习、未分类") + + # 网站默认文件夹 + if db.query(Folder).filter_by(type="website").count() == 0: + for name in ["代码托管", "云服务", "开发工具"]: + db.add(Folder(name=name, type="website")) + db.add(Folder(name="未分类", type="website")) + print("[OK] 网站文件夹已创建: 代码托管、云服务、开发工具、未分类") + + db.commit() + print("[OK] 默认数据插入完成") + finally: + db.close() + + +if __name__ == "__main__": + init_database() diff --git a/backend/logger.py b/backend/logger.py new file mode 100644 index 0000000..2b7ec00 --- /dev/null +++ b/backend/logger.py @@ -0,0 +1,62 @@ +"""日志配置 — 按天拆分 + 当前日志""" +import logging +import os +from logging.handlers import TimedRotatingFileHandler +from datetime import datetime + +LOG_DIR = os.getenv("LOG_DIR", os.path.join(os.path.dirname(__file__), "logs")) + + +def setup_logger(name="mokeetext"): + """配置日志:一天一个文件 + current.log 始终为当天日志""" + os.makedirs(LOG_DIR, exist_ok=True) + + logger = logging.getLogger(name) + logger.setLevel(logging.INFO) + + # 避免重复添加 handler + if logger.handlers: + return logger + + # 格式 + formatter = logging.Formatter( + "[%(asctime)s] %(levelname)s %(name)s | %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) + + # 按天轮转:每天午夜切一个新文件,保留 30 天 + daily_handler = TimedRotatingFileHandler( + filename=os.path.join(LOG_DIR, "mokeetext.log"), + when="midnight", + interval=1, + backupCount=30, + encoding="utf-8", + ) + daily_handler.suffix = "%Y-%m-%d" + daily_handler.setFormatter(formatter) + daily_handler.setLevel(logging.INFO) + logger.addHandler(daily_handler) + + # 当前日志软链接(始终指向今天的日志) + current_log = os.path.join(LOG_DIR, "current.log") + + # 控制台也输出 + console_handler = logging.StreamHandler() + console_handler.setFormatter(formatter) + console_handler.setLevel(logging.INFO) + logger.addHandler(console_handler) + + # 记录日志文件路径 + logger.info(f"日志目录: {LOG_DIR}") + + return logger + + +def get_log_path(): + """返回今天的日志文件路径""" + today = datetime.now().strftime("%Y-%m-%d") + return os.path.join(LOG_DIR, f"mokeetext.log{today}") + + +# 单例 +logger = setup_logger() diff --git a/backend/middleware/__init__.py b/backend/middleware/__init__.py new file mode 100644 index 0000000..68428a6 --- /dev/null +++ b/backend/middleware/__init__.py @@ -0,0 +1 @@ +"""中间件包""" diff --git a/backend/middleware/user_context.py b/backend/middleware/user_context.py new file mode 100644 index 0000000..af5b872 --- /dev/null +++ b/backend/middleware/user_context.py @@ -0,0 +1,94 @@ +"""Mokee Gateway 用户上下文中间件 + +网关转发请求时注入以下请求头,本中间件读取并存入 request.state.user: + X-User-Id, X-User-Name, X-User-Account, X-User-Email, + X-User-Post, X-User-Roles, X-System-Id, X-System-Code, X-System-Name + +本地开发时(无网关),使用 DEV_MODE=true 环境变量或 X-Dev-Mock-User 请求头 +启用默认 admin 用户,无需启动网关即可调试。 +""" + +import os +from starlette.middleware.base import BaseHTTPMiddleware +from fastapi import Request + +# 网关注入的所有请求头 +GATEWAY_HEADERS = [ + "X-User-Id", + "X-User-Name", + "X-User-Account", + "X-User-Email", + "X-User-Post", + "X-User-Roles", + "X-System-Id", + "X-System-Code", + "X-System-Name", +] + +# 本地开发默认用户(模拟网关注入) +DEV_DEFAULT_USER = { + "X-User-Id": "admin", + "X-User-Name": "管理员", + "X-User-Account": "admin", + "X-User-Email": "admin@zgitm.com", + "X-User-Post": "", + "X-User-Roles": '[{"roleId":"1","roleName":"管理员","roleCode":"admin"}]', + "X-System-Id": "1", + "X-System-Code": "mokeetext-edit", + "X-System-Name": "mokee编辑器", +} + + +class UserContext: + """用户上下文 — 提供快捷访问方法""" + + @staticmethod + def from_request(request: Request) -> dict: + """从 request.state 获取用户信息""" + return getattr(request.state, "user", {}) + + @staticmethod + def get_user_id(request: Request) -> str: + """获取当前用户账号名(用于 created_by 显示),未登录返回 'admin'""" + user = UserContext.from_request(request) + # 优先用登录账号名(如 admin),其次用用户名,最后用 ID + return user.get("X-User-Account") or user.get("X-User-Name") or user.get("X-User-Id", "admin") + + @staticmethod + def get_user_name(request: Request) -> str: + return UserContext.from_request(request).get("X-User-Name", "") + + @staticmethod + def get_user_account(request: Request) -> str: + return UserContext.from_request(request).get("X-User-Account", "") + + @staticmethod + def get_system_code(request: Request) -> str: + return UserContext.from_request(request).get("X-System-Code", "") + + +class UserContextMiddleware(BaseHTTPMiddleware): + """将网关注入的用户信息存入 request.state.user + + 生产环境:读取网关转发的 X-User-* 请求头 + 本地开发:DEV_MODE=true 时使用 DEV_DEFAULT_USER + """ + + async def dispatch(self, request: Request, call_next): + user_info = {} + + # 读取网关注入的请求头 + for header in GATEWAY_HEADERS: + value = request.headers.get(header) + if value: + user_info[header] = value + + # 本地开发:无网关时使用默认用户 + if not user_info.get("X-User-Id"): + dev_mode = os.getenv("DEV_MODE", "false").lower() == "true" + if dev_mode or request.headers.get("X-Dev-Mock-User"): + user_info = DEV_DEFAULT_USER.copy() + + request.state.user = user_info + response = await call_next(request) + return response diff --git a/backend/models.py b/backend/models.py new file mode 100644 index 0000000..e37d4e7 --- /dev/null +++ b/backend/models.py @@ -0,0 +1,135 @@ +"""SQLAlchemy 数据模型""" +from datetime import datetime +from sqlalchemy import ( + create_engine, Column, Integer, String, Text, DateTime, LargeBinary, + Enum as SAEnum, ForeignKey, Table +) +from sqlalchemy.orm import declarative_base, relationship, sessionmaker +from config import get_db_url + +engine = create_engine(get_db_url(), echo=False, pool_pre_ping=True) +SessionLocal = sessionmaker(bind=engine, autocommit=False) +Base = declarative_base() + + +def get_db(): + """获取数据库会话(FastAPI 依赖注入)""" + db = SessionLocal() + try: + yield db + finally: + db.close() + + +# ===== 文件夹 ===== +class Folder(Base): + """文件夹表 — 笔记和网站共用""" + __tablename__ = "folders" + + id = Column(Integer, primary_key=True, autoincrement=True) + name = Column(String(100), nullable=False) + type = Column(SAEnum("note", "website", name="folder_type"), nullable=False, default="note") + parent_id = Column(Integer, ForeignKey("folders.id"), nullable=True) + sort_order = Column(Integer, default=0) + created_by = Column(String(100), nullable=False, default="admin") + created_at = Column(DateTime, default=datetime.utcnow) + + children = relationship("Folder", backref="parent", remote_side=[id]) + notes = relationship("Note", back_populates="folder", cascade="all, delete-orphan") + websites = relationship("Website", back_populates="folder", cascade="all, delete-orphan") + + +# ===== 笔记 ===== +class Note(Base): + """笔记表""" + __tablename__ = "notes" + + id = Column(Integer, primary_key=True, autoincrement=True) + title = Column(String(500), nullable=False, default="无标题") + content = Column(Text, nullable=True) # Tiptap 输出的 HTML + folder_id = Column(Integer, ForeignKey("folders.id"), nullable=True) + created_by = Column(String(100), nullable=False, default="admin") + updated_by = Column(String(100), nullable=False, default="admin") + share_token = Column(String(64), nullable=True, unique=True) + share_expires_at = Column(DateTime, nullable=True) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + + folder = relationship("Folder", back_populates="notes") + tags = relationship("Tag", secondary="note_tags", back_populates="notes") + + +# ===== 笔记-标签关联 ===== +note_tags = Table( + "note_tags", + Base.metadata, + Column("note_id", Integer, ForeignKey("notes.id", ondelete="CASCADE"), primary_key=True), + Column("tag_id", Integer, ForeignKey("tags.id", ondelete="CASCADE"), primary_key=True), +) + + +# ===== 标签 ===== +class Tag(Base): + """标签表""" + __tablename__ = "tags" + + id = Column(Integer, primary_key=True, autoincrement=True) + name = Column(String(50), nullable=False, unique=True) + color = Column(String(20), default="#666666") + + notes = relationship("Note", secondary="note_tags", back_populates="tags") + + +# ===== 网站 ===== +class Website(Base): + """网站表""" + __tablename__ = "websites" + + id = Column(Integer, primary_key=True, autoincrement=True) + name = Column(String(200), nullable=False) + url = Column(String(500), nullable=False) + folder_id = Column(Integer, ForeignKey("folders.id"), nullable=True) + created_by = Column(String(100), nullable=False, default="admin") + updated_by = Column(String(100), nullable=False, default="admin") + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + + folder = relationship("Folder", back_populates="websites") + accounts = relationship("Account", back_populates="website", cascade="all, delete-orphan", + order_by="Account.sort_order") + + +# ===== 账号 ===== +class Account(Base): + """账号表 — 存储网站登录凭据""" + __tablename__ = "accounts" + + id = Column(Integer, primary_key=True, autoincrement=True) + website_id = Column(Integer, ForeignKey("websites.id", ondelete="CASCADE"), nullable=False) + username = Column(String(500), nullable=False) + password = Column(String(500), nullable=False) # 明文存储,后续加密 + remark = Column(Text, nullable=True) + created_by = Column(String(100), nullable=False, default="admin") + updated_by = Column(String(100), nullable=False, default="admin") + sort_order = Column(Integer, default=0) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + + website = relationship("Website", back_populates="accounts") + + +# ===== 上传文件 ===== +class Upload(Base): + """文件上传表 — 图片存储(新文件存文件服务,旧文件兼容 DB blob)""" + __tablename__ = "uploads" + + id = Column(Integer, primary_key=True, autoincrement=True) + filename = Column(String(255), nullable=False) + content_type = Column(String(100), nullable=False) + data = Column(LargeBinary(length=2**32-1), nullable=True) # 旧图片 LONGBLOB(兼容),新文件为 NULL + file_id = Column(String(64), nullable=True) # 文件服务返回的 fileId(新文件) + size = Column(Integer, default=0) + created_by = Column(String(100), nullable=False, default="admin") + created_at = Column(DateTime, default=datetime.utcnow) + + diff --git a/backend/requirements.txt b/backend/requirements.txt new file mode 100644 index 0000000..1d967aa --- /dev/null +++ b/backend/requirements.txt @@ -0,0 +1,7 @@ +fastapi>=0.115.0 +uvicorn[standard]>=0.30.0 +sqlalchemy>=2.0.35 +pymysql>=1.1.0 +cryptography>=43.0.0 +python-multipart>=0.0.12 +requests>=2.31.0 diff --git a/backend/routes/__init__.py b/backend/routes/__init__.py new file mode 100644 index 0000000..9864828 --- /dev/null +++ b/backend/routes/__init__.py @@ -0,0 +1 @@ +"""路由包""" diff --git a/backend/routes/import_api.py b/backend/routes/import_api.py new file mode 100644 index 0000000..af874a4 --- /dev/null +++ b/backend/routes/import_api.py @@ -0,0 +1,61 @@ +"""智能导入 API — 文本解析与匹配""" +from fastapi import APIRouter, Depends, Request +from sqlalchemy.orm import Session, joinedload +from models import get_db, Website +from middleware.user_context import UserContext +from urllib.parse import urlparse + +router = APIRouter(prefix="/api/import", tags=["智能导入"]) + + +@router.post("/parse") +def parse_import_text(data: dict, db: Session = Depends(get_db), request: Request = None): + """解析粘贴的文本,返回结构化结果 + 匹配信息""" + user_id = UserContext.get_user_id(request) + text = data.get("text", "").strip() + if not text: + return {"ok": False, "error": "文本为空"} + + lines = [l.strip() for l in text.split("\n") if l.strip()] + if len(lines) < 3: + return {"ok": False, "error": "至少需要 3 行:网址+网站名、账号、密码"} + + # 解析首行: 网址 + 空格 + 网站名 + first_line = lines[0] + space_idx = first_line.find(" ") + if space_idx > 0: + url = first_line[:space_idx].strip() + site_name = first_line[space_idx + 1:].strip() + else: + url = first_line + try: + site_name = urlparse(url).hostname or url + except Exception: + site_name = url + + result = { + "ok": True, + "url": url, + "site_name": site_name, + "username": lines[1] if len(lines) > 1 else "", + "password": lines[2] if len(lines) > 2 else "", + "remark": lines[3] if len(lines) > 3 else "", + } + + # 匹配已有网站(仅当前用户) + existing = db.query(Website).options(joinedload(Website.accounts)).filter( + Website.url == url, Website.created_by == user_id + ).first() + if existing: + result["matched_site"] = { + "id": existing.id, + "name": existing.name, + "folder_id": existing.folder_id, + "account_count": len(existing.accounts), + } + result["action"] = "append" + else: + result["matched_site"] = None + result["action"] = "create" + + return result diff --git a/backend/routes/notes.py b/backend/routes/notes.py new file mode 100644 index 0000000..7a22cbf --- /dev/null +++ b/backend/routes/notes.py @@ -0,0 +1,159 @@ +"""笔记相关路由""" +from fastapi import APIRouter, Depends, HTTPException, Request +from sqlalchemy.orm import Session +from models import get_db, Note +from middleware.user_context import UserContext + +router = APIRouter(tags=["笔记"]) + + +@router.get("/api/notes") +def list_notes(folder_id: int = None, db: Session = Depends(get_db), request: Request = None): + """获取笔记列表(仅当前用户)""" + user_id = UserContext.get_user_id(request) + q = db.query(Note).filter(Note.created_by == user_id) + if folder_id: + q = q.filter(Note.folder_id == folder_id) + return q.order_by(Note.updated_at.desc()).all() + + +@router.post("/api/notes") +def create_note(data: dict, db: Session = Depends(get_db), request: Request = None): + """创建笔记""" + user_id = UserContext.get_user_id(request) + note = Note( + title=data.get("title", "无标题"), + content=data.get("content", ""), + folder_id=data.get("folder_id"), + created_by=user_id, + updated_by=user_id, + ) + db.add(note) + db.commit() + db.refresh(note) + return {"id": note.id, "title": note.title, "content": note.content, + "folder_id": note.folder_id, "created_by": note.created_by, "updated_by": note.updated_by, + "created_at": str(note.created_at), "updated_at": str(note.updated_at)} + + +@router.get("/api/notes/{note_id}") +def get_note(note_id: int, db: Session = Depends(get_db), request: Request = None): + """获取单个笔记""" + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + return {"id": note.id, "title": note.title, "content": note.content, + "folder_id": note.folder_id, "created_by": note.created_by, "updated_by": note.updated_by, + "created_at": str(note.created_at), "updated_at": str(note.updated_at)} + + +@router.put("/api/notes/{note_id}") +def update_note(note_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """更新笔记""" + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + if "title" in data: + note.title = data["title"] + if "content" in data: + note.content = data["content"] + if "folder_id" in data: + note.folder_id = data["folder_id"] + note.updated_by = user_id + db.commit() + db.refresh(note) + return {"ok": True} + + +@router.delete("/api/notes/{note_id}") +def delete_note(note_id: int, db: Session = Depends(get_db), request: Request = None): + """删除笔记""" + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + db.delete(note) + db.commit() + return {"ok": True} + + +# ===== 分享 ===== +import secrets + +@router.post("/api/notes/{note_id}/share") +def share_note(note_id: int, data: dict = {}, db: Session = Depends(get_db), request: Request = None): + """生成/刷新分享链接,可设置有效期""" + from datetime import datetime, timedelta + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + note.share_token = secrets.token_urlsafe(16) + + # 有效期: 7d / 30d / 1y / forever + ttl = data.get("ttl", "forever") + if ttl == "7d": + note.share_expires_at = datetime.utcnow() + timedelta(days=7) + elif ttl == "30d": + note.share_expires_at = datetime.utcnow() + timedelta(days=30) + elif ttl == "1y": + note.share_expires_at = datetime.utcnow() + timedelta(days=365) + else: + note.share_expires_at = None # 永久 + + db.commit() + return { + "share_token": note.share_token, + "url": f"/share/{note.share_token}", + "expires_at": note.share_expires_at.strftime("%Y-%m-%d %H:%M") if note.share_expires_at else "永久有效", + } + + +@router.delete("/api/notes/{note_id}/share") +def unshare_note(note_id: int, db: Session = Depends(get_db), request: Request = None): + """取消分享""" + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + note.share_token = None + db.commit() + return {"ok": True} + + +# ===== 移动 ===== +@router.put("/api/notes/{note_id}/move") +def move_note(note_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """移动笔记到另一个文件夹""" + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + note.folder_id = data.get("folder_id") + db.commit() + return {"ok": True, "folder_id": note.folder_id} + + +# ===== 分享管理 ===== +@router.get("/api/shares") +def list_shares(db: Session = Depends(get_db), request: Request = None): + """列出当前用户已分享的笔记""" + user_id = UserContext.get_user_id(request) + notes = db.query(Note).filter( + Note.share_token.isnot(None), + Note.created_by == user_id, + ).order_by(Note.updated_at.desc()).all() + result = [] + for n in notes: + result.append({ + "id": n.id, + "title": n.title, + "share_token": n.share_token, + "share_url": f"/share/{n.share_token}", + "share_expires_at": n.share_expires_at.strftime("%Y-%m-%d %H:%M") if n.share_expires_at else "永久有效", + "created_by": n.created_by, + "updated_at": str(n.updated_at), + }) + return result diff --git a/backend/routes/share.py b/backend/routes/share.py new file mode 100644 index 0000000..7b95039 --- /dev/null +++ b/backend/routes/share.py @@ -0,0 +1,75 @@ +"""分享笔记公开查看""" +from datetime import datetime +from fastapi import APIRouter, Depends, HTTPException +from fastapi.responses import HTMLResponse +from sqlalchemy.orm import Session +from models import get_db, Note + +router = APIRouter(tags=["分享"]) + +CSS = """ +:root{--text:#1F2329;--text2:#646A73;--text3:#8F959E;--border:#E5E6EB;--brand:#3370FF;--bg:#F5F6F8;} +*{margin:0;padding:0;box-sizing:border-box;} +body{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;color:var(--text);background:var(--bg);min-height:100vh;} +.wrap{max-width:1100px;margin:0 auto;padding:32px 16px;} +.card{background:#fff;border-radius:12px;padding:36px;box-shadow:0 1px 3px rgba(0,0,0,.06);overflow-x:auto;word-wrap:break-word;overflow-wrap:break-word;max-width:100%;} +h1{font-size:26px;font-weight:700;padding-bottom:16px;margin-bottom:16px;border-bottom:2px solid var(--border);line-height:1.3;} +.meta{font-size:12px;color:var(--text3);margin-bottom:28px;display:flex;gap:20px;} +.content{font-size:15px;line-height:1.9;color:var(--text);overflow-x:auto;word-wrap:break-word;overflow-wrap:break-word;} +.content h2{font-size:20px;font-weight:600;margin:24px 0 10px;} +.content h3{font-size:17px;font-weight:600;margin:18px 0 8px;} +.content p{margin:8px 0;} +.content ul,.content ol{padding-left:22px;margin:8px 0;} +.content li{margin:4px 0;} +.content blockquote{border-left:3px solid var(--brand);padding:4px 14px;margin:12px 0;color:var(--text2);} +.content pre{background:#F7F8FA;padding:14px 18px;border-radius:8px;overflow-x:auto;font-size:13px;line-height:1.7;font-family:"SF Mono","Fira Code","Consolas",monospace;} +.content code{background:#F2F3F5;padding:2px 6px;border-radius:3px;font-size:13px;font-family:"SF Mono","Fira Code","Consolas",monospace;} +.content pre code{background:none;padding:0;} +.content table{border-collapse:collapse;width:100%;margin:12px 0;} +.content th,.content td{border:1px solid var(--border);padding:8px 14px;text-align:left;} +.content th{background:#F7F8FA;font-weight:600;font-size:13px;} +.content img{max-width:100%;border-radius:8px;} +.content mark{background:#FFF3CD;padding:2px 4px;border-radius:2px;} +.footer{text-align:center;margin-top:24px;font-size:11px;color:var(--text3);} +.footer a{color:var(--brand);text-decoration:none;} +""" + +TEMPLATE = """ + + + +{title} - MoKeeText + + + +
+
+

{title}

+
+ 创建于 {created_at} + {created_by} +
+
{content}
+
+ +
+ +""" + + +@router.get("/share/{token}") +def view_shared(token: str, db: Session = Depends(get_db)): + note = db.query(Note).filter_by(share_token=token).first() + if not note: + raise HTTPException(404, "链接无效或已取消分享") + if note.share_expires_at and note.share_expires_at < datetime.utcnow(): + raise HTTPException(410, "分享链接已过期") + + html = TEMPLATE.format( + title=note.title, + created_at=note.created_at.strftime('%Y-%m-%d %H:%M:%S') if note.created_at else '-', + created_by=note.created_by or 'admin', + content=note.content or '

暂无内容

', + css=CSS, + ) + return HTMLResponse(html) diff --git a/backend/routes/upload.py b/backend/routes/upload.py new file mode 100644 index 0000000..27389c9 --- /dev/null +++ b/backend/routes/upload.py @@ -0,0 +1,101 @@ +"""文件上传/读取 — 数据库存储(file_service.py 为可选备用方案,保留不删)""" +from fastapi import APIRouter, UploadFile, File, Depends, HTTPException, Request +from fastapi.responses import Response +from sqlalchemy.orm import Session +from logger import logger +from models import get_db, Upload +from middleware.user_context import UserContext +# 文件服务模块保留备用(不删除),如需切换取消下面注释即可 +# from file_service import upload_file, download_file, delete_file + +router = APIRouter(tags=["上传"]) + +ALLOWED = {"image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"} +MAX_SIZE = 20 * 1024 * 1024 # 20MB + + +@router.post("/api/upload/image") +async def upload_image(file: UploadFile = File(...), db: Session = Depends(get_db), request: Request = None): + """上传图片 — 存入数据库 LONGBLOB""" + user_id = UserContext.get_user_id(request) + try: + if file.content_type not in ALLOWED: + raise HTTPException(400, f"不支持的图片格式: {file.content_type}") + data = await file.read() + if len(data) > MAX_SIZE: + raise HTTPException(400, f"图片不能超过 20MB,当前 {len(data)} 字节") + + filename = file.filename or "img" + logger.info(f"上传图片: {filename}, {len(data)} bytes, {file.content_type}, user={user_id}") + + upload = Upload( + filename=filename, + content_type=file.content_type, + data=data, + size=len(data), + created_by=user_id, + ) + db.add(upload) + db.commit() + db.refresh(upload) + + logger.info(f"图片已存入 DB, id={upload.id}") + return {"url": f"/api/file/{upload.id}"} + + except HTTPException: + raise + except Exception as e: + logger.error(f"上传失败: {e}") + raise HTTPException(500, f"上传失败: {str(e)}") + + +@router.get("/api/file/{file_id}") +def get_file(file_id: int, db: Session = Depends(get_db)): + """读取图片 — 公开访问(不走网关,供编辑器 标签和分享页加载) + + 优先从 DB blob 读取;如为文件服务存储则代理下载 + """ + upload = db.query(Upload).filter_by(id=file_id).first() + if not upload: + raise HTTPException(404, "文件不存在") + + # DB blob(主存储方式) + if upload.data: + return Response(content=upload.data, media_type=upload.content_type) + + # 文件服务存储(兼容之前上传的文件) + if upload.file_id: + from file_service import download_file + try: + data, content_type, _ = download_file(upload.file_id) + return Response(content=data, media_type=content_type) + except FileNotFoundError: + raise HTTPException(404, "文件在文件服务中不存在") + except Exception as e: + logger.error(f"从文件服务下载失败: {e}") + raise HTTPException(500, f"下载文件失败: {str(e)}") + + raise HTTPException(404, "文件数据不存在") + + +@router.delete("/api/file/{file_id}") +def delete_file_api(file_id: int, db: Session = Depends(get_db), request: Request = None): + """删除图片 — 从 DB 和文件服务中删除""" + user_id = UserContext.get_user_id(request) + upload = db.query(Upload).filter_by(id=file_id).first() + if not upload: + raise HTTPException(404, "文件不存在") + + # 如果存在文件服务记录,同步删除 + if upload.file_id: + from file_service import delete_file + try: + delete_file(upload.file_id) + logger.info(f"文件服务删除成功, fileId={upload.file_id}") + except Exception as e: + logger.error(f"文件服务删除失败: {e}") + + db.delete(upload) + db.commit() + logger.info(f"图片记录已删除, db_id={file_id}, user={user_id}") + return {"ok": True} diff --git a/backend/routes/websites.py b/backend/routes/websites.py new file mode 100644 index 0000000..595305c --- /dev/null +++ b/backend/routes/websites.py @@ -0,0 +1,221 @@ +"""网站管理相关路由""" +from fastapi import APIRouter, Depends, HTTPException, Request +from sqlalchemy.orm import Session, joinedload +from models import get_db, Website, Account, Folder +from middleware.user_context import UserContext + +router = APIRouter(tags=["网站管理"]) + + +# ===== 网站 CRUD ===== + +@router.get("/api/websites") +def list_websites(folder_id: int = None, db: Session = Depends(get_db), request: Request = None): + """获取网站列表(仅当前用户)""" + user_id = UserContext.get_user_id(request) + q = db.query(Website).options(joinedload(Website.accounts)).filter(Website.created_by == user_id) + if folder_id: + q = q.filter(Website.folder_id == folder_id) + return q.order_by(Website.name).all() + + +@router.post("/api/websites") +def create_website(data: dict, db: Session = Depends(get_db), request: Request = None): + """创建网站""" + user_id = UserContext.get_user_id(request) + website = Website( + name=data.get("name", ""), + url=data.get("url", ""), + folder_id=data.get("folder_id"), + created_by=user_id, + updated_by=user_id, + ) + db.add(website) + db.commit() + db.refresh(website) + return {"id": website.id, "name": website.name, "url": website.url, + "folder_id": website.folder_id} + + +@router.get("/api/websites/{website_id}") +def get_website(website_id: int, db: Session = Depends(get_db), request: Request = None): + """获取网站详情(含账号列表)""" + user_id = UserContext.get_user_id(request) + website = db.query(Website).options(joinedload(Website.accounts)).filter( + Website.id == website_id, Website.created_by == user_id + ).first() + if not website: + raise HTTPException(404, "网站不存在") + return website + + +@router.put("/api/websites/{website_id}") +def update_website(website_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """更新网站信息""" + user_id = UserContext.get_user_id(request) + website = db.query(Website).filter(Website.id == website_id, Website.created_by == user_id).first() + if not website: + raise HTTPException(404, "网站不存在") + for field in ["name", "url", "folder_id"]: + if field in data: + setattr(website, field, data[field]) + website.updated_by = user_id + db.commit() + db.refresh(website) + return {"ok": True} + + +@router.delete("/api/websites/{website_id}") +def delete_website(website_id: int, db: Session = Depends(get_db), request: Request = None): + """删除网站""" + user_id = UserContext.get_user_id(request) + website = db.query(Website).filter(Website.id == website_id, Website.created_by == user_id).first() + if not website: + raise HTTPException(404, "网站不存在") + db.delete(website) + db.commit() + return {"ok": True} + + +# ===== 账号 CRUD ===== + +@router.post("/api/websites/{website_id}/accounts") +def add_account(website_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """添加账号""" + user_id = UserContext.get_user_id(request) + account = Account( + website_id=website_id, + username=data.get("username", ""), + password=data.get("password", ""), + remark=data.get("remark", ""), + sort_order=data.get("sort_order", 0), + created_by=user_id, + updated_by=user_id, + ) + db.add(account) + db.commit() + db.refresh(account) + return {"id": account.id, "username": account.username, "remark": account.remark, "sort_order": account.sort_order} + + +@router.get("/api/accounts/{account_id}") +def get_account(account_id: int, db: Session = Depends(get_db), request: Request = None): + """获取单个账号""" + user_id = UserContext.get_user_id(request) + account = db.query(Account).filter(Account.id == account_id, Account.created_by == user_id).first() + if not account: + raise HTTPException(404, "账号不存在") + return {"id": account.id, "username": account.username, + "password": account.password, "remark": account.remark} + + +@router.put("/api/accounts/{account_id}") +def update_account(account_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """更新账号""" + user_id = UserContext.get_user_id(request) + account = db.query(Account).filter(Account.id == account_id, Account.created_by == user_id).first() + if not account: + raise HTTPException(404, "账号不存在") + for field in ["username", "password", "remark", "sort_order"]: + if field in data: + setattr(account, field, data[field]) + account.updated_by = user_id + db.commit() + db.refresh(account) + return {"ok": True} + +@router.delete("/api/accounts/{account_id}") +def delete_account(account_id: int, db: Session = Depends(get_db), request: Request = None): + """删除账号""" + user_id = UserContext.get_user_id(request) + account = db.query(Account).filter(Account.id == account_id, Account.created_by == user_id).first() + if not account: + raise HTTPException(404, "账号不存在") + db.delete(account) + db.commit() + return {"ok": True} + + +@router.put("/api/accounts/{account_id}/move") +def move_account(account_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """移动账号顺序: direction = 'up' | 'down'""" + user_id = UserContext.get_user_id(request) + account = db.query(Account).filter(Account.id == account_id, Account.created_by == user_id).first() + if not account: + raise HTTPException(404, "账号不存在") + + direction = data.get("direction", "down") + website_id = account.website_id + + # 同网站下按 sort_order 排序的所有账号 + siblings = db.query(Account).filter_by(website_id=website_id).order_by(Account.sort_order).all() + + idx = next((i for i, a in enumerate(siblings) if a.id == account_id), None) + if idx is None: + return {"ok": False} + + if direction == "up" and idx > 0: + siblings[idx].sort_order, siblings[idx-1].sort_order = siblings[idx-1].sort_order, siblings[idx].sort_order + elif direction == "down" and idx < len(siblings) - 1: + siblings[idx].sort_order, siblings[idx+1].sort_order = siblings[idx+1].sort_order, siblings[idx].sort_order + + db.commit() + return {"ok": True} + + +# ===== 文件夹 API ===== + +@router.get("/api/folders") +def list_folders(type: str = "website", db: Session = Depends(get_db), request: Request = None): + """获取文件夹列表(仅当前用户)""" + user_id = UserContext.get_user_id(request) + return db.query(Folder).filter( + Folder.type == type, + Folder.created_by == user_id, + ).order_by(Folder.sort_order).all() + + +@router.post("/api/folders") +def create_folder(data: dict, db: Session = Depends(get_db), request: Request = None): + """创建文件夹""" + user_id = UserContext.get_user_id(request) + folder = Folder( + name=data.get("name", "新文件夹"), + type=data.get("type", "website"), + created_by=user_id, + ) + db.add(folder) + db.commit() + db.refresh(folder) + return {"id": folder.id, "name": folder.name, "type": folder.type} + + +@router.put("/api/folders/{folder_id}") +def update_folder(folder_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + """重命名文件夹""" + user_id = UserContext.get_user_id(request) + folder = db.query(Folder).filter(Folder.id == folder_id, Folder.created_by == user_id).first() + if not folder: + raise HTTPException(404, "文件夹不存在") + if "name" in data: + folder.name = data["name"] + db.commit() + return {"ok": True, "id": folder.id, "name": folder.name} + + +@router.delete("/api/folders/{folder_id}") +def delete_folder(folder_id: int, db: Session = Depends(get_db), request: Request = None): + """删除文件夹(文件夹下的内容变为未分类)""" + user_id = UserContext.get_user_id(request) + folder = db.query(Folder).filter(Folder.id == folder_id, Folder.created_by == user_id).first() + if not folder: + raise HTTPException(404, "文件夹不存在") + # 将该文件夹下的网站/笔记移到未分类(仅限当前用户) + from models import Website, Note + if folder.type == "website": + db.query(Website).filter_by(folder_id=folder_id, created_by=user_id).update({"folder_id": None}) + else: + db.query(Note).filter_by(folder_id=folder_id, created_by=user_id).update({"folder_id": None}) + db.delete(folder) + db.commit() + return {"ok": True} diff --git a/deploy/deploy.py b/deploy/deploy.py new file mode 100644 index 0000000..0b5d9d8 --- /dev/null +++ b/deploy/deploy.py @@ -0,0 +1,32 @@ +"""MoKeeText 部署脚本 — 上传构建产物并重建前端容器""" +import paramiko, os + +key_path = os.path.expanduser('~/.ssh/id_rsa') +key = paramiko.RSAKey.from_private_key_file(key_path) + +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect('101.132.183.138', username='root', pkey=key, timeout=15) + +# 清理旧文件 +c.exec_command('rm -f /data/mokee/mokeetext/frontend/static/dist/assets/index-*.js /data/mokee/mokeetext/frontend/static/dist/assets/index-*.css 2>/dev/null') + +# 上传新文件 +dist = 'E:/AI/claude/new/mokeeText/frontend/static/dist' +sftp = c.open_sftp() +sftp.put(f'{dist}/index.html', '/data/mokee/mokeetext/frontend/static/dist/index.html') +for f in os.listdir(f'{dist}/assets'): + sftp.put(f'{dist}/assets/{f}', f'/data/mokee/mokeetext/frontend/static/dist/assets/{f}') + print(f'✅ {f}') +sftp.close() + +# 重建容器 +_, stdout, stderr = c.exec_command('cd /data/mokee/mokeetext && docker compose up -d --build frontend 2>&1') +out = stdout.read().decode() +err = stderr.read().decode() +print(out) +if err: + print(err) + +c.close() +print('部署完成') diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml new file mode 100644 index 0000000..96c8899 --- /dev/null +++ b/deploy/docker-compose.yml @@ -0,0 +1,30 @@ +version: "3.8" + +services: + backend: + build: + context: ./backend + dockerfile: Dockerfile + ports: + - "4006:4006" + environment: + - MYSQL_HOST=${MYSQL_HOST:-10.20.1.122} + - MYSQL_PORT=${MYSQL_PORT:-3306} + - MYSQL_USER=${MYSQL_USER:-mokeetext} + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-mokee.} + - MYSQL_DATABASE=${MYSQL_DATABASE:-mokeetext} + - LOG_DIR=/data/mokee/mokeetext/logs + volumes: + # 日志挂到宿主机 + - /data/mokee/mokeetext/logs:/data/mokee/mokeetext/logs + restart: unless-stopped + + frontend: + build: + context: ./frontend + dockerfile: Dockerfile.frontend + ports: + - "3006:3006" + depends_on: + - backend + restart: unless-stopped diff --git a/docs/DEPLOY.md b/docs/DEPLOY.md new file mode 100644 index 0000000..9ae1b2e --- /dev/null +++ b/docs/DEPLOY.md @@ -0,0 +1,310 @@ +# MoKeeText 部署文档 + +## 部署架构 + +``` + Internet + │ + ┌───────┴───────┐ + │ 反向代理/Nginx │ (运维侧管理,SSL 终端) + └───────┬───────┘ + │ + ┌─────────────┼─────────────┐ + │ │ │ + :3006 (前端) :4006 (后端) :3306 (MySQL) + │ │ │ + ┌─────────┴──┐ ┌──────┴──────┐ ┌──┴──────────┐ + │ Nginx │ │ FastAPI │ │ MySQL 8.0 │ + │ (Alpine) │ │ (Python3.12)│ │ (远程) │ + │ │ │ │ │ │ + │ 静态文件 │ │ API + ORM │ │ 10.20.1.122 │ + └────────────┘ └─────────────┘ └──────────────┘ + 容器: frontend 容器: backend 外部服务 +``` + +**两个容器**: +- **frontend** — Nginx Alpine,挂载 Vue 构建产物,端口 3006 +- **backend** — Python 3.12-slim,Uvicorn 运行 FastAPI,端口 4006 + +**跨域通信**:前端直接跨域请求后端 API,Nginx **不代理** `/api/`。CORS 在后端 FastAPI 中配置。 + +--- + +## 环境信息 + +| 项目 | 值 | +|------|-----| +| 服务器 IP | `101.132.183.138` | +| SSH 用户 | `root` | +| SSH 认证 | 密钥(~/.ssh/id_rsa) | +| 项目路径 | `/data/mokee/mokeetext` | +| 前端域名 | `https://mokeetext.zgitm.com` → 端口 `3006` | +| 后端域名 | `https://mokeetext.server.zgitm.com` → 端口 `4006` | +| 数据库 | MySQL `10.20.1.122:3306` / 库 `mokeetext` | +| 数据库用户 | `mokeetext` | + +--- + +## 服务器目录结构 + +``` +/data/mokee/mokeetext/ +├── docker-compose.yml # 容器编排(由 deploy.py 上传) +├── backend/ +│ ├── Dockerfile +│ ├── app.py +│ ├── models.py +│ ├── config.py +│ ├── logger.py +│ ├── init_db.py +│ ├── requirements.txt +│ ├── routes/ +│ │ ├── notes.py +│ │ ├── websites.py +│ │ ├── import_api.py +│ │ ├── upload.py +│ │ └── share.py +│ └── middleware/ +│ └── user_context.py +├── frontend/ +│ ├── Dockerfile.frontend +│ ├── nginx.conf +│ └── static/ +│ └── dist/ # Vue 构建产物(Nginx 托管) +└── logs/ # 应用日志(挂载到宿主机) + ├── mokeetext.log # 按天轮转 + └── current.log +``` + +--- + +## 日常部署流程 + +### 前置条件 + +1. SSH 密钥已配置到服务器 +2. 本地已安装 Python 3.12 + paramiko + +### 快速部署(仅前端改动) + +大多数改动只需要重新构建前端并重建 frontend 容器: + +```bash +# 1. 构建前端 +cd frontend +npx vite build + +# 2. 部署 +cd .. +python deploy/deploy.py +``` + +`deploy.py` 会自动: +1. SSH 连接到服务器 +2. 清理旧的 JS/CSS 文件 +3. SFTP 上传新的 `static/dist/` 文件 +4. 执行 `docker compose up -d --build frontend` + +### 后端改动部署 + +如果修改了后端代码: + +```bash +# 1. 上传后端文件 +scp backend/*.py root@101.132.183.138:/data/mokee/mokeetext/backend/ +scp backend/routes/*.py root@101.132.183.138:/data/mokee/mokeetext/backend/routes/ +scp backend/middleware/*.py root@101.132.183.138:/data/mokee/mokeetext/backend/middleware/ + +# 2. 重建后端容器 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose up -d --build backend' +``` + +### Docker Compose 配置变更 + +如果修改了 `docker-compose.yml`: + +```bash +scp deploy/docker-compose.yml root@101.132.183.138:/data/mokee/mokeetext/docker-compose.yml +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose up -d --build' +``` + +--- + +## 首次部署(从零搭建) + +### 1. 服务器准备 + +```bash +# SSH 到服务器 +ssh root@101.132.183.138 + +# 安装 Docker(如果尚未安装) +curl -fsSL https://get.docker.com | sh + +# 创建项目目录 +mkdir -p /data/mokee/mokeetext/{backend/routes,backend/middleware,frontend/static/dist,logs} +``` + +### 2. 上传文件 + +```bash +# 在本地上传所有文件 +scp deploy/docker-compose.yml root@101.132.183.138:/data/mokee/mokeetext/ + +scp backend/*.py backend/*.txt backend/Dockerfile backend/.dockerignore \ + root@101.132.183.138:/data/mokee/mokeetext/backend/ + +scp backend/routes/*.py root@101.132.183.138:/data/mokee/mokeetext/backend/routes/ +scp backend/middleware/*.py root@101.132.183.138:/data/mokee/mokeetext/backend/middleware/ + +scp frontend/Dockerfile.frontend frontend/nginx.conf frontend/.dockerignore \ + root@101.132.183.138:/data/mokee/mokeetext/frontend/ + +# 构建前端并上传 +cd frontend && npx vite build && cd .. +scp -r frontend/static/dist/* root@101.132.183.138:/data/mokee/mokeetext/frontend/static/dist/ +``` + +### 3. 启动服务 + +```bash +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose up -d --build' +``` + +### 4. 验证 + +```bash +# 检查容器状态 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose ps' + +# 检查后端健康 +curl https://mokeetext.server.zgitm.com/api/notes + +# 检查前端 +curl https://mokeetext.zgitm.com +``` + +--- + +## 常用运维命令 + +### 容器管理 + +```bash +# 查看运行状态 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose ps' + +# 查看日志 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose logs --tail=50 backend' +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose logs --tail=50 frontend' + +# 重启单个服务 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose restart backend' + +# 停止所有服务 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose down' + +# 完全重建(清除缓存) +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose build --no-cache && docker compose up -d' +``` + +### 日志查看 + +```bash +# 应用日志(按天拆分) +ssh root@101.132.183.138 'ls -la /data/mokee/mokeetext/logs/' +ssh root@101.132.183.138 'tail -100 /data/mokee/mokeetext/logs/current.log' + +# 实时跟踪 +ssh root@101.132.183.138 'tail -f /data/mokee/mokeetext/logs/current.log' +``` + +### 数据库操作 + +```bash +# 进入 MySQL +ssh root@101.132.183.138 'docker exec -it mokeetext-backend-1 python -c " +import pymysql +conn = pymysql.connect(host=\"10.20.1.122\", user=\"mokeetext\", password=\"mokee.\", database=\"mokeetext\") +print(\"connected\") +conn.close() +"' +``` + +--- + +## 环境变量 + +### Backend 容器 + +| 变量 | 默认值 | 说明 | +|------|--------|------| +| `MYSQL_HOST` | `10.20.1.122` | 数据库主机 | +| `MYSQL_PORT` | `3306` | 数据库端口 | +| `MYSQL_USER` | `mokeetext` | 数据库用户 | +| `MYSQL_PASSWORD` | `mokee.` | 数据库密码 | +| `MYSQL_DATABASE` | `mokeetext` | 数据库名 | +| `LOG_DIR` | `/data/mokee/mokeetext/logs` | 日志目录 | + +这些在 `docker-compose.yml` 中定义,可通过 `.env` 文件覆盖。 + +### Frontend 构建 + +| 变量 | 说明 | +|------|------| +| `VITE_API_BASE` | 生产环境 API 地址 | +| `VITE_LOGIN_URL` | 统一登录页地址 | +| `VITE_SYSTEM_CODE` | 系统编码 | + +定义在 `frontend/.env.production` 中。 + +--- + +## 回滚 + +如果部署出现问题: + +```bash +# 1. 回到上一个前端镜像 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose up -d frontend' +# Docker 会使用缓存的镜像层 + +# 2. 如果有备份的 dist 文件 +scp backup-dist/* root@101.132.183.138:/data/mokee/mokeetext/frontend/static/dist/ +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose restart frontend' + +# 3. 极端情况:重建所有容器 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose down && docker compose up -d --build' +``` + +--- + +## 故障排查 + +### 前端页面空白 + +1. 检查 Nginx 容器是否运行:`docker compose ps frontend` +2. 检查 dist 文件是否存在:`ls /data/mokee/mokeetext/frontend/static/dist/` +3. 检查 Nginx 日志:`docker compose logs frontend` + +### API 返回 500 + +1. 检查后端容器日志:`docker compose logs backend --tail=100` +2. 检查数据库连接:确认 MySQL 可访问 +3. 检查应用日志:`tail -100 /data/mokee/mokeetext/logs/current.log` + +### CORS 错误 + +1. 确认前端请求的 API 地址正确 +2. 确认 `app.py` 中 `allow_origins` 包含当前域名 +3. 确认请求未经过 Nginx 代理(前端直接调后端) + +### 容器无法启动 + +```bash +# 查看构建日志 +ssh root@101.132.183.138 'cd /data/mokee/mokeetext && docker compose build --progress=plain' + +# 检查端口占用 +ssh root@101.132.183.138 'netstat -tlnp | grep -E "3006|4006"' +``` diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..6f685e6 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,345 @@ +# MoKeeText 项目文档 + +## 概述 + +**MoKeeText** 是一个 Web 端富文本笔记管理应用,同时具备网站账号密码管理功能,集成 Mokee Gateway 统一登录网关。 + +### 核心功能 + +| 模块 | 功能 | +|------|------| +| 📝 **笔记编辑** | 基于 Tiptap 的增强型富文本编辑器,支持文字颜色、图片粘贴/拖拽上传、表格、代码高亮、任务列表 | +| 🔐 **网站管理** | 按文件夹分类管理网站及其登录账号密码 | +| 🔗 **分享链接** | 笔记可生成分享链接,支持 7天/30天/1年/永久 四种有效期 | +| 📥 **智能导入** | 自动解析粘贴的网站账号信息,一键导入 | +| 🖼️ **图片上传** | 粘贴/拖拽图片自动上传,存数据库 LONGBLOB,点击全屏预览 | +| 👤 **统一登录** | 接入 Mokee Gateway,通过网关转发用户身份,支持 API 级数据隔离 | + +--- + +## 技术栈 + +| 层 | 技术 | 版本 | +|----|------|------| +| 后端框架 | FastAPI (Python) | ≥0.115 | +| 服务器 | Uvicorn | ≥0.30 | +| ORM | SQLAlchemy | ≥2.0 | +| 数据库 | MySQL | 8.0 | +| 前端框架 | Vue 3 + Vite | 3.5 / 8.x | +| 路由 | Vue Router | 4.6 | +| 编辑器 | Tiptap | 3.27 | +| 代码高亮 | highlight.js (lowlight) | - | +| HTTP 客户端 | Axios(生产)/ fetch(本地开发) | 1.18 | +| 容器化 | Docker + Docker Compose | - | +| Web 服务器 | Nginx (Alpine) | - | + +--- + +## 项目结构 + +``` +mokeeText/ +├── backend/ # 后端 — FastAPI 应用 +│ ├── app.py # 入口:CORS、中间件、路由注册 +│ ├── models.py # SQLAlchemy 数据模型(6 张表) +│ ├── config.py # 数据库连接配置(环境变量) +│ ├── logger.py # 日志系统(按天轮转,保留 30 天) +│ ├── init_db.py # 建表脚本 +│ ├── requirements.txt # Python 依赖 +│ ├── Dockerfile # 后端 Docker 镜像 +│ ├── .dockerignore +│ ├── routes/ # API 路由 +│ │ ├── notes.py # 笔记 CRUD + 分享 + 移动 +│ │ ├── websites.py # 网站/账号/文件夹 CRUD + 排序 +│ │ ├── import_api.py # 智能导入解析 +│ │ ├── upload.py # 图片上传/读取 +│ │ └── share.py # 公开分享查看页 +│ └── middleware/ +│ └── user_context.py # 网关用户上下文中间件 +│ +├── frontend/ # 前端 — Vue 3 SPA +│ ├── index.html # Vite 入口 HTML +│ ├── package.json # 前端依赖 +│ ├── vite.config.js # Vite 构建配置 +│ ├── nginx.conf # Nginx 配置 +│ ├── Dockerfile.frontend # 前端 Nginx Docker 镜像 +│ ├── .dockerignore +│ ├── .env / .env.production # 环境变量 +│ ├── src/ +│ │ ├── main.js # Vue 入口 → 挂载 Router + v-permission +│ │ ├── App.vue # 根组件:左导航 + 顶栏 + UserChip + 底栏 +│ │ ├── router.js # Vue Router 配置 + 路由守卫 +│ │ ├── utils/request.js # Axios 实例 + 拦截器 +│ │ ├── composables/useApi.js # 双模式 API(dev fetch / prod axios) +│ │ ├── directives/permission.js # v-permission 按钮权限指令 +│ │ ├── views/ +│ │ │ ├── NotesView.vue # 笔记:文件夹侧边栏 + 列表 + 编辑器 +│ │ │ ├── WebsitesView.vue # 网站管理:列表 + CRUD 弹窗 +│ │ │ └── SharesView.vue # 分享管理 +│ │ └── components/ +│ │ ├── NoteEditor.vue # Tiptap 增强编辑器 +│ │ ├── Modal.vue # 通用弹窗组件 +│ │ ├── ConfirmModal.vue +│ │ └── PromptModal.vue +│ └── static/ +│ ├── dist/ # Vite 构建产物(Nginx 托管) +│ ├── js/vendor/ # Tiptap UMD 扩展文件 +│ ├── css/ +│ └── uploads/ +│ +├── deploy/ # 部署 +│ ├── docker-compose.yml # 双容器编排 +│ ├── deploy.py # 日常部署脚本 +│ └── migrate_server.py # 服务器迁移脚本(一次性) +│ +├── docs/ # 文档 +│ ├── README.md # 本文档 +│ ├── DEPLOY.md # 部署文档 +│ └── superpowers/ # 设计规范 + 实施计划 +│ +└── memory/ # 会话记忆 +``` + +--- + +## 数据库设计 + +### ER 图 + +``` +folders ──┬── notes ──┬── note_tags ── tags + │ + └── websites ── accounts + +uploads(独立,图片存 DB) +``` + +### 表结构 + +#### folders — 文件夹(笔记和网站共用) +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 自增主键 | +| name | VARCHAR(100) | 文件夹名称 | +| type | ENUM('note','website') | 类型 | +| parent_id | INT FK→folders.id | 父文件夹(树形结构) | +| sort_order | INT | 排序 | +| created_by | VARCHAR(100) | 创建者账号 | +| created_at | DATETIME | 创建时间 | + +#### notes — 笔记 +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 自增主键 | +| title | VARCHAR(500) | 标题 | +| content | TEXT | Tiptap 输出的 HTML | +| folder_id | INT FK→folders.id | 所属文件夹 | +| created_by | VARCHAR(100) | 创建者 | +| updated_by | VARCHAR(100) | 最后修改者 | +| share_token | VARCHAR(64) UNIQUE | 分享令牌 | +| share_expires_at | DATETIME | 分享过期时间 | +| created_at / updated_at | DATETIME | 时间戳 | + +#### tags — 标签 +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 自增主键 | +| name | VARCHAR(50) UNIQUE | 标签名 | +| color | VARCHAR(20) | 颜色 | + +#### note_tags — 笔记-标签关联(多对多) +| 字段 | 类型 | 说明 | +|------|------|------| +| note_id | INT FK | 笔记 ID | +| tag_id | INT FK | 标签 ID | + +#### websites — 网站 +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 自增主键 | +| name | VARCHAR(200) | 网站名称 | +| url | VARCHAR(500) | 网址 | +| folder_id | INT FK | 所属文件夹 | +| created_by / updated_by | VARCHAR(100) | 操作者 | +| created_at / updated_at | DATETIME | 时间戳 | + +#### accounts — 账号 +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 自增主键 | +| website_id | INT FK | 所属网站 | +| username | VARCHAR(500) | 用户名 | +| password | VARCHAR(500) | 密码(明文,待加密) | +| remark | TEXT | 备注 | +| sort_order | INT | 排序 | +| created_by / updated_by | VARCHAR(100) | 操作者 | + +#### uploads — 上传文件 +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 自增主键 | +| filename | VARCHAR(255) | 原始文件名 | +| content_type | VARCHAR(100) | MIME 类型 | +| data | LONGBLOB | 二进制数据(最大 4GB) | +| size | INT | 文件大小(字节) | +| created_by | VARCHAR(100) | 上传者 | +| created_at | DATETIME | 上传时间 | + +--- + +## API 接口 + +所有接口均以 `/api/` 为前缀。除分享页和图片读取外,所有操作需要网关注入用户身份。 + +### 笔记 + +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | `/api/notes` | 获取笔记列表(支持 `?folder_id=` 筛选) | +| POST | `/api/notes` | 创建笔记 | +| GET | `/api/notes/{id}` | 获取笔记详情 | +| PUT | `/api/notes/{id}` | 修改笔记 | +| DELETE | `/api/notes/{id}` | 删除笔记 | +| PUT | `/api/notes/{id}/move` | 移动笔记到文件夹 | +| POST | `/api/notes/{id}/share` | 生成分享链接 | + +### 文件夹 + +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | `/api/folders` | 获取文件夹列表(支持 `?type=note\|website`) | +| POST | `/api/folders` | 创建文件夹 | +| PUT | `/api/folders/{id}` | 重命名文件夹 | +| DELETE | `/api/folders/{id}` | 删除文件夹 | + +### 网站与账号 + +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | `/api/websites` | 获取网站列表(支持 `?folder_id=`) | +| POST | `/api/websites` | 创建网站 | +| PUT | `/api/websites/{id}` | 修改网站 | +| DELETE | `/api/websites/{id}` | 删除网站 | +| GET | `/api/websites/{id}/accounts` | 获取账号列表 | +| POST | `/api/websites/{id}/accounts` | 创建账号 | +| PUT | `/api/accounts/{id}` | 修改账号 | +| DELETE | `/api/accounts/{id}` | 删除账号 | +| PUT | `/api/accounts/sort` | 账号排序 | + +### 文件 + +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | `/api/upload/image` | 上传图片(网关鉴权) | +| GET | `/api/file/{id}` | 读取图片(公开,无需鉴权) | + +### 分享 + +| 方法 | 路径 | 说明 | +|------|------|------| +| GET | `/share/{token}` | 公开查看分享的笔记(不走网关) | +| GET | `/api/shares` | 获取我的分享列表 | +| DELETE | `/api/shares/{note_id}` | 取消分享 | + +### 智能导入 + +| 方法 | 路径 | 说明 | +|------|------|------| +| POST | `/api/import/parse` | 解析粘贴的文本,提取网站+账号信息 | + +--- + +## 认证架构 + +``` +┌─────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────┐ +│ 浏览器 │ ──→ │ 统一登录页 │ ──→ │ Mokee │ ──→ │ FastAPI │ +│ │ │ login.user. │ │ Gateway │ │ 后端 │ +│ │ │ zgitm.com │ │ gw.server. │ │ :4006 │ +│ │ │ │ │ zgitm.com │ │ │ +└─────────┘ └──────────────┘ └──────┬───────┘ └──────────┘ + │ + 注入 X-User-* 头 + X-User-Id, X-User-Account, + X-User-Roles, X-System-Code ... +``` + +### 请求流程 + +1. **用户访问** → 前端路由守卫检查 Cookie 中是否有 `token` +2. **无 Token** → 重定向到 `login.user.zgitm.com` 统一登录 +3. **登录成功** → 网关设置 Cookie,用户回到应用 +4. **API 请求** → Axios 拦截器从 Cookie 取 Token 放入 Authorization 头 +5. **网关转发** → 验证 Token 后注入 `X-User-*` 系列请求头 +6. **后端中间件** → `UserContextMiddleware` 提取请求头存入 `request.state.user` +7. **业务路由** → 通过 `UserContext.get_user_id()` 获取当前用户,按 `created_by` 过滤数据 + +### 本地开发模式 + +设置环境变量 `DEV_MODE=true` 或添加请求头 `X-Dev-Mock-User`,后端绕过网关认证,使用默认 admin 用户。 + +```bash +# 启动后端 +cd backend +DEV_MODE=true uvicorn app:app --port 4006 + +# 启动前端(另一个终端) +cd frontend +npx vite +``` + +--- + +## 前端架构 + +### 路由 + +| 路径 | 组件 | 说明 | +|------|------|------| +| `/` | → 重定向 | 默认到 /notes | +| `/notes` | NotesView | 笔记编辑器(文件夹 + 列表 + 编辑器) | +| `/websites` | WebsitesView | 网站账号管理 | +| `/shares` | SharesView | 分享链接管理 | + +### API 调用模式 + +前端通过 `useApi()` 组合式函数发起请求,自动适配环境: + +- **生产环境**:使用 Axios 实例,拦截器自动携带 Token → 请求走网关 +- **本地开发**:使用 fetch,添加 `X-Dev-Mock-User` 头模拟用户 + +```js +// composables/useApi.js +import { useApi } from '@/composables/useApi' +const { get, post, put, del } = useApi() +const notes = await get('/api/notes') +``` + +### 图片处理 + +- **上传**:粘贴/拖拽 → `POST /api/upload/image`(走网关,带 Token) +- **显示**:``(走后端直连,公开读取) +- **预览**:点击图片 → 全屏灯箱,带关闭按钮 + +### UI 特性 + +- 左侧可收起导航栏(展开 "mokee编辑器",收起 "M") +- 文件夹侧边栏可收起 +- 笔记列表 + 编辑器双栏布局 +- Ctrl+S 保存,顶部 toast 提示 +- 弹窗全部为 Vue 组件(非浏览器 alert/confirm) +- 移动端响应式适配(768px 断点) +- 顶栏右侧「切换系统」按钮 → 跳转网关系统选择页 + +--- + +## 生产环境 + +| 项目 | 值 | +|------|-----| +| 服务器 | 101.132.183.138 (腾讯云) | +| 前端地址 | https://mokeetext.zgitm.com | +| 后端地址 | https://mokeetext.server.zgitm.com | +| 数据库 | MySQL 10.20.1.122:3306/mokeetext | +| 日志路径 | /data/mokee/mokeetext/logs(按天轮转,保留 30 天) | +| ICP 备案 | 湘ICP备19021539号 | diff --git a/docs/superpowers/plans/2026-06-23-mokeetext-gateway-integration.md b/docs/superpowers/plans/2026-06-23-mokeetext-gateway-integration.md new file mode 100644 index 0000000..a82e94e --- /dev/null +++ b/docs/superpowers/plans/2026-06-23-mokeetext-gateway-integration.md @@ -0,0 +1,1216 @@ +# MoKeeText 接入 Mokee Gateway 统一登录网关 — 实施计划 + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** 将 MoKeeText 接入 Mokee Gateway 统一登录网关,实现用户登录认证、用户数据隔离、按钮权限控制。 + +**Architecture:** 前端所有 API 请求从直连后端改为经过网关(`gw.server.zgitm.com`),网关验证 Token 后注入 `X-User-*` 请求头转发到后端。后端通过 FastAPI 中间件读取请求头,存入 `request.state.user`,所有业务查询据此过滤用户数据。前端用 UserChip Widget 替代硬编码的 Admin 头像,新增路由守卫和 v-permission 指令。 + +**Tech Stack:** FastAPI (Python), Vue 3 + Vite, Axios, Mokee Gateway UserChip Widget + +--- + +## 文件结构总览 + +``` +mokeeText/ +├── app.py # [修改] CORS 配置 + 注册用户上下文中间件 +├── middleware/ +│ └── user_context.py # [新建] FastAPI 用户上下文中间件 +├── routes/ +│ ├── notes.py # [修改] 查询加 created_by 过滤,写入取 X-User-Id +│ ├── websites.py # [修改] 同上 +│ ├── import_api.py # [修改] 同上 +│ ├── share.py # [修改] 同上 +│ └── upload.py # [修改] 同上 +├── src/ # Vue 3 前端源码 +│ ├── main.js # [修改] 挂载后加载 UserChip Widget +│ ├── router.js # [修改] 添加路由守卫 +│ ├── App.vue # [修改] 用 UserChip 占位替换硬编码 Admin +│ ├── composables/ +│ │ └── useApi.js # [修改] 改为网关地址 + 携带 Token + X-System-Code +│ ├── utils/ +│ │ └── request.js # [新建] Axios 实例(拦截器) +│ └── directives/ +│ └── permission.js # [新建] v-permission 指令 +├── .env # [新建] 开发环境变量 +├── .env.production # [新建] 生产环境变量 +├── index.html # [修改] 添加 UserChip CSS + process polyfill +└── vite.config.js # [修改] 确保 env 前缀配置 +``` + +--- + +## 前置准备:网关平台操作 + +这些操作在网关平台的数据库中执行,不涉及本项目代码。 + +### Task 0: 网关数据库初始化 + +**执行位置:** 网关平台数据库(非 mokeeText 数据库) + +- [ ] **Step 1: 执行菜单和角色初始化 SQL** + +执行接入文档 §6.2 的完整 SQL(创建目录、页面菜单、按钮权限、管理员角色、普通用户角色)。 + +```sql +-- 在网关数据库执行 +-- 0. 获取系统 ID +SET @system_id = (SELECT id FROM sys_system WHERE system_code = 'mokeetext-edit' AND is_deleted = 0 LIMIT 1); + +-- 1. 创建顶级菜单目录 +SET @menu_sys = REPLACE(UUID(),'-',''); +SET @menu_biz = REPLACE(UUID(),'-',''); + +INSERT INTO sys_menu (id, system_id, parent_id, menu_name, menu_path, component, icon, menu_type, sort_order, status, permission) VALUES +(@menu_sys, @system_id, '0', '系统管理', '/system', 'Layout', 'Setting', 1, 1, 1, NULL), +(@menu_biz, @system_id, '0', '业务管理', '/biz', 'Layout', 'Document', 1, 2, 1, NULL); + +-- 2. 创建页面菜单(对应 MoKeeText 实际路由:notes, websites, shares) +INSERT INTO sys_menu (id, system_id, parent_id, menu_name, menu_path, component, icon, menu_type, sort_order, status, permission) VALUES +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '笔记管理', '/notes', 'notes/index', 'Document', 2, 1, 1, 'notes:list'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '网站管理', '/websites', 'websites/index', 'Key', 2, 2, 1, 'websites:list'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '分享管理', '/shares', 'shares/index', 'Link', 2, 3, 1, 'shares:list'); + +-- 3. 创建按钮权限 +INSERT INTO sys_menu (id, system_id, parent_id, menu_name, menu_path, component, icon, menu_type, sort_order, status, permission) VALUES +-- 笔记操作 +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '创建笔记', NULL, NULL, '', 3, 1, 1, 'notes:add'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '编辑笔记', NULL, NULL, '', 3, 2, 1, 'notes:edit'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '删除笔记', NULL, NULL, '', 3, 3, 1, 'notes:delete'), +-- 网站操作 +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '创建网站', NULL, NULL, '', 3, 1, 1, 'websites:add'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '编辑网站', NULL, NULL, '', 3, 2, 1, 'websites:edit'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '删除网站', NULL, NULL, '', 3, 3, 1, 'websites:delete'), +-- 分享操作 +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '创建分享', NULL, NULL, '', 3, 1, 1, 'shares:add'), +(REPLACE(UUID(),'-',''), @system_id, @menu_sys, '删除分享', NULL, NULL, '', 3, 2, 1, 'shares:delete'); + +-- 4. 创建角色 +SET @role_admin = REPLACE(UUID(),'-',''); +SET @role_user = REPLACE(UUID(),'-',''); + +INSERT INTO sys_role (id, system_id, role_name, role_code, description, status) VALUES +(@role_admin, @system_id, '管理员', 'admin', '拥有全部权限', 1), +(@role_user, @system_id, '普通用户', 'user', '拥有基本权限', 1); + +-- 5. 管理员获得全部菜单权限 +INSERT INTO sys_role_menu (id, role_id, menu_id) +SELECT REPLACE(UUID(),'-',''), @role_admin, m.id +FROM sys_menu m WHERE m.system_id = @system_id; + +-- 6. 普通用户只分配页面菜单(不含按钮权限) +INSERT INTO sys_role_menu (id, role_id, menu_id) +SELECT REPLACE(UUID(),'-',''), @role_user, m.id +FROM sys_menu m WHERE m.system_id = @system_id + AND m.menu_type != 3; +``` + +- [ ] **Step 2: 创建网关管理员账号** + +执行接入文档 §7 的 SQL。 + +```sql +-- 在网关数据库执行 +-- 1. 创建管理员用户(密码 admin123 的 BCrypt 密文) +INSERT INTO sys_user (id, username, password, real_name, email, phone, status, is_deleted) +SELECT REPLACE(UUID(),'-',''), 'admin_mokeetext-edit', + '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi', + 'mokee编辑器管理员', 'admin@mokeetext-edit.com', NULL, 1, 0 +FROM DUAL +WHERE NOT EXISTS (SELECT 1 FROM sys_user WHERE username = 'admin_mokeetext-edit'); + +-- 2. 绑定到 gateway 系统 +INSERT INTO sys_user_system (id, user_id, system_id) +SELECT REPLACE(UUID(),'-',''), u.id, s.id +FROM sys_user u, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND s.system_code = 'gateway' + AND NOT EXISTS ( + SELECT 1 FROM sys_user_system us + WHERE us.user_id = u.id AND us.system_id = s.id + ); + +-- 3. 分配 gateway-app-admin 角色 +INSERT INTO sys_user_role (id, user_id, role_id) +SELECT REPLACE(UUID(),'-',''), u.id, r.id +FROM sys_user u, sys_role r, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND r.role_code = 'gateway-app-admin' + AND r.system_id = s.id + AND s.system_code = 'gateway' + AND NOT EXISTS ( + SELECT 1 FROM sys_user_role ur + WHERE ur.user_id = u.id AND ur.role_id = r.id + ); + +-- 4. 绑定到 mokeetext-edit 系统 +INSERT INTO sys_user_system (id, user_id, system_id) +SELECT REPLACE(UUID(),'-',''), u.id, s.id +FROM sys_user u, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND s.system_code = 'mokeetext-edit' + AND NOT EXISTS ( + SELECT 1 FROM sys_user_system us + WHERE us.user_id = u.id AND us.system_id = s.id + ); + +-- 5. 分配本系统 admin 角色 +INSERT INTO sys_user_role (id, user_id, role_id) +SELECT REPLACE(UUID(),'-',''), u.id, r.id +FROM sys_user u, sys_role r, sys_system s +WHERE u.username = 'admin_mokeetext-edit' + AND r.role_code = 'admin' + AND r.system_id = s.id + AND s.system_code = 'mokeetext-edit' + AND NOT EXISTS ( + SELECT 1 FROM sys_user_role ur + WHERE ur.user_id = u.id AND ur.role_id = r.id + ); +``` + +- [ ] **Step 3: 验证网关配置** + +在网关管理后台用 `admin_mokeetext-edit / admin123` 登录,确认: +- 能看到「mokee编辑器」系统 +- 菜单树包含笔记管理、网站管理、分享管理 +- 角色列表包含 admin 和 user + +--- + +## 阶段一:后端改造 + +### Task 1: 新建 FastAPI 用户上下文中间件 + +**文件:** +- Create: `middleware/__init__.py` +- Create: `middleware/user_context.py` + +- [ ] **Step 1: 创建 middleware 包** + +```bash +mkdir -p middleware +``` + +```python +# middleware/__init__.py +"""中间件包""" +``` + +- [ ] **Step 2: 编写 UserContext 辅助类 + 中间件** + +```python +# middleware/user_context.py +"""Mokee Gateway 用户上下文中间件 + +网关转发请求时注入以下请求头,本中间件读取并存入 request.state.user: + X-User-Id, X-User-Name, X-User-Account, X-User-Email, + X-User-Post, X-User-Roles, X-System-Id, X-System-Code, X-System-Name + +本地开发时(无网关),使用 X-Dev-Mock-User 请求头或默认 admin 用户。 +""" + +import os +from starlette.middleware.base import BaseHTTPMiddleware +from fastapi import Request + +# 网关注入的所有请求头 +GATEWAY_HEADERS = [ + "X-User-Id", + "X-User-Name", + "X-User-Account", + "X-User-Email", + "X-User-Post", + "X-User-Roles", + "X-System-Id", + "X-System-Code", + "X-System-Name", +] + +# 本地开发默认用户(模拟网关注入) +DEV_DEFAULT_USER = { + "X-User-Id": "admin", + "X-User-Name": "管理员", + "X-User-Account": "admin", + "X-User-Email": "admin@zgitm.com", + "X-User-Post": "", + "X-User-Roles": '[{"roleId":"1","roleName":"管理员","roleCode":"admin"}]', + "X-System-Id": "1", + "X-System-Code": "mokeetext-edit", + "X-System-Name": "mokee编辑器", +} + + +class UserContext: + """用户上下文 — 提供快捷访问方法""" + + @staticmethod + def from_request(request: Request) -> dict: + """从 request.state 获取用户信息""" + return getattr(request.state, "user", {}) + + @staticmethod + def get_user_id(request: Request) -> str: + return UserContext.from_request(request).get("X-User-Id", "admin") + + @staticmethod + def get_user_name(request: Request) -> str: + return UserContext.from_request(request).get("X-User-Name", "") + + @staticmethod + def get_user_account(request: Request) -> str: + return UserContext.from_request(request).get("X-User-Account", "") + + @staticmethod + def get_system_code(request: Request) -> str: + return UserContext.from_request(request).get("X-System-Code", "") + + +class UserContextMiddleware(BaseHTTPMiddleware): + """将网关注入的用户信息存入 request.state.user""" + + async def dispatch(self, request: Request, call_next): + user_info = {} + + # 读取网关注入的请求头 + for header in GATEWAY_HEADERS: + value = request.headers.get(header) + if value: + user_info[header] = value + + # 本地开发:无网关时使用默认用户 + if not user_info.get("X-User-Id"): + dev_mode = os.getenv("DEV_MODE", "false").lower() == "true" + if dev_mode or request.headers.get("X-Dev-Mock-User"): + user_info = DEV_DEFAULT_USER.copy() + + request.state.user = user_info + response = await call_next(request) + return response +``` + +**设计说明:** +- `request.state.user` 存储当前用户信息,路由函数通过 `UserContext.from_request(request)` 获取 +- `DEV_MODE=true` 环境变量或 `X-Dev-Mock-User` 请求头开启本地开发模式 +- 生产环境无网关请求头时 `user_info` 为空字典,不会错误地暴露数据 + +- [ ] **Step 3: 验证中间件可以导入** + +```bash +cd /e/AI/claude/new/mokeeText && python -c "from middleware.user_context import UserContextMiddleware, UserContext; print('OK')" +``` + +Expected: `OK` + +--- + +### Task 2: 修改 app.py — 注册中间件 + 更新 CORS + +**文件:** +- Modify: `app.py` + +- [ ] **Step 1: 更新 CORS 配置 + 注册用户上下文中间件** + +将 `app.py` 中的 CORS 配置和中间件注册改为: + +```python +"""MoKeeText — FastAPI 入口""" +from fastapi import FastAPI, Request +from fastapi.middleware.cors import CORSMiddleware +from fastapi.staticfiles import StaticFiles +from fastapi.responses import FileResponse, Response +from logger import logger +from middleware.user_context import UserContextMiddleware +from routes.notes import router as notes_router +from routes.websites import router as websites_router +from routes.import_api import router as import_router +from routes.share import router as share_router +from routes.upload import router as upload_router + +app = FastAPI(title="MoKeeText", version="2.1.0") + +# CORS — 允许网关域名和前端域名跨域 +# 注意:allow_credentials=True 时不能使用 allow_origins=["*"] +app.add_middleware( + CORSMiddleware, + allow_origins=[ + "https://mokeetext.zgitm.com", + "https://mokeetext.server.zgitm.com", # 分享页 + 图片直连 + "https://gw.server.zgitm.com", + "http://localhost:5173", + ], + allow_methods=["*"], + allow_headers=["*"], + allow_credentials=True, +) + +# 用户上下文中间件 — 在 CORS 之后、请求日志之前注册 +app.add_middleware(UserContextMiddleware) + +# ... 后续代码保持不变 ... +``` + +**关键变更:** +1. `allow_origins` 从 `["*"]` 改为显式列表,因为 `allow_credentials=True` 与 `*` 不兼容 +2. 新增 `UserContextMiddleware` 注册 + +- [ ] **Step 2: 验证应用可以启动** + +```bash +cd /e/AI/claude/new/mokeeText && python -c "from app import app; print('App loaded OK, routes:', len(app.routes))" +``` + +Expected: `App loaded OK, routes: N` + +--- + +### Task 3: 改造后端路由 — 用户数据隔离 + +**涉及 5 个文件。** 核心思路:所有 `created_by` / `updated_by` 从 `request.state.user` 获取,所有查询加 `created_by` 过滤。 + +**文件:** +- Modify: `routes/notes.py` +- Modify: `routes/websites.py` +- Modify: `routes/import_api.py` +- Modify: `routes/share.py` +- Modify: `routes/upload.py` + +- [ ] **Step 1: 改造 routes/notes.py** + +当前 `created_by` 硬编码为 `"admin"`,查询不过滤用户。改为从请求上下文获取。 + +在每个路由函数开头添加: +```python +from fastapi import Request +from middleware.user_context import UserContext + +# 在每个路由函数中: +def list_notes(folder_id: int = None, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + q = db.query(Note).filter(Note.created_by == user_id) + if folder_id: + q = q.filter(Note.folder_id == folder_id) + return q.order_by(Note.updated_at.desc()).all() + +def create_note(data: dict, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + note = Note( + title=data.get("title", "无标题"), + content=data.get("content", ""), + folder_id=data.get("folder_id"), + created_by=user_id, + updated_by=user_id, + ) + db.add(note) + db.commit() + db.refresh(note) + return {...} + +def update_note(note_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + # 更新字段... + note.updated_by = user_id + db.commit() + return {...} + +def delete_note(note_id: int, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + db.delete(note) + db.commit() + return {"ok": True} +``` + +**规则:** +- 查询:加 `.filter(Model.created_by == user_id)` +- 创建:`created_by=user_id, updated_by=user_id` +- 修改:先按 `id + created_by` 查找,再 `updated_by=user_id` +- 删除:先按 `id + created_by` 查找,再删除 + +- [ ] **Step 2: 改造 routes/websites.py** + +同样模式,涉及 `Website`、`Account`、`Folder`(note 类型和 website 类型)三个模型。改造要点: + +```python +from fastapi import Request +from middleware.user_context import UserContext + +# 示例 — 获取网站列表 +@router.get("/api/websites") +def list_websites(folder_id: int = None, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + q = db.query(Website).options(joinedload(Website.accounts)).filter(Website.created_by == user_id) + if folder_id: + q = q.filter(Website.folder_id == folder_id) + return q.order_by(Website.name).all() + +# 示例 — 创建网站 +@router.post("/api/websites") +def create_website(data: dict, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + website = Website( + name=data.get("name", ""), + url=data.get("url", ""), + folder_id=data.get("folder_id"), + created_by=user_id, + updated_by=user_id, + ) + # ... + +# Folder 同样需要过滤 +@router.get("/api/folders") +def list_folders(type: str, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + folders = db.query(Folder).filter( + Folder.type == type, + Folder.created_by == user_id, + ).order_by(Folder.sort_order).all() + return folders +``` + +- [ ] **Step 3: 改造 routes/import_api.py** + +```python +from middleware.user_context import UserContext + +@router.post("/api/import/parse") +def parse_import(data: dict, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + # ... 解析逻辑中创建数据时使用 user_id ... + website = Website( + name=..., + url=..., + created_by=user_id, + updated_by=user_id, + ) + account = Account( + username=..., + password=..., + created_by=user_id, + updated_by=user_id, + ) +``` + +- [ ] **Step 4: 改造 routes/share.py** + +分享功能分两部分:**公开查看**(不鉴权)和**分享管理**(需鉴权)。 + +```python +from middleware.user_context import UserContext + +# 公开查看 — 不走网关,直接后端渲染 HTML,不回 Vue SPA +# 用户访问: https://mokeetext.server.zgitm.com/share/{token} +# 无需 request 参数,保持原样 +@router.get("/share/{token}") +def view_shared(token: str, db: Session = Depends(get_db)): + note = db.query(Note).filter_by(share_token=token).first() + if not note: + raise HTTPException(404, "链接无效或已取消分享") + if note.share_expires_at and note.share_expires_at < datetime.utcnow(): + raise HTTPException(410, "分享链接已过期") + # ... 返回 HTMLResponse,保持原样 + +# 分享管理 — 走网关,需鉴权 +@router.post("/api/notes/{note_id}/share") +def share_note(note_id: int, data: dict, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + # ... 生成 share_token + +@router.delete("/api/notes/{note_id}/share") +def unshare_note(note_id: int, db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + note = db.query(Note).filter(Note.id == note_id, Note.created_by == user_id).first() + if not note: + raise HTTPException(404, "笔记不存在") + # ... 清除 share_token + +@router.get("/api/shares") +def list_shares(db: Session = Depends(get_db), request: Request = None): + user_id = UserContext.get_user_id(request) + shares = db.query(Note).filter( + Note.share_token.isnot(None), + Note.created_by == user_id, + ).all() + return shares +``` + +**关键**:`GET /share/{token}` 不走网关、不走 Vue SPA、不鉴权。分享链接格式为 `https://mokeetext.server.zgitm.com/share/{token}`(后端地址)。 + +- [ ] **Step 5: 改造 routes/upload.py** + +```python +from middleware.user_context import UserContext + +@router.post("/api/upload/image") +async def upload_image(file: UploadFile = File(...), db: Session = Depends(get_db), request: Request = None): + """上传图片 — 网关已通过 Authorization 头鉴权,后端记录创建者""" + user_id = UserContext.get_user_id(request) + data = await file.read() + upload = Upload( + filename=file.filename or "img", + content_type=file.content_type, + data=data, + size=len(data), + created_by=user_id, + ) + db.add(upload) + db.commit() + db.refresh(upload) + return {"url": f"/api/file/{upload.id}"} + + +@router.get("/api/file/{file_id}") +def get_file(file_id: int, db: Session = Depends(get_db)): + """读取图片 — 网关已通过 Cookie 鉴权( 标签浏览器自动带 Cookie) + + 流程:浏览器加载 + → 浏览器自动发送 .zgitm.com 域的 Cookie + → 网关从 Cookie 取 Token 验证(Authorization 头为空时 fallback 到 Cookie) + → 验证通过,注入 X-User-* 请求头,转发到后端 + → 后端直接返回图片数据 + """ + upload = db.query(Upload).filter_by(id=file_id).first() + if not upload: + raise HTTPException(404, "文件不存在") + return Response(content=upload.data, media_type=upload.content_type) +``` + +**设计说明:** +- `POST /api/upload/image`:JS fetch 发起,带上 `Authorization` 头 + `X-System-Code`,网关鉴权后注入 `X-User-Id` +- `GET /api/file/{id}`:`` 标签浏览器发起,**无法带 Authorization 头**,但网关会从 URL 所在域(`gw.server.zgitm.com`)的 Cookie 中取 Token 验证。因为 Cookie domain 是 `.zgitm.com`,所有子域请求都会自动携带 +- 图片读取由网关统一鉴权,后端不需要自己做用户隔离(到达后端的请求已经是合法的) + +- [ ] **Step 6: 验证所有路由改造完成** + +```bash +cd /e/AI/claude/new/mokeeText && python -c " +from app import app +# 检查所有路由的依赖注入是否包含 request: Request +for route in app.routes: + if hasattr(route, 'methods'): + print(f'{route.methods} {route.path}') +" +``` + +Expected: 列出所有 API 路由,确认没有遗漏。 + +--- + +## 阶段二:前端改造 + +### Task 4: 环境变量 + Vite 配置 + +**文件:** +- Create: `.env` +- Create: `.env.production` +- Modify: `vite.config.js` + +- [ ] **Step 1: 创建 .env(开发环境)** + +```bash +# .env — 本地开发环境变量 +VITE_GATEWAY_URL = http://localhost:4006 +VITE_LOGIN_URL = https://login.user.zgitm.com +VITE_SYSTEM_CODE = mokeetext-edit +``` + +开发时 Vite 代理到本地 FastAPI 后端,不走网关。 + +- [ ] **Step 2: 创建 .env.production(生产环境)** + +```bash +# .env.production — 生产环境变量 +VITE_GATEWAY_URL = https://gw.server.zgitm.com +VITE_LOGIN_URL = https://login.user.zgitm.com +VITE_SYSTEM_CODE = mokeetext-edit +``` + +生产环境前端请求走网关。 + +- [ ] **Step 3: 确认 vite.config.js 已正确处理 env 前缀** + +当前 `vite.config.js` 不需要改动——Vite 默认将 `VITE_` 前缀的变量暴露给客户端代码。 + +--- + +### Task 5: 新建 Axios 实例 + 请求拦截器 + +**文件:** +- Create: `src/utils/request.js` + +- [ ] **Step 1: 安装 axios** + +```bash +cd /e/AI/claude/new/mokeeText && npm install axios +``` + +- [ ] **Step 2: 创建 Axios 实例** + +```javascript +// src/utils/request.js +import axios from 'axios' + +const SYSTEM_CODE = import.meta.env.VITE_SYSTEM_CODE +const GATEWAY_URL = import.meta.env.VITE_GATEWAY_URL +const LOGIN_URL = import.meta.env.VITE_LOGIN_URL + +// 从 Cookie 读取 Token(登录后网关写入的跨域 Cookie) +function getToken() { + const match = document.cookie.match(/(?:^|;\s*)token=([^;]*)/) + return match ? decodeURIComponent(match[1]) : null +} + +const request = axios.create({ + baseURL: GATEWAY_URL, + timeout: 30000, +}) + +// 请求拦截器:携带 Token 和系统编码 +request.interceptors.request.use(config => { + const token = getToken() + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + // 关键:网关根据此头识别业务系统 + config.headers['X-System-Code'] = SYSTEM_CODE + return config +}) + +// 响应拦截器:401 自动跳转登录 +request.interceptors.response.use( + res => { + // 网关统一响应格式 { code: 200, data: ..., msg: ... } + if (res.data && res.data.code === 200) { + return res.data + } + return Promise.reject(res.data) + }, + err => { + if (err.response?.status === 401) { + window.location.href = `${LOGIN_URL}?systemCode=${SYSTEM_CODE}` + } + return Promise.reject(err) + } +) + +export { getToken } +export default request +``` + +- [ ] **Step 3: 验证 axios 实例可导入** + +```bash +cd /e/AI/claude/new/mokeeText && node -e "require('./src/utils/request.js')" 2>&1 || echo "ESM — 需要在 Vite 环境中验证" +``` + +--- + +### Task 6: 改造 useApi.js — 从 fetch 切换到 axios + +**文件:** +- Modify: `src/composables/useApi.js` + +- [ ] **Step 1: 重写 useApi.js** + +```javascript +// src/composables/useApi.js +// +// 开发模式:直连本地后端(localhost:4006),请求头注入 X-Dev-Mock-User +// 生产模式:走网关(gw.server.zgitm.com),请求头注入 Authorization + X-System-Code + +const isDev = window.location.hostname === 'localhost' + +// 本地开发:直连后端 + mock 用户 +const DEV_BASE = 'http://localhost:4006' + +async function devRequest(url, options = {}) { + const res = await fetch(DEV_BASE + url, { + headers: { + 'Content-Type': 'application/json', + 'X-Dev-Mock-User': 'admin', // 触发后端 DEV_MODE 默认用户 + ...options.headers, + }, + ...options, + }) + if (!res.ok) { + const err = await res.json().catch(() => ({})) + throw new Error(err.detail || res.statusText) + } + return res.json() +} + +// 生产:走网关(通过 axios 实例) +import request, { getToken } from '../utils/request.js' + +async function gwRequest(url, options = {}) { + const method = (options.method || 'GET').toLowerCase() + const config = { method, url, headers: options.headers || {} } + + if (options.body) { + config.data = JSON.parse(options.body) + } + + const res = await request(config) + return res.data !== undefined ? res.data : res +} + +const doRequest = isDev ? devRequest : gwRequest + +export function useApi() { + const api = { + // Notes + listNotes: (folderId) => doRequest(folderId ? `/api/notes?folder_id=${folderId}` : '/api/notes'), + getNote: (id) => doRequest(`/api/notes/${id}`), + createNote: (data) => doRequest('/api/notes', { method: 'POST', body: JSON.stringify(data) }), + updateNote: (id, data) => doRequest(`/api/notes/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteNote: (id) => doRequest(`/api/notes/${id}`, { method: 'DELETE' }), + shareNote: (id, ttl) => doRequest(`/api/notes/${id}/share`, { method: 'POST', body: JSON.stringify({ ttl }) }), + unshareNote: (id) => doRequest(`/api/notes/${id}/share`, { method: 'DELETE' }), + moveNote: (id, folderId) => doRequest(`/api/notes/${id}/move`, { method: 'PUT', body: JSON.stringify({ folder_id: folderId }) }), + + // Websites + listWebsites: (folderId) => doRequest(folderId ? `/api/websites?folder_id=${folderId}` : '/api/websites'), + getWebsite: (id) => doRequest(`/api/websites/${id}`), + createWebsite: (data) => doRequest('/api/websites', { method: 'POST', body: JSON.stringify(data) }), + updateWebsite: (id, data) => doRequest(`/api/websites/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteWebsite: (id) => doRequest(`/api/websites/${id}`, { method: 'DELETE' }), + + // Accounts + getAccount: (id) => doRequest(`/api/accounts/${id}`), + addAccount: (siteId, data) => doRequest(`/api/websites/${siteId}/accounts`, { method: 'POST', body: JSON.stringify(data) }), + updateAccount: (id, data) => doRequest(`/api/accounts/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteAccount: (id) => doRequest(`/api/accounts/${id}`, { method: 'DELETE' }), + moveAccount: (id, direction) => doRequest(`/api/accounts/${id}/move`, { method: 'PUT', body: JSON.stringify({ direction }) }), + + // Folders + listFolders: (type) => doRequest(`/api/folders?type=${type}`), + createFolder: (data) => doRequest('/api/folders', { method: 'POST', body: JSON.stringify(data) }), + updateFolder: (id, data) => doRequest(`/api/folders/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteFolder: (id) => doRequest(`/api/folders/${id}`, { method: 'DELETE' }), + + // Import + parseImport: (text) => doRequest('/api/import/parse', { method: 'POST', body: JSON.stringify({ text }) }), + } + + return api +} +``` + +**设计说明:** +- 开发模式(`localhost`)直连 FastAPI 后端,通过 `X-Dev-Mock-User` 头触发后端的 DEV_DEFAULT_USER +- 生产模式走网关,通过 axios 实例带 Token 和 X-System-Code +- API 方法签名不变,上层 Vue 组件无需改动 + +- [ ] **Step 2: 同步改造 NoteEditor.vue 的图片上传(双地址方案)** + +`NoteEditor.vue` 里有一份独立的 `API_BASE` 和 `fetch` 调用,不走 `useApi.js`,需要单独改。 + +**关键设计**:图片上传走网关(鉴权),图片读取走后端(公开)。因为分享链接是公开访问的,`` 标签只能指向无需鉴权的地址。 + +``` +上传 POST: https://gw.server.zgitm.com/api/upload/image ← 网关(鉴权) +读取 GET: https://mokeetext.server.zgitm.com/api/file/123 ← 后端直连(公开) +``` + +```javascript +// src/components/NoteEditor.vue — 改动点 + +// 现在(第 127 行) +const API_BASE = window.location.hostname === 'localhost' ? '' : 'https://mokeetext.server.zgitm.com' + +// 接入后 — 拆成两个地址 +const isDev = window.location.hostname === 'localhost' +const GW_BASE = isDev ? 'http://localhost:4006' : 'https://gw.server.zgitm.com' +// ↑ 上传走网关 +const FILE_BASE = isDev ? 'http://localhost:4006' : 'https://mokeetext.server.zgitm.com' +// ↑ 图片读取走后端(公开,分享页也需要加载图片) + +// uploadAndInsert 函数: +async function uploadAndInsert(file) { + const form = new FormData() + form.append('file', file) + + // 上传通过网关(需要鉴权头) + const headers = {} + if (!isDev) { + const token = document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1] + if (token) headers['Authorization'] = `Bearer ${token}` + headers['X-System-Code'] = 'mokeetext-edit' + } else { + headers['X-Dev-Mock-User'] = 'admin' + } + + const res = await fetch(GW_BASE + '/api/upload/image', { method: 'POST', body: form, headers }) + const data = await res.json() + + if (data.url) { + // 图片 URL 指向后端直连(公开,分享页 + 编辑器都能加载) + const src = data.url.startsWith('http') ? data.url : FILE_BASE + data.url + editor?.chain().focus().setImage({ src }).run() + } +} +``` + +**NoteEditor.vue 改动总结**:`API_BASE` 拆成 `GW_BASE` + `FILE_BASE`,上传请求加鉴权头,~20 行改动。 + +--- + +### Task 7: 路由守卫 — 未登录跳转登录页 + +**文件:** +- Modify: `src/router.js` + +- [ ] **Step 1: 添加路由守卫** + +```javascript +import { createRouter, createWebHistory } from 'vue-router' +import NotesView from './views/NotesView.vue' +import WebsitesView from './views/WebsitesView.vue' +import SharesView from './views/SharesView.vue' + +const SYSTEM_CODE = import.meta.env.VITE_SYSTEM_CODE +const LOGIN_URL = import.meta.env.VITE_LOGIN_URL + +const routes = [ + { path: '/', redirect: '/notes' }, + { path: '/notes', name: 'notes', component: NotesView }, + { path: '/websites', name: 'websites', component: WebsitesView }, + { path: '/shares', name: 'shares', component: SharesView }, +] + +const router = createRouter({ + history: createWebHistory(), + routes, +}) + +// 路由守卫:无 Token 则跳转统一登录页 +router.beforeEach((to, _from, next) => { + // 分享链接查看页不需要登录 + if (to.path.startsWith('/share/')) { + next() + return + } + + // 本地开发模式:跳过登录检查 + if (window.location.hostname === 'localhost') { + next() + return + } + + const token = document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1] + if (!token) { + window.location.href = `${LOGIN_URL}?systemCode=${SYSTEM_CODE}` + return + } + next() +}) + +export default router +``` + +- [ ] **Step 2: 为分享链接查看添加路由(如果尚未添加)** + +检查 `router.js` 是否已有 `/share/:token` 路由。如果没有,后续 Task 9 在 App.vue 改造时会处理。 + +--- + +### Task 8: 新建 v-permission 指令 + +**文件:** +- Create: `src/directives/permission.js` + +- [ ] **Step 1: 创建 permission 指令** + +```javascript +// src/directives/permission.js + +// 从 Cookie 中读取 Token,解析 JWT payload 中的 permissions +function getPermissions() { + const token = document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1] + if (!token) return [] + try { + const payload = JSON.parse(atob(token.split('.')[1])) + return payload.permissions ?? [] + } catch { + return [] + } +} + +export const permission = { + mounted(el, binding) { + const permissions = getPermissions() + const required = binding.value + // 没有该权限则从 DOM 中移除元素 + if (required && !permissions.includes(required)) { + el.parentNode?.removeChild(el) + } + }, +} +``` + +- [ ] **Step 2: 在 main.js 中全局注册指令** + +修改 `src/main.js`: + +```javascript +import { createApp } from 'vue' +import App from './App.vue' +import router from './router.js' +import { permission } from './directives/permission.js' +import './assets/main.css' + +const app = createApp(App) +app.use(router) +app.directive('permission', permission) +app.mount('#app') +``` + +--- + +### Task 9: 替换用户头像 — 接入 UserChip Widget + 更新路由守卫 + +**文件:** +- Modify: `src/App.vue` +- Modify: `index.html` +- Modify: `src/main.js` + +- [ ] **Step 1: 修改 index.html — 添加 UserChip CSS + process polyfill** + +```html + + + + + + + MoKeeText + + + + +
+ + + +``` + +- [ ] **Step 2: 修改 App.vue — 替换硬编码 Admin 为 UserChip 占位** + +找到 `App.vue` 中 `
` 内的: + +```html +
+ M + Admin +
+``` + +替换为: + +```html + +
+``` + +同时更新 `.user-widget-h` 样式为 UserChip 样式: + +```css +#mokee-user-chip { flex-shrink: 0; } +``` + +- [ ] **Step 3: 修改 main.js — 在 mount 后加载 UserChip JS** + +```javascript +import { createApp } from 'vue' +import App from './App.vue' +import router from './router.js' +import { permission } from './directives/permission.js' +import './assets/main.css' + +const app = createApp(App) +app.use(router) +app.directive('permission', permission) +app.mount('#app') + +// 生产环境:动态加载 UserChip Widget(必须在 mount 之后,因为需要 DOM 中已有 #mokee-user-chip) +// 本地开发:不加载 Widget,使用硬编码的 mock 头像 +if (window.location.hostname !== 'localhost') { + window.process = { env: {} } // polyfill:防止 "process is not defined" + const widgetScript = document.createElement('script') + widgetScript.src = 'https://web.gw.zgitm.com/widgets/user-chip.js' + document.body.appendChild(widgetScript) +} +``` + +- [ ] **Step 4: 本地开发保留 mock 头像** + +在 App.vue 的 topbar 中,UserChip 占位旁边加一个开发环境 fallback: + +```html + +
+ A + Admin(本地) +
+ +
+``` + +在 ` + + + + + + + + + + + + +{% endblock %} + +{% block content %} + + + + +
+
+ +
+
+ + + +
+ ✅ 已保存 +
+
+ + +
+ +
+
编辑
+
+
+
+ + +
+
+ + + +{% endblock %} + +{% block scripts %} + + +{% endblock %} +``` + +- [ ] **Step 3: 创建 static/js/editor.js — Tiptap 初始化** + +```javascript +/** + * Tiptap 增强编辑器初始化 + * 支持:文字颜色、背景高亮、图片、表格、任务列表、代码块、表情 + */ +let editor = null; + +function initEditor(content = "") { + if (editor) { + editor.destroy(); + } + + editor = new tiptap.Editor({ + element: document.querySelector("#tiptapEditor"), + extensions: [ + tiptap.StarterKit.configure({ + codeBlock: false, // 用 lowlight 替代 + }), + tiptap.TextStyle, + tiptap.Color, + tiptap.Highlight.configure({ multicolor: true }), + tiptap.Image.configure({ inline: true, allowBase64: true }), + tiptap.Table.configure({ resizable: true }), + tiptap.TableRow, + tiptap.TableCell, + tiptap.TableHeader, + tiptap.TaskList, + tiptap.TaskItem.configure({ nested: true }), + tiptap.CodeBlockLowlight, + ], + content: content, + onUpdate: () => { + updatePreview(); + scheduleSave(); + }, + }); + + // 初始化工具栏 + renderToolbar(); +} + +function renderToolbar() { + const toolbar = document.querySelector("#tiptapToolbar"); + if (!toolbar) return; + + const buttons = [ + { group: "heading", items: [ + { cmd: "h1", label: "H1", action: () => editor.chain().focus().toggleHeading({ level: 1 }).run() }, + { cmd: "h2", label: "H2", action: () => editor.chain().focus().toggleHeading({ level: 2 }).run() }, + { cmd: "h3", label: "H3", action: () => editor.chain().focus().toggleHeading({ level: 3 }).run() }, + ]}, + { group: "inline", items: [ + { cmd: "bold", label: "B", action: () => editor.chain().focus().toggleBold().run(), style: "font-weight:bold" }, + { cmd: "italic", label: "I", action: () => editor.chain().focus().toggleItalic().run(), style: "font-style:italic" }, + { cmd: "strike", label: "S", action: () => editor.chain().focus().toggleStrike().run(), style: "text-decoration:line-through" }, + ]}, + { group: "color", items: [ + { cmd: "color", label: "🎨 颜色", type: "color", action: (val) => editor.chain().focus().setColor(val).run() }, + { cmd: "highlight", label: "🖌 背景", type: "color", action: (val) => editor.chain().focus().toggleHighlight({ color: val }).run() }, + ]}, + { group: "media", items: [ + { cmd: "image", label: "🖼 图片", action: () => { + const url = prompt("输入图片 URL:"); + if (url) editor.chain().focus().setImage({ src: url }).run(); + }}, + { cmd: "emoji", label: "😊", action: () => { + const emoji = prompt("输入表情符号 (Win+. 打开表情面板):"); + if (emoji) editor.chain().focus().insertContent(emoji).run(); + }}, + ]}, + { group: "block", items: [ + { cmd: "bulletList", label: "• 列表", action: () => editor.chain().focus().toggleBulletList().run() }, + { cmd: "orderedList", label: "1. 列表", action: () => editor.chain().focus().toggleOrderedList().run() }, + { cmd: "taskList", label: "✅ 任务", action: () => editor.chain().focus().toggleTaskList().run() }, + { cmd: "blockquote", label: "❝ 引用", action: () => editor.chain().focus().toggleBlockquote().run() }, + { cmd: "codeBlock", label: "💻 代码", action: () => editor.chain().focus().toggleCodeBlock().run() }, + ]}, + { group: "table", items: [ + { cmd: "table", label: "📋 表格", action: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run() }, + ]}, + ]; + + toolbar.innerHTML = buttons.map(group => { + const items = group.items.map(item => { + if (item.type === "color") { + return ``; + } + return ``; + }).join(""); + return `${items}`; + }).join(""); + + // 绑定按钮事件(非 color 类型) + toolbar.querySelectorAll("button.tb-btn").forEach(btn => { + const item = buttons.flatMap(g => g.items).find(i => i.cmd === btn.dataset.cmd); + if (item && item.action) { + btn.addEventListener("click", item.action); + } + }); + + // 绑定 color input 事件 + toolbar.querySelectorAll("input[type='color']").forEach((input, idx) => { + const colorItems = buttons.flatMap(g => g.items).filter(i => i.type === "color"); + if (colorItems[idx]) { + input.addEventListener("input", (e) => colorItems[idx].action(e.target.value)); + } + }); +} + +function updatePreview() { + const preview = document.querySelector("#previewContent"); + if (preview && editor) { + preview.innerHTML = editor.getHTML(); + } +} +``` + +- [ ] **Step 4: 创建 static/js/notes.js — 笔记页面交互** + +```javascript +/** + * 笔记页面交互逻辑 + */ + +let currentNoteId = null; +let saveTimer = null; +let viewMode = "edit"; // edit | preview | split + +// ===== 视图模式切换 ===== +function setViewMode(mode) { + viewMode = mode; + const editPane = document.querySelector("#editPane"); + const previewPane = document.querySelector("#previewPane"); + + // 更新按钮状态 + document.querySelectorAll(".view-toggle button").forEach(b => { + b.classList.toggle("active", b.dataset.mode === mode); + }); + + // 更新编辑区和预览区 + editPane.classList.remove("hidden"); + previewPane.classList.remove("hidden"); + + if (mode === "edit") { + previewPane.classList.add("hidden"); + editPane.style.borderRight = "none"; + } else if (mode === "preview") { + editPane.classList.add("hidden"); + updatePreview(); + } else { + // split + editPane.style.borderRight = "1px solid #f0f0f0"; + updatePreview(); + } +} + +// ===== 创建新笔记 ===== +async function createNote() { + const resp = await fetch("/api/notes", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + title: "无标题笔记", + content: "", + folder_id: getActiveFolderId(), + }), + }); + const note = await resp.json(); + loadNote(note.id); + refreshNoteList(); +} + +// ===== 加载笔记 ===== +async function loadNote(noteId) { + const resp = await fetch(`/api/notes/${noteId}`); + if (!resp.ok) return; + const note = await resp.json(); + currentNoteId = note.id; + document.querySelector("#currentNoteId").value = note.id; + document.querySelector("#noteTitle").value = note.title; + initEditor(note.content || ""); +} + +// ===== 保存笔记 ===== +function scheduleSave() { + const status = document.querySelector("#saveStatus"); + status.textContent = "💾 保存中..."; + status.style.color = "#f4b400"; + clearTimeout(saveTimer); + saveTimer = setTimeout(() => saveNote(), 800); +} + +async function saveNote() { + if (!currentNoteId) return; + const title = document.querySelector("#noteTitle").value; + const content = editor ? editor.getHTML() : ""; + const resp = await fetch(`/api/notes/${currentNoteId}`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ title, content }), + }); + if (resp.ok) { + const status = document.querySelector("#saveStatus"); + status.textContent = "✅ 已保存"; + status.style.color = "#999"; + } +} + +// 标题修改时保存 +document.addEventListener("DOMContentLoaded", () => { + document.querySelector("#noteTitle").addEventListener("input", scheduleSave); +}); + +// ===== 文件夹筛选 ===== +function filterByFolder(folderId, el) { + document.querySelectorAll(".folder-item").forEach(f => f.classList.remove("active")); + el.classList.add("active"); + fetch(`/api/notes?folder_id=${folderId}`) + .then(r => r.json()) + .then(notes => renderNoteList(notes)); +} + +function getActiveFolderId() { + const active = document.querySelector(".folder-item.active"); + return active ? parseInt(active.dataset.folderId) : null; +} + +// ===== 删除笔记 ===== +async function deleteCurrentNote() { + if (!currentNoteId) return; + if (!confirm("确定删除这条笔记?")) return; + await fetch(`/api/notes/${currentNoteId}`, { method: "DELETE" }); + currentNoteId = null; + window.location.reload(); +} + +// ===== 初始化 ===== +document.addEventListener("DOMContentLoaded", () => { + // 加载第一条笔记 + const firstNoteId = document.querySelector("#currentNoteId")?.value; + if (!firstNoteId) { + createNote(); + } +}); +``` + +--- + +### Task 6: 网站管理页面路由与模板 + +**Files:** +- Create: `routes/websites.py` +- Create: `templates/websites.html` +- Create: `static/js/websites.js` + +- [ ] **Step 1: 创建 routes/websites.py — 页面和 API 路由** + +```python +"""网站管理相关路由""" +from fastapi import APIRouter, Request, Depends, HTTPException +from fastapi.responses import HTMLResponse +from sqlalchemy.orm import Session, joinedload +from models import get_db, Website, Account, Folder + +router = APIRouter(tags=["网站管理"]) + + +@router.get("/websites", response_class=HTMLResponse) +def websites_page(request: Request, db: Session = Depends(get_db)): + """网站管理主页""" + folders = db.query(Folder).filter_by(type="website").order_by(Folder.sort_order).all() + websites = db.query(Website).options(joinedload(Website.accounts)).order_by(Website.name).all() + return request.app.state.templates.TemplateResponse("websites.html", { + "request": request, + "active_page": "websites", + "folders": folders, + "websites": websites, + }) + + +# ===== 网站 CRUD ===== + +@router.get("/api/websites") +def list_websites(folder_id: int = None, db: Session = Depends(get_db)): + """获取网站列表""" + q = db.query(Website).options(joinedload(Website.accounts)) + if folder_id: + q = q.filter(Website.folder_id == folder_id) + return q.order_by(Website.name).all() + + +@router.post("/api/websites") +def create_website(data: dict, db: Session = Depends(get_db)): + """创建网站""" + website = Website( + name=data.get("name", ""), + url=data.get("url", ""), + folder_id=data.get("folder_id"), + ) + db.add(website) + db.commit() + db.refresh(website) + return website + + +@router.get("/api/websites/{website_id}") +def get_website(website_id: int, db: Session = Depends(get_db)): + """获取网站详情(含账号列表)""" + website = db.query(Website).options(joinedload(Website.accounts)).filter_by(id=website_id).first() + if not website: + raise HTTPException(404, "网站不存在") + return website + + +@router.put("/api/websites/{website_id}") +def update_website(website_id: int, data: dict, db: Session = Depends(get_db)): + """更新网站信息""" + website = db.query(Website).filter_by(id=website_id).first() + if not website: + raise HTTPException(404, "网站不存在") + for field in ["name", "url", "folder_id"]: + if field in data: + setattr(website, field, data[field]) + db.commit() + db.refresh(website) + return website + + +@router.delete("/api/websites/{website_id}") +def delete_website(website_id: int, db: Session = Depends(get_db)): + """删除网站""" + website = db.query(Website).filter_by(id=website_id).first() + if not website: + raise HTTPException(404, "网站不存在") + db.delete(website) + db.commit() + return {"ok": True} + + +# ===== 账号 CRUD ===== + +@router.post("/api/websites/{website_id}/accounts") +def add_account(website_id: int, data: dict, db: Session = Depends(get_db)): + """添加账号""" + account = Account( + website_id=website_id, + username=data.get("username", ""), + password=data.get("password", ""), + remark=data.get("remark", ""), + ) + db.add(account) + db.commit() + db.refresh(account) + return account + + +@router.put("/api/accounts/{account_id}") +def update_account(account_id: int, data: dict, db: Session = Depends(get_db)): + """更新账号""" + account = db.query(Account).filter_by(id=account_id).first() + if not account: + raise HTTPException(404, "账号不存在") + for field in ["username", "password", "remark"]: + if field in data: + setattr(account, field, data[field]) + db.commit() + db.refresh(account) + return account + + +@router.delete("/api/accounts/{account_id}") +def delete_account(account_id: int, db: Session = Depends(get_db)): + """删除账号""" + account = db.query(Account).filter_by(id=account_id).first() + if not account: + raise HTTPException(404, "账号不存在") + db.delete(account) + db.commit() + return {"ok": True} + + +# ===== 文件夹 API ===== + +@router.get("/api/folders") +def list_folders(type: str = "website", db: Session = Depends(get_db)): + """获取文件夹列表""" + return db.query(Folder).filter_by(type=type).order_by(Folder.sort_order).all() + + +@router.post("/api/folders") +def create_folder(data: dict, db: Session = Depends(get_db)): + """创建文件夹""" + folder = Folder( + name=data.get("name", "新文件夹"), + type=data.get("type", "website"), + ) + db.add(folder) + db.commit() + db.refresh(folder) + return folder +``` + +- [ ] **Step 2: 创建 templates/websites.html** + +```html +{% extends "base.html" %} +{% block content %} + + + + +
+
+
+ 选择一个网站查看账号详情 +
+
+ + +
+
+ + +
+
+
🔐
+

选择左侧网站查看账号密码

+
+
+
+ + + + + + + + + + + + + + +{% endblock %} + +{% block scripts %} + +{% endblock %} +``` + +- [ ] **Step 3: 创建 static/js/websites.js** + +```javascript +/** + * 网站管理页面交互逻辑 + */ + +let currentSiteId = null; +let parsedImportData = null; + +// ===== 网站选择 ===== +async function selectWebsite(siteId, el) { + currentSiteId = siteId; + document.querySelector("#currentSiteId").value = siteId; + document.querySelectorAll(".site-item").forEach(s => s.classList.remove("active")); + if (el) el.classList.add("active"); + + const resp = await fetch(`/api/websites/${siteId}`); + const site = await resp.json(); + renderSiteDetail(site); +} + +function renderSiteDetail(site) { + document.querySelector("#siteHeaderInfo").innerHTML = ` + 📁 ${getFolderName(site.folder_id)} / + 🌐 ${site.name} + 🔗 ${site.url} + `; + document.querySelector("#editSiteBtn").classList.remove("hidden"); + document.querySelector("#addAccountBtn").classList.remove("hidden"); + + const cardsDiv = document.querySelector("#accountCards"); + if (!site.accounts || site.accounts.length === 0) { + cardsDiv.innerHTML = '
暂无账号,点击"+ 添加账号"
'; + return; + } + + cardsDiv.innerHTML = site.accounts.map(acc => ` +
+ + +
+ `).join(""); +} + +function togglePassword(accId) { + const el = document.querySelector(`#pw-${accId}`); + if (el.textContent === "••••••••") { + el.textContent = el.dataset.password; + } else { + el.textContent = "••••••••"; + } +} + +function copyText(text) { + navigator.clipboard.writeText(text).then(() => { + // 短暂提示 + const toast = document.createElement("div"); + toast.textContent = "已复制!"; + toast.style.cssText = "position:fixed;top:20px;right:20px;background:#333;color:#fff;padding:8px 16px;border-radius:6px;font-size:13px;z-index:999;"; + document.body.appendChild(toast); + setTimeout(() => toast.remove(), 1500); + }); +} + +function getFolderName(folderId) { + if (!folderId) return "未分类"; + const el = document.querySelector(`.folder-group[data-folder-id="${folderId}"] .folder-item`); + return el ? el.textContent.trim().replace(/^[▼▶]\s*/, "").replace(/📁\s*/, "").replace(/\s*\d+$/, "") : "未分类"; +} + +// ===== 文件夹折叠 ===== +function toggleFolder(el) { + const arrow = el.querySelector(".folder-arrow"); + const children = el.parentElement.querySelector(".folder-children"); + if (children.style.display === "none") { + children.style.display = "block"; + arrow.textContent = "▼"; + } else { + children.style.display = "none"; + arrow.textContent = "▶"; + } +} + +// ===== 智能导入 ===== +function showImportModal() { + document.querySelector("#importModal").classList.remove("hidden"); + document.querySelector("#parseResult").classList.add("hidden"); + document.querySelector("#importText").value = ""; + document.querySelector("#importNewFolder").value = ""; +} + +function hideImportModal() { + document.querySelector("#importModal").classList.add("hidden"); + parsedImportData = null; +} + +function parseImport() { + const text = document.querySelector("#importText").value.trim(); + if (!text) return alert("请先粘贴文本"); + + const lines = text.split("\n").map(l => l.trim()).filter(Boolean); + if (lines.length < 3) return alert("至少需要3行:网址+网站名、账号、密码"); + + // 解析首行:网址 + 空格 + 网站名 + const firstLine = lines[0]; + const spaceIndex = firstLine.indexOf(" "); + let url, siteName; + if (spaceIndex > 0) { + url = firstLine.substring(0, spaceIndex).trim(); + siteName = firstLine.substring(spaceIndex + 1).trim(); + } else { + url = firstLine; + // 从 URL 自动提取网站名 + try { + siteName = new URL(url).hostname.replace("www.", ""); + } catch { + siteName = url; + } + } + + const username = lines[1] || ""; + const password = lines[2] || ""; + const remark = lines[3] || ""; + + parsedImportData = { url, siteName, username, password, remark }; + + // 显示识别结果 + document.querySelector("#parseResult").classList.remove("hidden"); + document.querySelector("#parseGrid").innerHTML = ` + 🌐 网址${url} + 🏷 网站名${siteName} + 👤 账号${username} + 🔑 密码${password} + 📝 备注${remark || '(无)'} + `; + + // 检查是否存在同URL网站 + checkDuplicateSite(url); +} + +async function checkDuplicateSite(url) { + const resp = await fetch("/api/websites"); + const sites = await resp.json(); + const exist = sites.find(s => s.url === url); + const alert = document.querySelector("#duplicateAlert"); + if (exist) { + alert.classList.remove("hidden"); + alert.innerHTML = `⚠️ ${exist.name} 已存在(${exist.accounts?.length || 0}个账号),将追加到该网站下`; + // 预选该网站所在文件夹 + if (exist.folder_id) { + document.querySelector("#importFolderSelect").value = exist.folder_id; + } + } else { + alert.classList.add("hidden"); + } +} + +async function confirmImport() { + if (!parsedImportData) return; + + const { url, siteName, username, password, remark } = parsedImportData; + + // 确定文件夹 + let folderId = document.querySelector("#importFolderSelect").value || null; + const newFolderName = document.querySelector("#importNewFolder").value.trim(); + if (newFolderName) { + const resp = await fetch("/api/folders", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ name: newFolderName, type: "website" }), + }); + const folder = await resp.json(); + folderId = folder.id; + } + + // 检查网站是否存在 + const resp = await fetch("/api/websites"); + const sites = await resp.json(); + let site = sites.find(s => s.url === url); + + if (!site) { + // 新建网站 + const createResp = await fetch("/api/websites", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ name: siteName, url, folder_id: folderId }), + }); + site = await createResp.json(); + } + + // 添加账号 + await fetch(`/api/websites/${site.id}/accounts`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ username, password, remark }), + }); + + hideImportModal(); + window.location.reload(); +} + +// ===== 弹窗控制 ===== +function showAddWebsite() { + document.querySelector("#websiteModalTitle").textContent = "添加网站"; + document.querySelector("#websiteName").value = ""; + document.querySelector("#websiteUrl").value = ""; + document.querySelector("#websiteFolder").value = ""; + document.querySelector("#editWebsiteId").value = ""; + document.querySelector("#websiteModal").classList.remove("hidden"); +} + +function hideWebsiteModal() { + document.querySelector("#websiteModal").classList.add("hidden"); +} + +function editWebsite() { + if (!currentSiteId) return; + document.querySelector("#websiteModalTitle").textContent = "编辑网站"; + document.querySelector("#editWebsiteId").value = currentSiteId; + document.querySelector("#websiteModal").classList.remove("hidden"); +} + +async function saveWebsite() { + const id = document.querySelector("#editWebsiteId").value; + const data = { + name: document.querySelector("#websiteName").value, + url: document.querySelector("#websiteUrl").value, + folder_id: document.querySelector("#websiteFolder").value || null, + }; + if (id) { + await fetch(`/api/websites/${id}`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }); + } else { + await fetch("/api/websites", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }); + } + hideWebsiteModal(); + window.location.reload(); +} + +function showAddAccount() { + if (!currentSiteId) return alert("请先选择一个网站"); + document.querySelector("#accountUsername").value = ""; + document.querySelector("#accountPassword").value = ""; + document.querySelector("#accountRemark").value = ""; + document.querySelector("#editAccountId").value = ""; + document.querySelector("#accountModal").classList.remove("hidden"); +} + +function hideAccountModal() { + document.querySelector("#accountModal").classList.add("hidden"); +} + +async function saveAccount() { + const siteId = document.querySelector("#currentSiteId").value; + const accId = document.querySelector("#editAccountId").value; + const data = { + username: document.querySelector("#accountUsername").value, + password: document.querySelector("#accountPassword").value, + remark: document.querySelector("#accountRemark").value, + }; + if (accId) { + await fetch(`/api/accounts/${accId}`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }); + } else { + await fetch(`/api/websites/${siteId}/accounts`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data), + }); + } + hideAccountModal(); + selectWebsite(siteId, document.querySelector(`.site-item[data-site-id="${siteId}"]`)); +} + +async function editAccount(accId) { + document.querySelector("#editAccountId").value = accId; + // 通过当前已渲染的 DOM 获取数据 + document.querySelector("#accountModal").classList.remove("hidden"); +} + +async function deleteAccount(accId) { + if (!confirm("确定删除这个账号?")) return; + await fetch(`/api/accounts/${accId}`, { method: "DELETE" }); + selectWebsite(currentSiteId, document.querySelector(`.site-item[data-site-id="${currentSiteId}"]`)); +} + +function showAddFolder() { + const name = prompt("输入新文件夹名称:"); + if (name) { + fetch("/api/folders", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ name, type: "website" }), + }).then(() => window.location.reload()); + } +} + +function filterSites() { + const query = document.querySelector("#siteSearch").value.toLowerCase(); + document.querySelectorAll(".site-item").forEach(item => { + const name = item.querySelector(".site-name").textContent.toLowerCase(); + item.style.display = name.includes(query) ? "flex" : "none"; + }); +} +``` + +--- + +### Task 7: 智能导入 API + +**Files:** +- Create: `routes/import_api.py` + +- [ ] **Step 1: 创建 routes/import_api.py** + +```python +"""智能导入 API — 文本解析与匹配""" +from fastapi import APIRouter, Depends +from sqlalchemy.orm import Session, joinedload +from models import get_db, Website +from urllib.parse import urlparse + +router = APIRouter(prefix="/api/import", tags=["智能导入"]) + + +@router.post("/parse") +def parse_import_text(data: dict, db: Session = Depends(get_db)): + """解析粘贴的文本,返回结构化结果 + 匹配信息""" + text = data.get("text", "").strip() + if not text: + return {"ok": False, "error": "文本为空"} + + lines = [l.strip() for l in text.split("\n") if l.strip()] + if len(lines) < 3: + return {"ok": False, "error": "至少需要 3 行:网址+网站名、账号、密码"} + + # 解析首行 + first_line = lines[0] + space_idx = first_line.find(" ") + if space_idx > 0: + url = first_line[:space_idx].strip() + site_name = first_line[space_idx + 1:].strip() + else: + url = first_line + try: + site_name = urlparse(url).hostname or url + except Exception: + site_name = url + + result = { + "ok": True, + "url": url, + "site_name": site_name, + "username": lines[1] if len(lines) > 1 else "", + "password": lines[2] if len(lines) > 2 else "", + "remark": lines[3] if len(lines) > 3 else "", + } + + # 匹配已有网站 + existing = db.query(Website).options(joinedload(Website.accounts)).filter_by(url=url).first() + if existing: + result["matched_site"] = { + "id": existing.id, + "name": existing.name, + "folder_id": existing.folder_id, + "account_count": len(existing.accounts), + } + result["action"] = "append" # 追加到已有网站 + else: + result["matched_site"] = None + result["action"] = "create" # 新建网站 + + return result +``` + +--- + +### Task 8: 启动配置与收尾 + +**Files:** +- Modify: `app.py` + +- [ ] **Step 1: 更新 app.py — 添加模板引擎和启动配置** + +将之前创建的 `app.py` 更新为以下完整版本: + +```python +"""MoKeeText — FastAPI 入口""" +from fastapi import FastAPI +from fastapi.staticfiles import StaticFiles +from starlette.responses import RedirectResponse +from starlette.templating import Jinja2Templates +from routes.notes import router as notes_router +from routes.websites import router as websites_router +from routes.import_api import router as import_router + +app = FastAPI(title="MoKeeText", version="1.0.0") + +# 模板引擎 +app.state.templates = Jinja2Templates(directory="templates") + +# 静态文件 +app.mount("/static", StaticFiles(directory="static"), name="static") + +# 路由注册 +app.include_router(notes_router) +app.include_router(websites_router) +app.include_router(import_router) + + +@app.get("/") +def root(): + return RedirectResponse(url="/notes") +``` + +- [ ] **Step 2: 启动应用** + +```bash +uvicorn app:app --reload --host 0.0.0.0 --port 8000 +``` + +Expected: 应用启动在 `http://localhost:8000` + +- [ ] **Step 3: 验证** + - 打开 `http://localhost:8000/notes` — 笔记页面 + - 打开 `http://localhost:8000/websites` — 网站管理页面 + - 新建笔记、编辑保存 + - 添加网站、添加账号 + - 测试智能导入功能 + +--- + +## 实施顺序 + +``` +Task 1 (项目骨架) → Task 2 (数据模型) → Task 3 (初始化数据库) + → Task 4 (入口 + 基础模板 + CSS) + → Task 5 (笔记模块) → Task 6 (网站管理模块) → Task 7 (智能导入) + → Task 8 (收尾 + 启动验证) +``` + +每个 Task 完成后刷新浏览器确认功能正常再继续。 diff --git a/docs/superpowers/specs/2026-06-23-mokeetext-design.md b/docs/superpowers/specs/2026-06-23-mokeetext-design.md new file mode 100644 index 0000000..c291186 --- /dev/null +++ b/docs/superpowers/specs/2026-06-23-mokeetext-design.md @@ -0,0 +1,173 @@ +# MoKeeText Web 记事本 — 设计文档 + +**日期**: 2026-06-23 +**状态**: 已确认 + +--- + +## 项目概述 + +一个 Web 记事本工具,包含两个核心模块: +1. **Markdown 笔记** — 增强型编辑器,类似飞书文档体验 +2. **网站账号管理** — 网站密码本,智能导入功能 + +数据存储到 MySQL。 + +--- + +## 技术选型 + +| 层级 | 技术 | 理由 | +|------|------|------| +| 后端框架 | Python FastAPI | 高性能异步,Python 操作 MySQL 成熟 | +| 模板引擎 | Jinja2 | FastAPI 内置支持,服务端渲染 | +| ORM | SQLAlchemy | 最成熟的 Python ORM,MySQL 支持好 | +| 数据库 | MySQL | 用户指定 | +| 编辑器 | Tiptap | 增强型富文本编辑器,支持颜色/图片/表情/表格 | +| 前端交互 | 原生 JS + CDN 库 | 无构建步骤,快速迭代 | +| 样式 | 手写 CSS(飞书风格)| 简洁现代,大量留白 | + +--- + +## 数据库设计 + +### 文件夹表 (folders) +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 主键 | +| name | VARCHAR(100) | 文件夹名 | +| type | ENUM('note','website') | 文件夹类型 | +| parent_id | INT FK | 父文件夹(NULL为根) | +| sort_order | INT | 排序 | +| created_at | DATETIME | 创建时间 | + +### 笔记表 (notes) +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 主键 | +| title | VARCHAR(500) | 标题 | +| content | LONGTEXT | Tiptap JSON/HTML | +| folder_id | INT FK | 所属文件夹 | +| created_at | DATETIME | 创建时间 | +| updated_at | DATETIME | 更新时间 | + +### 标签表 (tags) +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 主键 | +| name | VARCHAR(50) | 标签名 | +| color | VARCHAR(20) | 颜色 | + +### 笔记-标签关联 (note_tags) +| 字段 | 类型 | 说明 | +|------|------|------| +| note_id | INT FK | 笔记ID | +| tag_id | INT FK | 标签ID | + +### 网站表 (websites) +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 主键 | +| name | VARCHAR(200) | 网站名 | +| url | VARCHAR(500) | 网址 | +| folder_id | INT FK | 所属文件夹 | +| created_at | DATETIME | 创建时间 | + +### 账号表 (accounts) +| 字段 | 类型 | 说明 | +|------|------|------| +| id | INT PK | 主键 | +| website_id | INT FK | 所属网站 | +| username | VARCHAR(500) | 账号 | +| password | VARCHAR(500) | 密码(明文,后续加密) | +| remark | TEXT | 登录说明/备注 | +| created_at | DATETIME | 创建时间 | + +--- + +## 页面路由 + +| 路由 | 页面 | +|------|------| +| `/` | 重定向到 /notes | +| `/notes` | 笔记主页 | +| `/websites` | 网站管理主页 | +| `/api/notes/*` | 笔记 CRUD API | +| `/api/websites/*` | 网站 CRUD API | +| `/api/accounts/*` | 账号 CRUD API | +| `/api/folders/*` | 文件夹 CRUD API | +| `/api/tags/*` | 标签 CRUD API | +| `/api/import/parse` | 智能导入解析 | +| `/api/import/save` | 智能导入保存 | + +--- + +## 智能导入解析逻辑 + +输入格式: +``` +https://github.com 代码网站 +zhangsan_new@qq.com +Xyz789!@# +新注册的开发账号 +``` + +解析规则: +- 第1行:按第一个空格分割 → 前半为URL,后半为网站名 +- 第2行:账号 +- 第3行:密码 +- 第4行:备注(可选) +- 根据URL匹配已有网站 → 存在则返回匹配信息,不存在则标记新建 + +--- + +## UI 布局 + +``` +┌──────────────────────────────────────────────┐ +│ 📝 MoKeeText [笔记] [网站管理] 个人版 │ +├────────────┬─────────────────────────────────┤ +│ 搜索... │ 标题 编辑/预览/分屏 标签│ +│ + 新建 │ ───────────────────────────── │ +│ │ │ +│ 📁 文件夹 │ Tiptap 增强编辑器 │ +│ ├ 工作 │ (支持颜色/图片/表情/表格) │ +│ ├ 个人 │ │ +│ └ 学习 │ │ +│ │ │ +│ 🏷️ 标签 │ │ +│ python │ │ +│ mysql │ │ +└────────────┴─────────────────────────────────┘ +``` + +--- + +## 项目结构 + +``` +mokeeText/ +├── app.py # FastAPI 入口 +├── config.py # 数据库配置 +├── models.py # SQLAlchemy 模型 +├── routes/ +│ ├── notes.py # 笔记相关路由 +│ ├── websites.py # 网站相关路由 +│ └── import_api.py # 智能导入 API +├── templates/ +│ ├── base.html # 基础布局 +│ ├── notes.html # 笔记页 +│ └── websites.html # 网站管理页 +├── static/ +│ ├── css/ +│ │ └── style.css # 飞书风格样式 +│ └── js/ +│ ├── editor.js # Tiptap 初始化 +│ ├── notes.js # 笔记交互 +│ └── websites.js # 网站管理交互 +├── requirements.txt +└── docs/ + └── superpowers/ + └── specs/ + └── 2026-06-23-mokeetext-design.md +``` diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..cd3ca40 --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,2 @@ +node_modules +src diff --git a/frontend/.env b/frontend/.env new file mode 100644 index 0000000..cc3c608 --- /dev/null +++ b/frontend/.env @@ -0,0 +1,4 @@ +# 本地开发环境变量 +VITE_GATEWAY_URL = http://localhost:4006 +VITE_LOGIN_URL = https://login.user.zgitm.com +VITE_SYSTEM_CODE = mokeetext-edit diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 0000000..ac4e4ea --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1,4 @@ +# 生产环境变量 +VITE_GATEWAY_URL = https://gw.server.zgitm.com +VITE_LOGIN_URL = https://login.user.zgitm.com +VITE_SYSTEM_CODE = mokeetext-edit diff --git a/frontend/Dockerfile.frontend b/frontend/Dockerfile.frontend new file mode 100644 index 0000000..7a60fa4 --- /dev/null +++ b/frontend/Dockerfile.frontend @@ -0,0 +1,9 @@ +# ===== 前端 Nginx ===== +FROM nginx:alpine + +# 先构建好 Vue 再打镜像 +COPY static/dist/ /usr/share/nginx/html/ + +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 3006 diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..c90b82e --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,12 @@ + + + + + + MoKeeText + + +
+ + + diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..9ffac00 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 3006; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/frontend/package-lock.json b/frontend/package-lock.json new file mode 100644 index 0000000..93cae75 --- /dev/null +++ b/frontend/package-lock.json @@ -0,0 +1,2835 @@ +{ + "name": "mokeetext", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "mokeetext", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@tiptap/core": "^3.27.1", + "@tiptap/extension-code-block-lowlight": "^3.27.1", + "@tiptap/extension-color": "^3.27.1", + "@tiptap/extension-highlight": "^3.27.1", + "@tiptap/extension-image": "^3.27.1", + "@tiptap/extension-table": "^3.27.1", + "@tiptap/extension-table-cell": "^3.27.1", + "@tiptap/extension-table-header": "^3.27.1", + "@tiptap/extension-table-row": "^3.27.1", + "@tiptap/extension-task-item": "^3.27.1", + "@tiptap/extension-task-list": "^3.27.1", + "@tiptap/extension-text-style": "^3.27.1", + "@tiptap/starter-kit": "^3.27.1", + "axios": "^1.18.1" + }, + "devDependencies": { + "@tiptap/vue-3": "^3.27.1", + "@vitejs/plugin-vue": "^6.0.7", + "esbuild": "^0.28.1", + "vite": "^8.0.16", + "vue": "^3.5.38", + "vue-router": "^4.6.4" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.10.0", + "resolved": "https://registry.npmmirror.com/@emnapi/core/-/core-1.10.0.tgz", + "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.10.0", + "resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.10.0.tgz", + "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", + "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.7.5", + "resolved": "https://registry.npmmirror.com/@floating-ui/core/-/core-1.7.5.tgz", + "integrity": "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.11" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.7.6", + "resolved": "https://registry.npmmirror.com/@floating-ui/dom/-/dom-1.7.6.tgz", + "integrity": "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.7.5", + "@floating-ui/utils": "^0.2.11" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.11", + "resolved": "https://registry.npmmirror.com/@floating-ui/utils/-/utils-0.2.11.tgz", + "integrity": "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.5", + "resolved": "https://registry.npmmirror.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.5.tgz", + "integrity": "sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.133.0", + "resolved": "https://registry.npmmirror.com/@oxc-project/types/-/types-0.133.0.tgz", + "integrity": "sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.3.tgz", + "integrity": "sha512-454rs7jHngixp/NMxd5srYD57OnzSlZ/eFTETjORQHLwJG1lRtmNOJcBerZlfu4GjKqeq8aCCIQrMdHyhI51Hw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.3.tgz", + "integrity": "sha512-PcAhP+ynjURNyy8SKGl5DQP94aGuB/7JrXJb/t7P+hanXvQVMWzUvRRhBAcg/lNRadBhoUPqSoP4xw5tR/KBEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.3.tgz", + "integrity": "sha512-9YpfeUvSE2RS7wysJ81uOZkXJz7f7Q55H2Gvp3VEw/EsahqDtrphrZ0EwDLK5vvKOzaCrBsjF8JmnMLcUt78Gg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.3.tgz", + "integrity": "sha512-yB1IlAsSNHncV6SCTL27/MVGR5htvQsoGxIv5KMGXALp+Ll1wYsn+x98M9MW7qa+NdSbvrrY7ANI4wLJ0n1e6g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.3.tgz", + "integrity": "sha512-Yi30IVAAfLUCy2MseFjbB1jAMDl1VMCAas5StnYp8da9+CKvMd2H2cbEjWcw5NPaPqzvYkVIaF1nNUG+b7u/sw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.3.tgz", + "integrity": "sha512-jsO7R8To+AdlYgUmN5sHSCZbfhtMBkO0WUx8iORQnPcMMdgr7qM2DQmMwgabs3GhNztdmoKkMKQFHD6DTMCIQw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.3.tgz", + "integrity": "sha512-VWkUHwWriDciit80wleYwKILoR/KMvxh/IdwS/paX+ZgpuRpCrKLUdadJbc0NpBEiyhpYawsJ73j9aCvOH+f7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.3.tgz", + "integrity": "sha512-5f1laC0SlIR0yDbFCd8acUhvJIag6N3zC5P7oUPN6wX0aOma+uKJ0wBDH5aq7I1PVI2ttTlhJwzwRIBnLiSGEg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.3.tgz", + "integrity": "sha512-Iq4ko0r4XsgbrF/LunNgHtAGLRRVE2kXonAXQ/MV0mC6jQpMOhW1SvtZja2EhC/kd05++bP78dsqBeIQyYJ6Yg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.3.tgz", + "integrity": "sha512-B8m6tD5+/N5FeNQFbKlLA/2yVq9ycQP1SeedyEYYKWBNR3ZQbkvIUcNnDNM03lO1l5F2roiiFJGgvoLLyZXtSg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.3.tgz", + "integrity": "sha512-pSdpdUJHkuCxun9LE7jvgUB9qsRgaiyNNCX7m/AvHTcq67AiT/Yhoxvw5zPfhrM8k/BfP8ce/hMOpthKDpEUow==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.3.tgz", + "integrity": "sha512-OXXS3RKJgX2uLwM+gYyuH5omcH8fL1LJs96pZGgtetVCahON57+d4SJHzTgZiOjxgGkSnpXpOsWuPDGAKAigEg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.3.tgz", + "integrity": "sha512-JTtb8BWFynicNSoPrehsCzBtOKjZ6jhMiPFEmOiuXg1Fl8dn2KHQob+GuPSGR0dryQa1PQJbzjF3dqO/whhjLg==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.3.tgz", + "integrity": "sha512-gEdFFEN70A/jxb2svrWsN3aDL7OUtmvlOy+6fa2jxG8K0wQ1ZbdeLGnidov6Yu5/733dI5ySfzFlQ/cb0bSz1g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.3.tgz", + "integrity": "sha512-eXB7CHuaQdqmJcc3koCNtNPmT/bj2gc999kUFgBxG8Ac0NdgXc4rkCHhqrgrhN3zddvvvrgzj1e90SuSfmyIXA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tiptap/core": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/core/-/core-3.27.1.tgz", + "integrity": "sha512-rV6Qn4wmC6BxfF+4mu6bqGWj9vA4oXXhsrpXaJL2uhjxeHAGofjwcHof2X84VYzeyXgdlsGmqKie4TAppVXZUQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-blockquote": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-blockquote/-/extension-blockquote-3.27.1.tgz", + "integrity": "sha512-VMF7xJx6qEGiX6DTKNiL31NLqypOcd/4sNjFSe8rb41PwejBJh/nOqVIbBvWkiT6NMGFLxMhj7zJ8/zPo1hXeg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-bold": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-bold/-/extension-bold-3.27.1.tgz", + "integrity": "sha512-TlC5bsS+pqETTrlz4CZz9RO/cKBYtELGIxwtKeivUn3eNfnOxQbbu4WDsiwIfzRFyd0OMnKl6BPM2KnYEehoEQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-bubble-menu": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-bubble-menu/-/extension-bubble-menu-3.27.1.tgz", + "integrity": "sha512-j/j8Qp9Z5nViade2m7zjrO/CYH/Ca80Qj7aqo0eUaei6FZQ5izlF9o4XQU5EFMAutV6mwynsPUp8FVo5sCuYfw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@floating-ui/dom": "^1.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-bullet-list": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-bullet-list/-/extension-bullet-list-3.27.1.tgz", + "integrity": "sha512-faCUHnRP47o9Zh9VZZX6EX/569udw9Vopm2PgEKPWuKLE2qaS5WBuUVU0iItdJmKUqaWiOZkpoW4jvnDmj0dfg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "3.27.1" + } + }, + "node_modules/@tiptap/extension-code": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-code/-/extension-code-3.27.1.tgz", + "integrity": "sha512-epOUpFfEmBzjvnqvjv2qHX7NAuLo5dlOGV690lWu+sAYMjibuJBeVvAiKPyFCfRCCTUxdbDB3jbaOA1yEcEJ7w==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-code-block": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-code-block/-/extension-code-block-3.27.1.tgz", + "integrity": "sha512-pHlzmZx2OlHfyQ0yRlT5UL4mGokz947DthZuYefN1OleVqOkHpWBG+2JQwqoNq6bmzMne92zbH32rhcJUEYSjA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-code-block-lowlight": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-code-block-lowlight/-/extension-code-block-lowlight-3.27.1.tgz", + "integrity": "sha512-rDZYDwKpV3Uw8xjI5pzSQTLJ7pEyJkDrVhnzdh9mBY3sHVwP1maYh+0kRUrHi5N3EhiNp/GXG1kPjysPIQ4nqQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/extension-code-block": "3.27.1", + "@tiptap/pm": "3.27.1", + "highlight.js": "^11", + "lowlight": "^2 || ^3" + } + }, + "node_modules/@tiptap/extension-color": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-color/-/extension-color-3.27.1.tgz", + "integrity": "sha512-9R/vW4dDTce0E0HU+AyfSkKhz08Hlrx7noRRj3CKrTwsCTR86wReTKFHlzxhLKZiDrJuV2Y7CtNG7KGrAArf+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-text-style": "3.27.1" + } + }, + "node_modules/@tiptap/extension-document": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-document/-/extension-document-3.27.1.tgz", + "integrity": "sha512-8FbBTkfnRP4iVaoj+2h3iWa+H0eGDD3yTyVCwrmue/sQTkqUNUoSuAZa3GDG4Sd41xdPwTJxl9nUWGgM1qDCnw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-dropcursor": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-dropcursor/-/extension-dropcursor-3.27.1.tgz", + "integrity": "sha512-blFf9x9RG0Qr7P3FoAH/033ffa+mMLZn34trVs8Vi0Ppk6FmJAg5HpYFOtmYoeREdNDJ5rHJKV7SoACbOHgskQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extensions": "3.27.1" + } + }, + "node_modules/@tiptap/extension-floating-menu": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-floating-menu/-/extension-floating-menu-3.27.1.tgz", + "integrity": "sha512-BmJF1VqB7dSJkgAalrpVFj88WLhxKjcWPuWHOqf2ITrUU2832BhKLXKmxjWUy1gqV8PfNNVWtGfIERy7I0y0+Q==", + "dev": true, + "license": "MIT", + "optional": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@floating-ui/dom": "^1.0.0", + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-gapcursor": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-gapcursor/-/extension-gapcursor-3.27.1.tgz", + "integrity": "sha512-QoezN0wdvXIwLQ4ee2ccWDaX3RG0lzgQpIMpMz55oPDhpUVax1+19ApsS53LkcktpS4EbnPL4xO4DaJk0Vp7PQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extensions": "3.27.1" + } + }, + "node_modules/@tiptap/extension-hard-break": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-hard-break/-/extension-hard-break-3.27.1.tgz", + "integrity": "sha512-iv/m9hzl6jfSj9Q8UEjAxONvCoUDaP7M9SRCPx3PaLNxA230TTD6RE0Ye4zFJ8ze7ZVoJJMAqg9Qpq1iYg2JOQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-heading": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-heading/-/extension-heading-3.27.1.tgz", + "integrity": "sha512-SrC4l1kEIyv9ZXFaI/8LQqU2MyMmjczw7XXsWUQOTN4YXv0JyVgMNR3cI/wz0d2xsTfBdZ1N85Tdng+Ga1t0Sg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-highlight": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-highlight/-/extension-highlight-3.27.1.tgz", + "integrity": "sha512-IeMIUKbW4oyRkgn92BPYQ0fifkbTwVigKwa107nGDHMokz+pHQPFHy8xG3U7gtUOra/8OUo57bFgNGuP0TaH4A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-horizontal-rule": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-3.27.1.tgz", + "integrity": "sha512-QlKE7qn5qMnIGVGhXQlvYedvLtNJ9z0dmit5w8vPb8tKzW4Spk6M7N2kruprrDA8GBwHfeR5wmF+njfUm34qxg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-image": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-image/-/extension-image-3.27.1.tgz", + "integrity": "sha512-+JTahgQT+NxiGjduaB3qJVyhU/wh4m3pVkht1Earioku2bm/apj5Lb8rSowa/NJYP3B+oQgV/V4YLw5dtDgBoA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-italic": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-italic/-/extension-italic-3.27.1.tgz", + "integrity": "sha512-jGGeyn9uRUnNjSTHpbqhiGsp6KaYTSbV09jDXPJI9cDwfV9hpugLvpaCZd0BMBbhU1B1W6kOfX0BE15qX/HQfA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-link": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-link/-/extension-link-3.27.1.tgz", + "integrity": "sha512-/2jBfsxBZUDGJmpZifqRQPz7f1E5qpS1BckTZ39TADzUJX+feKy7RJ3DtQ02+8y6SSMzvP9loGVjrk6zEMTk4g==", + "license": "MIT", + "dependencies": { + "linkifyjs": "^4.3.3" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-list": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-list/-/extension-list-3.27.1.tgz", + "integrity": "sha512-c2Upru7lj0/ZV/Ibww6cNz6sUS8m6Dp/9uygFhYcZOd3X8M0xBIEk42c6m6SQehkPziVA8QOgNJz7sMqsbz1OQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-list-item": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-list-item/-/extension-list-item-3.27.1.tgz", + "integrity": "sha512-zwRl01ETfCkWUvtvK5fw9bXtAajMPkvlkE3Cq6JvH3LF7XXJwDtNj5Tj7exacMpCaSZmlNc43vFb2rAYnrnwMA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "3.27.1" + } + }, + "node_modules/@tiptap/extension-list-keymap": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-list-keymap/-/extension-list-keymap-3.27.1.tgz", + "integrity": "sha512-OIMZNlzPSO8WRd4ic73Fxckzl4N1tesjjLL2XApaNA/uMpO0LoF6WSRPAWv+Z24Wp92ARRJAnRP7iZoI5+Jxig==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "3.27.1" + } + }, + "node_modules/@tiptap/extension-ordered-list": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-ordered-list/-/extension-ordered-list-3.27.1.tgz", + "integrity": "sha512-GYrKqD//9nHJ2r80uXqbDMzRnFpGzbaEQRTSGaO/SH7DvXWFMow8evkOdjQ7PCQO07jNjJo75+A85Jwu3Ov3AA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "3.27.1" + } + }, + "node_modules/@tiptap/extension-paragraph": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-paragraph/-/extension-paragraph-3.27.1.tgz", + "integrity": "sha512-7K7eo1gruOgAsnbK+GCV23AUVUI0cL1bTig8HaPneoFMVbig7vddk8jNLKBWO8TXVbG7TuHdnDN4F98vdtwh5Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-strike": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-strike/-/extension-strike-3.27.1.tgz", + "integrity": "sha512-Y3DW1jlSlCNCyMGHP3+3qBNNPS83wuFz4RTYGjZtvRRTCRh7apZme9XRWMq1rN5mJ2Cr7fKocA2/5Bs13KgN6Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-table": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-table/-/extension-table-3.27.1.tgz", + "integrity": "sha512-tNB8kjxo0+XPremnWkd6NUikpeJ+JQrss7HntL8GgIxX4t0gkdnLn9yUWb0JzcaYP7Y8iTZZHdkPs0P154DG8Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/extension-table-cell": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-table-cell/-/extension-table-cell-3.27.1.tgz", + "integrity": "sha512-aopweoHugP+ZR5WTgb7mccXXWmjoNv7PBjtQDl8rvS4IWsJE1w23B+rkj7VuoncO8WK5bU3SS9O3l5aObql68w==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-table": "3.27.1" + } + }, + "node_modules/@tiptap/extension-table-header": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-table-header/-/extension-table-header-3.27.1.tgz", + "integrity": "sha512-+J9EyKP6RMInfMJbIoNemqWzHxZe9XZv/7OjpsvtVZO1cxMTd5W1xIg0Ntr7YMdG9eKBC8Vwx5jjFbRm2tbM3A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-table": "3.27.1" + } + }, + "node_modules/@tiptap/extension-table-row": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-table-row/-/extension-table-row-3.27.1.tgz", + "integrity": "sha512-peEcbNRrJJ9Qc/WNKQNFbkwBrJvBvq22Dp5WNqEygn/ZJez1qD9ctd10+D6f3b9GtSyx12sfDgn8yBufWa+Iug==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-table": "3.27.1" + } + }, + "node_modules/@tiptap/extension-task-item": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-task-item/-/extension-task-item-3.27.1.tgz", + "integrity": "sha512-HxS85Xqlf9voWpqW6yJNExjnqy9AcQbvL7K41gzKUIaXZdNxAyEkUg7wve7WAd7AUPI9yrS9WONplhmq7pWuJw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "3.27.1" + } + }, + "node_modules/@tiptap/extension-task-list": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-task-list/-/extension-task-list-3.27.1.tgz", + "integrity": "sha512-5LaJU3q/O6S1aNe9uj/VbZ7uS8G9mJMvJGNm/wRGyR3HcZtHAcFsPh9+woylQvUThD0qO9OMeGXkgqRSE+ayuA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/extension-list": "3.27.1" + } + }, + "node_modules/@tiptap/extension-text": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-text/-/extension-text-3.27.1.tgz", + "integrity": "sha512-6ZwaZwSrDh+KFFv6V1J79oO37yPs7y1bFxvk1/9Ih2rn3Xr5AWz+eMS+n8RpH3djBVVAQpdIAeYQgcn+VCSsTg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-text-style": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-text-style/-/extension-text-style-3.27.1.tgz", + "integrity": "sha512-J48WIl+6YDYTFPhWXUBQk+u7+AKVUqTdvrZOQyPYCGuQMgHrYzgWrI5+HeEifUgXJ5rMIWWP3qytp7KhVVqpDQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extension-underline": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extension-underline/-/extension-underline-3.27.1.tgz", + "integrity": "sha512-N889J4nXN/TPfVt8uF9N1A0SY82E90zwc1y26lqOcw6KWNLmQrlhMh/9OD4ikLDbekmFpOBq/UicpHf/6S8hbQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1" + } + }, + "node_modules/@tiptap/extensions": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/extensions/-/extensions-3.27.1.tgz", + "integrity": "sha512-1Tdx9faw8k0/83V6X+xCDVhV8yElGt95JxeW3YMkKQJI56QdlPz0xOdJPlMiSGJKinPyVier+x9LJD/YZUZIaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1" + } + }, + "node_modules/@tiptap/pm": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/pm/-/pm-3.27.1.tgz", + "integrity": "sha512-Ffjx+vimmBU7zH/KrpXzJid3+pziCe/VL2aexSTP63cyQwKQ65LkFkCKaIsSpFdQQuakVZBGWjCA5RoBV852pw==", + "license": "MIT", + "dependencies": { + "prosemirror-changeset": "^2.3.0", + "prosemirror-commands": "^1.6.2", + "prosemirror-dropcursor": "^1.8.1", + "prosemirror-gapcursor": "^1.3.2", + "prosemirror-history": "^1.4.1", + "prosemirror-inputrules": "^1.4.0", + "prosemirror-keymap": "^1.2.3", + "prosemirror-model": "^1.25.7", + "prosemirror-schema-list": "^1.5.0", + "prosemirror-state": "^1.4.4", + "prosemirror-tables": "^1.8.0", + "prosemirror-transform": "^1.12.0", + "prosemirror-view": "^1.41.8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + } + }, + "node_modules/@tiptap/starter-kit": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/starter-kit/-/starter-kit-3.27.1.tgz", + "integrity": "sha512-vfxRsqW8rCc0k4pzo0ilU3wobVi2wqVj88VZI2SlgZlNnUAkrDGDIAph7CTa9k9fshV+O1ivpEgPC5yC046jow==", + "license": "MIT", + "dependencies": { + "@tiptap/core": "^3.27.1", + "@tiptap/extension-blockquote": "^3.27.1", + "@tiptap/extension-bold": "^3.27.1", + "@tiptap/extension-bullet-list": "^3.27.1", + "@tiptap/extension-code": "^3.27.1", + "@tiptap/extension-code-block": "^3.27.1", + "@tiptap/extension-document": "^3.27.1", + "@tiptap/extension-dropcursor": "^3.27.1", + "@tiptap/extension-gapcursor": "^3.27.1", + "@tiptap/extension-hard-break": "^3.27.1", + "@tiptap/extension-heading": "^3.27.1", + "@tiptap/extension-horizontal-rule": "^3.27.1", + "@tiptap/extension-italic": "^3.27.1", + "@tiptap/extension-link": "^3.27.1", + "@tiptap/extension-list": "^3.27.1", + "@tiptap/extension-list-item": "^3.27.1", + "@tiptap/extension-list-keymap": "^3.27.1", + "@tiptap/extension-ordered-list": "^3.27.1", + "@tiptap/extension-paragraph": "^3.27.1", + "@tiptap/extension-strike": "^3.27.1", + "@tiptap/extension-text": "^3.27.1", + "@tiptap/extension-underline": "^3.27.1", + "@tiptap/extensions": "^3.27.1", + "@tiptap/pm": "^3.27.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + } + }, + "node_modules/@tiptap/vue-3": { + "version": "3.27.1", + "resolved": "https://registry.npmmirror.com/@tiptap/vue-3/-/vue-3-3.27.1.tgz", + "integrity": "sha512-o5GB6hfUnyf9sCB306rHWmaIYRL+02ROX657EkuY8tEWKHMTuMjHWl2AqHMP47wz0W9DaMOJLvcPpYdAEKq3Mw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "optionalDependencies": { + "@tiptap/extension-bubble-menu": "^3.27.1", + "@tiptap/extension-floating-menu": "^3.27.1" + }, + "peerDependencies": { + "@floating-ui/dom": "^1.0.0", + "@tiptap/core": "3.27.1", + "@tiptap/pm": "3.27.1", + "vue": "^3.0.0" + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.3", + "resolved": "https://registry.npmmirror.com/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", + "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmmirror.com/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT", + "peer": true + }, + "node_modules/@vitejs/plugin-vue": { + "version": "6.0.7", + "resolved": "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-6.0.7.tgz", + "integrity": "sha512-km+p+XdSz9Sxm5rqUbqcSfZYaAniKxWBj1KURl+Jr7UaPvvX7BmaWMdP69I5rrFDeQGyxAG7NXdc57vz+snhWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", + "vue": "^3.2.25" + } + }, + "node_modules/@vue/compiler-core": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.5.38.tgz", + "integrity": "sha512-s99aGxWYig9ErHbct27KXEGhrBYlRI6c4MwAgXErOAbX9xiW37/uMa+XUDO69zLz83dng8UUZ70CTOJrLrYrEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@vue/shared": "3.5.38", + "entities": "^7.0.1", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.1" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.5.38.tgz", + "integrity": "sha512-JTqp25l8aFfJYF7/KmsXZjAxJz7T+SjmTJLoXVjHtc2BrSgSiW2n9Aem/cWq1OPe68A8JL06B3eVdhlP0H4TVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-core": "3.5.38", + "@vue/shared": "3.5.38" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.5.38.tgz", + "integrity": "sha512-DuA2GiZawSEW442iw/9+Fkol8hTgb4Ke5KkhmSry65QA7YuyMbIdy8p0XZRMvNwJdgRz307W8g1CSzdvS4nuNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@vue/compiler-core": "3.5.38", + "@vue/compiler-dom": "3.5.38", + "@vue/compiler-ssr": "3.5.38", + "@vue/shared": "3.5.38", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.21", + "postcss": "^8.5.15", + "source-map-js": "^1.2.1" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.5.38.tgz", + "integrity": "sha512-7s+W5Gc42FGxZMcuwl8H5B29T8BJPMdBT7KHFE+BbAuZ/iTEdTtv7z2XiMjiaUUw4w3ZcCEdHs36RuYJ2VA7bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.38", + "@vue/shared": "3.5.38" + } + }, + "node_modules/@vue/devtools-api": { + "version": "6.6.4", + "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.6.4.tgz", + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vue/reactivity": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.38.tgz", + "integrity": "sha512-pG6LV/NDNRbKizcUjFFLAfjaL8mcv4DmR9avNcUw2gDHBzZneuS2TWCmp633ynzxz9YYKNeEPK2I8Wraqy2HUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/shared": "3.5.38" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.5.38.tgz", + "integrity": "sha512-iyW8WVfF1CpCXxncZY5Ei6rSd6oZr5DgEom//fUjRBRl56AXPD+s9ATvukRt77ZFTuYlnVA1bxY+dJB94tWVYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.38", + "@vue/shared": "3.5.38" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.5.38.tgz", + "integrity": "sha512-apX2wt9sdfDshS+a2xueFZLVpt0GkRJZSoPmrW/SA4yzXTznhfcMVW59gr7h4YQeY0vJhdJkk2rsIDwgfFgC5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.38", + "@vue/runtime-core": "3.5.38", + "@vue/shared": "3.5.38", + "csstype": "^3.2.3" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.5.38.tgz", + "integrity": "sha512-vue8vbf2QlV4quHqzwmJy6dWfmRhP1J8l4wtZg60CL6VoKqcPY2oe7may3+1d9qfpedjK5PRLFqd5k3Isj9mUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-ssr": "3.5.38", + "@vue/shared": "3.5.38" + }, + "peerDependencies": { + "vue": "3.5.38" + } + }, + "node_modules/@vue/shared": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.5.38.tgz", + "integrity": "sha512-FTW0AFZNaK5/mOqvGBwVfUlNLU38TiQn4+DQgIFUnrBBJQ1crMJ82yeGQLV5jyKFsO8yRukpbuP7x+nRbH6aug==", + "dev": true, + "license": "MIT" + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.18.1", + "resolved": "https://registry.npmmirror.com/axios/-/axios-1.18.1.tgz", + "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.16.0", + "form-data": "^4.0.5", + "https-proxy-agent": "^5.0.1", + "proxy-from-env": "^2.1.0" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "peer": true, + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmmirror.com/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/follow-redirects": { + "version": "1.16.0", + "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.16.0.tgz", + "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/highlight.js": { + "version": "11.11.1", + "resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.11.1.tgz", + "integrity": "sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==", + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmmirror.com/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/linkifyjs": { + "version": "4.3.3", + "resolved": "https://registry.npmmirror.com/linkifyjs/-/linkifyjs-4.3.3.tgz", + "integrity": "sha512-P8aEP5U/D1/IlTY2OeYsErdwh9bGuLE30NcXtKEjgdHcahveQoQwM2yZNsioQHsWFz0P7KKudisbrzCgR0sDHg==", + "license": "MIT" + }, + "node_modules/lowlight": { + "version": "3.3.0", + "resolved": "https://registry.npmmirror.com/lowlight/-/lowlight-3.3.0.tgz", + "integrity": "sha512-0JNhgFoPvP6U6lE/UdVsSq99tn6DhjjpAj5MxG49ewd2mOBVtwWYIT8ClyABhq198aXXODMU6Ox8DrGy/CpTZQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.0.0", + "highlight.js": "~11.11.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.15", + "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.15.tgz", + "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/orderedmap": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/orderedmap/-/orderedmap-2.1.1.tgz", + "integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.15", + "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prosemirror-changeset": { + "version": "2.4.1", + "resolved": "https://registry.npmmirror.com/prosemirror-changeset/-/prosemirror-changeset-2.4.1.tgz", + "integrity": "sha512-96WBLhOaYhJ+kPhLg3uW359Tz6I/MfcrQfL4EGv4SrcqKEMC1gmoGrXHecPE8eOwTVCJ4IwgfzM8fFad25wNfw==", + "license": "MIT", + "dependencies": { + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-commands": { + "version": "1.7.1", + "resolved": "https://registry.npmmirror.com/prosemirror-commands/-/prosemirror-commands-1.7.1.tgz", + "integrity": "sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w==", + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.10.2" + } + }, + "node_modules/prosemirror-dropcursor": { + "version": "1.8.2", + "resolved": "https://registry.npmmirror.com/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.2.tgz", + "integrity": "sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw==", + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0", + "prosemirror-view": "^1.1.0" + } + }, + "node_modules/prosemirror-gapcursor": { + "version": "1.4.1", + "resolved": "https://registry.npmmirror.com/prosemirror-gapcursor/-/prosemirror-gapcursor-1.4.1.tgz", + "integrity": "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==", + "license": "MIT", + "dependencies": { + "prosemirror-keymap": "^1.0.0", + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-view": "^1.0.0" + } + }, + "node_modules/prosemirror-history": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/prosemirror-history/-/prosemirror-history-1.5.0.tgz", + "integrity": "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==", + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.31.0", + "rope-sequence": "^1.3.0" + } + }, + "node_modules/prosemirror-inputrules": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/prosemirror-inputrules/-/prosemirror-inputrules-1.5.1.tgz", + "integrity": "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw==", + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-keymap": { + "version": "1.2.3", + "resolved": "https://registry.npmmirror.com/prosemirror-keymap/-/prosemirror-keymap-1.2.3.tgz", + "integrity": "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==", + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.0.0", + "w3c-keyname": "^2.2.0" + } + }, + "node_modules/prosemirror-model": { + "version": "1.25.9", + "resolved": "https://registry.npmmirror.com/prosemirror-model/-/prosemirror-model-1.25.9.tgz", + "integrity": "sha512-pRTklkDDMMRopyoAcrr9wV/8g/RYgrLHBuJAb5hlEuYZRdm5yqmPjWId83fpBwPpSFqEdja0H7Dfd7z1X/npcA==", + "license": "MIT", + "dependencies": { + "orderedmap": "^2.0.0" + } + }, + "node_modules/prosemirror-schema-list": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/prosemirror-schema-list/-/prosemirror-schema-list-1.5.1.tgz", + "integrity": "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==", + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.7.3" + } + }, + "node_modules/prosemirror-state": { + "version": "1.4.4", + "resolved": "https://registry.npmmirror.com/prosemirror-state/-/prosemirror-state-1.4.4.tgz", + "integrity": "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==", + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.27.0" + } + }, + "node_modules/prosemirror-tables": { + "version": "1.8.5", + "resolved": "https://registry.npmmirror.com/prosemirror-tables/-/prosemirror-tables-1.8.5.tgz", + "integrity": "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==", + "license": "MIT", + "dependencies": { + "prosemirror-keymap": "^1.2.3", + "prosemirror-model": "^1.25.4", + "prosemirror-state": "^1.4.4", + "prosemirror-transform": "^1.10.5", + "prosemirror-view": "^1.41.4" + } + }, + "node_modules/prosemirror-transform": { + "version": "1.12.0", + "resolved": "https://registry.npmmirror.com/prosemirror-transform/-/prosemirror-transform-1.12.0.tgz", + "integrity": "sha512-GxboyN4AMIsoHNtz5uf2r2Ru551i5hWeCMD6E2Ib4Eogqoub0NflniaBPVQ4MrGE5yZ8JV9tUHg9qcZTTrcN4w==", + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.21.0" + } + }, + "node_modules/prosemirror-view": { + "version": "1.41.9", + "resolved": "https://registry.npmmirror.com/prosemirror-view/-/prosemirror-view-1.41.9.tgz", + "integrity": "sha512-clTunTX+eaLbr87L1V1QPheRlEQJyTlL3gXe9x3jQIk3rL0RVWxviDGz8tFaydwIVm+hKhYCyr+R/zBtWr9s6A==", + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.25.8", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0" + } + }, + "node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/rolldown": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/rolldown/-/rolldown-1.0.3.tgz", + "integrity": "sha512-i00lAJ2ks1BYr7rjNjKC7BcqAS7nVfiT3QX1SI5aY+AFHblCmaUf9OE9dbdzDvW6dJxbi2ZCZiy9v3CcwOiX3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.133.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.0.3", + "@rolldown/binding-darwin-arm64": "1.0.3", + "@rolldown/binding-darwin-x64": "1.0.3", + "@rolldown/binding-freebsd-x64": "1.0.3", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.3", + "@rolldown/binding-linux-arm64-gnu": "1.0.3", + "@rolldown/binding-linux-arm64-musl": "1.0.3", + "@rolldown/binding-linux-ppc64-gnu": "1.0.3", + "@rolldown/binding-linux-s390x-gnu": "1.0.3", + "@rolldown/binding-linux-x64-gnu": "1.0.3", + "@rolldown/binding-linux-x64-musl": "1.0.3", + "@rolldown/binding-openharmony-arm64": "1.0.3", + "@rolldown/binding-wasm32-wasi": "1.0.3", + "@rolldown/binding-win32-arm64-msvc": "1.0.3", + "@rolldown/binding-win32-x64-msvc": "1.0.3" + } + }, + "node_modules/rope-sequence": { + "version": "1.3.4", + "resolved": "https://registry.npmmirror.com/rope-sequence/-/rope-sequence-1.3.4.tgz", + "integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==", + "license": "MIT" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/vite": { + "version": "8.0.16", + "resolved": "https://registry.npmmirror.com/vite/-/vite-8.0.16.tgz", + "integrity": "sha512-h9bXPmJichP5fLmVQo3PyaGSDE2n3aPuomeAlVRm0JLmt4rY6zmPKd59HYI4LNW8oTK7tlTsuC7l/m7awx9Jcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.32.0", + "picomatch": "^4.0.4", + "postcss": "^8.5.15", + "rolldown": "1.0.3", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.1.18", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vue": { + "version": "3.5.38", + "resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.38.tgz", + "integrity": "sha512-vAMKHfImQlYSy0C+PBue4s3ERZ2xGKfgZg5GXAsLInq1dyh2H78ILVP5sK0KPFPVW4kv+OGCIvBEondcjpZp7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.38", + "@vue/compiler-sfc": "3.5.38", + "@vue/runtime-dom": "3.5.38", + "@vue/server-renderer": "3.5.38", + "@vue/shared": "3.5.38" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/vue-router": { + "version": "4.6.4", + "resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.6.4.tgz", + "integrity": "sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vue/devtools-api": "^6.6.4" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmmirror.com/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "license": "MIT" + } + } +} diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..25607f0 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,42 @@ +{ + "name": "mokeetext", + "version": "1.0.0", + "description": "", + "main": "index.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "dev": "vite", + "build": "vite build", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "type": "commonjs", + "dependencies": { + "@tiptap/core": "^3.27.1", + "@tiptap/extension-code-block-lowlight": "^3.27.1", + "@tiptap/extension-color": "^3.27.1", + "@tiptap/extension-highlight": "^3.27.1", + "@tiptap/extension-image": "^3.27.1", + "@tiptap/extension-table": "^3.27.1", + "@tiptap/extension-table-cell": "^3.27.1", + "@tiptap/extension-table-header": "^3.27.1", + "@tiptap/extension-table-row": "^3.27.1", + "@tiptap/extension-task-item": "^3.27.1", + "@tiptap/extension-task-list": "^3.27.1", + "@tiptap/extension-text-style": "^3.27.1", + "@tiptap/starter-kit": "^3.27.1", + "axios": "^1.18.1" + }, + "devDependencies": { + "@tiptap/vue-3": "^3.27.1", + "@vitejs/plugin-vue": "^6.0.7", + "esbuild": "^0.28.1", + "vite": "^8.0.16", + "vue": "^3.5.38", + "vue-router": "^4.6.4" + } +} diff --git a/frontend/src/App.vue b/frontend/src/App.vue new file mode 100644 index 0000000..b71f638 --- /dev/null +++ b/frontend/src/App.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/frontend/src/assets/main.css b/frontend/src/assets/main.css new file mode 100644 index 0000000..8913021 --- /dev/null +++ b/frontend/src/assets/main.css @@ -0,0 +1,314 @@ +/* ===== MoKeeText Design System ===== */ +:root { + --bg-page: #F5F6F8; + --bg-sidebar: #FCFCFD; + --bg-surface: #FFFFFF; + --bg-hover: #F2F3F5; + --bg-active: #EEF3FF; + + --text-primary: #1F2329; + --text-secondary: #646A73; + --text-tertiary: #8F959E; + --text-placeholder: #BCC0C6; + + --border-light: #E5E6EB; + --border-medium: #DEE0E3; + + --brand: #3370FF; + --brand-hover: #245BDB; + --brand-light: #EEF3FF; + + --danger: #F54A45; + --danger-light: #FFF1F0; + --success: #34C759; + + --r-sm: 6px; --r-md: 8px; --r-lg: 12px; + --shadow-sm: 0 1px 2px rgba(0,0,0,.04); + --shadow-md: 0 4px 12px rgba(0,0,0,.08); + --shadow-lg: 0 8px 24px rgba(0,0,0,.12); +} + +*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; + font-size: 14px; line-height: 1.5; color: var(--text-primary); background: var(--bg-page); + height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; +} + +#app { height: 100vh; display: flex; flex-direction: column; } + +/* Scrollbar */ +::-webkit-scrollbar { width: 5px; } +::-webkit-scrollbar-track { background: transparent; } +::-webkit-scrollbar-thumb { background: #D0D3D7; border-radius: 3px; } +::-webkit-scrollbar-thumb:hover { background: #B0B3B7; } + +/* ===== Topnav ===== */ +.topnav { display:flex; align-items:center; height:48px; padding:0 20px; background:var(--bg-surface); border-bottom:1px solid var(--border-light); flex-shrink:0; } +.topnav-brand { font-weight:700; font-size:15px; color:var(--text-primary); text-decoration:none; margin-right:24px; } +.topnav-link { padding:13px 16px; font-size:13px; font-weight:500; color:var(--text-secondary); text-decoration:none; border-bottom:2px solid transparent; transition:color .15s; } +.topnav-link:hover { color:var(--brand); } +.topnav-link.active, .topnav-link.router-link-exact-active { color:var(--brand); border-bottom-color:var(--brand); } +.user-widget { margin-left:auto; display:flex; align-items:center; gap:8px; padding:4px 10px 4px 4px; border-radius:20px; cursor:pointer; transition:background .15s; user-select:none; } +.user-widget:hover { background:var(--bg-hover); } +.user-avatar { width:28px; height:28px; border-radius:50%; background:var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:600; flex-shrink:0; } +.user-name { font-size:13px; font-weight:500; } + +.footer { display:flex; align-items:center; justify-content:space-between; height:32px; padding:0 20px; background:var(--bg-surface); border-top:1px solid var(--border-light); font-size:11px; color:var(--text-tertiary); flex-shrink:0; } + +/* ===== Layout ===== */ +.layout { display:flex; flex:1; min-height:0; } +.sidebar { width:260px; min-width:260px; background:var(--bg-sidebar); border-right:1px solid var(--border-light); display:flex; flex-direction:column; padding:12px; gap:8px; overflow:hidden; transition:all .2s; } +.sidebar.collapsed { width:40px; min-width:40px; padding:8px 4px; } +.content { flex:1; display:flex; flex-direction:column; background:var(--bg-surface); min-width:0; } + +/* ===== Buttons ===== */ +.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; height:36px; padding:0 16px; border:none; border-radius:var(--r-sm); font-size:13px; font-weight:500; cursor:pointer; transition:all .15s; font-family:inherit; white-space:nowrap; } +.btn:focus-visible { outline:2px solid var(--brand); outline-offset:2px; } +.btn-primary { background:var(--brand); color:#fff; } +.btn-primary:hover { background:var(--brand-hover); } +.btn-outline { background:var(--bg-surface); color:var(--brand); border:1px solid var(--brand); } +.btn-outline:hover { background:var(--brand-light); } +.btn-ghost { background:transparent; color:var(--text-secondary); } +.btn-ghost:hover { background:var(--bg-hover); color:var(--text-primary); } +.btn-danger-ghost { background:transparent; color:var(--text-tertiary); } +.btn-danger-ghost:hover { background:var(--danger-light); color:var(--danger); } +.btn-block { width:100%; } +.btn-sm { height:30px; font-size:12px; padding:0 12px; } +.btn-xs { height:24px; font-size:11px; padding:0 8px; } + +/* ===== Input / Select / Textarea ===== */ +.input, .select { width:100%; height:36px; padding:0 12px; border:1px solid var(--border-medium); border-radius:var(--r-sm); font-size:13px; color:var(--text-primary); background:var(--bg-surface); outline:none; transition:border .15s; font-family:inherit; } +.input:focus, .select:focus { border-color:var(--brand); box-shadow:0 0 0 2px var(--brand-light); } +.input::placeholder { color:var(--text-placeholder); } +.textarea { width:100%; padding:8px 12px; border:1px solid var(--border-medium); border-radius:var(--r-sm); font-size:13px; color:var(--text-primary); background:var(--bg-surface); outline:none; resize:vertical; font-family:inherit; transition:border .15s; min-height:60px; } +.textarea:focus { border-color:var(--brand); box-shadow:0 0 0 2px var(--brand-light); } + +/* ===== Sidebar Items ===== */ +.sidebar-label { font-size:10px; font-weight:700; color:var(--text-tertiary); letter-spacing:.06em; text-transform:uppercase; padding:8px 8px 4px 4px; margin-top:8px; display:flex; align-items:center; justify-content:space-between; } +.sidebar-label .add-btn { cursor:pointer; color:var(--text-tertiary); font-size:16px; line-height:1; width:22px; height:22px; display:flex; align-items:center; justify-content:center; border-radius:4px; transition:all .15s; } +.sidebar-label .add-btn:hover { background:var(--bg-hover); color:var(--brand); } + +.folder-item { display:flex; align-items:center; gap:8px; height:34px; padding:0 10px; border-radius:var(--r-sm); cursor:pointer; font-size:13px; color:var(--text-secondary); transition:all .12s; user-select:none; position:relative; } +.folder-item:hover { background:var(--bg-hover); color:var(--text-primary); } +.folder-item.active { background:var(--brand-light); color:var(--brand); } +.folder-item .count { margin-left:auto; font-size:10px; font-weight:500; color:var(--text-tertiary); background:var(--bg-hover); padding:1px 6px; border-radius:8px; min-width:20px; text-align:center; } +.folder-item.active .count { background:rgba(51,112,255,.12); color:var(--brand); } + +.folder-dot { width:6px; height:6px; border-radius:50%; background:var(--text-tertiary); flex-shrink:0; opacity:.5; } +.folder-item.active .folder-dot { background:var(--brand); opacity:1; } + +.folder-more { opacity:0; padding:2px 6px; font-size:16px; font-weight:700; color:var(--text-tertiary); border-radius:4px; cursor:pointer; line-height:1; } +.folder-item:hover .folder-more { opacity:1; } +.folder-more:hover { background:var(--bg-hover); color:var(--text-primary); } + +.site-item { display:flex; align-items:center; gap:8px; height:36px; padding:0 8px; border-radius:var(--r-sm); cursor:pointer; font-size:13px; transition:background .1s; user-select:none; } +.site-item:hover { background:var(--bg-hover); } +.site-item.active { background:var(--brand-light); color:var(--brand); font-weight:500; } +.site-item .site-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } +.site-item .site-count { font-size:10px; color:var(--text-tertiary); flex-shrink:0; } + +.note-list-item { display:flex; align-items:center; gap:8px; height:34px; padding:0 8px; border-radius:var(--r-sm); cursor:pointer; font-size:12px; transition:background .1s; } +.note-list-item:hover { background:var(--bg-hover); } +.note-list-item.active { background:var(--brand-light); } +.note-list-item .note-title { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:500; } +.note-list-item .note-date { font-size:10px; color:var(--text-tertiary); } + +.folder-children { margin-left:16px; } +.folder-arrow { font-size:10px; color:var(--text-tertiary); width:12px; flex-shrink:0; } + +/* ===== Card ===== */ +.card { background:var(--bg-surface); border:1px solid var(--border-light); border-radius:var(--r-lg); padding:16px; transition:box-shadow .15s; margin-bottom:12px; } +.card:hover { box-shadow:var(--shadow-sm); } +.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; } +.card-title { font-size:14px; font-weight:600; } +.card-body { display:grid; grid-template-columns:auto 1fr auto; gap:8px 12px; font-size:13px; align-items:center; } +.card-body .label { color:var(--text-tertiary); font-size:12px; white-space:nowrap; } + +.card-btn { height:30px; padding:0 10px; border:1px solid var(--border-light); border-radius:var(--r-sm); background:var(--bg-surface); font-size:12px; cursor:pointer; color:var(--text-secondary); transition:all .15s; font-family:inherit; } +.card-btn:hover { background:var(--bg-hover); border-color:var(--border-medium); } +.card-btn.edit-btn:hover { color:var(--brand); border-color:var(--brand); background:var(--brand-light); } +.card-btn.danger-btn:hover { color:var(--danger); border-color:var(--danger); background:var(--danger-light); } + +/* ===== Modal ===== */ +.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.35); display:flex; align-items:center; justify-content:center; z-index:100; animation:fi .15s ease; } +@keyframes fi { from{opacity:0} to{opacity:1} } +.modal { background:var(--bg-surface); border-radius:var(--r-lg); box-shadow:var(--shadow-lg); width:480px; max-width:90vw; max-height:85vh; display:flex; flex-direction:column; animation:si .15s ease; } +@keyframes si { from{transform:translateY(8px); opacity:0} to{transform:translateY(0); opacity:1} } +.modal-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border-light); flex-shrink:0; } +.modal-title { font-size:15px; font-weight:600; } +.modal-close { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border:none; background:transparent; border-radius:var(--r-sm); cursor:pointer; font-size:18px; color:var(--text-tertiary); transition:all .15s; } +.modal-close:hover { background:var(--bg-hover); color:var(--text-primary); } +.modal-body { padding:20px; overflow-y:auto; flex:1; } +.modal-footer { display:flex; justify-content:flex-end; gap:8px; padding:12px 20px; border-top:1px solid var(--border-light); flex-shrink:0; } + +/* ===== Form ===== */ +.form-group { margin-bottom:16px; } +.form-group:last-child { margin-bottom:0; } +.form-label { display:block; font-size:12px; font-weight:600; color:var(--text-secondary); margin-bottom:4px; } +.form-row { display:flex; gap:8px; align-items:center; } + +/* ===== Editor ===== */ +.editor-wrap { flex:1; display:flex; min-height:0; } +.editor-pane { flex:1; padding:20px; overflow-y:auto; min-width:0; display:flex; justify-content:center; } +.editor-pane + .editor-pane { border-left:1px solid var(--border-light); } +.editor-inner { width:100%; max-width:960px; } + +.content-header { display:flex; align-items:center; justify-content:space-between; padding:12px 20px; border-bottom:1px solid var(--border-light); gap:12px; flex-shrink:0; } +.content-title { font-size:16px; font-weight:600; color:var(--text-primary); border:none; outline:none; background:transparent; flex:1; font-family:inherit; } +.content-title::placeholder { color:var(--text-placeholder); } + +.toggle-group { display:flex; background:var(--bg-hover); border-radius:var(--r-sm); padding:2px; } +.toggle-group button { height:28px; padding:0 12px; border:none; background:transparent; border-radius:4px; font-size:12px; cursor:pointer; color:var(--text-secondary); transition:all .15s; font-family:inherit; } +.toggle-group button.active { background:var(--bg-surface); box-shadow:var(--shadow-sm); color:var(--text-primary); font-weight:500; } + +.save-badge { font-size:10px; color:var(--text-tertiary); background:var(--bg-hover); padding:2px 8px; border-radius:10px; flex-shrink:0; white-space:nowrap; } + +/* ===== Toolbar ===== */ +.tb-bar { display:flex; flex-wrap:wrap; align-items:center; gap:2px; padding:4px 6px; background:var(--bg-sidebar); border:1px solid var(--border-light); border-radius:var(--r-md); margin-bottom:16px; } +.tb-divider { width:1px; height:16px; background:var(--border-medium); margin:0 4px; } +.tb-btn { height:28px; padding:0 8px; border:none; background:transparent; border-radius:4px; font-size:12px; cursor:pointer; color:var(--text-secondary); white-space:nowrap; font-family:inherit; transition:all .1s; } +.tb-btn:hover { background:var(--bg-hover); } +.tb-btn.active { background:var(--brand-light); color:var(--brand); } +.tb-color { width:24px; height:24px; border:1px solid var(--border-medium); border-radius:4px; cursor:pointer; padding:0; margin:0 2px; } + +/* ProseMirror */ +.ProseMirror { outline:none; min-height:300px; font-size:14px; line-height:1.8; } +.ProseMirror h1 { font-size:22px; font-weight:700; margin:16px 0 8px; padding-bottom:6px; border-bottom:1px solid var(--border-light); } +.ProseMirror h2 { font-size:18px; font-weight:600; margin:14px 0 6px; } +.ProseMirror h3 { font-size:15px; font-weight:600; margin:12px 0 4px; } +.ProseMirror p { margin:4px 0; } +.ProseMirror ul, .ProseMirror ol { padding-left:20px; margin:4px 0; } +.ProseMirror li { margin:2px 0; } +.ProseMirror blockquote { border-left:3px solid var(--brand); padding-left:12px; color:var(--text-secondary); margin:8px 0; } +.ProseMirror pre { background:#F7F8FA; padding:12px 16px; border-radius:var(--r-sm); overflow-x:auto; font-family:"SF Mono","Fira Code","Consolas",monospace; font-size:13px; line-height:1.6; } +.ProseMirror code { background:#F2F3F5; padding:2px 6px; border-radius:3px; font-size:12px; font-family:"SF Mono","Fira Code","Consolas",monospace; } +.ProseMirror table { border-collapse:collapse; width:100%; margin:8px 0; } +.ProseMirror th, .ProseMirror td { border:1px solid var(--border-light); padding:8px 12px; text-align:left; } +.ProseMirror th { background:#F7F8FA; font-weight:600; font-size:13px; } +.ProseMirror img { max-width:100%; border-radius:var(--r-sm); } +.ProseMirror mark { background:#FFF3CD; padding:2px 4px; border-radius:2px; } + +/* ===== Import ===== */ +.import-textarea { width:100%; height:90px; padding:10px 12px; border:2px solid var(--brand); border-radius:var(--r-md); font-size:13px; font-family:inherit; resize:vertical; outline:none; background:var(--brand-light); } +.import-hint { font-size:11px; color:var(--text-tertiary); margin:4px 0 12px; } +.result-box { background:#F0FAF0; border:1px solid #A3E4A7; border-radius:var(--r-md); padding:14px 16px; margin-bottom:16px; } +.result-grid { display:grid; grid-template-columns:70px 1fr; gap:6px 12px; font-size:13px; } +.alert { padding:8px 12px; border-radius:var(--r-sm); font-size:12px; } +.alert-warning { background:#FFF7E6; color:#8A5D00; } + +/* ===== Stats ===== */ +.stat-row { display:flex; gap:6px; } +.stat { flex:1; text-align:center; padding:8px 4px; background:var(--bg-surface); border:1px solid var(--border-light); border-radius:var(--r-sm); font-size:11px; } +.stat-num { font-size:18px; font-weight:700; } +.stat-label { color:var(--text-tertiary); font-size:10px; } + +/* ===== Tag Badge ===== */ +.tag-badge { display:inline-block; padding:2px 10px; background:var(--bg-hover); border-radius:10px; font-size:11px; cursor:pointer; color:var(--text-secondary); transition:all .15s; } +.tag-badge:hover { background:#DEE0E3; } +.tag-badge.active { background:var(--brand); color:#fff; } + +/* ===== Toast ===== */ +.toast { position:fixed; top:20px; right:20px; background:#1F2329; color:#fff; padding:8px 16px; border-radius:var(--r-sm); font-size:13px; z-index:9999; animation:fi .2s ease; } + +/* ===== Folder Menu ===== */ +.folder-menu { position:absolute; right:0; top:100%; background:var(--bg-surface); border:1px solid var(--border-light); border-radius:var(--r-md); box-shadow:var(--shadow-md); z-index:10; min-width:120px; padding:4px; } +.folder-menu-item { padding:6px 12px; cursor:pointer; font-size:12px; color:var(--text-primary); border-radius:var(--r-sm); transition:background .1s; } +.folder-menu-item:hover { background:var(--bg-hover); } +.folder-menu-item.danger { color:var(--danger); } +.folder-menu-item.danger:hover { background:var(--danger-light); } + +/* ===== Lightbox ===== */ +.lightbox { position:fixed; inset:0; background:rgba(0,0,0,.85); display:flex; align-items:center; justify-content:center; z-index:200; cursor:zoom-out; } +.lightbox img { max-width:90vw; max-height:90vh; object-fit:contain; cursor:default; border-radius:4px; } +.lightbox-close { position:fixed; top:16px; right:16px; width:40px; height:40px; border:none; background:rgba(255,255,255,.15); color:#fff; font-size:22px; border-radius:50%; cursor:pointer; z-index:201; display:flex; align-items:center; justify-content:center; transition:background .15s; } +.lightbox-close:hover { background:rgba(255,255,255,.3); } + +/* Selection toolbar */ +.sel-toolbar { position:fixed; z-index:150; background:var(--bg-surface); border:1px solid var(--border-light); border-radius:var(--r-md); box-shadow:var(--shadow-md); padding:6px; display:flex; gap:4px; } + +/* ===== Comments Panel ===== */ +.comments-panel { width:260px; min-width:260px; border-left:1px solid var(--border-light); background:var(--bg-sidebar); display:flex; flex-direction:column; font-size:13px; } + +/* ===== Helpers ===== */ +.hidden { display:none !important; } + +/* ================================================ + Mobile responsive (<=768px) + ================================================ */ +@media (max-width: 768px) { + /* -- App shell -- */ + .app-nav { position:fixed; left:0; top:0; bottom:0; z-index:50; + transform:translateX(-100%); transition:transform .25s; } + .app-nav.open { transform:translateX(0); } + .app-nav.collapsed { width:200px; min-width:200px; } + + .app-main { width:100%; } + + /* Hamburger */ + .hamburger { display:flex !important; } + + /* -- Layout: single column -- */ + .layout { flex-direction:column; } + + /* Sidebar becomes a top filter bar or hidden */ + .sidebar { width:100%; min-width:100%; max-height:40vh; flex-shrink:0; border-right:none; border-bottom:1px solid var(--border-light); } + + /* -- Content full width -- */ + .content { width:100%; } + .content-header { flex-wrap:wrap; gap:8px; padding:10px 12px; } + .content-title { font-size:15px; } + + /* -- Tables become cards -- */ + .doc-table, .doc-table thead, .doc-table tbody, .doc-table th, .doc-table td, .doc-table tr { display:block; } + .doc-table thead { display:none; } + .doc-table tr { padding:10px 12px; border-bottom:1px solid var(--border-light); } + .doc-table td { padding:4px 0; border:none; } + .doc-table td:before { content:attr(data-label); font-size:10px; font-weight:600; color:var(--text-tertiary); display:block; margin-bottom:2px; text-transform:uppercase; letter-spacing:.04em; } + .doc-title-cell { max-width:none; white-space:normal; } + + /* -- Editor -- */ + .editor-wrap { flex-direction:column; } + .editor-pane { padding:12px; } + .editor-pane + .editor-pane { border-left:none; border-top:1px solid var(--border-light); } + .editor-inner { max-width:100%; } + .tb-bar { flex-wrap:nowrap; overflow-x:auto; gap:1px; padding:4px; } + + /* -- Modals full screen -- */ + .modal { width:100vw !important; max-width:100vw; height:100vh; max-height:100vh; border-radius:0; } + .modal-overlay { align-items:flex-end; } + + /* -- Account cards -- */ + .card-body { grid-template-columns:1fr; gap:4px; } + .card-body .label { margin-top:6px; } + + /* -- Filter tags scrollable -- */ + .content-header { overflow-x:auto; flex-wrap:nowrap; white-space:nowrap; } + + /* -- Topbar -- */ + .topbar { padding:0 10px; height:40px; } + .topbar-brand { font-size:13px; } + + /* -- Lightbox -- */ + .lightbox-close { top:10px; right:10px; width:36px; height:36px; font-size:18px; } + .lightbox img { max-width:95vw; max-height:85vh; } + + /* -- Comments panel -- */ + .comments-panel { width:100%; min-width:100%; max-height:40vh; border-left:none; border-top:1px solid var(--border-light); } +} + +/* Hamburger button (hidden on desktop) */ +.hamburger { display:none; position:fixed; top:8px; left:8px; z-index:60; width:36px; height:36px; + background:var(--bg-surface); border:1px solid var(--border-light); border-radius:var(--r-sm); + font-size:18px; cursor:pointer; align-items:center; justify-content:center; box-shadow:var(--shadow-sm); } + +/* Sidebar overlay for mobile */ +@media (max-width: 768px) { + .app-nav.open + .nav-overlay { display:block; } +} +.nav-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:49; } +.flex-1 { flex:1; } +.text-muted { color:var(--text-tertiary); font-size:12px; } +.mb-sm { margin-bottom:8px; } +.mb-md { margin-bottom:16px; } diff --git a/frontend/src/components/ConfirmModal.vue b/frontend/src/components/ConfirmModal.vue new file mode 100644 index 0000000..b7c1dc8 --- /dev/null +++ b/frontend/src/components/ConfirmModal.vue @@ -0,0 +1,17 @@ + + diff --git a/frontend/src/components/Modal.vue b/frontend/src/components/Modal.vue new file mode 100644 index 0000000..628d437 --- /dev/null +++ b/frontend/src/components/Modal.vue @@ -0,0 +1,25 @@ + + + diff --git a/frontend/src/components/NoteEditor.vue b/frontend/src/components/NoteEditor.vue new file mode 100644 index 0000000..30152fb --- /dev/null +++ b/frontend/src/components/NoteEditor.vue @@ -0,0 +1,183 @@ + + + diff --git a/frontend/src/components/PromptModal.vue b/frontend/src/components/PromptModal.vue new file mode 100644 index 0000000..b2cd108 --- /dev/null +++ b/frontend/src/components/PromptModal.vue @@ -0,0 +1,20 @@ + + diff --git a/frontend/src/composables/useApi.js b/frontend/src/composables/useApi.js new file mode 100644 index 0000000..9de4fff --- /dev/null +++ b/frontend/src/composables/useApi.js @@ -0,0 +1,79 @@ +// API 请求层 +// +// 开发模式(localhost):直连后端 + X-Dev-Mock-User 头模拟用户 +// 生产模式:走网关 gw.server.zgitm.com,axios 自动携带 Authorization + X-System-Code + +import request from '../utils/request.js' + +const isDev = window.location.hostname === 'localhost' + +// 本地开发:直连后端 + mock 用户 +const DEV_BASE = 'http://localhost:4006' + +async function devRequest(url, options = {}) { + const res = await fetch(DEV_BASE + url, { + headers: { + 'Content-Type': 'application/json', + 'X-Dev-Mock-User': 'admin', // 触发后端 DEV_DEFAULT_USER + ...options.headers, + }, + ...options, + }) + if (!res.ok) { + const err = await res.json().catch(() => ({})) + throw new Error(err.detail || res.statusText) + } + return res.json() +} + +// 生产:走网关(通过 axios 实例) +async function gwRequest(url, options = {}) { + const method = (options.method || 'GET').toLowerCase() + const config = { method, url } + if (options.headers) config.headers = options.headers + if (options.body) config.data = JSON.parse(options.body) + + const res = await request(config) + // 后端返回原始数据时 axios response 的 .data 是实际内容 + // 网关返回时拦截器已解包为 {code,data,msg},.data 也是实际内容 + return res.data +} + +const doRequest = isDev ? devRequest : gwRequest + +export function useApi() { + return { + // Notes + listNotes: (folderId) => doRequest(folderId ? `/api/notes?folder_id=${folderId}` : '/api/notes'), + getNote: (id) => doRequest(`/api/notes/${id}`), + createNote: (data) => doRequest('/api/notes', { method: 'POST', body: JSON.stringify(data) }), + updateNote: (id, data) => doRequest(`/api/notes/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteNote: (id) => doRequest(`/api/notes/${id}`, { method: 'DELETE' }), + shareNote: (id, ttl) => doRequest(`/api/notes/${id}/share`, { method: 'POST', body: JSON.stringify({ ttl }) }), + unshareNote: (id) => doRequest(`/api/notes/${id}/share`, { method: 'DELETE' }), + moveNote: (id, folderId) => doRequest(`/api/notes/${id}/move`, { method: 'PUT', body: JSON.stringify({ folder_id: folderId }) }), + + // Websites + listWebsites: (folderId) => doRequest(folderId ? `/api/websites?folder_id=${folderId}` : '/api/websites'), + getWebsite: (id) => doRequest(`/api/websites/${id}`), + createWebsite: (data) => doRequest('/api/websites', { method: 'POST', body: JSON.stringify(data) }), + updateWebsite: (id, data) => doRequest(`/api/websites/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteWebsite: (id) => doRequest(`/api/websites/${id}`, { method: 'DELETE' }), + + // Accounts + getAccount: (id) => doRequest(`/api/accounts/${id}`), + addAccount: (siteId, data) => doRequest(`/api/websites/${siteId}/accounts`, { method: 'POST', body: JSON.stringify(data) }), + updateAccount: (id, data) => doRequest(`/api/accounts/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteAccount: (id) => doRequest(`/api/accounts/${id}`, { method: 'DELETE' }), + moveAccount: (id, direction) => doRequest(`/api/accounts/${id}/move`, { method: 'PUT', body: JSON.stringify({ direction }) }), + + // Folders + listFolders: (type) => doRequest(`/api/folders?type=${type}`), + createFolder: (data) => doRequest('/api/folders', { method: 'POST', body: JSON.stringify(data) }), + updateFolder: (id, data) => doRequest(`/api/folders/${id}`, { method: 'PUT', body: JSON.stringify(data) }), + deleteFolder: (id) => doRequest(`/api/folders/${id}`, { method: 'DELETE' }), + + // Import + parseImport: (text) => doRequest('/api/import/parse', { method: 'POST', body: JSON.stringify({ text }) }), + } +} diff --git a/frontend/src/directives/permission.js b/frontend/src/directives/permission.js new file mode 100644 index 0000000..de1c99c --- /dev/null +++ b/frontend/src/directives/permission.js @@ -0,0 +1,27 @@ +// v-permission 指令 — 按钮权限控制 +// 从 Cookie 中读取 JWT Token,解析 payload 中的 permissions 数组 +// 如果当前用户没有所需权限,则从 DOM 中移除该元素 +// +// 用法: 新增用户 + +function getPermissions() { + const token = document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1] + if (!token) return [] + try { + const payload = JSON.parse(atob(token.split('.')[1])) + return payload.permissions ?? [] + } catch { + return [] + } +} + +export const permission = { + mounted(el, binding) { + const permissions = getPermissions() + const required = binding.value + // 没有该权限则从 DOM 中移除元素 + if (required && !permissions.includes(required)) { + el.parentNode?.removeChild(el) + } + }, +} diff --git a/frontend/src/main.js b/frontend/src/main.js new file mode 100644 index 0000000..0a1846a --- /dev/null +++ b/frontend/src/main.js @@ -0,0 +1,10 @@ +import { createApp } from 'vue' +import App from './App.vue' +import router from './router.js' +import { permission } from './directives/permission.js' +import './assets/main.css' + +const app = createApp(App) +app.use(router) +app.directive('permission', permission) +app.mount('#app') diff --git a/frontend/src/router.js b/frontend/src/router.js new file mode 100644 index 0000000..8bb0cac --- /dev/null +++ b/frontend/src/router.js @@ -0,0 +1,38 @@ +import { createRouter, createWebHistory } from 'vue-router' +import NotesView from './views/NotesView.vue' +import WebsitesView from './views/WebsitesView.vue' +import SharesView from './views/SharesView.vue' + +const SYSTEM_CODE = import.meta.env.VITE_SYSTEM_CODE || 'mokeetext-edit' +const LOGIN_URL = import.meta.env.VITE_LOGIN_URL || 'https://login.user.zgitm.com' +const WEBSITE_URL = window.location.origin + +const routes = [ + { path: '/', redirect: '/notes' }, + { path: '/notes', name: 'notes', component: NotesView }, + { path: '/websites', name: 'websites', component: WebsitesView }, + { path: '/shares', name: 'shares', component: SharesView }, +] + +const router = createRouter({ + history: createWebHistory(), + routes, +}) + +// 路由守卫:无 Token 则跳转统一登录页 +router.beforeEach((to, _from, next) => { + // 本地开发模式:跳过登录检查 + if (window.location.hostname === 'localhost') { + next() + return + } + + const token = document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1] + if (!token) { + window.location.href = `${LOGIN_URL}?systemCode=${SYSTEM_CODE}&redirect=${encodeURIComponent(WEBSITE_URL)}` + return + } + next() +}) + +export default router diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js new file mode 100644 index 0000000..6253996 --- /dev/null +++ b/frontend/src/utils/request.js @@ -0,0 +1,53 @@ +// Axios 实例 — 统一请求拦截器 +// 开发模式(localhost):直连后端,不走网关 +// 生产模式:走网关 gw.server.zgitm.com,带 Authorization + X-System-Code + +import axios from 'axios' + +const SYSTEM_CODE = import.meta.env.VITE_SYSTEM_CODE +const GATEWAY_URL = import.meta.env.VITE_GATEWAY_URL +const LOGIN_URL = import.meta.env.VITE_LOGIN_URL + +// 从 Cookie 读取 Token(登录后网关写入的跨域 Cookie,domain: .zgitm.com) +function getToken() { + const match = document.cookie.match(/(?:^|;\s*)token=([^;]*)/) + return match ? decodeURIComponent(match[1]) : null +} + +const request = axios.create({ + baseURL: GATEWAY_URL, + timeout: 30000, +}) + +// 请求拦截器:携带 Token 和系统编码 +request.interceptors.request.use(config => { + const token = getToken() + if (token) { + config.headers.Authorization = `Bearer ${token}` + } + // 网关根据此头识别业务系统 + config.headers['X-System-Code'] = SYSTEM_CODE + return config +}) + +// 响应拦截器 +request.interceptors.response.use( + response => { + const data = response.data + // 网关 API 返回 { code: 200, data: ..., msg: ... },解包返回 + // 业务后端返回原始数据(数组/对象),直接透传 axios response + if (data && typeof data === 'object' && (data.code === 200 || data.code === 0)) { + return data + } + return response + }, + error => { + if (error.response?.status === 401) { + window.location.href = `${LOGIN_URL}?systemCode=${SYSTEM_CODE}` + } + return Promise.reject(error) + } +) + +export { getToken } +export default request diff --git a/frontend/src/views/NotesView.vue b/frontend/src/views/NotesView.vue new file mode 100644 index 0000000..bce842f --- /dev/null +++ b/frontend/src/views/NotesView.vue @@ -0,0 +1,321 @@ + + + + + diff --git a/frontend/src/views/SharesView.vue b/frontend/src/views/SharesView.vue new file mode 100644 index 0000000..6781a0e --- /dev/null +++ b/frontend/src/views/SharesView.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/frontend/src/views/WebsitesView.vue b/frontend/src/views/WebsitesView.vue new file mode 100644 index 0000000..a08358f --- /dev/null +++ b/frontend/src/views/WebsitesView.vue @@ -0,0 +1,439 @@ + + + diff --git a/frontend/static/css/style.css b/frontend/static/css/style.css new file mode 100644 index 0000000..44b4e94 --- /dev/null +++ b/frontend/static/css/style.css @@ -0,0 +1,701 @@ +/* ======================================== + MoKeeText — Feishu-inspired Design System + ======================================== */ + +/* ——— Design Tokens ——— */ +:root { + /* Surface */ + --bg-page: #F5F6F8; + --bg-sidebar: #FCFCFD; + --bg-surface: #FFFFFF; + --bg-hover: #F2F3F5; + --bg-active: #EEF3FF; + + /* Text */ + --text-primary: #1F2329; + --text-secondary: #646A73; + --text-tertiary: #8F959E; + --text-placeholder:#BCC0C6; + + /* Border */ + --border-light: #E5E6EB; + --border-medium: #DEE0E3; + + /* Brand */ + --brand: #3370FF; + --brand-hover: #245BDB; + --brand-light: #EEF3FF; + --brand-ghost: rgba(51,112,255,0.06); + + /* Semantic */ + --danger: #F54A45; + --danger-light: #FFF1F0; + --success: #34C759; + + /* Radius */ + --r-sm: 6px; + --r-md: 8px; + --r-lg: 12px; + + /* Shadow */ + --shadow-sm: 0 1px 2px rgba(0,0,0,0.04); + --shadow-md: 0 4px 12px rgba(0,0,0,0.08); + --shadow-lg: 0 8px 24px rgba(0,0,0,0.12); + + /* Spacing */ + --space-xs: 4px; + --space-sm: 8px; + --space-md: 12px; + --space-lg: 16px; + --space-xl: 20px; + --space-2xl: 24px; +} + +/* ——— Reset ——— */ +*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; + font-size: 14px; + line-height: 1.5; + color: var(--text-primary); + background: var(--bg-page); + height: 100vh; + overflow: hidden; + -webkit-font-smoothing: antialiased; +} + +/* ——— Top Navigation ——— */ +.topnav { + display: flex; + align-items: center; + height: 48px; + padding: 0 var(--space-xl); + background: var(--bg-surface); + border-bottom: 1px solid var(--border-light); + gap: 0; + flex-shrink: 0; + user-select: none; +} +.topnav-brand { + font-weight: 700; + font-size: 15px; + color: var(--text-primary); + text-decoration: none; + margin-right: var(--space-2xl); + letter-spacing: -0.01em; +} +.topnav-link { + padding: 13px var(--space-lg); + font-size: 13px; + font-weight: 500; + color: var(--text-secondary); + text-decoration: none; + border-bottom: 2px solid transparent; + transition: color 0.15s; + letter-spacing: 0; +} +.topnav-link:hover { color: var(--brand); } +.topnav-link.active { + color: var(--brand); + border-bottom-color: var(--brand); +} +/* ——— User Widget ——— */ +.user-widget { + margin-left: auto; + display: flex; + align-items: center; + gap: 8px; + padding: 4px 10px 4px 4px; + border-radius: 20px; + cursor: pointer; + transition: background 0.15s; + user-select: none; +} +.user-widget:hover { background: var(--bg-hover); } +.user-avatar { + width: 28px; height: 28px; + border-radius: 50%; + background: var(--brand); + color: #fff; + display: flex; align-items: center; justify-content: center; + font-size: 12px; font-weight: 600; + flex-shrink: 0; +} +.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); } + +/* ——— Footer ——— */ +.footer { + display: flex; + align-items: center; + justify-content: space-between; + height: 32px; + padding: 0 var(--space-xl); + background: var(--bg-surface); + border-top: 1px solid var(--border-light); + font-size: 11px; + color: var(--text-tertiary); + flex-shrink: 0; +} +.footer-icp { color: var(--text-placeholder); } + +/* ——— Main Layout ——— */ +.layout { display: flex; height: calc(100vh - 48px - 32px); } + +/* ——— Sidebar ——— */ +.sidebar { + width: 260px; + min-width: 260px; + background: var(--bg-sidebar); + border-right: 1px solid var(--border-light); + display: flex; + flex-direction: column; + padding: var(--space-md); + gap: var(--space-sm); + overflow: hidden; +} + +/* Sidebar section label */ +.sidebar-label { + font-size: 11px; + font-weight: 600; + color: var(--text-tertiary); + text-transform: uppercase; + letter-spacing: 0.04em; + padding: 4px 0; + margin-top: 4px; + display: flex; + align-items: center; + justify-content: space-between; +} + +/* ——— Buttons ——— */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 6px; + height: 36px; + padding: 0 var(--space-lg); + border: none; + border-radius: var(--r-sm); + font-size: 13px; + font-weight: 500; + cursor: pointer; + transition: all 0.15s; + font-family: inherit; + white-space: nowrap; +} +.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; } + +.btn-primary { + background: var(--brand); + color: #fff; +} +.btn-primary:hover { background: var(--brand-hover); } + +.btn-outline { + background: var(--bg-surface); + color: var(--brand); + border: 1px solid var(--brand); +} +.btn-outline:hover { background: var(--brand-light); } + +.btn-ghost { + background: transparent; + color: var(--text-secondary); +} +.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); } + +.btn-danger-ghost { + background: transparent; + color: var(--text-tertiary); +} +.btn-danger-ghost:hover { background: var(--danger-light); color: var(--danger); } + +.btn-block { width: 100%; } + +.btn-sm { height: 30px; font-size: 12px; padding: 0 12px; } + +/* ——— Input ——— */ +.input { + width: 100%; + height: 36px; + padding: 0 12px; + border: 1px solid var(--border-medium); + border-radius: var(--r-sm); + font-size: 13px; + color: var(--text-primary); + background: var(--bg-surface); + outline: none; + transition: border 0.15s; + font-family: inherit; +} +.input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); } +.input::placeholder { color: var(--text-placeholder); } + +.textarea { + width: 100%; + padding: 8px 12px; + border: 1px solid var(--border-medium); + border-radius: var(--r-sm); + font-size: 13px; + color: var(--text-primary); + background: var(--bg-surface); + outline: none; + resize: vertical; + font-family: inherit; + transition: border 0.15s; + min-height: 60px; +} +.textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); } + +.select { + width: 100%; + height: 36px; + padding: 0 12px; + border: 1px solid var(--border-medium); + border-radius: var(--r-sm); + font-size: 13px; + color: var(--text-primary); + background: var(--bg-surface); + outline: none; + cursor: pointer; + font-family: inherit; +} + +/* ——— Folder Tree ——— */ +.folder-item { + display: flex; + align-items: center; + gap: 6px; + height: 32px; + padding: 0 8px; + border-radius: var(--r-sm); + cursor: pointer; + font-size: 13px; + color: var(--text-primary); + transition: background 0.1s; + user-select: none; +} +.folder-item:hover { background: var(--bg-hover); } +.folder-item.active { background: var(--brand-light); color: var(--brand); font-weight: 500; } +.folder-item .count { + margin-left: auto; + font-size: 11px; + color: var(--text-tertiary); +} +.folder-item.active .count { color: var(--brand); opacity: 0.7; } + +/* Folder menu */ +.folder-more { + opacity: 0; + padding: 2px 6px; + font-size: 16px; + font-weight: 700; + color: var(--text-tertiary); + border-radius: 4px; + cursor: pointer; + line-height: 1; +} +.folder-item:hover .folder-more { opacity: 1; } +.folder-more:hover { background: var(--bg-hover); color: var(--text-primary); } + +.folder-menu { + position: absolute; + right: 0; + top: 100%; + background: var(--bg-surface); + border: 1px solid var(--border-light); + border-radius: var(--r-md); + box-shadow: var(--shadow-md); + z-index: 10; + min-width: 120px; + padding: 4px; +} +.folder-menu-item { + padding: 6px 12px; + cursor: pointer; + font-size: 12px; + color: var(--text-primary); + border-radius: var(--r-sm); + transition: background 0.1s; +} +.folder-menu-item:hover { background: var(--bg-hover); } +.folder-menu-item.danger { color: var(--danger); } +.folder-menu-item.danger:hover { background: var(--danger-light); } + +.folder-children { margin-left: 16px; } +.folder-arrow { font-size: 10px; color: var(--text-tertiary); width: 12px; flex-shrink: 0; } + +/* ——— Site List ——— */ +.site-item { + display: flex; + align-items: center; + gap: 8px; + height: 36px; + padding: 0 8px; + border-radius: var(--r-sm); + cursor: pointer; + font-size: 13px; + transition: background 0.1s; + user-select: none; +} +.site-item:hover { background: var(--bg-hover); } +.site-item.active { background: var(--brand-light); color: var(--brand); font-weight: 500; } +.site-item .site-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.site-item .site-count { font-size: 10px; color: var(--text-tertiary); flex-shrink: 0; } +.site-item.active .site-count { color: var(--brand); opacity: 0.7; } + +/* ——— Content Area ——— */ +.content { + flex: 1; + display: flex; + flex-direction: column; + background: var(--bg-surface); + min-width: 0; +} +.content-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 12px var(--space-xl); + border-bottom: 1px solid var(--border-light); + gap: var(--space-md); + flex-shrink: 0; +} +.content-title { + font-size: 16px; + font-weight: 600; + color: var(--text-primary); + border: none; + outline: none; + background: transparent; + flex: 1; + font-family: inherit; +} +.content-title::placeholder { color: var(--text-placeholder); } + +/* ——— View Toggle ——— */ +.toggle-group { + display: flex; + background: var(--bg-hover); + border-radius: var(--r-sm); + padding: 2px; +} +.toggle-group button { + height: 28px; + padding: 0 12px; + border: none; + background: transparent; + border-radius: 4px; + font-size: 12px; + cursor: pointer; + color: var(--text-secondary); + transition: all 0.15s; + font-family: inherit; +} +.toggle-group button.active { + background: var(--bg-surface); + box-shadow: var(--shadow-sm); + color: var(--text-primary); + font-weight: 500; +} + +/* ——— Editor Area ——— */ +.editor-wrap { + flex: 1; + display: flex; + min-height: 0; +} +.editor-pane { + flex: 1; + padding: var(--space-xl); + overflow-y: auto; + min-width: 0; +} +.editor-pane + .editor-pane { border-left: 1px solid var(--border-light); } + +/* ——— Tiptap Toolbar ——— */ +.tb-bar { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 2px; + padding: 4px 6px; + background: var(--bg-sidebar); + border: 1px solid var(--border-light); + border-radius: var(--r-md); + margin-bottom: var(--space-lg); +} +.tb-divider { + width: 1px; + height: 16px; + background: var(--border-medium); + margin: 0 4px; +} +.tb-btn { + height: 28px; + padding: 0 8px; + border: none; + background: transparent; + border-radius: 4px; + font-size: 12px; + cursor: pointer; + color: var(--text-secondary); + white-space: nowrap; + font-family: inherit; + transition: all 0.1s; +} +.tb-btn:hover { background: var(--bg-hover); } +.tb-btn.active { background: var(--brand-light); color: var(--brand); } +.tb-color { + width: 24px; + height: 24px; + border: 1px solid var(--border-medium); + border-radius: 4px; + cursor: pointer; + padding: 0; + margin: 0 2px; +} + +/* ProseMirror / Tiptap Content */ +.ProseMirror { outline: none; min-height: 300px; font-size: 14px; line-height: 1.8; } +.ProseMirror h1 { font-size: 22px; font-weight: 700; margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); } +.ProseMirror h2 { font-size: 18px; font-weight: 600; margin: 14px 0 6px; } +.ProseMirror h3 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; } +.ProseMirror p { margin: 4px 0; } +.ProseMirror ul, .ProseMirror ol { padding-left: 20px; margin: 4px 0; } +.ProseMirror li { margin: 2px 0; } +.ProseMirror blockquote { border-left: 3px solid var(--brand); padding-left: 12px; color: var(--text-secondary); margin: 8px 0; } +.ProseMirror pre { background: #F7F8FA; padding: 12px 16px; border-radius: var(--r-sm); overflow-x: auto; font-family: "SF Mono","Fira Code","Consolas",monospace; font-size: 13px; line-height: 1.6; } +.ProseMirror code { background: #F2F3F5; padding: 2px 6px; border-radius: 3px; font-size: 12px; font-family: "SF Mono","Fira Code","Consolas",monospace; } +.ProseMirror table { border-collapse: collapse; width: 100%; margin: 8px 0; } +.ProseMirror th, .ProseMirror td { border: 1px solid var(--border-light); padding: 8px 12px; text-align: left; } +.ProseMirror th { background: #F7F8FA; font-weight: 600; font-size: 13px; } +.ProseMirror img { max-width: 100%; border-radius: var(--r-sm); } +.ProseMirror mark { background: #FFF3CD; padding: 2px 4px; border-radius: 2px; } + +/* ——— Note List in Sidebar ——— */ +.note-list-item { + display: flex; + align-items: center; + gap: 8px; + height: 34px; + padding: 0 8px; + border-radius: var(--r-sm); + cursor: pointer; + font-size: 12px; + transition: background 0.1s; +} +.note-list-item:hover { background: var(--bg-hover); } +.note-list-item.active { background: var(--brand-light); } +.note-list-item .note-title-s { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 500; +} +.note-list-item .note-date { font-size: 10px; color: var(--text-tertiary); } + +/* ——— Account Card ——— */ +.card { + background: var(--bg-surface); + border: 1px solid var(--border-light); + border-radius: var(--r-lg); + padding: var(--space-lg); + transition: box-shadow 0.15s; +} +.card:hover { box-shadow: var(--shadow-sm); } +.card-header { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 12px; +} +.card-title { font-size: 14px; font-weight: 600; } +.card-body { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; font-size: 13px; align-items: center; } +.card-body .label { color: var(--text-tertiary); font-size: 12px; white-space: nowrap; } +.card-body .value { font-family: "SF Mono","Fira Code","Consolas",monospace; font-size: 13px; word-break: break-all; } + +.card-actions { display: flex; gap: 6px; } +.card-btn { + height: 30px; + padding: 0 10px; + border: 1px solid var(--border-light); + border-radius: var(--r-sm); + background: var(--bg-surface); + font-size: 12px; + cursor: pointer; + color: var(--text-secondary); + transition: all 0.15s; + font-family: inherit; +} +.card-btn:hover { background: var(--bg-hover); border-color: var(--border-medium); } +.card-btn.edit:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-light); } +.card-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-light); } + +/* ——— Modal ——— */ +.modal-overlay { + position: fixed; + inset: 0; + background: rgba(0,0,0,0.35); + display: flex; + align-items: center; + justify-content: center; + z-index: 100; + animation: fade-in 0.15s ease; +} +@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } } + +.modal { + background: var(--bg-surface); + border-radius: var(--r-lg); + box-shadow: var(--shadow-lg); + width: 480px; + max-width: 90vw; + max-height: 85vh; + display: flex; + flex-direction: column; + animation: slide-in 0.15s ease; +} +@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } + +.modal-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: var(--space-lg) var(--space-xl); + border-bottom: 1px solid var(--border-light); + flex-shrink: 0; +} +.modal-title { font-size: 15px; font-weight: 600; } +.modal-close { + width: 28px; height: 28px; + display: flex; align-items: center; justify-content: center; + border: none; background: transparent; + border-radius: var(--r-sm); + cursor: pointer; + font-size: 18px; color: var(--text-tertiary); + transition: all 0.15s; +} +.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); } + +.modal-body { padding: var(--space-xl); overflow-y: auto; flex: 1; } + +.modal-footer { + display: flex; + justify-content: flex-end; + gap: var(--space-sm); + padding: var(--space-md) var(--space-xl); + border-top: 1px solid var(--border-light); + flex-shrink: 0; +} + +/* ——— Form ——— */ +.form-group { margin-bottom: var(--space-lg); } +.form-group:last-child { margin-bottom: 0; } +.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; } +.form-row { display: flex; gap: var(--space-sm); align-items: center; } + +/* ——— Import Area ——— */ +.import-textarea { + width: 100%; + height: 90px; + padding: 10px 12px; + border: 2px solid var(--brand); + border-radius: var(--r-md); + font-size: 13px; + font-family: inherit; + resize: vertical; + outline: none; + background: var(--brand-light); +} +.import-hint { font-size: 11px; color: var(--text-tertiary); margin: 4px 0 12px; } + +.result-box { + background: #F0FAF0; + border: 1px solid #A3E4A7; + border-radius: var(--r-md); + padding: 14px 16px; + margin-bottom: var(--space-lg); +} +.result-grid { display: grid; grid-template-columns: 70px 1fr; gap: 6px 12px; font-size: 13px; } + +.alert { + padding: 8px 12px; + border-radius: var(--r-sm); + font-size: 12px; +} +.alert-warning { background: #FFF7E6; color: #8A5D00; } + +/* ——— Stats ——— */ +.stat-row { display: flex; gap: 6px; } +.stat { + flex: 1; + text-align: center; + padding: 8px 4px; + background: var(--bg-surface); + border: 1px solid var(--border-light); + border-radius: var(--r-sm); + font-size: 11px; +} +.stat-num { font-size: 18px; font-weight: 700; } +.stat-label { color: var(--text-tertiary); font-size: 10px; } + +/* ——— Toast ——— */ +.toast { + position: fixed; + top: 20px; + right: 20px; + background: #1F2329; + color: #fff; + padding: 8px 16px; + border-radius: var(--r-sm); + font-size: 13px; + z-index: 9999; + animation: fade-in 0.2s ease; +} + +/* ——— Tag Badge ——— */ +.tag-badge { + display: inline-block; + padding: 2px 10px; + background: var(--bg-hover); + border-radius: 10px; + font-size: 11px; + cursor: pointer; + color: var(--text-secondary); + transition: all 0.15s; +} +.tag-badge:hover { background: #DEE0E3; } +.tag-badge.active { background: var(--brand); color: #fff; } +.tag-add { border: 1px dashed var(--border-medium); background: transparent; color: var(--text-tertiary); } +.tag-add:hover { border-color: var(--brand); color: var(--brand); background: transparent; } + +/* ——— Helpers ——— */ +.hidden { display: none !important; } +.flex-1 { flex: 1; } +.text-muted { color: var(--text-tertiary); font-size: 12px; } +.text-sm { font-size: 12px; } +.gap-xs { gap: var(--space-xs); } +.gap-sm { gap: var(--space-sm); } +.mb-sm { margin-bottom: var(--space-sm); } +.mb-md { margin-bottom: var(--space-md); } + +/* ——— Scrollbar ——— */ +::-webkit-scrollbar { width: 5px; } +::-webkit-scrollbar-track { background: transparent; } +::-webkit-scrollbar-thumb { background: #D0D3D7; border-radius: 3px; } +::-webkit-scrollbar-thumb:hover { background: #B0B3B7; } + +/* ——— Brand wrapper ——— */ +.save-badge { + font-size: 10px; + color: var(--text-tertiary); + background: var(--bg-hover); + padding: 2px 8px; + border-radius: 10px; + flex-shrink: 0; +} diff --git a/frontend/static/dist/assets/index-5uIxZ5nb.css b/frontend/static/dist/assets/index-5uIxZ5nb.css new file mode 100644 index 0000000..a0fcdc2 --- /dev/null +++ b/frontend/static/dist/assets/index-5uIxZ5nb.css @@ -0,0 +1 @@ +.app-shell[data-v-727c46b1]{height:100vh;display:flex}.app-nav[data-v-727c46b1]{background:var(--bg-sidebar);border-right:1px solid var(--border-light);flex-direction:column;width:200px;min-width:200px;transition:all .2s;display:flex;overflow:hidden}.app-nav.collapsed[data-v-727c46b1]{width:56px;min-width:56px}.nav-brand[data-v-727c46b1]{height:48px;color:var(--brand);cursor:pointer;border-bottom:1px solid var(--border-light);flex-shrink:0;justify-content:center;align-items:center;font-size:18px;font-weight:800;display:flex}.nav-menu[data-v-727c46b1]{flex-direction:column;flex:1;gap:2px;padding:8px;display:flex}.nav-item[data-v-727c46b1]{border-radius:var(--r-sm);height:38px;color:var(--text-secondary);cursor:pointer;white-space:nowrap;align-items:center;gap:10px;padding:0 10px;font-size:13px;font-weight:500;text-decoration:none;transition:all .12s;display:flex}.nav-item[data-v-727c46b1]:hover{background:var(--bg-hover);color:var(--text-primary)}.nav-item.active[data-v-727c46b1],.nav-item.router-link-exact-active[data-v-727c46b1]{background:var(--brand-light);color:var(--brand);position:relative}.nav-item.active[data-v-727c46b1]:before,.nav-item.router-link-exact-active[data-v-727c46b1]:before{content:"";background:var(--brand);border-radius:0 2px 2px 0;width:3px;position:absolute;top:8px;bottom:8px;left:0}.nav-icon[data-v-727c46b1]{text-align:center;opacity:.7;flex-shrink:0;width:22px;font-size:15px}.nav-item.active .nav-icon[data-v-727c46b1],.nav-item.router-link-exact-active .nav-icon[data-v-727c46b1]{opacity:1}.nav-label[data-v-727c46b1]{overflow:hidden}.collapsed .nav-label[data-v-727c46b1]{display:none}.nav-bottom[data-v-727c46b1]{border-top:1px solid var(--border-light);flex-direction:column;gap:4px;padding:8px;display:flex}.app-main[data-v-727c46b1]{flex-direction:column;flex:1;min-width:0;display:flex;overflow:visible}.topbar[data-v-727c46b1]{background:var(--bg-surface);border-bottom:1px solid var(--border-light);flex-shrink:0;align-items:center;height:44px;padding:0 16px;display:flex}.header-left[data-v-727c46b1]{align-items:center;gap:8px;display:flex}.header-title[data-v-727c46b1]{color:var(--text-primary);font-size:15px;font-weight:500}.toggle-sidebar-btn[data-v-727c46b1]{border-radius:var(--r-sm);cursor:pointer;width:32px;height:32px;color:var(--text-secondary);background:0 0;border:none;justify-content:center;align-items:center;font-size:16px;transition:all .15s;display:flex}.toggle-sidebar-btn[data-v-727c46b1]:hover{background:var(--bg-hover);color:var(--text-primary)}.topbar-right[data-v-727c46b1]{flex-shrink:0;align-items:center;display:flex}#mokee-user-chip[data-v-727c46b1]{flex-shrink:0}.switch-system-btn[data-v-727c46b1]{border-radius:var(--r-sm);height:28px;color:var(--text-secondary);background:0 0;flex-shrink:0;align-items:center;gap:4px;padding:0 10px;font-size:12px;font-weight:500;text-decoration:none;transition:all .15s;display:flex}.switch-system-btn[data-v-727c46b1]:hover{background:var(--bg-hover);color:var(--brand)}.switch-icon[data-v-727c46b1]{font-size:13px}.switch-label[data-v-727c46b1]{white-space:nowrap}.app-footer[data-v-727c46b1]{height:28px;color:var(--text-tertiary);border-top:1px solid var(--border-light);flex-shrink:0;justify-content:space-between;align-items:center;padding:0 12px;font-size:10px;display:flex}.doc-table[data-v-e7f3da17]{border-collapse:collapse;width:100%}.doc-table th[data-v-e7f3da17]{text-align:left;color:var(--text-tertiary);letter-spacing:.04em;border-bottom:2px solid var(--border-light);-webkit-user-select:none;user-select:none;padding:10px 12px;font-size:11px;font-weight:600}.doc-table td[data-v-e7f3da17]{border-bottom:1px solid var(--border-light);padding:10px 12px}.clickable-row[data-v-e7f3da17]{cursor:pointer}.clickable-row:hover td[data-v-e7f3da17]{background:var(--bg-hover)}.doc-title-cell[data-v-e7f3da17]{text-overflow:ellipsis;white-space:nowrap;max-width:0;font-size:14px;font-weight:500;overflow:hidden}.share-radio[data-v-e7f3da17]{border:1px solid var(--border-light);border-radius:var(--r-md);background:var(--bg-surface);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:8px;padding:10px 14px;font-size:13px;transition:all .15s;display:flex}.share-radio[data-v-e7f3da17]:hover{border-color:var(--brand)}.share-radio.active[data-v-e7f3da17]{border-color:var(--brand);background:var(--brand-light)}.share-radio-dot[data-v-e7f3da17]{border:2px solid var(--border-medium);border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;transition:all .15s;display:inline-flex}.share-radio.active .share-radio-dot[data-v-e7f3da17]{border-color:var(--brand)}.share-radio.active .share-radio-dot[data-v-e7f3da17]:after{content:"";background:var(--brand);border-radius:50%;width:8px;height:8px}.doc-table[data-v-04fd67c6]{border-collapse:collapse;width:100%}.doc-table th[data-v-04fd67c6]{text-align:left;color:var(--text-tertiary);letter-spacing:.04em;border-bottom:2px solid var(--border-light);-webkit-user-select:none;user-select:none;padding:10px 12px;font-size:11px;font-weight:600}.doc-table td[data-v-04fd67c6]{border-bottom:1px solid var(--border-light);padding:10px 12px}.doc-title-cell[data-v-04fd67c6]{text-overflow:ellipsis;white-space:nowrap;max-width:0;font-size:14px;font-weight:500;overflow:hidden}:root{--bg-page:#f5f6f8;--bg-sidebar:#fcfcfd;--bg-surface:#fff;--bg-hover:#f2f3f5;--bg-active:#eef3ff;--text-primary:#1f2329;--text-secondary:#646a73;--text-tertiary:#8f959e;--text-placeholder:#bcc0c6;--border-light:#e5e6eb;--border-medium:#dee0e3;--brand:#3370ff;--brand-hover:#245bdb;--brand-light:#eef3ff;--danger:#f54a45;--danger-light:#fff1f0;--success:#34c759;--r-sm:6px;--r-md:8px;--r-lg:12px;--shadow-sm:0 1px 2px #0000000a;--shadow-md:0 4px 12px #00000014;--shadow-lg:0 8px 24px #0000001f}*,:before,:after{box-sizing:border-box;margin:0;padding:0}body{color:var(--text-primary);background:var(--bg-page);-webkit-font-smoothing:antialiased;height:100vh;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,system-ui,sans-serif;font-size:14px;line-height:1.5;overflow:hidden}#app{flex-direction:column;height:100vh;display:flex}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:#d0d3d7;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#b0b3b7}.topnav{background:var(--bg-surface);border-bottom:1px solid var(--border-light);flex-shrink:0;align-items:center;height:48px;padding:0 20px;display:flex}.topnav-brand{color:var(--text-primary);margin-right:24px;font-size:15px;font-weight:700;text-decoration:none}.topnav-link{color:var(--text-secondary);border-bottom:2px solid #0000;padding:13px 16px;font-size:13px;font-weight:500;text-decoration:none;transition:color .15s}.topnav-link:hover{color:var(--brand)}.topnav-link.active,.topnav-link.router-link-exact-active{color:var(--brand);border-bottom-color:var(--brand)}.user-widget{cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:20px;align-items:center;gap:8px;margin-left:auto;padding:4px 10px 4px 4px;transition:background .15s;display:flex}.user-widget:hover{background:var(--bg-hover)}.user-avatar{background:var(--brand);color:#fff;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:28px;height:28px;font-size:12px;font-weight:600;display:flex}.user-name{font-size:13px;font-weight:500}.footer{background:var(--bg-surface);border-top:1px solid var(--border-light);height:32px;color:var(--text-tertiary);flex-shrink:0;justify-content:space-between;align-items:center;padding:0 20px;font-size:11px;display:flex}.layout{flex:1;min-height:0;display:flex}.sidebar{background:var(--bg-sidebar);border-right:1px solid var(--border-light);flex-direction:column;gap:8px;width:260px;min-width:260px;padding:12px;transition:all .2s;display:flex;overflow:hidden}.sidebar.collapsed{width:40px;min-width:40px;padding:8px 4px}.content{background:var(--bg-surface);flex-direction:column;flex:1;min-width:0;display:flex}.btn{border-radius:var(--r-sm);cursor:pointer;white-space:nowrap;border:none;justify-content:center;align-items:center;gap:6px;height:36px;padding:0 16px;font-family:inherit;font-size:13px;font-weight:500;transition:all .15s;display:inline-flex}.btn:focus-visible{outline:2px solid var(--brand);outline-offset:2px}.btn-primary{background:var(--brand);color:#fff}.btn-primary:hover{background:var(--brand-hover)}.btn-outline{background:var(--bg-surface);color:var(--brand);border:1px solid var(--brand)}.btn-outline:hover{background:var(--brand-light)}.btn-ghost{color:var(--text-secondary);background:0 0}.btn-ghost:hover{background:var(--bg-hover);color:var(--text-primary)}.btn-danger-ghost{color:var(--text-tertiary);background:0 0}.btn-danger-ghost:hover{background:var(--danger-light);color:var(--danger)}.btn-block{width:100%}.btn-sm{height:30px;padding:0 12px;font-size:12px}.btn-xs{height:24px;padding:0 8px;font-size:11px}.input,.select{border:1px solid var(--border-medium);border-radius:var(--r-sm);width:100%;height:36px;color:var(--text-primary);background:var(--bg-surface);outline:none;padding:0 12px;font-family:inherit;font-size:13px;transition:border .15s}.input:focus,.select:focus{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand-light)}.input::placeholder{color:var(--text-placeholder)}.textarea{border:1px solid var(--border-medium);border-radius:var(--r-sm);width:100%;color:var(--text-primary);background:var(--bg-surface);resize:vertical;outline:none;min-height:60px;padding:8px 12px;font-family:inherit;font-size:13px;transition:border .15s}.textarea:focus{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand-light)}.sidebar-label{color:var(--text-tertiary);letter-spacing:.06em;text-transform:uppercase;justify-content:space-between;align-items:center;margin-top:8px;padding:8px 8px 4px 4px;font-size:10px;font-weight:700;display:flex}.sidebar-label .add-btn{cursor:pointer;color:var(--text-tertiary);border-radius:4px;justify-content:center;align-items:center;width:22px;height:22px;font-size:16px;line-height:1;transition:all .15s;display:flex}.sidebar-label .add-btn:hover{background:var(--bg-hover);color:var(--brand)}.folder-item{border-radius:var(--r-sm);cursor:pointer;height:34px;color:var(--text-secondary);-webkit-user-select:none;user-select:none;align-items:center;gap:8px;padding:0 10px;font-size:13px;transition:all .12s;display:flex;position:relative}.folder-item:hover{background:var(--bg-hover);color:var(--text-primary)}.folder-item.active{background:var(--brand-light);color:var(--brand)}.folder-item .count{color:var(--text-tertiary);background:var(--bg-hover);text-align:center;border-radius:8px;min-width:20px;margin-left:auto;padding:1px 6px;font-size:10px;font-weight:500}.folder-item.active .count{color:var(--brand);background:#3370ff1f}.folder-dot{background:var(--text-tertiary);opacity:.5;border-radius:50%;flex-shrink:0;width:6px;height:6px}.folder-item.active .folder-dot{background:var(--brand);opacity:1}.folder-more{opacity:0;color:var(--text-tertiary);cursor:pointer;border-radius:4px;padding:2px 6px;font-size:16px;font-weight:700;line-height:1}.folder-item:hover .folder-more{opacity:1}.folder-more:hover{background:var(--bg-hover);color:var(--text-primary)}.site-item{border-radius:var(--r-sm);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:8px;height:36px;padding:0 8px;font-size:13px;transition:background .1s;display:flex}.site-item:hover{background:var(--bg-hover)}.site-item.active{background:var(--brand-light);color:var(--brand);font-weight:500}.site-item .site-name{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.site-item .site-count{color:var(--text-tertiary);flex-shrink:0;font-size:10px}.note-list-item{border-radius:var(--r-sm);cursor:pointer;align-items:center;gap:8px;height:34px;padding:0 8px;font-size:12px;transition:background .1s;display:flex}.note-list-item:hover{background:var(--bg-hover)}.note-list-item.active{background:var(--brand-light)}.note-list-item .note-title{text-overflow:ellipsis;white-space:nowrap;flex:1;font-weight:500;overflow:hidden}.note-list-item .note-date{color:var(--text-tertiary);font-size:10px}.folder-children{margin-left:16px}.folder-arrow{color:var(--text-tertiary);flex-shrink:0;width:12px;font-size:10px}.card{background:var(--bg-surface);border:1px solid var(--border-light);border-radius:var(--r-lg);margin-bottom:12px;padding:16px;transition:box-shadow .15s}.card:hover{box-shadow:var(--shadow-sm)}.card-header{justify-content:space-between;align-items:center;margin-bottom:12px;display:flex}.card-title{font-size:14px;font-weight:600}.card-body{grid-template-columns:auto 1fr auto;align-items:center;gap:8px 12px;font-size:13px;display:grid}.card-body .label{color:var(--text-tertiary);white-space:nowrap;font-size:12px}.card-btn{border:1px solid var(--border-light);border-radius:var(--r-sm);background:var(--bg-surface);cursor:pointer;height:30px;color:var(--text-secondary);padding:0 10px;font-family:inherit;font-size:12px;transition:all .15s}.card-btn:hover{background:var(--bg-hover);border-color:var(--border-medium)}.card-btn.edit-btn:hover{color:var(--brand);border-color:var(--brand);background:var(--brand-light)}.card-btn.danger-btn:hover{color:var(--danger);border-color:var(--danger);background:var(--danger-light)}.modal-overlay{z-index:100;background:#00000059;justify-content:center;align-items:center;animation:.15s fi;display:flex;position:fixed;inset:0}@keyframes fi{0%{opacity:0}to{opacity:1}}.modal{background:var(--bg-surface);border-radius:var(--r-lg);box-shadow:var(--shadow-lg);flex-direction:column;width:480px;max-width:90vw;max-height:85vh;animation:.15s si;display:flex}@keyframes si{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.modal-header{border-bottom:1px solid var(--border-light);flex-shrink:0;justify-content:space-between;align-items:center;padding:16px 20px;display:flex}.modal-title{font-size:15px;font-weight:600}.modal-close{border-radius:var(--r-sm);cursor:pointer;width:28px;height:28px;color:var(--text-tertiary);background:0 0;border:none;justify-content:center;align-items:center;font-size:18px;transition:all .15s;display:flex}.modal-close:hover{background:var(--bg-hover);color:var(--text-primary)}.modal-body{flex:1;padding:20px;overflow-y:auto}.modal-footer{border-top:1px solid var(--border-light);flex-shrink:0;justify-content:flex-end;gap:8px;padding:12px 20px;display:flex}.form-group{margin-bottom:16px}.form-group:last-child{margin-bottom:0}.form-label{color:var(--text-secondary);margin-bottom:4px;font-size:12px;font-weight:600;display:block}.form-row{align-items:center;gap:8px;display:flex}.editor-wrap{flex:1;min-height:0;display:flex}.editor-pane{flex:1;justify-content:center;min-width:0;padding:20px;display:flex;overflow-y:auto}.editor-pane+.editor-pane{border-left:1px solid var(--border-light)}.editor-inner{width:100%;max-width:960px}.content-header{border-bottom:1px solid var(--border-light);flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:12px 20px;display:flex}.content-title{color:var(--text-primary);background:0 0;border:none;outline:none;flex:1;font-family:inherit;font-size:16px;font-weight:600}.content-title::placeholder{color:var(--text-placeholder)}.toggle-group{background:var(--bg-hover);border-radius:var(--r-sm);padding:2px;display:flex}.toggle-group button{cursor:pointer;height:28px;color:var(--text-secondary);background:0 0;border:none;border-radius:4px;padding:0 12px;font-family:inherit;font-size:12px;transition:all .15s}.toggle-group button.active{background:var(--bg-surface);box-shadow:var(--shadow-sm);color:var(--text-primary);font-weight:500}.save-badge{color:var(--text-tertiary);background:var(--bg-hover);white-space:nowrap;border-radius:10px;flex-shrink:0;padding:2px 8px;font-size:10px}.tb-bar{background:var(--bg-sidebar);border:1px solid var(--border-light);border-radius:var(--r-md);flex-wrap:wrap;align-items:center;gap:2px;margin-bottom:16px;padding:4px 6px;display:flex}.tb-divider{background:var(--border-medium);width:1px;height:16px;margin:0 4px}.tb-btn{cursor:pointer;height:28px;color:var(--text-secondary);white-space:nowrap;background:0 0;border:none;border-radius:4px;padding:0 8px;font-family:inherit;font-size:12px;transition:all .1s}.tb-btn:hover{background:var(--bg-hover)}.tb-btn.active{background:var(--brand-light);color:var(--brand)}.tb-color{border:1px solid var(--border-medium);cursor:pointer;border-radius:4px;width:24px;height:24px;margin:0 2px;padding:0}.ProseMirror{outline:none;min-height:300px;font-size:14px;line-height:1.8}.ProseMirror h1{border-bottom:1px solid var(--border-light);margin:16px 0 8px;padding-bottom:6px;font-size:22px;font-weight:700}.ProseMirror h2{margin:14px 0 6px;font-size:18px;font-weight:600}.ProseMirror h3{margin:12px 0 4px;font-size:15px;font-weight:600}.ProseMirror p{margin:4px 0}.ProseMirror ul,.ProseMirror ol{margin:4px 0;padding-left:20px}.ProseMirror li{margin:2px 0}.ProseMirror blockquote{border-left:3px solid var(--brand);color:var(--text-secondary);margin:8px 0;padding-left:12px}.ProseMirror pre{border-radius:var(--r-sm);background:#f7f8fa;padding:12px 16px;font-family:SF Mono,Fira Code,Consolas,monospace;font-size:13px;line-height:1.6;overflow-x:auto}.ProseMirror code{background:#f2f3f5;border-radius:3px;padding:2px 6px;font-family:SF Mono,Fira Code,Consolas,monospace;font-size:12px}.ProseMirror table{border-collapse:collapse;width:100%;margin:8px 0}.ProseMirror th,.ProseMirror td{border:1px solid var(--border-light);text-align:left;padding:8px 12px}.ProseMirror th{background:#f7f8fa;font-size:13px;font-weight:600}.ProseMirror img{border-radius:var(--r-sm);max-width:100%}.ProseMirror mark{background:#fff3cd;border-radius:2px;padding:2px 4px}.import-textarea{border:2px solid var(--brand);border-radius:var(--r-md);resize:vertical;background:var(--brand-light);outline:none;width:100%;height:90px;padding:10px 12px;font-family:inherit;font-size:13px}.import-hint{color:var(--text-tertiary);margin:4px 0 12px;font-size:11px}.result-box{border-radius:var(--r-md);background:#f0faf0;border:1px solid #a3e4a7;margin-bottom:16px;padding:14px 16px}.result-grid{grid-template-columns:70px 1fr;gap:6px 12px;font-size:13px;display:grid}.alert{border-radius:var(--r-sm);padding:8px 12px;font-size:12px}.alert-warning{color:#8a5d00;background:#fff7e6}.stat-row{gap:6px;display:flex}.stat{text-align:center;background:var(--bg-surface);border:1px solid var(--border-light);border-radius:var(--r-sm);flex:1;padding:8px 4px;font-size:11px}.stat-num{font-size:18px;font-weight:700}.stat-label{color:var(--text-tertiary);font-size:10px}.tag-badge{background:var(--bg-hover);cursor:pointer;color:var(--text-secondary);border-radius:10px;padding:2px 10px;font-size:11px;transition:all .15s;display:inline-block}.tag-badge:hover{background:#dee0e3}.tag-badge.active{background:var(--brand);color:#fff}.toast{color:#fff;border-radius:var(--r-sm);z-index:9999;background:#1f2329;padding:8px 16px;font-size:13px;animation:.2s fi;position:fixed;top:20px;right:20px}.folder-menu{background:var(--bg-surface);border:1px solid var(--border-light);border-radius:var(--r-md);box-shadow:var(--shadow-md);z-index:10;min-width:120px;padding:4px;position:absolute;top:100%;right:0}.folder-menu-item{cursor:pointer;color:var(--text-primary);border-radius:var(--r-sm);padding:6px 12px;font-size:12px;transition:background .1s}.folder-menu-item:hover{background:var(--bg-hover)}.folder-menu-item.danger{color:var(--danger)}.folder-menu-item.danger:hover{background:var(--danger-light)}.lightbox{z-index:200;cursor:zoom-out;background:#000000d9;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.lightbox img{object-fit:contain;cursor:default;border-radius:4px;max-width:90vw;max-height:90vh}.lightbox-close{color:#fff;cursor:pointer;z-index:201;background:#ffffff26;border:none;border-radius:50%;justify-content:center;align-items:center;width:40px;height:40px;font-size:22px;transition:background .15s;display:flex;position:fixed;top:16px;right:16px}.lightbox-close:hover{background:#ffffff4d}.sel-toolbar{z-index:150;background:var(--bg-surface);border:1px solid var(--border-light);border-radius:var(--r-md);box-shadow:var(--shadow-md);gap:4px;padding:6px;display:flex;position:fixed}.comments-panel{border-left:1px solid var(--border-light);background:var(--bg-sidebar);flex-direction:column;width:260px;min-width:260px;font-size:13px;display:flex}.hidden{display:none!important}@media (width<=768px){.app-nav{z-index:50;transition:transform .25s;position:fixed;top:0;bottom:0;left:0;transform:translate(-100%)}.app-nav.open{transform:translate(0)}.app-nav.collapsed{width:200px;min-width:200px}.app-main{width:100%}.hamburger{display:flex!important}.layout{flex-direction:column}.sidebar{border-right:none;border-bottom:1px solid var(--border-light);flex-shrink:0;width:100%;min-width:100%;max-height:40vh}.content{width:100%}.content-header{flex-wrap:wrap;gap:8px;padding:10px 12px}.content-title{font-size:15px}.doc-table,.doc-table thead,.doc-table tbody,.doc-table th,.doc-table td,.doc-table tr{display:block}.doc-table thead{display:none}.doc-table tr{border-bottom:1px solid var(--border-light);padding:10px 12px}.doc-table td{border:none;padding:4px 0}.doc-table td:before{content:attr(data-label);color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.04em;margin-bottom:2px;font-size:10px;font-weight:600;display:block}.doc-title-cell{white-space:normal;max-width:none}.editor-wrap{flex-direction:column}.editor-pane{padding:12px}.editor-pane+.editor-pane{border-left:none;border-top:1px solid var(--border-light)}.editor-inner{max-width:100%}.tb-bar{flex-wrap:nowrap;gap:1px;padding:4px;overflow-x:auto}.modal{border-radius:0;max-width:100vw;height:100vh;max-height:100vh;width:100vw!important}.modal-overlay{align-items:flex-end}.card-body{grid-template-columns:1fr;gap:4px}.card-body .label{margin-top:6px}.content-header{white-space:nowrap;flex-wrap:nowrap;overflow-x:auto}.topbar{height:40px;padding:0 10px}.topbar-brand{font-size:13px}.lightbox-close{width:36px;height:36px;font-size:18px;top:10px;right:10px}.lightbox img{max-width:95vw;max-height:85vh}.comments-panel{border-left:none;border-top:1px solid var(--border-light);width:100%;min-width:100%;max-height:40vh}}.hamburger{z-index:60;background:var(--bg-surface);border:1px solid var(--border-light);border-radius:var(--r-sm);cursor:pointer;width:36px;height:36px;box-shadow:var(--shadow-sm);justify-content:center;align-items:center;font-size:18px;display:none;position:fixed;top:8px;left:8px}@media (width<=768px){.app-nav.open+.nav-overlay{display:block}}.nav-overlay{z-index:49;background:#0000004d;display:none;position:fixed;inset:0}.flex-1{flex:1}.text-muted{color:var(--text-tertiary);font-size:12px}.mb-sm{margin-bottom:8px}.mb-md{margin-bottom:16px} diff --git a/frontend/static/dist/assets/index-BpxV2n8n.js b/frontend/static/dist/assets/index-BpxV2n8n.js new file mode 100644 index 0000000..b40cbb3 --- /dev/null +++ b/frontend/static/dist/assets/index-BpxV2n8n.js @@ -0,0 +1,166 @@ +var e=Object.defineProperty,t=(e,t)=>()=>(e&&(t=e(e=0)),t),n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),r=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function i(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}function a(e){if(S(e)){let t={};for(let n=0;n{if(e){let n=e.split(be);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function s(e){let t=``;if(E(e))t=e;else if(S(e))for(let n=0;nu(e,t))}var f,p,m,h,g,_,v,y,b,x,S,C,w,ee,T,E,D,O,te,k,ne,re,ie,ae,oe,se,ce,le,ue,A,de,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,j,Te,Ee,De=t((()=>{f={},p=[],m=()=>{},h=()=>!1,g=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),_=e=>e.startsWith(`onUpdate:`),v=Object.assign,y=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},b=Object.prototype.hasOwnProperty,x=(e,t)=>b.call(e,t),S=Array.isArray,C=e=>ne(e)===`[object Map]`,w=e=>ne(e)===`[object Set]`,ee=e=>ne(e)===`[object Date]`,T=e=>typeof e==`function`,E=e=>typeof e==`string`,D=e=>typeof e==`symbol`,O=e=>typeof e==`object`&&!!e,te=e=>(O(e)||T(e))&&T(e.then)&&T(e.catch),k=Object.prototype.toString,ne=e=>k.call(e),re=e=>ne(e).slice(8,-1),ie=e=>ne(e)===`[object Object]`,ae=e=>E(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,oe=i(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),se=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ce=/-\w/g,le=se(e=>e.replace(ce,e=>e.slice(1).toUpperCase())),ue=/\B([A-Z])/g,A=se(e=>e.replace(ue,`-$1`).toLowerCase()),de=se(e=>e.charAt(0).toUpperCase()+e.slice(1)),fe=se(e=>e?`on${de(e)}`:``),pe=(e,t)=>!Object.is(e,t),me=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ge=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ve=()=>_e||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{},ye=/;(?![^(]*\))/g,be=/:([^]+)/,xe=/\/\*[^]*?\*\//g,Se=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Ce=i(Se),Se+``,we=e=>!!(e&&e.__v_isRef===!0),j=e=>E(e)?e:e==null?``:S(e)||O(e)&&(e.toString===k||!T(e.toString))?we(e)?j(e.value):JSON.stringify(e,Te,2):String(e),Te=(e,t)=>we(t)?Te(e,t.value):C(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ee(t,r)+` =>`]=n,e),{})}:w(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ee(e))}:D(t)?Ee(t):O(t)&&!S(t)&&!ie(t)?String(t):t,Ee=(e,t=``)=>D(e)?`Symbol(${e.description??t})`:e}));function Oe(){return St}function ke(e,t=!1){if(e.flags|=8,t){e.next=kt,kt=e;return}e.next=Ot,Ot=e}function Ae(){Dt++}function je(){if(--Dt>0)return;if(kt){let e=kt;for(kt=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Ot;){let t=Ot;for(Ot=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function Me(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ne(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ie(r),Le(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Pe(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Fe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Fe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Mt)||(e.globalVersion=Mt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Pe(e))))return;e.flags|=2;let t=e.dep,n=wt,r=At;wt=e,At=!0;try{Me(e);let n=e.fn(e._value);(t.version===0||pe(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{wt=n,At=r,Ne(e),e.flags&=-3}}function Ie(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ie(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Le(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function Re(){jt.push(At),At=!1}function ze(){let e=jt.pop();At=e===void 0?!0:e}function Be(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=wt;wt=void 0;try{t()}finally{wt=e}}}function Ve(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)Ve(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function He(e,t,n){if(At&&wt){let t=Ft.get(e);t||Ft.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new Pt),r.map=t,r.key=n),r.track()}}function Ue(e,t,n,r,i,a){let o=Ft.get(e);if(!o){Mt++;return}let s=e=>{e&&e.trigger()};if(Ae(),t===`clear`)o.forEach(s);else{let i=S(e),a=i&&ae(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===Rt||!D(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(Rt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(It)),C(e)&&s(o.get(Lt)));break;case`delete`:i||(s(o.get(It)),C(e)&&s(o.get(Lt)));break;case`set`:C(e)&&s(o.get(It));break}}je()}function We(e){let t=M(e);return t===e?t:(He(t,`iterate`,Rt),ut(e)?t:t.map(an))}function Ge(e){return He(e=M(e),`iterate`,Rt),e}function Ke(e,t){return lt(e)?on(ct(e)?an(t):t):an(t)}function qe(e,t,n){let r=Ge(e),i=r[t]();return r!==e&&!ut(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}function Je(e,t,n,r,i,a){let o=Ge(e),s=o!==e&&!ut(e),c=o[t];if(c!==Bt[t]){let t=c.apply(e,a);return s?an(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,Ke(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function Ye(e,t,n,r){let i=Ge(e),a=i!==e&&!ut(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=Ke(e,t)),n.call(this,t,Ke(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?Ke(e,c):c}function Xe(e,t,n){let r=M(e);He(r,`iterate`,Rt);let i=r[t](...n);return(i===-1||i===!1)&&dt(n[0])?(n[0]=M(n[0]),r[t](...n)):i}function Ze(e,t,n=[]){Re(),Ae();let r=M(e)[t].apply(e,n);return je(),ze(),r}function Qe(e){D(e)||(e=String(e));let t=M(this);return He(t,`has`,e),t.hasOwnProperty(e)}function $e(e,t,n){return function(...r){let i=this.__v_raw,a=M(i),o=C(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Yt:t?on:an;return!t&&He(a,`iterate`,c?Lt:It),v(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function et(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function tt(e,t){let n={get(n){let r=this.__v_raw,i=M(r),a=M(n);e||(pe(n,a)&&He(i,`get`,n),He(i,`get`,a));let{has:o}=Xt(i),s=t?Yt:e?on:an;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&He(M(t),`iterate`,It),t.size},has(t){let n=this.__v_raw,r=M(n),i=M(t);return e||(pe(t,i)&&He(r,`has`,t),He(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=M(a),s=t?Yt:e?on:an;return!e&&He(o,`iterate`,It),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return v(n,e?{add:et(`add`),set:et(`set`),delete:et(`delete`),clear:et(`clear`)}:{add(e){let n=M(this),r=Xt(n),i=M(e),a=!t&&!ut(e)&&!lt(e)?i:e;return r.has.call(n,a)||pe(e,a)&&r.has.call(n,e)||pe(i,a)&&r.has.call(n,i)||(n.add(a),Ue(n,`add`,a,a)),this},set(e,n){!t&&!ut(n)&&!lt(n)&&(n=M(n));let r=M(this),{has:i,get:a}=Xt(r),o=i.call(r,e);o||=(e=M(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?pe(n,s)&&Ue(r,`set`,e,n,s):Ue(r,`add`,e,n),this},delete(e){let t=M(this),{has:n,get:r}=Xt(t),i=n.call(t,e);i||=(e=M(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&Ue(t,`delete`,e,void 0,a),o},clear(){let e=M(this),t=e.size!==0,n=e.clear();return t&&Ue(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=$e(r,e,t)}),n}function nt(e,t){let n=tt(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(x(n,r)&&r in t?n:t,r,i)}function rt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function it(e){return lt(e)?e:st(e,!1,Kt,Zt,en)}function at(e){return st(e,!1,Jt,Qt,tn)}function ot(e){return st(e,!0,qt,$t,nn)}function st(e,t,n,r,i){if(!O(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=rt(re(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function ct(e){return lt(e)?ct(e.__v_raw):!!(e&&e.__v_isReactive)}function lt(e){return!!(e&&e.__v_isReadonly)}function ut(e){return!!(e&&e.__v_isShallow)}function dt(e){return e?!!e.__v_raw:!1}function M(e){let t=e&&e.__v_raw;return t?M(t):e}function ft(e){return!x(e,`__v_skip`)&&Object.isExtensible(e)&&he(e,`__v_skip`,!0),e}function pt(e){return e?e.__v_isRef===!0:!1}function N(e){return ht(e,!1)}function mt(e){return ht(e,!0)}function ht(e,t){return pt(e)?e:new sn(e,t)}function gt(e){return pt(e)?e.value:e}function _t(e){return ct(e)?e:new Proxy(e,cn)}function vt(e,t,n=!1){let r,i;return T(e)?r=e:(r=e.get,i=e.set),new ln(r,i,n)}function yt(e,t=!1,n=fn){if(n){let t=dn.get(n);t||dn.set(n,t=[]),t.push(e)}}function bt(e,t,n=f){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:ut(e)||i===!1||i===0?xt(e,1):xt(e),u,d,p,h,g=!1,_=!1;if(pt(e)?(d=()=>e.value,g=ut(e)):ct(e)?(d=()=>l(e),g=!0):S(e)?(_=!0,g=e.some(e=>ct(e)||ut(e)),d=()=>e.map(e=>{if(pt(e))return e.value;if(ct(e))return l(e);if(T(e))return c?c(e,2):e()})):d=T(e)?t?c?()=>c(e,2):e:()=>{if(p){Re();try{p()}finally{ze()}}let t=fn;fn=u;try{return c?c(e,3,[h]):e(h)}finally{fn=t}}:m,t&&i){let e=d,t=i===!0?1/0:i;d=()=>xt(e(),t)}let v=Oe(),b=()=>{u.stop(),v&&v.active&&y(v.effects,u)};if(a&&t){let e=t;t=(...t)=>{let n=e(...t);return b(),n}}let x=_?Array(e.length).fill(un):un,C=e=>{if(!(!(u.flags&1)||!u.dirty&&!e))if(t){let n=u.run();if(e||i||g||(_?n.some((e,t)=>pe(e,x[t])):pe(n,x))){p&&p();let e=fn;fn=u;try{let e=[n,x===un?void 0:_&&x[0]===un?[]:x,h];x=n,c?c(t,3,e):t(...e)}finally{fn=e}}}else u.run()};return s&&s(C),u=new Et(d),u.scheduler=o?()=>o(C,!1):C,h=e=>yt(e,!1,u),p=u.onStop=()=>{let e=dn.get(u);if(e){if(c)c(e,4);else for(let t of e)t();dn.delete(u)}},t?r?C(!0):x=u.run():o?o(C.bind(null,!0),!0):u.run(),b.pause=u.pause.bind(u),b.resume=u.resume.bind(u),b.stop=b,b}function xt(e,t=1/0,n){if(t<=0||!O(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,pt(e))xt(e.value,t,n);else if(S(e))for(let r=0;r{xt(e,t,n)});else if(ie(e)){for(let r in e)xt(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&xt(e[r],t,n)}return e}var St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn=t((()=>{De(),Ct=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&St&&(St.active?(this.parent=St,this.index=(St.scopes||=[]).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e0&&--this._on===0){if(St===this)St=this.prevScope;else{let e=St;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;tKe(this,e))},concat(...e){return We(this).concat(...e.map(e=>S(e)?We(e):e))},entries(){return qe(this,`entries`,e=>(e[1]=Ke(this,e[1]),e))},every(e,t){return Je(this,`every`,e,t,void 0,arguments)},filter(e,t){return Je(this,`filter`,e,t,e=>e.map(e=>Ke(this,e)),arguments)},find(e,t){return Je(this,`find`,e,t,e=>Ke(this,e),arguments)},findIndex(e,t){return Je(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return Je(this,`findLast`,e,t,e=>Ke(this,e),arguments)},findLastIndex(e,t){return Je(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return Je(this,`forEach`,e,t,void 0,arguments)},includes(...e){return Xe(this,`includes`,e)},indexOf(...e){return Xe(this,`indexOf`,e)},join(e){return We(this).join(e)},lastIndexOf(...e){return Xe(this,`lastIndexOf`,e)},map(e,t){return Je(this,`map`,e,t,void 0,arguments)},pop(){return Ze(this,`pop`)},push(...e){return Ze(this,`push`,e)},reduce(e,...t){return Ye(this,`reduce`,e,t)},reduceRight(e,...t){return Ye(this,`reduceRight`,e,t)},shift(){return Ze(this,`shift`)},some(e,t){return Je(this,`some`,e,t,void 0,arguments)},splice(...e){return Ze(this,`splice`,e)},toReversed(){return We(this).toReversed()},toSorted(e){return We(this).toSorted(e)},toSpliced(...e){return We(this).toSpliced(...e)},unshift(...e){return Ze(this,`unshift`,e)},values(){return qe(this,`values`,e=>Ke(this,e))}},Bt=Array.prototype,Vt=i(`__proto__,__v_isRef,__isVue`),Ht=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(D)),Ut=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?rn:nn:i?tn:en).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=S(e);if(!r){let e;if(a&&(e=zt[t]))return e;if(t===`hasOwnProperty`)return Qe}let o=Reflect.get(e,t,pt(e)?e:n);if((D(t)?Ht.has(t):Vt(t))||(r||He(e,`get`,t),i))return o;if(pt(o)){let e=a&&ae(t)?o:o.value;return r&&O(e)?ot(e):e}return O(o)?r?ot(o):it(o):o}},Wt=class extends Ut{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=S(e)&&ae(t);if(!this._isShallow){let e=lt(i);if(!ut(n)&&!lt(n)&&(i=M(i),n=M(n)),!a&&pt(i)&&!pt(n))return e||(i.value=n),!0}let o=a?Number(t)e,Xt=e=>Reflect.getPrototypeOf(e),Zt={get:nt(!1,!1)},Qt={get:nt(!1,!0)},$t={get:nt(!0,!1)},en=new WeakMap,tn=new WeakMap,nn=new WeakMap,rn=new WeakMap,an=e=>O(e)?it(e):e,on=e=>O(e)?ot(e):e,sn=class{constructor(e,t){this.dep=new Pt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:M(e),this._value=t?e:an(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||ut(e)||lt(e);e=n?e:M(e),pe(e,t)&&(this._rawValue=e,this._value=n?e:an(e),this.dep.trigger())}},cn={get:(e,t,n)=>t===`__v_raw`?e:gt(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return pt(i)&&!pt(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}},ln=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Pt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Mt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&wt!==this)return ke(this,!0),!0}get value(){let e=this.dep.track();return Fe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},un={},dn=new WeakMap,fn=void 0}));function mn(e,t,n,r){try{return r?e(...r):e()}catch(e){gn(e,t,n)}}function hn(e,t,n,r){if(T(e)){let i=mn(e,t,n,r);return i&&te(i)&&i.catch(e=>{gn(e,t,n)}),i}if(S(e)){let i=[];for(let a=0;a>>1,i=mi[r],a=xi(i);a=xi(n)?mi.push(e):mi.splice(yn(t),0,e),e.flags|=1,xn()}}function xn(){bi||=yi.then(Tn)}function Sn(e){S(e)?gi.push(...e):_i&&e.id===-1?_i.splice(vi+1,0,e):e.flags&1||(gi.push(e),e.flags|=1),xn()}function Cn(e,t,n=hi+1){for(;nxi(e)-xi(t));if(gi.length=0,_i){_i.push(...e);return}for(_i=e,vi=0;vi<_i.length;vi++){let e=_i[vi];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}_i=null,vi=0}}function Tn(e){try{for(hi=0;hi{r._d&&Hr(-1);let i=En(t),a;try{a=e(...n)}finally{En(i),r._d&&Hr(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function On(e,t){if(Si===null)return e;let n=ui(Si),r=e.dirs||=[];for(let e=0;e1)return n&&T(t)?t.call(r&&r.proxy):t}}function Mn(e,t,n){return Nn(e,t,n)}function Nn(e,t,n=f){let{immediate:r,deep:i,flush:a,once:o}=n,s=v({},n),c=t&&r||!t&&a!==`post`,l;if(Na){if(a===`sync`){let e=Ti();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=m,e.resume=m,e.pause=m,e}}let u=Da;s.call=(e,t,n)=>hn(e,u,t,n);let d=!1;a===`post`?s.scheduler=e=>{ma(e,u&&u.suspense)}:a!==`sync`&&(d=!0,s.scheduler=(e,t)=>{t?e():bn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),d&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let p=bt(e,t,s);return Na&&(l?l.push(p):c&&p()),p}function Pn(e,t,n){let r=this.proxy,i=E(e)?e.includes(`.`)?Fn(r,e):()=>r[e]:e.bind(r,r),a;T(t)?a=t:(a=t.handler,n=t);let o=ja(this),s=Nn(i,a.bind(r),n);return o(),s}function Fn(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;eBn(e,t&&(S(t)?t[a]:t),n,r,i));return}if(Ai(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Bn(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?ui(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,u=s.refs===f?s.refs={}:s.refs,d=s.setupState,p=M(d),m=d===f?h:e=>zn(u,e)?!1:x(p,e),g=(e,t)=>!(t&&zn(u,t));if(l!=null&&l!==c){if(Vn(t),E(l))u[l]=null,m(l)&&(d[l]=null);else if(pt(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(u[e.k]=null)}}if(T(c))mn(c,s,12,[o,u]);else{let t=E(c),r=pt(c);if(t||r){let s=()=>{if(e.f){let n=t?m(c)?d[c]:u[c]:g(c)||!e.k?c.value:u[e.k];if(i)S(n)&&y(n,a);else if(S(n))n.includes(a)||n.push(a);else if(t)u[c]=[a],m(c)&&(d[c]=u[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(u[e.k]=t)}}else t?(u[c]=o,m(c)&&(d[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(u[e.k]=o))};if(o){let t=()=>{s(),ki.delete(e)};t.id=-1,ki.set(e,t),ma(t,n)}else Vn(e),s()}}}function Vn(e){let t=ki.get(e);t&&(t.flags|=8,ki.delete(e))}function Hn(e,t){Wn(e,`a`,t)}function Un(e,t){Wn(e,`da`,t)}function Wn(e,t,n=Da){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Kn(t,r,n),n){let e=n.parent;for(;e&&e.parent;)ji(e.parent.vnode)&&Gn(r,t,n,e),e=e.parent}}function Gn(e,t,n,r){let i=Kn(t,e,r,!0);Ri(()=>{y(r[t],i)},n)}function Kn(e,t,n=Da,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{Re();let i=ja(n),a=hn(t,n,e,r);return i(),ze(),a};return r?i.unshift(a):i.push(a),a}}function qn(e,t=Da){Kn(`ec`,e,t)}function Jn(e,t){return Yn(Hi,e,!0,t)||e}function Yn(e,t,n=!0,r=!1){let i=Si||Da;if(i){let n=i.type;if(e===Hi){let e=di(n,!1);if(e&&(e===t||e===le(t)||e===de(le(t))))return n}let a=Xn(i[e]||n[e],t)||Xn(i.appContext[e],t);return!a&&r?n:a}}function Xn(e,t){return e&&(e[t]||e[le(t)]||e[de(le(t))])}function Zn(e,t,n,r){let i,a=n&&n[r],o=S(e);if(o||E(e)){let n=o&&ct(e),r=!1,s=!1;n&&(r=!ut(e),s=lt(e),e=Ge(e)),i=Array(e.length);for(let n=0,o=e.length;nt(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r0;return t!=="default"&&(n.name=t),P(),Wr(ga,null,[L(`slot`,n,r&&r())],e?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),P();let o=a&&$n(a(n)),s=n.key||o&&o.key,c=Wr(ga,{key:(s&&!D(s)?s:`_${t}`)+(!o&&r?`_fb`:``)},o||(r?r():[]),o&&e._===1?64:-2);return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),a&&a._c&&(a._d=!0),c}function $n(e){return e.some(e=>Gr(e)?!(e.type===va||e.type===ga&&!$n(e.children)):!0)?e:null}function er(e){return S(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function tr(e){let t=ar(e),n=e.proxy,r=e.ctx;Ji=!1,t.beforeCreate&&rr(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:f,beforeUpdate:p,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:b,unmounted:x,render:C,renderTracked:w,renderTriggered:ee,errorCaptured:E,serverPrefetch:D,expose:te,inheritAttrs:k,components:ne,directives:re,filters:ie}=t;if(l&&nr(l,r,null),o)for(let e in o){let t=o[e];T(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);O(t)&&(e.data=it(t))}if(Ji=!0,a)for(let e in a){let t=a[e],i=La({get:T(t)?t.bind(n,n):T(t.get)?t.get.bind(n,n):m,set:!T(t)&&T(t.set)?t.set.bind(n):m});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)ir(s[e],r,n,e);if(c){let e=T(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{An(t,e[t])})}u&&rr(u,e,`c`);function ae(e,t){S(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(ae(Ni,d),ae(Pi,f),ae(Fi,p),ae(Ii,h),ae(Hn,g),ae(Un,_),ae(qn,E),ae(Vi,w),ae(Bi,ee),ae(Li,y),ae(Ri,x),ae(zi,D),S(te))if(te.length){let t=e.exposed||={};te.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={};C&&e.render===m&&(e.render=C),k!=null&&(e.inheritAttrs=k),ne&&(e.components=ne),re&&(e.directives=re),D&&Rn(e)}function nr(e,t,n=m){S(e)&&(e=lr(e));for(let n in e){let r=e[n],i;i=O(r)?`default`in r?jn(r.from||n,r.default,!0):jn(r.from||n):jn(r),pt(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function rr(e,t,n){hn(S(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function ir(e,t,n,r){let i=r.includes(`.`)?Fn(n,r):()=>n[r];if(E(e)){let n=t[e];T(n)&&Mn(i,n)}else if(T(e))Mn(i,e.bind(n));else if(O(e))if(S(e))e.forEach(e=>ir(e,t,n,r));else{let r=T(e.handler)?e.handler.bind(n):t[e.handler];T(r)&&Mn(i,r,e)}}function ar(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>or(c,e,o,!0)),or(c,t,o)),O(t)&&a.set(t,c),c}function or(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&or(e,a,n,!0),i&&i.forEach(t=>or(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Yi[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}function sr(e,t){return t?e?function(){return v(T(e)?e.call(this,this):e,T(t)?t.call(this,this):t)}:t:e}function cr(e,t){return dr(lr(e),lr(t))}function lr(e){if(S(e)){let t={};for(let n=0;nE(e)?e.trim():e)),o.number&&(i=n.map(ge)));let s,c=r[s=fe(t)]||r[s=fe(le(t))];!c&&a&&(c=r[s=fe(A(t))]),c&&hn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,hn(l,e,6,i)}}function _r(e,t,n=!1){let r=n?$i:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!T(e)){let r=e=>{let n=_r(e,t,!0);n&&(s=!0,v(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(O(e)&&r.set(e,null),null):(S(a)?a.forEach(e=>o[e]=null):v(o,a),O(e)&&r.set(e,o),o)}function vr(e,t){return!e||!g(t)?!1:(t=t.slice(2).replace(/Once$/,``),x(e,t[0].toLowerCase()+t.slice(1))||x(e,A(t))||x(e,t))}function yr(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:h}=e,g=En(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=Qr(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=Qr(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:ea(s)}}catch(t){ba.length=0,gn(t,e,1),v=L(va)}let b=v;if(y&&h!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(_)&&(y=ta(y,a)),b=Yr(b,y,!1,!0))}return n.dirs&&(b=Yr(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&In(b,n.transition),v=b,En(g),v}function br(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?xr(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r{c=!0;let[n,r]=Or(e,t,!0);v(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return O(e)&&r.set(e,p),p;if(S(a))for(let e=0;e{if(e===t)return;e&&!Kr(e,t)&&(r=_e(e),de(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case _a:y(e,t,n,r);break;case va:b(e,t,n,r);break;case ya:e??x(t,n,r,o);break;case ga:k(e,t,n,r,i,a,o,s,c);break;default:d&1?w(e,t,n,r,i,a,o,s,c):d&6?ne(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,xe)}u!=null&&i?Bn(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&Bn(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)ee(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),D(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},ee=(e,t,n,i,s,c,l,d)=>{let f,p,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(f=e.el=o(e.type,c,m&&m.is,m),h&8?u(f,e.children):h&16&&E(e.children,f,null,i,s,Mr(e,c),l,d),_&&kn(e,null,i,`created`),T(f,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!oe(e)&&a(f,e,null,m[e],c,i);`value`in m&&a(f,`value`,null,m.value,c),(p=m.onVnodeBeforeMount)&&ni(p,i,e)}_&&kn(e,null,i,`beforeMount`);let v=Pr(s,g);v&&g.beforeEnter(f),r(f,t,n),((p=m&&m.onVnodeMounted)||v||_)&&ma(()=>{try{p&&ni(p,i,e),v&&g.enter(f),_&&kn(e,null,i,`mounted`)}finally{}},s)},T=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t{for(let l=c;l{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:p}=t;l|=e.patchFlag&16;let m=e.props||f,h=t.props||f,g;if(n&&Nr(n,!1),(g=h.onVnodeBeforeUpdate)&&ni(g,n,t,e),p&&kn(t,e,n,`beforeUpdate`),n&&Nr(n,!0),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&u(c,``),d?O(e.dynamicChildren,d,c,n,r,Mr(t,i),o):s||ce(e,t,c,null,n,r,Mr(t,i),o,!1),l>0){if(l&16)te(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t{g&&ni(g,n,t,e),p&&kn(t,e,n,`updated`)},r)},O=(e,t,n,r,i,a,o)=>{for(let s=0;s{if(t!==n){if(t!==f)for(let o in t)!oe(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(oe(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},k=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),E(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(O(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Fr(e,t,!0)):ce(e,t,n,f,a,o,c,l,u)},ne=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):re(t,n,r,i,a,o,c):ie(e,t,c)},re=(e,t,n,r,i,a,o)=>{let s=e.component=ri(e,r,i);if(ji(e)&&(s.ctx.renderer=xe),ai(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,ae,o),!e.el){let r=s.subTree=L(va);b(null,r,t,n),e.placeholder=r.el}}else ae(s,e,t,n,i,a,o)},ie=(e,t,n)=>{let r=t.component=e.component;if(br(e,t,n))if(r.asyncDep&&!r.asyncResolved){se(r,t,n);return}else r.next=t,r.update();else t.el=e.el,r.vnode=t},ae=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Lr(e);if(n){t&&(t.el=c.el,se(e,t,o)),n.asyncDep.then(()=>{ma(()=>{e.isUnmounted||l()},i)});return}}let u=t,f;Nr(e,!1),t?(t.el=c.el,se(e,t,o)):t=c,n&&me(n),(f=t.props&&t.props.onVnodeBeforeUpdate)&&ni(f,s,t,c),Nr(e,!0);let p=yr(e),m=e.subTree;e.subTree=p,v(m,p,d(m.el),_e(m),e,i,a),t.el=p.el,u===null&&Cr(e,p.el),r&&ma(r,i),(f=t.props&&t.props.onVnodeUpdated)&&ma(()=>ni(f,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Ai(t);if(Nr(e,!1),l&&me(l),!m&&(o=c&&c.onVnodeBeforeMount)&&ni(o,d,t),Nr(e,!0),s&&Ce){let t=()=>{e.subTree=yr(e),Ce(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=yr(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&ma(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;ma(()=>ni(o,d,e),i)}(t.shapeFlag&256||d&&Ai(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&ma(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Et(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>bn(u),Nr(e,!0),l()},se=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Tr(e,t.props,r,n),pa(e,t.children,n),Re(),Cn(e),ze()},ce=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,d=e?e.shapeFlag:0,f=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(p&128){ue(l,f,n,r,i,a,o,s,c);return}else if(p&256){le(l,f,n,r,i,a,o,s,c);return}}m&8?(d&16&&ge(l,i,a),f!==l&&u(n,f)):d&16?m&16?ue(l,f,n,r,i,a,o,s,c):ge(l,i,a,!0):(d&8&&u(n,``),m&16&&E(f,n,r,i,a,o,s,c))},le=(e,t,n,r,i,a,o,s,c)=>{e||=p,t||=p;let l=e.length,u=t.length,d=Math.min(l,u),f;for(f=0;fu?ge(e,i,a,!0,!1,d):E(t,n,r,i,a,o,s,c,d)},ue=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,d=e.length-1,f=u-1;for(;l<=d&&l<=f;){let r=e[l],u=t[l]=c?$r(t[l]):Qr(t[l]);if(Kr(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=d&&l<=f;){let r=e[d],l=t[f]=c?$r(t[f]):Qr(t[f]);if(Kr(r,l))v(r,l,n,null,i,a,o,s,c);else break;d--,f--}if(l>d){if(l<=f){let e=f+1,d=ef)for(;l<=d;)de(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=f;l++){let e=t[l]=c?$r(t[l]):Qr(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=f-h+1,x=!1,S=0,C=Array(b);for(l=0;l=b){de(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=f;_++)if(C[_-h]===0&&Kr(r,t[_])){u=_;break}u===void 0?de(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let w=x?Ir(C):p;for(_=w.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){A(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,xe);return}if(c===ga){r(s,t,n);for(let e=0;el.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[Oi];s._isLeaving&&s[Oi](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}else r(s,t,n)},de=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if(d===-2&&(i=!1),s!=null&&(Re(),Bn(s,null,n,e,!0),ze()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!Ai(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&ni(_,t,e),u&6)he(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&kn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,xe,r):l&&!l.hasOnce&&(a!==ga||d>0&&d&64)?ge(l,t,n,!1,!0):(a===ga&&d&384||!i&&u&16)&&ge(c,t,n),r&&fe(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&ma(()=>{_&&ni(_,t,e),h&&kn(e,null,t,`unmounted`),v&&(e.el=null)},n)},fe=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===ga){pe(n,r);return}if(t===ya){C(e);return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},pe=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},he=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Rr(c),Rr(l),r&&me(r),i.stop(),a&&(a.flags|=8,de(o,e,t,n)),s&&ma(s,t),ma(()=>{e.isUnmounted=!0},t)},ge=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o{if(e.shapeFlag&6)return _e(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[Ei];return n?h(n):t},ye=!1,be=(e,t,n)=>{let r;e==null?t._vnode&&(de(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,ye||=(ye=!0,Cn(r),wn(),!1)},xe={p:v,um:de,m:A,r:fe,mt:re,mc:E,pc:ce,pbc:O,n:_e,o:e},Se,Ce;return t&&([Se,Ce]=t(xe)),{render:be,hydrate:Se,createApp:hr(be,Se)}}function Mr({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Nr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Pr(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Fr(e,t,n=!1){let r=e.children,i=t.children;if(S(r)&&S(i))for(let e=0;e>1,e[n[s]]0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-- >0;)n[a]=o,o=t[o];return n}function Lr(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Lr(t)}function Rr(e){if(e)for(let t=0;t0?xa||p:null,Vr(),Sa>0&&xa&&xa.push(e),e}function F(e,t,n,r,i,a){return Ur(I(e,t,n,r,i,a,!0))}function Wr(e,t,n,r,i){return Ur(L(e,t,n,r,i,!0))}function Gr(e){return e?e.__v_isVNode===!0:!1}function Kr(e,t){return e.type===t.type&&e.key===t.key}function I(e,t=null,n=null,r=0,i=null,a=e===ga?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ca(t),ref:t&&wa(t),scopeId:Ci,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Si};return s?(ei(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=E(n)?8:16),Sa>0&&!o&&xa&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&xa.push(c),c}function qr(e,t=null,n=null,r=0,i=null,o=!1){if((!e||e===Ui)&&(e=va),Gr(e)){let r=Yr(e,t,!0);return n&&ei(r,n),Sa>0&&!o&&xa&&(r.shapeFlag&6?xa[xa.indexOf(e)]=r:xa.push(r)),r.patchFlag=-2,r}if(fi(e)&&(e=e.__vccOpts),t){t=Jr(t);let{class:e,style:n}=t;e&&!E(e)&&(t.class=s(e)),O(n)&&(dt(n)&&!S(n)&&(n=v({},n)),t.style=a(n))}let c=E(e)?1:ha(e)?128:Di(e)?64:O(e)?4:T(e)?2:0;return I(e,t,n,r,i,c,o,!0)}function Jr(e){return e?dt(e)||ia(e)?v({},e):e:null}function Yr(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?ti(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Ca(l),ref:t&&t.ref?n&&a?S(a)?a.concat(wa(t)):[a,wa(t)]:wa(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ga?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Yr(e.ssContent),ssFallback:e.ssFallback&&Yr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&In(u,c.clone(u)),u}function Xr(e=` `,t=0){return L(_a,null,e,t)}function Zr(e=``,t=!1){return t?(P(),Wr(va,null,e)):L(va,null,e)}function Qr(e){return e==null||typeof e==`boolean`?L(va):S(e)?L(ga,null,e.slice()):Gr(e)?$r(e):L(_a,null,String(e))}function $r(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Yr(e)}function ei(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(S(t))n=16;else if(typeof t==`object`)if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),ei(e,n()),n._c&&(n._d=!0));return}else{n=32;let r=t._;!r&&!ia(t)?t._ctx=Si:r===3&&Si&&(Si.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else T(t)?(t={default:t,_ctx:Si},n=32):(t=String(t),r&64?(n=16,t=[Xr(t)]):n=8);e.children=t,e.shapeFlag|=n}function ti(...e){let t={};for(let n=0;n1?li(e):null,i=ja(e),a=mn(r,e,0,[e.props,n]),o=te(a);if(ze(),i(),(o||e.sp)&&!Ai(e)&&Rn(e),o){if(a.then(Ma,Ma),t)return a.then(n=>{si(e,n,t)}).catch(t=>{gn(t,e,0)});e.asyncDep=a}else si(e,a,t)}else ci(e,t)}function si(e,t,n){T(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:O(t)&&(e.setupState=_t(t)),ci(e,n)}function ci(e,t,n){let r=e.type;if(!e.render){if(!t&&Pa&&!r.render){let t=r.template||ar(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=Pa(t,v(v({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||m,Fa&&Fa(e)}{let t=ja(e);Re();try{tr(e)}finally{ze(),t()}}}function li(e){return{attrs:new Proxy(e.attrs,Ia),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function ui(e){return e.exposed?e.exposeProxy||=new Proxy(_t(ft(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Gi)return Gi[n](e)},has(e,t){return t in e||t in Gi}}):e.proxy}function di(e,t=!0){return T(e)?e.displayName||e.name:e.name||t&&e.__name}function fi(e){return T(e)&&`__vccOpts`in e}function pi(e,t,n){try{Hr(-1);let r=arguments.length;return r===2?O(t)&&!S(t)?Gr(t)?L(e,null,[t]):L(e,t):L(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Gr(n)&&(n=[n]),L(e,t,n))}finally{Hr(1)}}var mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,L,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za=t((()=>{pn(),De(),mi=[],hi=-1,gi=[],_i=null,vi=0,yi=Promise.resolve(),bi=null,xi=e=>e.id==null?e.flags&2?-1:1/0:e.id,Si=null,Ci=null,wi=Symbol.for(`v-scx`),Ti=()=>jn(wi),Ei=Symbol(`_vte`),Di=e=>e.__isTeleport,Oi=Symbol(`_leaveCb`),ki=new WeakMap,ve().requestIdleCallback,ve().cancelIdleCallback,Ai=e=>!!e.type.__asyncLoader,ji=e=>e.type.__isKeepAlive,Mi=e=>(t,n=Da)=>{(!Na||e===`sp`)&&Kn(e,(...e)=>t(...e),n)},Ni=Mi(`bm`),Pi=Mi(`m`),Fi=Mi(`bu`),Ii=Mi(`u`),Li=Mi(`bum`),Ri=Mi(`um`),zi=Mi(`sp`),Bi=Mi(`rtg`),Vi=Mi(`rtc`),Hi=`components`,Ui=Symbol.for(`v-ndc`),Wi=e=>e?ii(e)?ui(e):Wi(e.parent):null,Gi=v(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Wi(e.parent),$root:e=>Wi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ar(e),$forceUpdate:e=>e.f||=()=>{bn(e.update)},$nextTick:e=>e.n||=vn.bind(e.proxy),$watch:e=>Pn.bind(e)}),Ki=(e,t)=>e!==f&&!e.__isScriptSetup&&x(e,t),qi={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Ki(r,t))return o[t]=1,r[t];else if(i!==f&&x(i,t))return o[t]=2,i[t];else if(x(a,t))return o[t]=3,a[t];else if(n!==f&&x(n,t))return o[t]=4,n[t];else Ji&&(o[t]=0)}let l=Gi[t],u,d;if(l)return t===`$attrs`&&He(e.attrs,`get`,``),l(e);if((u=s.__cssModules)&&(u=u[t]))return u;if(n!==f&&x(n,t))return o[t]=4,n[t];if(d=c.config.globalProperties,x(d,t))return d[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Ki(i,t)?(i[t]=n,!0):r!==f&&x(r,t)?(r[t]=n,!0):x(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==f&&s[0]!==`$`&&x(e,s)||Ki(t,s)||x(a,s)||x(r,s)||x(Gi,s)||x(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?x(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}},Ji=!0,Yi={data:sr,props:fr,emits:fr,methods:dr,computed:dr,beforeCreate:ur,created:ur,beforeMount:ur,mounted:ur,beforeUpdate:ur,updated:ur,beforeDestroy:ur,beforeUnmount:ur,destroyed:ur,unmounted:ur,activated:ur,deactivated:ur,errorCaptured:ur,serverPrefetch:ur,components:dr,directives:dr,watch:pr,provide:sr,inject:cr},Xi=0,Zi=null,Qi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${le(t)}Modifiers`]||e[`${A(t)}Modifiers`],$i=new WeakMap,ea=e=>{let t;for(let n in e)(n===`class`||n===`style`||g(n))&&((t||={})[n]=e[n]);return t},ta=(e,t)=>{let n={};for(let r in e)(!_(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},na={},ra=()=>Object.create(na),ia=e=>Object.getPrototypeOf(e)===na,aa=new WeakMap,oa=e=>e===`_`||e===`_ctx`||e===`$stable`,sa=e=>S(e)?e.map(Qr):[Qr(e)],ca=(e,t,n)=>{if(t._n)return t;let r=Dn((...e)=>sa(t(...e)),n);return r._c=!1,r},la=(e,t,n)=>{let r=e._ctx;for(let n in e){if(oa(n))continue;let i=e[n];if(T(i))t[n]=ca(n,i,r);else if(i!=null){let e=sa(i);t[n]=()=>e}}},ua=(e,t)=>{let n=sa(t);e.slots.default=()=>n},da=(e,t,n)=>{for(let r in t)(n||!oa(r))&&(e[r]=t[r])},fa=(e,t,n)=>{let r=e.slots=ra();if(e.vnode.shapeFlag&32){let e=t._;e?(da(r,t,n),n&&he(r,`_`,e,!0)):la(t,r)}else t&&ua(e,t)},pa=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=f;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:da(i,t,n):(a=!t.$stable,la(t,i)),o=t}else t&&(ua(e,t),o={default:1});if(a)for(let e in i)!oa(e)&&o[e]==null&&delete i[e]},ma=Br,ha=e=>e.__isSuspense,ga=Symbol.for(`v-fgt`),_a=Symbol.for(`v-txt`),va=Symbol.for(`v-cmt`),ya=Symbol.for(`v-stc`),ba=[],xa=null,Sa=1,Ca=({key:e})=>e??null,wa=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:E(e)||pt(e)||T(e)?{i:Si,r:e,k:t,f:!!n}:e),L=qr,Ta=mr(),Ea=0,Da=null,Oa=()=>Da||Si;{let e=ve(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};ka=t(`__VUE_INSTANCE_SETTERS__`,e=>Da=e),Aa=t(`__VUE_SSR_SETTERS__`,e=>Na=e)}ja=e=>{let t=Da;return ka(e),e.scope.on(),()=>{e.scope.off(),ka(t)}},Ma=()=>{Da&&Da.scope.off(),ka(null)},Na=!1,Ia={get(e,t){return He(e,`get`,``),e[t]}},La=(e,t)=>vt(e,t,Na),Ra=`3.5.38`}));function Ba(e,t,n){let r=e[So];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}function Va(e,t){e.style.display=t?e[Co]:`none`,e[wo]=!t}function Ha(e,t,n){let r=e.style,i=E(n),a=!1;if(n&&!i){if(t)if(E(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??Ua(r,t,``)}else for(let e in t)n[e]??Ua(r,e,``);for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?Ua(r,i,``):Ga(e,i,!E(t)&&t?t[i]:void 0,o)||Ua(r,i,o)}}else if(i){if(t!==n){let e=r[Eo];e&&(n+=`;`+e),r.cssText=n,a=Do.test(n)}}else t&&e.removeAttribute(`style`);Co in e&&(e[Co]=a?r.display:``,e[wo]&&(r.display=`none`))}function Ua(e,t,n){if(S(n))n.forEach(n=>Ua(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=Wa(e,t);Oo.test(n)?e.setProperty(A(r),n.replace(Oo,``),`important`):e[r]=n}}function Wa(e,t){let n=Ao[t];if(n)return n;let r=le(t);if(r!==`filter`&&r in e)return Ao[t]=r;r=de(r);for(let n=0;n{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(S(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;nle(e)===r):Object.keys(n).some(e=>le(e)===r)}function to(e){e.target.composing=!0}function no(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}function ro(e,t,n){return t&&(e=e.trim()),n&&(e=ge(e)),e}function io(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(S(t))i=d(t,r.props.value)>-1;else if(w(t))i=t.has(r.props.value);else{if(t===n)return;i=u(t,so(e,!0))}e.checked!==i&&(e.checked=i)}function ao(e,t){let n=e.multiple,r=S(t);if(!(n&&!r&&!w(t))){for(let i=0,a=e.options.length;iString(e)===String(o)):a.selected=d(t,o)>-1}else a.selected=t.has(o);else if(u(oo(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function oo(e){return`_value`in e?e._value:e.value}function so(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}function co(e,t){switch(e){case`SELECT`:return Wo;case`TEXTAREA`:return Vo;default:switch(t){case`checkbox`:return Ho;case`radio`:return Uo;default:return Vo}}}function lo(e,t,n,r,i){let a=co(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function uo(){return Qo||=Ar(Zo)}function fo(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function po(e){return E(e)?document.querySelector(e):e}var mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es=t((()=>{if(za(),za(),De(),mo=void 0,ho=typeof window<`u`&&window.trustedTypes,ho)try{mo=ho.createPolicy(`vue`,{createHTML:e=>e})}catch{}go=mo?e=>mo.createHTML(e):e=>e,_o=`http://www.w3.org/2000/svg`,vo=`http://www.w3.org/1998/Math/MathML`,yo=typeof document<`u`?document:null,bo=yo&&yo.createElement(`template`),xo={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?yo.createElementNS(_o,e):t===`mathml`?yo.createElementNS(vo,e):n?yo.createElement(e,{is:n}):yo.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>yo.createTextNode(e),createComment:e=>yo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>yo.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===a||!(i=i.nextSibling)););else{bo.innerHTML=go(r===`svg`?`${e}`:r===`mathml`?`${e}`:e);let i=bo.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},So=Symbol(`_vtc`),Co=Symbol(`_vod`),wo=Symbol(`_vsh`),To={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Co]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):Va(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Va(e,!0),r.enter(e)):r.leave(e,()=>{Va(e,!1)}):Va(e,t))},beforeUnmount(e,{value:t}){Va(e,t)}},Eo=Symbol(``),Do=/(?:^|;)\s*display\s*:/,Oo=/\s*!important$/,ko=[`Webkit`,`Moz`,`ms`],Ao={},jo=`http://www.w3.org/1999/xlink`,Mo=Symbol(`_vei`),No=/(?:Once|Passive|Capture)$/,Po=0,Fo=Promise.resolve(),Io=()=>Po||=(Fo.then(()=>Po=0),Date.now()),Lo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ro=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Ba(e,r,o):t===`style`?Ha(e,n,r):g(t)?_(t)||Xa(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),!0):t[0]===`^`?(t=t.slice(1),!1):$a(e,t,r,o))?(qa(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&Ka(e,t,r,o,a,t!==`value`)):e._isVueCE&&(eo(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!E(r)))?qa(e,le(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),Ka(e,t,r,o))},zo=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return S(t)?e=>me(t,e):t},Bo=Symbol(`_assign`),Vo={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e[Bo]=zo(i);let a=r||i.props&&i.props.type===`number`;Ja(e,t?`change`:`input`,t=>{t.target.composing||e[Bo](ro(e.value,n,a))}),(n||a)&&Ja(e,`change`,()=>{e.value=ro(e.value,n,a)}),t||(Ja(e,`compositionstart`,to),Ja(e,`compositionend`,no),Ja(e,`change`,no))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Bo]=zo(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?ge(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Ho={deep:!0,created(e,t,n){e[Bo]=zo(n),Ja(e,`change`,()=>{let t=e._modelValue,n=oo(e),r=e.checked,i=e[Bo];if(S(t)){let e=d(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(w(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(so(e,r))})},mounted:io,beforeUpdate(e,t,n){e[Bo]=zo(n),io(e,t,n)}},Uo={created(e,{value:t},n){e.checked=u(t,n.props.value),e[Bo]=zo(n),Ja(e,`change`,()=>{e[Bo](oo(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Bo]=zo(r),t!==n&&(e.checked=u(t,r.props.value))}},Wo={deep:!0,created(e,{value:t,modifiers:{number:n}},r){let i=w(t);Ja(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?ge(oo(e)):oo(e));e[Bo](e.multiple?i?new Set(t):t:t[0]),e._assigning=!0,vn(()=>{e._assigning=!1})}),e[Bo]=zo(r)},mounted(e,{value:t}){ao(e,t)},beforeUpdate(e,t,n){e[Bo]=zo(n)},updated(e,{value:t}){e._assigning||ao(e,t)}},Go={created(e,t,n){lo(e,t,n,null,`created`)},mounted(e,t,n){lo(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){lo(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){lo(e,t,n,r,`updated`)}},Ko=[`ctrl`,`shift`,`alt`,`meta`],qo={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Ko.some(n=>e[`${n}Key`]&&!t.includes(n))},Jo=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=A(n.key);if(t.some(e=>e===r||Yo[e]===r))return e(n)}))},Zo=v({patchProp:Ro},xo),$o=((...e)=>{let t=uo().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=po(e);if(!r)return;let i=t._component;!T(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,fo(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t})})),ts=t((()=>{es()}));function ns(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function rs(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&ns(e.default)}function is(e,t){let n={};for(let r in t){let i=t[r];n[r]=Us(i)?i.map(e):e(i)}return n}function as(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}function ss(e){return e==null?``:encodeURI(``+e).replace(tc,`|`).replace(Xs,`[`).replace(Zs,`]`)}function cs(e){return ss(e).replace(ec,`{`).replace(nc,`}`).replace(Qs,`^`)}function ls(e){return ss(e).replace(Ys,`%2B`).replace(rc,`+`).replace(Ws,`%23`).replace(Gs,`%26`).replace($s,"`").replace(ec,`{`).replace(nc,`}`).replace(Qs,`^`)}function us(e){return ls(e).replace(qs,`%3D`)}function ds(e){return ss(e).replace(Ws,`%23`).replace(Js,`%3F`)}function fs(e){return ds(e).replace(Ks,`%2F`)}function ps(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}function ms(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=Ss(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:ps(o)}}function hs(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function gs(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function _s(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&vs(t.matched[r],n.matched[i])&&ys(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function vs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function ys(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!bs(e[n],t[n]))return!1;return!0}function bs(e,t){return Us(e)?xs(e,t):Us(t)?xs(t,e):e?.valueOf()===t?.valueOf()}function xs(e,t){return Us(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function Ss(e,t){if(e.startsWith(`/`))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o1&&a--;else break;return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}function Cs(e){if(!e)if(Vs){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^\/]+/,``)}else e=`/`;return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),ac(e)}function ws(e,t){return e.replace(lc,`#`)+t}function Ts(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}function Es(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`),i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i)return;t=Ts(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}function Ds(e,t){return(history.state?history.state.position-t:-1)+e}function Os(e,t){dc.set(e,t)}function ks(e){let t=dc.get(e);return dc.delete(e),t}function As(e){return typeof e==`string`||e&&typeof e==`object`}function js(e){return typeof e==`string`||typeof e==`symbol`}function Ms(e,t){return R(Error(),{type:e,[pc]:!0},t)}function Ns(e,t){return e instanceof Error&&pc in e&&(t==null||!!(e.type&t))}function Ps(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;ee&&ls(e)):[r&&ls(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function Is(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=Us(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}function Ls(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Rs(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c(Ms(fc.NAVIGATION_ABORTED,{from:n,to:t})):e instanceof Error?c(e):As(e)?c(Ms(fc.NAVIGATION_GUARD_REDIRECT,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},u=a(()=>e.call(r&&r.instances[i],t,n,l)),d=Promise.resolve(u);e.length<3&&(d=d.then(l)),d.catch(e=>c(e))})}function zs(e,t,n,r,i=e=>e()){let a=[];for(let o of e)for(let e in o.components){let s=o.components[e];if(!(t!==`beforeRouteEnter`&&!o.instances[e]))if(ns(s)){let c=(s.__vccOpts||s)[t];c&&a.push(Rs(c,n,r,o,e,i))}else{let c=s();a.push(()=>c.then(a=>{if(!a)throw Error(`Couldn't resolve component "${e}" at "${o.path}"`);let s=rs(a)?a.default:a;o.mods[e]=a,o.components[e]=s;let c=(s.__vccOpts||s)[t];return c&&Rs(c,n,r,o,e,i)()}))}}return a}function Bs(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;ovs(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>vs(e,s))||i.push(s))}return[n,r,i]}var Vs,R,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc=t((()=>{ts(),Vs=typeof document<`u`,R=Object.assign,Hs=()=>{},Us=Array.isArray,Ws=/#/g,Gs=/&/g,Ks=/\//g,qs=/=/g,Js=/\?/g,Ys=/\+/g,Xs=/%5B/g,Zs=/%5D/g,Qs=/%5E/g,$s=/%60/g,ec=/%7B/g,tc=/%7C/g,nc=/%7D/g,rc=/%20/g,ic=/\/$/,ac=e=>e.replace(ic,``),oc={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0},sc=function(e){return e.pop=`pop`,e.push=`push`,e}({}),cc=function(e){return e.back=`back`,e.forward=`forward`,e.unknown=``,e}({}),lc=/^[^#]+#/,uc=()=>({left:window.scrollX,top:window.scrollY}),dc=new Map,fc=function(e){return e[e.MATCHER_NOT_FOUND=1]=`MATCHER_NOT_FOUND`,e[e.NAVIGATION_GUARD_REDIRECT=2]=`NAVIGATION_GUARD_REDIRECT`,e[e.NAVIGATION_ABORTED=4]=`NAVIGATION_ABORTED`,e[e.NAVIGATION_CANCELLED=8]=`NAVIGATION_CANCELLED`,e[e.NAVIGATION_DUPLICATED=16]=`NAVIGATION_DUPLICATED`,e}({}),pc=Symbol(``),fc.MATCHER_NOT_FOUND,fc.NAVIGATION_GUARD_REDIRECT,fc.NAVIGATION_ABORTED,fc.NAVIGATION_CANCELLED,fc.NAVIGATION_DUPLICATED,mc=Symbol(``),hc=Symbol(``),gc=Symbol(``),_c=Symbol(``),vc=Symbol(``)}));function bc(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),gs(n,``)}return gs(n,e)+r+i}function xc(e,t,n,r){let i=[],a=[],o=null,s=({state:a})=>{let s=bc(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=s,t.value=a,o&&o===c){o=null;return}u=l?a.position-l.position:0}else r(s);i.forEach(e=>{e(n.value,c,{delta:u,type:sc.pop,direction:u?u>0?cc.forward:cc.back:cc.unknown})})};function c(){o=n.value}function l(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return a.push(t),t}function u(){if(document.visibilityState===`hidden`){let{history:e}=window;if(!e.state)return;e.replaceState(R({},e.state,{scroll:uc()}),``)}}function d(){for(let e of a)e();a=[],window.removeEventListener(`popstate`,s),window.removeEventListener(`pagehide`,u),document.removeEventListener(`visibilitychange`,u)}return window.addEventListener(`popstate`,s),window.addEventListener(`pagehide`,u),document.addEventListener(`visibilitychange`,u),{pauseListeners:c,listen:l,destroy:d}}function Sc(e,t,n,r=!1,i=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:i?uc():null}}function Cc(e){let{history:t,location:n}=window,r={value:bc(e,n)},i={value:t.state};i.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:Jc()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){console.error(e),n[o?`replace`:`assign`](c)}}function o(e,n){a(e,R({},t.state,Sc(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function s(e,n){let o=R({},i.value,t.state,{forward:e,scroll:uc()});a(o.current,o,!0),a(e,R({},Sc(r.value,e,null),{position:o.position+1},n),!1),r.value=e}return{location:r,state:i,push:s,replace:o}}function wc(e){e=Cs(e);let t=Cc(e),n=xc(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=R({location:``,base:e,go:r,createHref:ws.bind(null,e)},t,n);return Object.defineProperty(i,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,"state",{enumerable:!0,get:()=>t.state.value}),i}function Tc(e){if(!e)return[[]];if(e===`/`)return[[Zc]];if(!e.startsWith(`/`))throw Error(`Invalid path "${e}"`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=Xc.Static,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===Xc.Static?a.push({type:Yc.Static,value:l}):n===Xc.Param||n===Xc.ParamRegExp||n===Xc.ParamRegExpEnd?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Yc.Param,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;st.length?t.length===1&&t[0]===tl.Static+tl.Segment?1:-1:0}function Oc(e,t){let n=0,r=e.score,i=t.score;for(;n0&&t[t.length-1]<0}function Ac(e,t,n){let r=R(Ec(Tc(e.path),n),{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function jc(e,t){let n=[],r=new Map;t=as(rl,t);function i(e){return r.get(e)}function a(e,n,r){let i=!r,s=Nc(e);s.aliasOf=r&&r.record;let l=as(t,e),u=[s];if(`alias`in e){let t=typeof e.alias==`string`?[e.alias]:e.alias;for(let e of t)u.push(Nc(R({},s,{components:r?r.record.components:s.components,path:e,aliasOf:r?r.record:s})))}let d,f;for(let t of u){let{path:u}=t;if(n&&u[0]!==`/`){let e=n.record.path,r=e[e.length-1]===`/`?``:`/`;t.path=n.record.path+(u&&r+u)}if(d=Ac(t,n,l),r?r.alias.push(d):(f||=d,f!==d&&f.alias.push(d),i&&e.name&&!Fc(d)&&o(e.name)),zc(d)&&c(d),s.children){let e=s.children;for(let t=0;t{o(f)}:Hs}function o(e){if(js(e)){let t=r.get(e);t&&(r.delete(e),n.splice(n.indexOf(t),1),t.children.forEach(o),t.alias.forEach(o))}else{let t=n.indexOf(e);t>-1&&(n.splice(t,1),e.record.name&&r.delete(e.record.name),e.children.forEach(o),e.alias.forEach(o))}}function s(){return n}function c(e){let t=Lc(e,n);n.splice(t,0,e),e.record.name&&!Fc(e)&&r.set(e.record.name,e)}function l(e,t){let i,a={},o,s;if(`name`in e&&e.name){if(i=r.get(e.name),!i)throw Ms(fc.MATCHER_NOT_FOUND,{location:e});s=i.record.name,a=R(Mc(t.params,i.keys.filter(e=>!e.optional).concat(i.parent?i.parent.keys.filter(e=>e.optional):[]).map(e=>e.name)),e.params&&Mc(e.params,i.keys.map(e=>e.name))),o=i.stringify(a)}else if(e.path!=null)o=e.path,i=n.find(e=>e.re.test(o)),i&&(a=i.parse(o),s=i.record.name);else{if(i=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!i)throw Ms(fc.MATCHER_NOT_FOUND,{location:e,currentLocation:t});s=i.record.name,a=R({},t.params,e.params),o=i.stringify(a)}let c=[],l=i;for(;l;)c.unshift(l.record),l=l.parent;return{name:s,path:o,params:a,matched:c,meta:Ic(c)}}e.forEach(e=>a(e));function u(){n.length=0,r.clear()}return{addRoute:a,resolve:l,removeRoute:o,clearRoutes:u,getRoutes:s,getRecordMatcher:i}}function Mc(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function Nc(e){let t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Pc(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:`components`in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function Pc(e){let t={},n=e.props||!1;if(`component`in e)t.default=n;else for(let r in e.components)t[r]=typeof n==`object`?n[r]:n;return t}function Fc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Ic(e){return e.reduce((e,t)=>R(e,t.meta),{})}function Lc(e,t){let n=0,r=t.length;for(;n!==r;){let i=n+r>>1;Oc(e,t[i])<0?r=i:n=i+1}let i=Rc(e);return i&&(r=t.lastIndexOf(i,r-1)),r}function Rc(e){let t=e;for(;t=t.parent;)if(zc(t)&&Oc(e,t)===0)return t}function zc({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Bc(e){let t=jn(gc),n=jn(_c),r=La(()=>{let n=gt(e.to);return t.resolve(n)}),i=La(()=>{let{matched:e}=r.value,{length:t}=e,i=e[t-1],a=n.matched;if(!i||!a.length)return-1;let o=a.findIndex(vs.bind(null,i));if(o>-1)return o;let s=Wc(e[t-2]);return t>1&&Wc(i)===s&&a[a.length-1].path!==s?a.findIndex(vs.bind(null,e[t-2])):o}),a=La(()=>i.value>-1&&Uc(n.params,r.value.params)),o=La(()=>i.value>-1&&i.value===n.matched.length-1&&ys(n.params,r.value.params));function s(n={}){if(Hc(n)){let n=t[gt(e.replace)?`replace`:`push`](gt(e.to)).catch(Hs);return e.viewTransition&&typeof document<`u`&&`startViewTransition`in document&&document.startViewTransition(()=>n),n}return Promise.resolve()}return{route:r,href:La(()=>r.value.href),isActive:a,isExactActive:o,navigate:s}}function Vc(e){return e.length===1?e[0]:e}function Hc(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){let t=e.currentTarget.getAttribute(`target`);if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Uc(e,t){for(let n in t){let r=t[n],i=e[n];if(typeof r==`string`){if(r!==i)return!1}else if(!Us(i)||i.length!==r.length||r.some((e,t)=>e.valueOf()!==i[t].valueOf()))return!1}return!0}function Wc(e){return e?e.aliasOf?e.aliasOf.path:e.path:``}function Gc(e,t){if(!e)return null;let n=e(t);return n.length===1?n[0]:n}function Kc(e){let t=jc(e.routes,e),n=e.parseQuery||Ps,r=e.stringifyQuery||Fs,i=e.history,a=Ls(),o=Ls(),s=Ls(),c=mt(oc),l=oc;Vs&&e.scrollBehavior&&`scrollRestoration`in history&&(history.scrollRestoration=`manual`);let u=is.bind(null,e=>``+e),d=is.bind(null,fs),f=is.bind(null,ps);function p(e,n){let r,i;return js(e)?(r=t.getRecordMatcher(e),i=n):i=e,t.addRoute(i,r)}function m(e){let n=t.getRecordMatcher(e);n&&t.removeRoute(n)}function h(){return t.getRoutes().map(e=>e.record)}function g(e){return!!t.getRecordMatcher(e)}function _(e,a){if(a=R({},a||c.value),typeof e==`string`){let r=ms(n,e,a.path),o=t.resolve({path:r.path},a),s=i.createHref(r.fullPath);return R(r,o,{params:f(o.params),hash:ps(r.hash),redirectedFrom:void 0,href:s})}let o;if(e.path!=null)o=R({},e,{path:ms(n,e.path,a.path).path});else{let t=R({},e.params);for(let e in t)t[e]??delete t[e];o=R({},e,{params:d(t)}),a.params=d(a.params)}let s=t.resolve(o,a),l=e.hash||``;s.params=u(f(s.params));let p=hs(r,R({},e,{hash:cs(l),path:s.path})),m=i.createHref(p);return R({fullPath:p,hash:l,query:r===Fs?Is(e.query):e.query||{}},s,{redirectedFrom:void 0,href:m})}function v(e){return typeof e==`string`?ms(n,e,c.value.path):R({},e)}function y(e,t){if(l!==e)return Ms(fc.NAVIGATION_CANCELLED,{from:t,to:e})}function b(e){return C(e)}function x(e){return b(R(v(e),{replace:!0}))}function S(e,t){let n=e.matched[e.matched.length-1];if(n&&n.redirect){let{redirect:r}=n,i=typeof r==`function`?r(e,t):r;return typeof i==`string`&&(i=i.includes(`?`)||i.includes(`#`)?i=v(i):{path:i},i.params={}),R({query:e.query,hash:e.hash,params:i.path==null?e.params:{}},i)}}function C(e,t){let n=l=_(e),i=c.value,a=e.state,o=e.force,s=e.replace===!0,u=S(n,i);if(u)return C(R(v(u),{state:typeof u==`object`?R({},a,u.state):a,force:o,replace:s}),t||n);let d=n;d.redirectedFrom=t;let f;return!o&&_s(r,i,n)&&(f=Ms(fc.NAVIGATION_DUPLICATED,{to:d,from:i}),se(i,i,!0,!1)),(f?Promise.resolve(f):T(d,i)).catch(e=>Ns(e)?Ns(e,fc.NAVIGATION_GUARD_REDIRECT)?e:oe(e):ie(e,d,i)).then(e=>{if(e){if(Ns(e,fc.NAVIGATION_GUARD_REDIRECT))return C(R({replace:s},v(e.to),{state:typeof e.to==`object`?R({},a,e.to.state):a,force:o}),t||d)}else e=D(d,i,!0,s,a);return E(d,i,e),e})}function w(e,t){let n=y(e,t);return n?Promise.reject(n):Promise.resolve()}function ee(e){let t=ue.values().next().value;return t&&typeof t.runWithContext==`function`?t.runWithContext(e):e()}function T(e,t){let n,[r,i,s]=Bs(e,t);n=zs(r.reverse(),`beforeRouteLeave`,e,t);for(let i of r)i.leaveGuards.forEach(r=>{n.push(Rs(r,e,t))});let c=w.bind(null,e,t);return n.push(c),de(n).then(()=>{n=[];for(let r of a.list())n.push(Rs(r,e,t));return n.push(c),de(n)}).then(()=>{n=zs(i,`beforeRouteUpdate`,e,t);for(let r of i)r.updateGuards.forEach(r=>{n.push(Rs(r,e,t))});return n.push(c),de(n)}).then(()=>{n=[];for(let r of s)if(r.beforeEnter)if(Us(r.beforeEnter))for(let i of r.beforeEnter)n.push(Rs(i,e,t));else n.push(Rs(r.beforeEnter,e,t));return n.push(c),de(n)}).then(()=>(e.matched.forEach(e=>e.enterCallbacks={}),n=zs(s,`beforeRouteEnter`,e,t,ee),n.push(c),de(n))).then(()=>{n=[];for(let r of o.list())n.push(Rs(r,e,t));return n.push(c),de(n)}).catch(e=>Ns(e,fc.NAVIGATION_CANCELLED)?e:Promise.reject(e))}function E(e,t,n){s.list().forEach(r=>ee(()=>r(e,t,n)))}function D(e,t,n,r,a){let o=y(e,t);if(o)return o;let s=t===oc,l=Vs?history.state:{};n&&(r||s?i.replace(e.fullPath,R({scroll:s&&l&&l.scroll},a)):i.push(e.fullPath,a)),c.value=e,se(e,t,n,s),oe()}let O;function te(){O||=i.listen((e,t,n)=>{if(!A.listening)return;let r=_(e),a=S(r,A.currentRoute.value);if(a){C(R(a,{replace:!0,force:!0}),r).catch(Hs);return}l=r;let o=c.value;Vs&&Os(Ds(o.fullPath,n.delta),uc()),T(r,o).catch(e=>Ns(e,fc.NAVIGATION_ABORTED|fc.NAVIGATION_CANCELLED)?e:Ns(e,fc.NAVIGATION_GUARD_REDIRECT)?(C(R(v(e.to),{force:!0}),r).then(e=>{Ns(e,fc.NAVIGATION_ABORTED|fc.NAVIGATION_DUPLICATED)&&!n.delta&&n.type===sc.pop&&i.go(-1,!1)}).catch(Hs),Promise.reject()):(n.delta&&i.go(-n.delta,!1),ie(e,r,o))).then(e=>{e||=D(r,o,!1),e&&(n.delta&&!Ns(e,fc.NAVIGATION_CANCELLED)?i.go(-n.delta,!1):n.type===sc.pop&&Ns(e,fc.NAVIGATION_ABORTED|fc.NAVIGATION_DUPLICATED)&&i.go(-1,!1)),E(r,o,e)}).catch(Hs)})}let k=Ls(),ne=Ls(),re;function ie(e,t,n){oe(e);let r=ne.list();return r.length?r.forEach(r=>r(e,t,n)):console.error(e),Promise.reject(e)}function ae(){return re&&c.value!==oc?Promise.resolve():new Promise((e,t)=>{k.add([e,t])})}function oe(e){return re||(re=!e,te(),k.list().forEach(([t,n])=>e?n(e):t()),k.reset()),e}function se(t,n,r,i){let{scrollBehavior:a}=e;if(!Vs||!a)return Promise.resolve();let o=!r&&ks(Ds(t.fullPath,0))||(i||!r)&&history.state&&history.state.scroll||null;return vn().then(()=>a(t,n,o)).then(e=>e&&Es(e)).catch(e=>ie(e,t,n))}let ce=e=>i.go(e),le,ue=new Set,A={currentRoute:c,listening:!0,addRoute:p,removeRoute:m,clearRoutes:t.clearRoutes,hasRoute:g,getRoutes:h,resolve:_,options:e,push:b,replace:x,go:ce,back:()=>ce(-1),forward:()=>ce(1),beforeEach:a.add,beforeResolve:o.add,afterEach:s.add,onError:ne.add,isReady:ae,install(e){e.component(`RouterLink`,il),e.component(`RouterView`,sl),e.config.globalProperties.$router=A,Object.defineProperty(e.config.globalProperties,"$route",{enumerable:!0,get:()=>gt(c)}),Vs&&!le&&c.value===oc&&(le=!0,b(i.location).catch(e=>{}));let t={};for(let e in oc)Object.defineProperty(t,e,{get:()=>c.value[e],enumerable:!0});e.provide(gc,A),e.provide(_c,at(t)),e.provide(vc,c);let n=e.unmount;ue.add(e),e.unmount=function(){ue.delete(e),ue.size<1&&(l=oc,O&&O(),O=null,c.value=oc,le=!1,re=!1),n()}}};function de(e){return e.reduce((e,t)=>e.then(()=>ee(t)),Promise.resolve())}return A}function qc(){return jn(gc)}var Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl=t((()=>{yc(),ts(),Jc=()=>location.protocol+`//`+location.host,Yc=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.Group=2]=`Group`,e}({}),Xc=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.ParamRegExp=2]=`ParamRegExp`,e[e.ParamRegExpEnd=3]=`ParamRegExpEnd`,e[e.EscapeNext=4]=`EscapeNext`,e}(Xc||{}),Zc={type:Yc.Static,value:``},Qc=/[a-zA-Z0-9_]/,$c=`[^/]+?`,el={sensitive:!1,strict:!1,start:!0,end:!0},tl=function(e){return e[e._multiplier=10]=`_multiplier`,e[e.Root=90]=`Root`,e[e.Segment=40]=`Segment`,e[e.SubSegment=30]=`SubSegment`,e[e.Static=40]=`Static`,e[e.Dynamic=20]=`Dynamic`,e[e.BonusCustomRegExp=10]=`BonusCustomRegExp`,e[e.BonusWildcard=-50]=`BonusWildcard`,e[e.BonusRepeatable=-20]=`BonusRepeatable`,e[e.BonusOptional=-8]=`BonusOptional`,e[e.BonusStrict=.7000000000000001]=`BonusStrict`,e[e.BonusCaseSensitive=.25]=`BonusCaseSensitive`,e}(tl||{}),nl=/[.+*?^${}()[\]/\\]/g,rl={strict:!1,end:!0,sensitive:!1},il=Ln({name:`RouterLink`,compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:`page`},viewTransition:Boolean},useLink:Bc,setup(e,{slots:t}){let n=it(Bc(e)),{options:r}=jn(gc),i=La(()=>({[al(e.activeClass,r.linkActiveClass,`router-link-active`)]:n.isActive,[al(e.exactActiveClass,r.linkExactActiveClass,`router-link-exact-active`)]:n.isExactActive}));return()=>{let r=t.default&&Vc(t.default(n));return e.custom?r:pi(`a`,{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:i.value},r)}}}),al=(e,t,n)=>e??t??n,ol=Ln({name:`RouterView`,inheritAttrs:!1,props:{name:{type:String,default:`default`},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){let r=jn(vc),i=La(()=>e.route||r.value),a=jn(hc,0),o=La(()=>{let e=gt(a),{matched:t}=i.value,n;for(;(n=t[e])&&!n.components;)e++;return e}),s=La(()=>i.value.matched[o.value]);An(hc,La(()=>o.value+1)),An(mc,s),An(vc,i);let c=N();return Mn(()=>[c.value,s.value,e.name],([e,t,n],[r,i,a])=>{t&&(t.instances[n]=e,i&&i!==t&&e&&e===r&&(t.leaveGuards.size||(t.leaveGuards=i.leaveGuards),t.updateGuards.size||(t.updateGuards=i.updateGuards))),e&&t&&(!i||!vs(t,i)||!r)&&(t.enterCallbacks[n]||[]).forEach(t=>t(e))},{flush:`post`}),()=>{let r=i.value,a=e.name,o=s.value,l=o&&o.components[a];if(!l)return Gc(n.default,{Component:l,route:r});let u=o.props[a],d=u?u===!0?r.params:typeof u==`function`?u(r):u:null,f=pi(l,R({},d,t,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(o.instances[a]=null)},ref:c}));return Gc(n.default,{Component:f,route:r})||f}}}),sl=ol})),ll=t((()=>{})),ul,dl=t((()=>{ul=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n}})),fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl=t((()=>{ts(),cl(),ll(),dl(),fl={class:`app-shell`},pl={key:0},ml={key:1},hl={class:`nav-menu`},gl={class:`nav-bottom`},_l={class:`nav-icon`},vl={class:`app-main`},yl={class:`topbar`},bl={class:`header-left`},xl=[`title`],Sl={__name:`App`,setup(e){let t=qc(),n=N(!1),r=N(!1);return Mn(()=>t.currentRoute.value,()=>{r.value=!1}),(e,t)=>{let i=Jn(`router-link`),a=Jn(`router-view`);return P(),F(`div`,fl,[I(`button`,{class:`hamburger`,onClick:t[0]||=e=>r.value=!r.value},`☰`),r.value?(P(),F(`div`,{key:0,class:`nav-overlay`,onClick:t[1]||=e=>r.value=!1})):Zr(``,!0),I(`aside`,{class:s([`app-nav`,{collapsed:n.value,open:r.value}])},[I(`div`,{class:`nav-brand`,onClick:t[2]||=t=>e.$router.push(`/`)},[n.value?(P(),F(`span`,pl,`M`)):(P(),F(`span`,ml,`mokee编辑器`))]),I(`nav`,hl,[L(i,{to:`/notes`,class:`nav-item`,title:`笔记`},{default:Dn(()=>[...t[5]||=[I(`span`,{class:`nav-icon`},`📝`,-1),I(`span`,{class:`nav-label`},`笔记`,-1)]]),_:1}),L(i,{to:`/websites`,class:`nav-item`,title:`网站管理`},{default:Dn(()=>[...t[6]||=[I(`span`,{class:`nav-icon`},`🔐`,-1),I(`span`,{class:`nav-label`},`网站管理`,-1)]]),_:1}),L(i,{to:`/shares`,class:`nav-item`,title:`分享管理`},{default:Dn(()=>[...t[7]||=[I(`span`,{class:`nav-icon`},`🔗`,-1),I(`span`,{class:`nav-label`},`分享管理`,-1)]]),_:1})]),I(`div`,gl,[I(`div`,{class:`nav-item`,onClick:t[3]||=e=>n.value=!n.value,title:`收起菜单`},[I(`span`,_l,j(n.value?`▶`:`◀`),1)])])],2),I(`div`,vl,[I(`header`,yl,[I(`div`,bl,[I(`button`,{class:`toggle-sidebar-btn`,onClick:t[4]||=e=>n.value=!n.value,title:n.value?`展开侧边栏`:`收起侧边栏`},j(n.value?`☰`:`✕`),9,xl),t[8]||=I(`span`,{class:`header-title`},`MoKeeText`,-1)]),t[9]||=I(`div`,{style:{flex:`1`}},null,-1),t[10]||=I(`a`,{class:`switch-system-btn`,href:`https://web.gw.zgitm.com/select`,title:`切换系统`},[I(`span`,{class:`switch-icon`},`🔄`),I(`span`,{class:`switch-label`},`切换系统`)],-1)]),L(a),t[11]||=I(`footer`,{class:`app-footer`},[I(`span`,null,`湘ICP备19021539号`),I(`span`,null,`MoKeeText v1.0`)],-1)])])}}},Cl=ul(Sl,[[`__scopeId`,`data-v-727c46b1`]])}));function Tl(e,t){return function(){return e.apply(t,arguments)}}var El=t((()=>{}));function Dl(e){return e!==null&&!Gl(e)&&e.constructor!==null&&!Gl(e.constructor)&&Jl(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}function Ol(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Kl(e.buffer),t}function kl(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}function Al(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),Wl(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}function Ml(...e){let{caseless:t,skipUndefined:n}=_u(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&typeof i==`string`&&jl(r,i)||i,o=Rl(r,a)?r[a]:void 0;Ql(o)&&Ql(e)?r[a]=Ml(o,e):Ql(e)?r[a]=Ml({},e):Wl(e)?r[a]=e.slice():(!n||!Gl(e))&&(r[a]=e)};for(let t=0,n=e.length;t{El(),{toString:Pl}=Object.prototype,{getPrototypeOf:Fl}=Object,{iterator:Il,toStringTag:Ll}=Symbol,Rl=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),zl=(e,t)=>{let n=e,r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Rl(n,t))return!0;n=Fl(n)}return!1},Bl=(e,t)=>e!=null&&zl(e,t)?e[t]:void 0,Vl=(e=>t=>{let n=Pl.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Hl=e=>(e=e.toLowerCase(),t=>Vl(t)===e),Ul=e=>t=>typeof t===e,{isArray:Wl}=Array,Gl=Ul(`undefined`),Kl=Hl(`ArrayBuffer`),ql=Ul(`string`),Jl=Ul(`function`),Yl=Ul(`number`),Xl=e=>typeof e==`object`&&!!e,Zl=e=>e===!0||e===!1,Ql=e=>{if(!Xl(e))return!1;let t=Fl(e);return(t===null||t===Object.prototype||Fl(t)===null)&&!zl(e,Ll)&&!zl(e,Il)},$l=e=>{if(!Xl(e)||Dl(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},eu=Hl(`Date`),tu=Hl(`File`),nu=e=>!!(e&&e.uri!==void 0),ru=e=>e&&e.getParts!==void 0,iu=Hl(`Blob`),au=Hl(`FileList`),ou=e=>Xl(e)&&Jl(e.pipe),su=kl(),cu=su.FormData===void 0?void 0:su.FormData,lu=e=>{if(!e)return!1;if(cu&&e instanceof cu)return!0;let t=Fl(e);if(!t||t===Object.prototype||!Jl(e.append))return!1;let n=Vl(e);return n===`formdata`||n===`object`&&Jl(e.toString)&&e.toString()===`[object FormData]`},uu=Hl(`URLSearchParams`),[du,fu,pu,mu]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(Hl),hu=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``),gu=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,_u=e=>!Gl(e)&&e!==gu,vu=(e,t,n,{allOwnKeys:r}={})=>(Al(t,(t,r)=>{n&&Jl(t)?Object.defineProperty(e,r,{__proto__:null,value:Tl(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),yu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),bu=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},xu=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&Fl(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Su=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},Cu=e=>{if(!e)return null;if(Wl(e))return e;let t=e.length;if(!Yl(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},wu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&Fl(Uint8Array)),Tu=(e,t)=>{let n=(e&&e[Il]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},Eu=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Du=Hl(`HTMLFormElement`),Ou=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),{propertyIsEnumerable:ku}=Object.prototype,Au=Hl(`RegExp`),ju=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};Al(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Mu=e=>{ju(e,(t,n)=>{if(Jl(e)&&[`arguments`,`caller`,`callee`].includes(n))return!1;let r=e[n];if(Jl(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},Nu=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Wl(e)?r(e):r(String(e).split(t)),n},Pu=()=>{},Fu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Iu=e=>{let t=new WeakSet,n=e=>{if(Xl(e)){if(t.has(e))return;if(Dl(e))return e;if(!(`toJSON`in e)){t.add(e);let r=Wl(e)?[]:{};return Al(e,(e,t)=>{let i=n(e);!Gl(i)&&(r[t]=i)}),t.delete(e),r}}return e};return n(e)},Lu=Hl(`AsyncFunction`),Ru=e=>e&&(Xl(e)||Jl(e))&&Jl(e.then)&&Jl(e.catch),zu=((e,t)=>e?setImmediate:t?((e,t)=>(gu.addEventListener(`message`,({source:n,data:r})=>{n===gu&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),gu.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,Jl(gu.postMessage)),Bu=typeof queueMicrotask<`u`?queueMicrotask.bind(gu):typeof process<`u`&&process.nextTick||zu,Vu=e=>e!=null&&Jl(e[Il]),Hu=e=>e!=null&&zl(e,Il)&&Vu(e),z={isArray:Wl,isArrayBuffer:Kl,isBuffer:Dl,isFormData:lu,isArrayBufferView:Ol,isString:ql,isNumber:Yl,isBoolean:Zl,isObject:Xl,isPlainObject:Ql,isEmptyObject:$l,isReadableStream:du,isRequest:fu,isResponse:pu,isHeaders:mu,isUndefined:Gl,isDate:eu,isFile:tu,isReactNativeBlob:nu,isReactNative:ru,isBlob:iu,isRegExp:Au,isFunction:Jl,isStream:ou,isURLSearchParams:uu,isTypedArray:wu,isFileList:au,forEach:Al,merge:Ml,extend:vu,trim:hu,stripBOM:yu,inherits:bu,toFlatObject:xu,kindOf:Vl,kindOfTest:Hl,endsWith:Su,toArray:Cu,forEachEntry:Tu,matchAll:Eu,isHTMLForm:Du,hasOwnProperty:Rl,hasOwnProp:Rl,hasOwnInPrototypeChain:zl,getSafeProp:Bl,reduceDescriptors:ju,freezeMethods:Mu,toObjectSet:Nu,toCamelCase:Ou,noop:Pu,toFiniteNumber:Fu,findKey:jl,global:gu,isContextDefined:_u,isSpecCompliantForm:Nl,toJSONObject:Iu,isAsyncFn:Lu,isThenable:Ru,setImmediate:zu,asap:Bu,isIterable:Vu,isSafeIterable:Hu}})),Wu,Gu,Ku=t((()=>{Uu(),Wu=z.toObjectSet([`age`,`authorization`,`content-length`,`content-type`,`etag`,`expires`,`from`,`host`,`if-modified-since`,`if-unmodified-since`,`last-modified`,`location`,`max-forwards`,`proxy-authorization`,`referer`,`retry-after`,`user-agent`]),Gu=e=>{let t={},n,r,i;return e&&e.split(` +`).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&Wu[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t}}));function qu(e){let t=0,n=e.length;for(;tt;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}function Ju(e,t){return z.isArray(e)?e.map(e=>Ju(e,t)):qu(String(e).replace(t,``))}function Yu(e){let t=Object.create(null);return z.forEach(e.toJSON(),(e,n)=>{t[n]=$u(e)}),t}var Xu,Zu,Qu,$u,ed=t((()=>{Uu(),Xu=RegExp(`[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+`,`g`),Zu=RegExp(`[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+`,`g`),Qu=e=>Ju(e,Xu),$u=e=>Ju(e,Zu)}));function td(e){return e&&String(e).trim().toLowerCase()}function nd(e){return e===!1||e==null?e:z.isArray(e)?e.map(nd):Qu(String(e))}function rd(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}function id(e,t,n,r,i){if(z.isFunction(r))return r.call(this,t,n);if(i&&(t=n),z.isString(t)){if(z.isString(r))return t.indexOf(r)!==-1;if(z.isRegExp(r))return r.test(t)}}function ad(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function od(e,t){let n=z.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var sd,cd,ld,ud=t((()=>{Uu(),Ku(),ed(),sd=Symbol(`internals`),cd=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()),ld=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=td(t);if(!i)return;let a=z.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=nd(e))}let a=(e,t)=>z.forEach(e,(e,n)=>i(e,n,t));if(z.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(z.isString(e)&&(e=e.trim())&&!cd(e))a(Gu(e),t);else if(z.isObject(e)&&z.isSafeIterable(e)){let n=Object.create(null),r,i;for(let t of e){if(!z.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);i=t[0],z.hasOwnProp(n,i)?(r=n[i],n[i]=z.isArray(r)?[...r,t[1]]:[r,t[1]]):n[i]=t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=td(e),e){let n=z.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return rd(e);if(z.isFunction(t))return t.call(this,e,n);if(z.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=td(e),e){let n=z.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||id(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=td(e),e){let i=z.findKey(n,e);i&&(!t||id(n,n[i],i,t))&&(delete n[i],r=!0)}}return z.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||id(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return z.forEach(this,(r,i)=>{let a=z.findKey(n,i);if(a){t[a]=nd(r),delete t[i];return}let o=e?ad(i):String(i).trim();o!==i&&delete t[i],t[o]=nd(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return z.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&z.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(` +`)}getSetCookie(){return this.get(`set-cookie`)||[]}get[Symbol.toStringTag](){return`AxiosHeaders`}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[sd]=this[sd]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=td(e);t[r]||(od(n,e),t[r]=!0)}return z.isArray(e)?e.forEach(r):r(e),this}},ld.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),z.reduceDescriptors(ld.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),z.freezeMethods(ld)}));function dd(e){if(z.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(z.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function fd(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||z.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof ld&&(e=e.toJSON()),r.push(e);let t;if(z.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);z.isUndefined(r)||(t[n]=r)});else{if(!z.isPlainObject(e)&&dd(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?pd:i(a);z.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var pd,B,md=t((()=>{Uu(),ud(),pd=`[REDACTED ****]`,B=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return Object.defineProperty(s,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){let e=this.config,t=e&&z.hasOwnProp(e,`redact`)?e.redact:void 0,n=z.isArray(t)&&t.length>0?fd(e,t):z.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}},B.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,B.ERR_BAD_OPTION=`ERR_BAD_OPTION`,B.ECONNABORTED=`ECONNABORTED`,B.ETIMEDOUT=`ETIMEDOUT`,B.ECONNREFUSED=`ECONNREFUSED`,B.ERR_NETWORK=`ERR_NETWORK`,B.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,B.ERR_DEPRECATED=`ERR_DEPRECATED`,B.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,B.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,B.ERR_CANCELED=`ERR_CANCELED`,B.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,B.ERR_INVALID_URL=`ERR_INVALID_URL`,B.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`})),hd=t((()=>{}));function gd(e){return z.isPlainObject(e)||z.isArray(e)}function _d(e){return z.endsWith(e,`[]`)?e.slice(0,-2):e}function vd(e,t,n){return e?e.concat(t).map(function(e,t){return e=_d(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function yd(e){return z.isArray(e)&&!e.some(gd)}function bd(e,t,n){if(!z.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!z.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||m,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&z.isSpecCompliantForm(t),u=[];if(!z.isFunction(i))throw TypeError(`visitor must be a function`);function d(e){if(e===null)return``;if(z.isDate(e))return e.toISOString();if(z.isBoolean(e))return e.toString();if(!l&&z.isBlob(e))throw new B(`Blob is not supported. Use a Buffer instead.`);if(z.isArrayBuffer(e)||z.isTypedArray(e)){if(l&&typeof s==`function`)return new s([e]);if(typeof Buffer<`u`)return Buffer.from(e);throw new B(`Blob is not supported. Use a Buffer instead.`,B.ERR_NOT_SUPPORT)}return e}function f(e){if(e>c)throw new B(`Object is too deeply nested (`+e+` levels). Max depth: `+c,B.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(e,t){if(c===1/0)return JSON.stringify(e);let n=[];return JSON.stringify(e,function(e,r){if(!z.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),f(t+n.length-1),r})}function m(e,n,i){let s=e;if(z.isReactNative(t)&&z.isReactNativeBlob(e))return t.append(vd(i,n,a),d(e)),!1;if(e&&!i&&typeof e==`object`){if(z.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=p(e,1);else if(z.isArray(e)&&yd(e)||(z.isFileList(e)||z.endsWith(n,`[]`))&&(s=z.toArray(e)))return n=_d(n),s.forEach(function(e,r){!(z.isUndefined(e)||e===null)&&t.append(o===!0?vd([n],r,a):o===null?n:n+`[]`,d(e))}),!1}return gd(e)?!0:(t.append(vd(i,n,a),d(e)),!1)}let h=Object.assign(xd,{defaultVisitor:m,convertValue:d,isVisitable:gd});function g(e,n,r=0){if(!z.isUndefined(e)){if(f(r),u.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));u.push(e),z.forEach(e,function(e,a){(!(z.isUndefined(e)||e===null)&&i.call(t,e,z.isString(a)?a.trim():a,n,h))===!0&&g(e,n?n.concat(a):[a],r+1)}),u.pop()}}if(!z.isObject(e))throw TypeError(`data must be an object`);return g(e),t}var xd,Sd=t((()=>{Uu(),md(),hd(),xd=z.toFlatObject(z,{},null,function(e){return/^is[A-Z]/.test(e)})}));function Cd(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function wd(e,t){this._pairs=[],e&&bd(e,this,t)}var Td,Ed=t((()=>{Sd(),Td=wd.prototype,Td.append=function(e,t){this._pairs.push([e,t])},Td.toString=function(e){let t=e?t=>e.call(this,t,Cd):Cd;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)}}));function Dd(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function Od(e,t,n){if(!t)return e;e||=``;let r=z.isFunction(n)?{serialize:n}:n,i=z.getSafeProp(r,`encode`)||Dd,a=z.getSafeProp(r,`serialize`),o;if(o=a?a(t,r):z.isURLSearchParams(t)?t.toString():new wd(t,r).toString(i),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var kd=t((()=>{Uu(),Ed()})),Ad,jd=t((()=>{Uu(),Ad=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){z.forEach(this.handlers,function(t){t!==null&&e(t)})}}})),Md,Nd=t((()=>{Md={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0}})),Pd,Fd=t((()=>{Ed(),Pd=typeof URLSearchParams<`u`?URLSearchParams:wd})),Id,Ld=t((()=>{Id=typeof FormData<`u`?FormData:null})),Rd,zd=t((()=>{Rd=typeof Blob<`u`?Blob:null})),Bd,Vd=t((()=>{Fd(),Ld(),zd(),Bd={isBrowser:!0,classes:{URLSearchParams:Pd,FormData:Id,Blob:Rd},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]}})),Hd=r({hasBrowserEnv:()=>Ud,hasStandardBrowserEnv:()=>Gd,hasStandardBrowserWebWorkerEnv:()=>Kd,navigator:()=>Wd,origin:()=>qd}),Ud,Wd,Gd,Kd,qd,Jd=t((()=>{Ud=typeof window<`u`&&typeof document<`u`,Wd=typeof navigator==`object`&&navigator||void 0,Gd=Ud&&(!Wd||[`ReactNative`,`NativeScript`,`NS`].indexOf(Wd.product)<0),Kd=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,qd=Ud&&window.location.href||`http://localhost`})),Yd,Xd=t((()=>{Vd(),Jd(),Yd={...Hd,...Bd}}));function Zd(e,t){return bd(e,new Yd.classes.URLSearchParams,{visitor:function(e,t,n,r){return Yd.isNode&&z.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}var Qd=t((()=>{Uu(),Sd(),Xd()}));function $d(e){if(e>rf)throw new B(`FormData field is too deeply nested (`+e+` levels). Max depth: `+rf,B.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ef(e){let t=[],n=/\w+|\[(\w*)]/g,r;for(;(r=n.exec(e))!==null;)$d(t.length),t.push(r[0]===`[]`?``:r[1]||r[0]);return t}function tf(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r=e.length;return a=!a&&z.isArray(r)?r.length:a,s?(z.hasOwnProp(r,a)?r[a]=z.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!z.hasOwnProp(r,a)||!z.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&z.isArray(r[a])&&(r[a]=tf(r[a])),!o)}if(z.isFormData(e)&&z.isFunction(e.entries)){let n={};return z.forEachEntry(e,(e,r)=>{t(ef(e),r,n,0)}),n}return null}var rf,af=t((()=>{Uu(),md(),Sd(),rf=100}));function of(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var sf,cf,lf=t((()=>{Uu(),md(),Nd(),Sd(),Qd(),Xd(),af(),sf=(e,t)=>e!=null&&z.hasOwnProp(e,t)?e[t]:void 0,cf={transitional:Md,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=z.isObject(e);if(i&&z.isHTMLForm(e)&&(e=new FormData(e)),z.isFormData(e))return r?JSON.stringify(nf(e)):e;if(z.isArrayBuffer(e)||z.isBuffer(e)||z.isStream(e)||z.isFile(e)||z.isBlob(e)||z.isReadableStream(e))return e;if(z.isArrayBufferView(e))return e.buffer;if(z.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=sf(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return Zd(e,t).toString();if((a=z.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=sf(this,`env`),r=n&&n.FormData;return bd(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),of(e)):e}],transformResponse:[function(e){let t=sf(this,`transitional`)||cf.transitional,n=t&&t.forcedJSONParsing,r=sf(this,`responseType`),i=r===`json`;if(z.isResponse(e)||z.isReadableStream(e))return e;if(e&&z.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,sf(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?B.from(e,B.ERR_BAD_RESPONSE,this,null,sf(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yd.classes.FormData,Blob:Yd.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}},z.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`],e=>{cf.headers[e]={}})}));function uf(e,t){let n=this||cf,r=t||n,i=ld.from(r.headers),a=r.data;return z.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}var df=t((()=>{Uu(),lf(),ud()}));function ff(e){return!!(e&&e.__CANCEL__)}var pf=t((()=>{})),mf,hf=t((()=>{md(),mf=class extends B{constructor(e,t,n){super(e??`canceled`,B.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}}}));function gf(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new B(`Request failed with status code `+n.status,n.status>=400&&n.status<500?B.ERR_BAD_REQUEST:B.ERR_BAD_RESPONSE,n.config,n.request,n))}var _f=t((()=>{md()}));function vf(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}var yf=t((()=>{}));function bf(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{}));function Sf(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var Cf=t((()=>{})),wf,Tf,Ef,Df=t((()=>{xf(),Cf(),Uu(),wf=(e,t,n=3)=>{let r=0,i=bf(50,250);return Sf(n=>{if(!n||typeof n.loaded!=`number`)return;let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Tf=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ef=e=>(...t)=>z.asap(()=>e(...t))})),Of,kf=t((()=>{Xd(),Of=Yd.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Yd.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Yd.origin),Yd.navigator&&/(msie|trident)/i.test(Yd.navigator.userAgent)):()=>!0})),Af,jf=t((()=>{Uu(),Xd(),Af=Yd.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];z.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),z.isString(r)&&s.push(`path=${r}`),z.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),z.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.split(`;`);for(let n=0;n{}));function Pf(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}var Ff=t((()=>{}));function If(e){let t=0;for(;t{md(),Nf(),Ff(),Bf=/^https?:(?!\/\/)/i,Vf=/[\t\n\r]/g}));function Uf(e,t){e||={},t||={};let n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return z.isPlainObject(e)&&z.isPlainObject(t)?z.merge.call({caseless:r},e,t):z.isPlainObject(t)?z.merge({},t):z.isArray(t)?t.slice():t}function i(e,t,n,i){if(!z.isUndefined(t))return r(e,t,n,i);if(!z.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!z.isUndefined(t))return r(void 0,t)}function o(e,t){if(!z.isUndefined(t))return r(void 0,t);if(!z.isUndefined(e))return r(void 0,e)}function s(n){let r=z.hasOwnProp(t,`transitional`)?t.transitional:void 0;if(!z.isUndefined(r))if(z.isPlainObject(r)){if(z.hasOwnProp(r,n))return r[n]}else return;let i=z.hasOwnProp(e,`transitional`)?e.transitional:void 0;if(z.isPlainObject(i)&&z.hasOwnProp(i,n))return i[n]}function c(n,i,a){if(z.hasOwnProp(t,a))return r(n,i);if(z.hasOwnProp(e,a))return r(void 0,n)}let l={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(e,t,n)=>i(Wf(e),Wf(t),n,!0)};return z.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=z.hasOwnProp(l,r)?l[r]:i,o=a(z.hasOwnProp(e,r)?e[r]:void 0,z.hasOwnProp(t,r)?t[r]:void 0,r);z.isUndefined(o)&&a!==c||(n[r]=o)}),z.hasOwnProp(t,`validateStatus`)&&z.isUndefined(t.validateStatus)&&s(`validateStatusUndefinedResolves`)===!1&&(z.hasOwnProp(e,`validateStatus`)?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}var Wf,Gf=t((()=>{Uu(),ud(),Wf=e=>e instanceof ld?{...e}:e}));function Kf(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t||{}).forEach(([t,n])=>{Jf.includes(t.toLowerCase())&&e.set(t,n)})}function qf(e){let t=Uf({},e),n=e=>z.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=ld.from(s),t.url=Od(zf(l,d,u,t),n(`params`),n(`paramsSerializer`)),c){let t=z.getSafeProp(c,`username`)||``,n=z.getSafeProp(c,`password`)||``;try{s.set(`Authorization`,`Basic `+btoa(t+`:`+(n?Yf(n):``)))}catch(t){throw B.from(t,B.ERR_BAD_OPTION_VALUE,e)}}if(z.isFormData(r)&&(Yd.hasStandardBrowserEnv||Yd.hasStandardBrowserWebWorkerEnv||z.isReactNative(r)?s.setContentType(void 0):z.isFunction(r.getHeaders)&&Kf(s,r.getHeaders(),n(`formDataHeaderPolicy`))),Yd.hasStandardBrowserEnv&&(z.isFunction(i)&&(i=i(t)),i===!0||i==null&&Of(t.url))){let e=a&&o&&Af.read(o);e&&s.set(a,e)}return t}var Jf,Yf,Xf=t((()=>{Xd(),Uu(),md(),kf(),jf(),Hf(),Gf(),ud(),kd(),Jf=[`content-type`,`content-length`],Yf=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))})),Zf,Qf,$f=t((()=>{Uu(),_f(),Nd(),md(),hf(),yf(),Xd(),ud(),Df(),Xf(),ed(),Zf=typeof XMLHttpRequest<`u`,Qf=Zf&&function(e){return new Promise(function(t,n){let r=qf(e),i=r.data,a=ld.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=ld.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());gf(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&=(n(new B(`Request aborted`,B.ECONNABORTED,e,h)),m(),null)},h.onerror=function(t){let r=new B(t&&t.message?t.message:`Network Error`,B.ERR_NETWORK,e,h);r.event=t||null,n(r),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||Md;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new B(t,i.clarifyTimeoutError?B.ETIMEDOUT:B.ECONNABORTED,e,h)),m(),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&z.forEach(Yu(a),function(e,t){h.setRequestHeader(t,e)}),z.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=wf(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=wf(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new mf(null,e,h):t),h.abort(),m(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=vf(r.url);if(_&&!Yd.protocols.includes(_)){n(new B(`Unsupported protocol `+_+`:`,B.ERR_BAD_REQUEST,e)),m();return}h.send(i||null)})}})),ep,tp=t((()=>{hf(),md(),Uu(),ep=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;let n=new AbortController,r=!1,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof B?t:new mf(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new B(`timeout of ${t}ms exceeded`,B.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i,{once:!0}));let{signal:s}=n;return s.unsubscribe=()=>z.asap(o),s}})),np,rp,ip,ap,op=t((()=>{np=function*(e,t){let n=e.byteLength;if(!t||n{let i=rp(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})}}));function sp(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;ne>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}let i=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var cp,lp,up=t((()=>{cp=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,lp=(e,t,n)=>t+2{dp=`1.18.1`})),pp,mp,hp,gp,_p,vp,yp,bp,xp,Sp=t((()=>{Xd(),Uu(),md(),tp(),op(),ud(),Df(),Xf(),_f(),up(),fp(),ed(),pp=64*1024,{isFunction:mp}=z,hp=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),gp=e=>{if(!z.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},_p=(e,...t)=>{try{return!!e(...t)}catch{return!1}},vp=e=>{let t=e.indexOf(`://`),n=e;return t!==-1&&(n=n.slice(t+3)),n.includes(`@`)||n.includes(`:`)},yp=e=>{let t=z.global!==void 0&&z.global!==null?z.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=z.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?mp(i):typeof fetch==`function`,c=mp(a),l=mp(o);if(!s)return!1;let u=s&&mp(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&_p(()=>{let e=!1,t=new a(Yd.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&_p(()=>z.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new B(`Response type '${e}' is not supported`,B.ERR_NOT_SUPPORT,n)})});let h=async e=>{if(e==null)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e))return(await new a(Yd.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(z.isArrayBufferView(e)||z.isArrayBuffer(e))return e.byteLength;if(z.isURLSearchParams(e)&&(e+=``),z.isString(e))return(await d(e)).byteLength},g=async(e,t)=>z.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:d,timeout:_,onDownloadProgress:v,onUploadProgress:y,responseType:b,headers:x,withCredentials:S=`same-origin`,fetchOptions:C,maxContentLength:w,maxBodyLength:ee}=qf(e),T=z.isNumber(w)&&w>-1,E=z.isNumber(ee)&&ee>-1,D=t=>z.hasOwnProp(e,t)?e[t]:void 0,O=i||fetch;b=b?(b+``).toLowerCase():`text`;let te=ep([l,d&&d.toAbortSignal()],_),k=null,ne=te&&te.unsubscribe&&(()=>{te.unsubscribe()}),re,ie=null,ae=()=>new B(`Request body larger than maxBodyLength limit`,B.ERR_BAD_REQUEST,e,k);try{let i,l=D(`auth`);if(l&&(i={username:z.getSafeProp(l,`username`)||``,password:z.getSafeProp(l,`password`)||``}),vp(t)){let e=new URL(t,Yd.origin);!i&&(e.username||e.password)&&(i={username:gp(e.username),password:gp(e.password)}),(e.username||e.password)&&(e.username=``,e.password=``,t=e.href)}if(i&&(x.delete(`authorization`),x.set(`Authorization`,`Basic `+btoa(hp((i.username||``)+`:`+(i.password||``))))),T&&typeof t==`string`&&t.startsWith(`data:`)&&sp(t)>w)throw new B(`maxContentLength size of `+w+` exceeded`,B.ERR_BAD_RESPONSE,e,k);if(E&&n!==`get`&&n!==`head`){let e=await h(s);if(typeof e==`number`&&isFinite(e)&&(re=e,e>ee))throw ae()}let d=E&&(z.isReadableStream(s)||z.isStream(s)),_=(e,t,n)=>ap(e,pp,e=>{if(E&&e>ee)throw ie=ae();t&&t(e)},n);if(f&&n!==`get`&&n!==`head`&&(y||d)){if(re??=await g(x,s),re!==0||d){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(z.isFormData(s)&&(n=e.headers.get(`content-type`))&&x.setContentType(n),e.body){let[t,n]=y&&Tf(re,wf(Ef(y)))||[];s=_(e.body,t,n)}}}else if(d&&!c&&u&&n!==`get`&&n!==`head`)s=_(s);else if(d&&c&&!f&&n!==`get`&&n!==`head`)throw new B(`Stream request bodies are not supported by the current fetch implementation`,B.ERR_NOT_SUPPORT,e,k);z.isString(S)||(S=S?`include`:`omit`);let oe=c&&`credentials`in a.prototype;if(z.isFormData(s)){let e=x.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&x.delete(`content-type`)}x.set(`User-Agent`,`axios/`+dp,!1);let se={...C,signal:te,method:n.toUpperCase(),headers:Yu(x.normalize()),body:s,duplex:`half`,credentials:oe?S:void 0};k=c&&new a(t,se);let ce=await(c?O(k,C):O(t,se)),le=ld.from(ce.headers);if(T){let t=z.toFiniteNumber(le.getContentLength());if(t!=null&&t>w)throw new B(`maxContentLength size of `+w+` exceeded`,B.ERR_BAD_RESPONSE,e,k)}let ue=p&&(b===`stream`||b===`response`);if(p&&ce.body&&(v||T||ue&&ne)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=ce[e]});let n=z.toFiniteNumber(le.getContentLength()),[r,i]=v&&Tf(n,wf(Ef(v),!0))||[],a=0;ce=new o(ap(ce.body,pp,t=>{if(T&&(a=t,a>w))throw new B(`maxContentLength size of `+w+` exceeded`,B.ERR_BAD_RESPONSE,e,k);r&&r(t)},()=>{i&&i(),ne&&ne()}),t)}b||=`text`;let A=await m[z.findKey(m,b)||`text`](ce,e);if(T&&!p&&!ue){let t;if(A!=null&&(typeof A.byteLength==`number`?t=A.byteLength:typeof A.size==`number`?t=A.size:typeof A==`string`&&(t=typeof r==`function`?new r().encode(A).byteLength:A.length)),typeof t==`number`&&t>w)throw new B(`maxContentLength size of `+w+` exceeded`,B.ERR_BAD_RESPONSE,e,k)}return!ue&&ne&&ne(),await new Promise((t,n)=>{gf(t,n,{data:A,headers:ld.from(ce.headers),status:ce.status,statusText:ce.statusText,config:e,request:k})})}catch(t){if(ne&&ne(),te&&te.aborted&&te.reason instanceof B){let n=te.reason;throw n.config=e,k&&(n.request=k),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(ie)throw k&&!ie.request&&(ie.request=k),ie;if(t instanceof B)throw k&&!t.request&&(t.request=k),t;if(t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)){let n=new B(`Network Error`,B.ERR_NETWORK,e,k,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw B.from(t,t&&t.code,e,k,t&&t.response)}}},bp=new Map,xp=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=bp;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:yp(t)),l=c;return c},xp()}));function Cp(e,t){e=z.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new B(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since : +`+e.map(Tp).join(` +`):` `+Tp(e[0]):`as no adapter specified`),B.ERR_NOT_SUPPORT)}return i}var wp,Tp,Ep,Dp,Op=t((()=>{Uu(),hd(),$f(),Sp(),md(),wp={http:null,xhr:Qf,fetch:{get:xp}},z.forEach(wp,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}}),Tp=e=>`- ${e}`,Ep=e=>z.isFunction(e)||e===null||e===!1,Dp={getAdapter:Cp,adapters:wp}}));function kp(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new mf(null,e)}function Ap(e){return kp(e),e.headers=ld.from(e.headers),e.data=uf.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),Dp.getAdapter(e.adapter||cf.adapter,e)(e).then(function(t){kp(e),e.response=t;try{t.data=uf.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=ld.from(t.headers),t},function(t){if(!ff(t)&&(kp(e),t&&t.response)){e.response=t.response;try{t.response.data=uf.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=ld.from(t.response.headers)}return Promise.reject(t)})}var jp=t((()=>{df(),pf(),lf(),hf(),ud(),Op()}));function Mp(e,t,n){if(typeof e!=`object`||!e)throw new B(`options must be an object`,B.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new B(`option `+a+` must be `+n,B.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new B(`Unknown option `+a,B.ERR_BAD_OPTION)}}var Np,Pp,Fp,Ip=t((()=>{fp(),md(),Np={},[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{Np[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}}),Pp={},Np.transitional=function(e,t,n){function r(e,t){return`[Axios v`+dp+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new B(r(i,` has been removed`+(t?` in `+t:``)),B.ERR_DEPRECATED);return t&&!Pp[i]&&(Pp[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},Np.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)},Fp={assertOptions:Mp,validators:Np}})),Lp,Rp,zp=t((()=>{Uu(),kd(),jd(),jp(),Gf(),Hf(),Ip(),ud(),Nd(),Lp=Fp.validators,Rp=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ad,response:new Ad}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(` +`);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(` +`),r=t===-1?-1:n.indexOf(` +`,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=` +`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=Uf(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&Fp.assertOptions(n,{silentJSONParsing:Lp.transitional(Lp.boolean),forcedJSONParsing:Lp.transitional(Lp.boolean),clarifyTimeoutError:Lp.transitional(Lp.boolean),legacyInterceptorReqResOrdering:Lp.transitional(Lp.boolean),advertiseZstdAcceptEncoding:Lp.transitional(Lp.boolean),validateStatusUndefinedResolves:Lp.transitional(Lp.boolean)},!1),r!=null&&(z.isFunction(r)?t.paramsSerializer={serialize:r}:Fp.assertOptions(r,{encode:Lp.function,serialize:Lp.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),Fp.assertOptions(t,{baseUrl:Lp.spelling(`baseURL`),withXsrfToken:Lp.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&z.merge(i.common,i[t.method]);i&&z.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=ld.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||Md;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[Ap.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u{hf(),Bp=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new mf(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}}}));function Hp(e){return function(t){return e.apply(null,t)}}var Up=t((()=>{}));function Wp(e){return z.isObject(e)&&e.isAxiosError===!0}var Gp=t((()=>{Uu()})),Kp,qp=t((()=>{Kp={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526},Object.entries(Kp).forEach(([e,t])=>{Kp[t]=e})}));function Jp(e){let t=new Rp(e),n=Tl(Rp.prototype.request,t);return z.extend(n,Rp.prototype,t,{allOwnKeys:!0}),z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return Jp(Uf(e,t))},n}var Yp,Xp=t((()=>{Uu(),El(),zp(),Gf(),lf(),af(),hf(),Vp(),pf(),fp(),Sd(),md(),Up(),Gp(),ud(),Op(),qp(),Yp=Jp(cf),Yp.Axios=Rp,Yp.CanceledError=mf,Yp.CancelToken=Bp,Yp.isCancel=ff,Yp.VERSION=dp,Yp.toFormData=bd,Yp.AxiosError=B,Yp.Cancel=Yp.CanceledError,Yp.all=function(e){return Promise.all(e)},Yp.spread=Hp,Yp.isAxiosError=Wp,Yp.mergeConfig=Uf,Yp.AxiosHeaders=ld,Yp.formToJSON=e=>nf(z.isHTMLForm(e)?new FormData(e):e),Yp.getAdapter=Dp.getAdapter,Yp.HttpStatusCode=Kp,Yp.default=Yp})),Zp,Qp,$p,em,tm,nm,rm,im,am,om,sm,cm,lm,um,dm,fm,pm,mm=t((()=>{Xp(),{Axios:Zp,AxiosError:Qp,CanceledError:$p,isCancel:em,CancelToken:tm,VERSION:nm,all:rm,Cancel:im,isAxiosError:am,spread:om,toFormData:sm,AxiosHeaders:cm,HttpStatusCode:lm,formToJSON:um,getAdapter:dm,mergeConfig:fm,create:pm}=Yp}));function hm(){let e=document.cookie.match(/(?:^|;\s*)token=([^;]*)/);return e?decodeURIComponent(e[1]):null}var gm,_m,vm,ym,bm=t((()=>{mm(),gm=`mokeetext-edit`,_m=`https://gw.server.zgitm.com`,vm=`https://login.user.zgitm.com`,ym=Yp.create({baseURL:_m,timeout:3e4}),ym.interceptors.request.use(e=>{let t=hm();return t&&(e.headers.Authorization=`Bearer ${t}`),e.headers[`X-System-Code`]=gm,e}),ym.interceptors.response.use(e=>{let t=e.data;return t&&typeof t==`object`&&(t.code===200||t.code===0)?t:e},e=>(e.response?.status===401&&(window.location.href=`${vm}?systemCode=${gm}`),Promise.reject(e)))}));async function xm(e,t={}){let n=await fetch(Tm+e,{headers:{"Content-Type":`application/json`,"X-Dev-Mock-User":`admin`,...t.headers},...t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.detail||n.statusText)}return n.json()}async function Sm(e,t={}){let n={method:(t.method||`GET`).toLowerCase(),url:e};return t.headers&&(n.headers=t.headers),t.body&&(n.data=JSON.parse(t.body)),(await ym(n)).data}function Cm(){return{listNotes:e=>Em(e?`/api/notes?folder_id=${e}`:`/api/notes`),getNote:e=>Em(`/api/notes/${e}`),createNote:e=>Em(`/api/notes`,{method:`POST`,body:JSON.stringify(e)}),updateNote:(e,t)=>Em(`/api/notes/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteNote:e=>Em(`/api/notes/${e}`,{method:`DELETE`}),shareNote:(e,t)=>Em(`/api/notes/${e}/share`,{method:`POST`,body:JSON.stringify({ttl:t})}),unshareNote:e=>Em(`/api/notes/${e}/share`,{method:`DELETE`}),moveNote:(e,t)=>Em(`/api/notes/${e}/move`,{method:`PUT`,body:JSON.stringify({folder_id:t})}),listWebsites:e=>Em(e?`/api/websites?folder_id=${e}`:`/api/websites`),getWebsite:e=>Em(`/api/websites/${e}`),createWebsite:e=>Em(`/api/websites`,{method:`POST`,body:JSON.stringify(e)}),updateWebsite:(e,t)=>Em(`/api/websites/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteWebsite:e=>Em(`/api/websites/${e}`,{method:`DELETE`}),getAccount:e=>Em(`/api/accounts/${e}`),addAccount:(e,t)=>Em(`/api/websites/${e}/accounts`,{method:`POST`,body:JSON.stringify(t)}),updateAccount:(e,t)=>Em(`/api/accounts/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteAccount:e=>Em(`/api/accounts/${e}`,{method:`DELETE`}),moveAccount:(e,t)=>Em(`/api/accounts/${e}/move`,{method:`PUT`,body:JSON.stringify({direction:t})}),listFolders:e=>Em(`/api/folders?type=${e}`),createFolder:e=>Em(`/api/folders`,{method:`POST`,body:JSON.stringify(e)}),updateFolder:(e,t)=>Em(`/api/folders/${e}`,{method:`PUT`,body:JSON.stringify(t)}),deleteFolder:e=>Em(`/api/folders/${e}`,{method:`DELETE`}),parseImport:e=>Em(`/api/import/parse`,{method:`POST`,body:JSON.stringify({text:e})})}}var wm,Tm,Em,Dm=t((()=>{bm(),wm=window.location.hostname===`localhost`,Tm=`http://localhost:4006`,Em=wm?xm:Sm}));function Om(e){this.content=e}var km=t((()=>{Om.prototype={constructor:Om,find:function(e){for(var t=0;t>1}},Om.from=function(e){if(e instanceof Om)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Om(t)}}));function Am(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i=56320&&e<57344}function Nm(e){return e>=55296&&e<56320}function Pm(e,t){return Th.index=e,Th.offset=t,Th}function Fm(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;ne.depth)throw new Eh(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Eh(`Inconsistent open depths`);return zm(e,t,n,0)}function zm(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Um(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Hm(e.nodeAfter,r),a++));for(let e=a;ei&&Vm(e,t,i+1),o=r.depth>i&&Vm(n,r,i+1),s=[];return Um(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Bm(a,o),Hm(Wm(a,Gm(e,t,n,r,i+1)),s)):(a&&Hm(Wm(a,Km(e,t,i+1)),s),Um(t,n,i,s),o&&Hm(Wm(o,Km(n,r,i+1)),s)),Um(r,null,i,s),new V(s)}function Km(e,t,n){let r=[];return Um(null,e,n,r),e.depth>n&&Hm(Wm(Vm(e,t,n+1),Km(e,t,n+1)),r),Um(t,null,n,r),new V(r)}function qm(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(V.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}function Jm(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function Ym(e){let t=[];do t.push(Xm(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Xm(e){let t=[];do t.push(Zm(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Zm(e){let t=th(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=$m(e,t);else break;return t}function Qm(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function $m(e,t){let n=Qm(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Qm(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function eh(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function th(e){if(e.eat(`(`)){let t=Ym(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=eh(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function nh(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Fh(r.indexOf(e.length-1)>-1);for(let e=0;e{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}function fh(e,t){let n=[];for(let r=0;r-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ph(e){return e.tag!=null}function mh(e){return e.style!=null}function hh(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Gh:0)|(t===`full`?Kh:0)}function gh(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Wh.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function _h(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function vh(e){let t={};for(let n in e)t[n]=e[n];return t}function yh(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;iu)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=wh(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var V,Th,H,Eh,U,Dh,Oh,kh,Ah,jh,Mh,Nh,Ph,Fh,Ih,Lh,Rh,zh,Bh,Vh,Hh,Uh,Wh,Gh,Kh,qh,Jh,Yh,Xh,Zh,Qh=t((()=>{km(),V=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;te&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);at)for(let e=0,a=0;at&&((an)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Pm(t+1,i):Pm(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;ethis.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;te.type.rank-t.type.rank),n}},H.none=[],Eh=class extends Error{},U=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Lm(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Im(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(V.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}},U.empty=new U(V.empty,0,0),Dh=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new jh(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Ah.get(t);if(r)for(let e=0;ee&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Jm(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=V.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;ee.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=V.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}},Nh.prototype.text=void 0,Ph=class e extends Nh{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Jm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}},Fh=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ih(t,n);if(r.next==null)return e.empty;let i=Ym(r);r.next&&r.err(`Unexpected trailing text`);let a=ah(nh(i));return oh(a,r),a}matchType(e){for(let t=0;te.createAndFill()));for(let e=0;e=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n`+e.indexOf(t.next[n].next);return r}).join(` +`)}},Fh.empty=new Fh(!0),Ih=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}},Lh=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=uh(e,n.attrs),this.defaultAttrs=sh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Fh.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ch(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Nh(this,this.computeAttrs(e),V.from(t),H.setFrom(n))}createChecked(e=null,t,n){return t=V.from(t),this.checkContent(t),new Nh(this,this.computeAttrs(e),t,H.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=V.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(V.empty,!0);return i?new Nh(this,e,t.append(i),H.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}},Rh=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?dh(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},zh=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=uh(e,r.attrs),this.excluded=null;let i=sh(this.attrs);this.instance=i?new H(this,i):null}create(e=null){return!e&&this.instance?this.instance:new H(this,ch(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t-1}},Bh=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Om.from(e.nodes),t.marks=Om.from(e.marks||{}),this.nodes=Lh.compile(this.spec.nodes,this),this.marks=zh.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Fh.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?fh(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:fh(this,n.split(` `))}this.nodeFromJSON=e=>Nh.fromJSON(this,e),this.markFromJSON=e=>H.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Lh))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Ph(n,n.defaultAttrs,e,H.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}},Vh=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ph(e))this.tags.push(e);else if(mh(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Yh(this,t,!1);return n.addAll(e,H.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Yh(this,t,!0);return n.addAll(e,H.none,t.from,t.to),U.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;re.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r{n(e=vh(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vh(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Hh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Uh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wh={ol:!0,ul:!0},Gh=1,Kh=2,qh=4,Jh=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=H.none,this.match=i||(a&qh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(V.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Gh)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=V.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Hh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Yh=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=hh(null,t.preserveWhitespace,0)|(n?qh:0);i=r?new Jh(r.type,r.attrs,H.none,!0,t.topMatch||r.type.contentMatch,a):n?new Jh(null,null,H.none,!0,null,a):new Jh(e.schema.topNodeType,null,H.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Kh?`full`:this.localPreserveWS||(r.options&Gh)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,` +`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e(a.type?a.type.allowsMarkType(t.type):yh(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Jh(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Gh);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}},Xh=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=xh(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&wh(xh(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:wh(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=bh(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return bh(e.marks)}},Zh=new WeakMap}));function $h(e,t){return e+t*Wg}function eg(e){return e&Ug}function tg(e){return(e-(e&Ug))/Wg}function ng(e,t,n){let r=[];for(let i=0;i0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ig(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;ee.step(t)),a.forEach(t=>e.step(t))}function ag(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof zh){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;ee.step(new n_(t.from,t.to,t.style)))}function og(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t=0;t--)e.step(o[t])}function sg(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function cg(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(nn;e--)t||r.index(e)>0?(t=!0,u=V.from(r.node(e).copy(u)),d++):c--;let f=V.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=V.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new o_(i,a,i,a,new U(r,0,0),n.length,!0))}function hg(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&vg(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&_g(e,t,n,a),og(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new o_(c,l,c+1,l-1,new U(V.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&gg(e,t,n,a),!1}})}function gg(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function _g(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(` +`))}})}function vg(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function yg(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new o_(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new U(V.from(o),0,0),1,!0))}function bg(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function xg(e,t,n=1,r){let i=e.doc.resolve(t),a=V.empty,o=V.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=V.from(i.node(e).copy(a));let t=r&&r[s];o=V.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new a_(t,t,new U(a.append(o),n,n),!0))}function Sg(e,t){let n=e.resolve(t),r=n.index();return wg(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cg(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&wg(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Eg(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);_g(e,r.node(),r.before(),s)}o.inlineContent&&og(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new a_(l,c.map(t+n,-1),U.empty,!0)),r===!0){let t=e.doc.resolve(l);gg(e,t.node(),t.before(),e.steps.length)}return e}function Dg(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function kg(e,t,n=t,r=U.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Ag(i,a,r)?new a_(t,n,r):new s_(i,a,r).fit()}function Ag(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}function jg(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(jg(e.firstChild.content,t-1,n)))}function Mg(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Mg(e.lastChild.content,t-1,n)))}function Ng(e,t){for(let n=0;n1&&(r=r.replaceChild(0,Pg(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(V.empty,!0)))),e.copy(r)}function Fg(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!Ig(n,a.content,o)?s:null}function Ig(e,t,n){for(let r=n;r0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=Lg(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function zg(e,t,n,r,i){if(tr){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(V.empty,!0))}return e}function Bg(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Dg(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new U(V.from(r),0,0))}function Vg(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=Hg(r,i);for(let t=0;t0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Hg(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(rt.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_,r_,i_,a_,o_,s_,c_,l_,u_,d_,f_=t((()=>{Qh(),Ug=65535,Wg=2**16,Gg=1,Kg=2,qg=4,Jg=8,Yg=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Jg)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&qg)>0}},Xg=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=eg(e);if(!this.inverted)for(let e=0;ee)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:$h(o/3,e-s),f=e==s?Kg:e==u?Gg:qg;return(t<0?e!=s:e!=u)&&(f|=Jg),new Yg(a,f,d)}r+=l-c}return n?e+r:new Yg(e+r,0,null)}touches(e,t){let n=0,r=eg(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;te)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;nn&&t!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return e_.fromReplace(e,this.from,this.to,i)}invert(){return new n_(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}},$g.jsonID(`addMark`,t_),n_=class e extends $g{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new U(ng(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return e_.fromReplace(e,this.from,this.to,n)}invert(){return new t_(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}},$g.jsonID(`removeMark`,n_),r_=class e extends $g{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return e_.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return e_.fromReplace(e,this.pos,this.pos+1,new U(V.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;rr.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,U.fromJSON(t,n.slice),n.insert,!!n.structure)}},$g.jsonID(`replaceAround`,o_),s_=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=V.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=V.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new U(i,a,o);return e>-1?new o_(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new a_(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ng(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(V.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ng(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new U(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ng(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new U(jg(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new U(jg(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e1||s==0||e.content.size)&&(u=t,l.push(Pg(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Mg(this.placed,t,V.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t=0;n--){let{match:t,type:r}=this.frontier[n],i=Fg(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Mg(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Mg(this.placed,this.depth,V.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(V.empty,!0);e.childCount&&(this.placed=Mg(this.placed,this.frontier.length,e))}},c_=class e extends $g{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return e_.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return e_.fromReplace(e,this.pos,this.pos+1,new U(V.from(r),0,+!t.isLeaf))}getMap(){return Xg.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}},$g.jsonID(`attr`,c_),l_=class e extends $g{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return e_.ok(n)}getMap(){return Xg.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}},$g.jsonID(`docAttr`,l_),u_=class extends Error{},u_=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},u_.prototype=Object.create(Error.prototype),u_.prototype.constructor=u_,u_.prototype.name=`TransformError`,d_=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zg}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new u_(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=U.empty){let r=kg(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new U(V.from(n),0,0))}delete(e,t){return this.replace(e,t,U.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Rg(this,e,t,n),this}replaceRangeWith(e,t,n){return Bg(this,e,t,n),this}deleteRange(e,t){return Vg(this,e,t),this}lift(e,t){return lg(this,e,t),this}join(e,t=1){return Eg(this,e,t),this}wrap(e,t){return mg(this,e,t),this}setBlockType(e,t=e,n,r=null){return hg(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return yg(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new c_(e,t,n)),this}setDocAttribute(e,t){return this.step(new l_(e,t)),this}addNodeMark(e,t){return this.step(new r_(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof H)t.isInSet(n.marks)&&this.step(new i_(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new i_(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return xg(this,e,t,n),this}addMark(e,t,n){return ig(this,e,t,n),this}removeMark(e,t,n){return ag(this,e,t,n),this}clearIncompatible(e,t,n){return og(this,e,t,n),this}}})),p_=t((()=>{f_()}));function m_(e){!S_&&!e.parent.inlineContent&&(S_=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}function h_(e,t,n,r,i,a=!1){if(t.inlineContent)return G.create(e,n);for(let o=r-(i>0?0:1);i>0?o=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=h_(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&K.isSelectable(r))return K.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function g_(e,t,n){let r=e.steps.length-1;if(r{o??=r}),e.setSelection(W.near(e.doc.resolve(o),n))}function __(e,t){return!t||!e?e:e.bind(t)}function v_(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=v_(i,t,{})),n[r]=i}return n}function y_(e){return e in I_?e+`$`+ ++I_[e]:(I_[e]=0,e+`$`)}var b_,W,x_,S_,G,C_,K,w_,T_,E_,D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_=t((()=>{Qh(),f_(),b_=Object.create(null),W=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new x_(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;r--){let i=t<0?h_(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):h_(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new T_(e.node(0))}static atStart(e){return h_(e,e,0,0,1)||new T_(e)}static atEnd(e){return h_(e,e,e.content.size,e.childCount,-1)||new T_(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=b_[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in b_)throw RangeError(`Duplicate use of selection JSON ID `+e);return b_[e]=t,t.prototype.jsonID=e,t}getBookmark(){return G.between(this.$anchor,this.$head).getBookmark()}},W.prototype.visible=!0,x_=class{constructor(e,t){this.$from=e,this.$to=t}},S_=!1,G=class e extends W{constructor(e,t=e){m_(e),m_(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return W.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=U.empty){if(super.replace(e,t),t==U.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new C_(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=W.findFrom(n,r,!0)||W.findFrom(n,-r,!0);if(e)n=e.$head;else return W.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(W.findFrom(t,-r,!0)||W.findFrom(t,r,!0)).$anchor,t.pos0}setStoredMarks(e){return this.storedMarks=e,this.updated|=O_,this}ensureMarks(e){return H.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&O_)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||H.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(W.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=k_,this}get scrolledIntoView(){return(this.updated&k_)>0}},j_=class{constructor(e,t,n){this.name=e,this.init=__(t.init,n),this.apply=__(t.apply,n)}},M_=[new j_(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new j_(`selection`,{init(e,t){return e.selection||W.atStart(t.doc)},apply(e){return e.selection}}),new j_(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new j_(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],N_=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=M_.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new j_(e.key,e.spec.state,e))})}},P_=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;ne.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new N_(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Nh.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=W.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}},F_=class{constructor(e){this.spec=e,this.props={},e.props&&v_(e.props,this,this.props),this.key=e.key?e.key.key:y_(`plugin`)}getState(e){return e[this.key]}},I_=Object.create(null),L_=class{constructor(e=`key`){this.key=y_(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}}));function z_(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}function B_(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=kg(e.doc,i,o,U.empty);if(!s||s.from!=i||s instanceof a_&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(G.create(t.doc,i)),n(t.scrollIntoView())}return!0}function V_(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}function H_(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function U_(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let{$from:r,$to:i}=t.selection;if(t.selection instanceof K&&t.selection.node.isBlock)return!r.parentOffset||!bg(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=G_(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof G||t.selection instanceof T_)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=bg(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,bg(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}function q_(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Sg(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function J_(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&q_(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=V.empty;for(let e=o.length-1;e>=0;e--)s=V.from(o[e].create(null,s));s=V.from(i.copy(s));let c=e.tr.step(new o_(t.pos-1,r,t.pos,r,new U(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Sg(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:W.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&cg(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&V_(a,`start`,!0)&&V_(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=V.empty;for(let e=o.length-1;e>=0;e--)r=V.from(o[e].copy(r));n(e.tr.step(new o_(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new U(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Y_(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(G.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}function X_(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&ug(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function Z_(e,t=null){return function(n,r){let i=!1;for(let r=0;r{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r{f_(),Qh(),R_(),$_=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0),ev=(e,t,n)=>{let r=z_(e,n);if(!r)return!1;let i=H_(r);if(!i){let n=r.blockRange(),i=n&&cg(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(J_(e,i,t,-1))return!0;if(r.parent.content.size==0&&(V_(a,`end`)||K.isSelectable(a)))for(let n=r.depth;;n--){let o=kg(e.doc,r.before(n),r.after(n),U.empty);if(o&&o.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},tv=(e,t,n)=>{let r=z_(e,n);if(!r)return!1;let i=H_(r);return i?B_(e,i,t):!1},nv=(e,t,n)=>{let r=U_(e,n);if(!r)return!1;let i=W_(r);return i?B_(e,i,t):!1},rv=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=H_(r)}let o=a&&a.nodeBefore;return!o||!K.isSelectable(o)?!1:(t&&t(e.tr.setSelection(K.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)},iv=(e,t,n)=>{let r=U_(e,n);if(!r)return!1;let i=W_(r);if(!i)return!1;let a=i.nodeAfter;if(J_(e,i,t,1))return!0;if(r.parent.content.size==0&&(V_(a,`start`)||K.isSelectable(a))){let n=kg(e.doc,r.before(),r.after(),U.empty);if(n&&n.slice.size{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset{let n=e.selection,r=n instanceof K,i;if(r){if(n.node.isTextblock||!Sg(e.doc,n.from))return!1;i=n.from}else if(i=Tg(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(K.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},sv=(e,t)=>{let n=e.selection,r;if(n instanceof K){if(n.node.isTextblock||!Sg(e.doc,n.to))return!1;r=n.to}else if(r=Tg(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},cv=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&cg(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},lv=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(` +`).scrollIntoView()),!0)},uv=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=G_(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(W.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},dv=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof T_||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=G_(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(bg(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&cg(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)},pv=K_(),mv=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(K.create(e.doc,i))),!0)},hv=(e,t)=>(t&&t(e.tr.setSelection(new T_(e.doc))),!0),gv=Y_(-1),_v=Y_(1),vv=Q_($_,ev,rv),yv=Q_($_,iv,av),bv={Enter:Q_(lv,dv,fv,pv),"Mod-Enter":uv,Backspace:vv,"Mod-Backspace":vv,"Shift-Backspace":vv,Delete:yv,"Mod-Delete":yv,"Mod-a":hv},xv={"Ctrl-h":bv.Backspace,"Alt-Backspace":bv[`Mod-Backspace`],"Ctrl-d":bv.Delete,"Ctrl-Alt-Backspace":bv[`Mod-Delete`],"Alt-Delete":bv[`Mod-Delete`],"Alt-d":bv[`Mod-Delete`],"Ctrl-a":gv,"Ctrl-e":_v};for(let e in bv)xv[e]=bv[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform()})),Cv=t((()=>{Sv()})),wv=t((()=>{R_()})),Tv=t((()=>{Qh()}));function Ev(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Dv(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Dv(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new jh(e,e,t.depth),t.endIndex=0;e--)a=V.from(n[e].type.create(n[e].attrs,a));e.step(new o_(t.start-(r?2:0),t.end,t.start,t.end,new U(a,0,0),n.length,!0));let o=0;for(let e=0;et.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Av(t,n,e,a):jv(t,n,a):!0:!1}}function Av(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);aa;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?V.empty:V.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new o_(d-+!!s,f+ +!!c,d+1,f-1,new U((s?V.empty:V.from(i.copy(V.empty))).append(c?V.empty:V.from(i.copy(V.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Mv(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=V.from(r?e.create():null),o=new U(V.from(e.create(null,V.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new o_(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var Nv=t((()=>{f_(),Qh()})),Pv=t((()=>{Nv()}));function Fv(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Iv(e))){let n=e.parentNode;if(!n||n.nodeType!=1||Bv(e)||Lx.test(e.nodeName)||e.contentEditable==`false`)return!1;t=jx(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?Iv(e):0}else return!1}}function Iv(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Lv(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Iv(e)}else if(e.parentNode&&!Bv(e))t=jx(e),e=e.parentNode;else return null}}function Rv(e,t){for(;;){if(e.nodeType==3&&ts.bottom-Gv(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Gv(i,`top`)-s.top:t.bottom-s.bottom+Gv(i,`bottom`)),t.lefts.right-Gv(r,`right`)&&(c=t.right-s.right+Gv(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:Mx(o)}}function Jv(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Yv(e.dom)}}function Yv(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Mx(r));return t}function Xv({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Zv(n,r==0?0:r-t)}function Zv(e,t){for(let n=0;n=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?ey(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:$v(n,i)}function ey(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function ty(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ny(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function iy(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right-1?i:e.docView.posFromDOM(t,n,-1)}function ay(e,t,n){let r=e.childNodes.length;if(r&&n.topt.top&&i++}let n;nS&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=iy(e,r,i,t))}s??=ry(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function sy(e){return e.top=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,uy(cy(Px(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Iv(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return dy(e.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==Iv(r))){let e=r.childNodes[i-1],t=e.nodeType==3?Px(e,Iv(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return uy(cy(t,1),!1)}if(a==null&&i=0)}function uy(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function dy(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function fy(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function py(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return fy(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=ly(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=Px(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;ei.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}function my(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!oS.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:fy(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}function hy(e,t,n){return sS==t&&cS==n?lS:(sS=t,cS=n,lS=n==`up`||n==`down`?py(e,t,n):my(e,t,n))}function gy(e,t,n,r,i){xy(r,t,e);let a=new vS(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}function _y(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof _S)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function Ty(e,t){return e.type.side-t.type.side}function Ey(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;na;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function Dy(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function Oy(e,t,n,r){for(let i=0,a=0;i=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function ky(e,t,n,r,i){let a=[];for(let o=0,s=0;o=n||u<=t?a.push(c):(ln&&a.push(c.slice(n-l,c.size,r)))}return a}function Ay(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Rx(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&K.isSelectable(e)&&i.parent&&!(e.isInline&&zv(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new K(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!jy(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Ly(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,jx(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Gx&&Kx<=11&&(n.disabled=!0,n.disabled=!1)}function Ry(e,t){if(t instanceof K){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(zy(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else zy(e)}function zy(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function By(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||G.between(t,n,r)}function Vy(e){return e.editable&&!e.hasFocus()?!1:Hy(e)}function Hy(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Uy(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Ix(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Wy(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&W.findFrom(a,t)}function Gy(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ky(e,t,n){let r=e.state.selection;if(r instanceof G){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Gy(e,new G(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Wy(e.state,t);return n&&n instanceof K?Gy(e,n):!1}else if(!($x&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?K.isSelectable(i)?Gy(e,new K(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):nS?Gy(e,new G(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof K&&r.node.isInline)return Gy(e,new G(t>0?r.$to:r.$from));else{let n=Wy(e.state,t);return n?Gy(e,n):!1}}function qy(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Jy(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function Yy(e,t){return t<0?Xy(e):Zy(e)}function Xy(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(qx&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(Jy(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(Qy(n))break;else{let t=n.previousSibling;for(;t&&Jy(t,-1);)i=n.parentNode,a=jx(t),t=t.previousSibling;if(t)n=t,r=qy(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?tb(e,n,r):i&&tb(e,i,a)}function Zy(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=qy(n),a,o;for(;;)if(r{e.state==i&&My(e)},50)}function nb(e,t){let n=e.state.doc.resolve(t);if(!(Yx||eS)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i1)return n.leftr.top&&i1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function rb(e,t,n){let r=e.state.selection;if(r instanceof G&&!r.empty||n.indexOf(`s`)>-1||$x&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Wy(e.state,t);if(n&&n instanceof K)return Gy(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof T_?W.near(n,t):W.findFrom(n,t);return o?Gy(e,o):!1}return!1}function ib(e,t){if(!(e.state.selection instanceof G))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function ab(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function ob(e){if(!Zx||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;ab(e,n,`true`),setTimeout(()=>ab(e,n,`false`),20)}return!1}function sb(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function cb(e,t){let n=t.keyCode,r=sb(t);if(n==8||$x&&n==72&&r==`c`)return ib(e,-1)||Yy(e,-1);if(n==46&&!t.shiftKey||$x&&n==68&&r==`c`)return ib(e,1)||Yy(e,1);if(n==13||n==27)return!0;if(n==37||$x&&n==66&&r==`c`){let t=n==37?nb(e,e.state.selection.from)==`ltr`?-1:1:-1;return Ky(e,t,r)||Yy(e,t)}else if(n==39||$x&&n==70&&r==`c`){let t=n==39?nb(e,e.state.selection.from)==`ltr`?1:-1:1;return Ky(e,t,r)||Yy(e,t)}else if(n==38||$x&&n==80&&r==`c`)return rb(e,-1,r)||Yy(e,-1);else if(n==40||$x&&n==78&&r==`c`)return ob(e)||rb(e,1,r)||Yy(e,1);else if(r==($x?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function lb(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Xh.fromSchema(e.state.schema),s=_b(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=DS[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,` + +`),slice:t}}function ub(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new U(V.from(e.state.schema.text(t.replace(/\r\n?/g,` +`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Xh.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=yb(n),nS&&bb(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Vh.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!ES.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=xb(gb(s,+u[1],+u[2]),u[4]);else if(s=U.maxOpen(db(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e{s=t(s,e,c)}),s}function db(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&pb(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=mb(a[a.length-1],i.length));let n=fb(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return V.from(a)}return e}function fb(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,V.from(e));return e}function pb(e,t,n,r,i){if(i1&&(a=0),i=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function gb(e,t,n){return te}),kS.createHTML(e)):e}function yb(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=_b().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&DS[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>``).reverse().join(``)),n.innerHTML=vb(e),i)for(let e=0;e=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=V.from(t.create(r[e+1],i)),a++,o++}return new U(i,a,o)}function Sb(e){for(let t in AS){let n=AS[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{Db(e,t)&&!Eb(e,t)&&(e.editable||!(t.type in jS))&&n(e,t)},MS[t]?{passive:!0}:void 0)}Zx&&e.dom.addEventListener(`input`,()=>null),Tb(e)}function Cb(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function wb(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Tb(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Eb(e,t))})}function Eb(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Db(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Ob(e,t){!Eb(e,t)&&AS[t.type]&&(e.editable||!(t.type in jS))&&AS[t.type](e,t)}function kb(e){return{left:e.clientX,top:e.clientY}}function Ab(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function jb(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Mb(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function Nb(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&K.isSelectable(r)?(Mb(e,new K(n),`pointer`),!0):!1}function Pb(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof K&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(K.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(Mb(e,K.create(e.state.doc,i),`pointer`),!0)}function Fb(e,t,n,r,i){return jb(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Pb(e,n):Nb(e,n))}function Ib(e,t,n,r){return jb(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Lb(e,t,n,r){return jb(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Rb(e,n,r)}function Rb(e,t,n){if(n.button!=0)return!1;let r=zb(e,t,!0),i=e.state.doc;return r?(Mb(e,r,`pointer`),r instanceof G&&i.eq(e.state.doc)&&(e.input.mouseDown=new LS(e,r)),!0):!1}function zb(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?G.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return G.create(r,a+1,a+1+t.content.size);if(n&&K.isSelectable(t))return K.create(r,a)}return null}function Bb(e){return Kb(e)}function Vb(e,t){return e.composing?!0:Zx&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}function Hb(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}function Ub(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Kb(e),t))}function Wb(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Gb(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Lv(t.focusNode,t.focusOffset),r=Rv(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Kb(e,t=!1){if(!(tS&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Wb(e),t||e.docView&&e.docView.dirty){let n=Ay(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function qb(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}function Jb(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Yb(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xb(e,r.value,null,i,t):Xb(e,r.textContent,r.innerHTML,i,t)},50)}function Xb(e,t,n,r,i){let a=ub(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||U.empty)))return!0;if(!a)return!1;let o=Jb(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Zb(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}function Qb(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[VS]:!n}function $b(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(kb(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=ub(e,Zb(t.dataTransfer),zS?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&Qb(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||U.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Og(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&K.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new K(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(By(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}function ex(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}function tx(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e{let o=a-i-(n-e);for(let i=0;ia+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==YS?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=ox(rx(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;en&&a.to{let s=ix(e,t,o+n);if(s){a=!0;let e=ox(s,t,n+o+1,r);e!=YS&&i.push(o,o+t.nodeSize,e)}});let o=nx(a?ax(e):e,-n).sort(sx);for(let e=0;e0;)t++;e.splice(t,0,n)}function ux(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=YS&&t.push(r)}),e.cursorWrapper&&t.push(JS.create(e.state.doc,[e.cursorWrapper.deco])),XS.from(t)}function dx(e){if(!tC.has(e)&&(tC.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=qx,nC)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),nC=!0}}function fx(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Ix(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function px(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return fx(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?fx(e,n):null}function mx(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function hx(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function gx(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],Rx(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Yx&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Vh.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:_x,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function _x(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(Zx&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||Zx&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}function vx(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Ay(e,t);if(n&&!e.state.selection.eq(n)){if(Yx&&tS&&e.input.lastKeyCode===13&&Date.now()-100t(e,Vv(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=gx(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||tS)&&i.some(e=>e.nodeType==1&&!rC.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Vv(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof G&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=yx(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.frome.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Gx&&Kx<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((Qx&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.post(e,Vv(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&xx(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Vv(8,`Backspace`)))){tS&&Yx&&e.domObserver.suppressSelectionUpdates();return}Yx&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),tS&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Vv(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=yx(e,n.doc,l.sel);t&&!(Yx&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDeleteMy(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=bx(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function yx(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:By(e,t.resolve(n.anchor),t.resolve(n.head))}function bx(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;ee.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;en||Sx(o,!0,!1)0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Cx(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}function wx(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[GS.node(0,e.state.doc.content.size,t)]}function Tx(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:GS.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Ex(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Dx(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Ox(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function kx(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function Ax(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC=t((()=>{R_(),Qh(),f_(),jx=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Mx=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Nx=null,Px=function(e,t,n){let r=Nx||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Fx=function(){Nx=null},Ix=function(e,t,n,r){return n&&(Fv(e,t,n,r,-1)||Fv(e,t,n,r,1))},Lx=/^(img|br|input|textarea|hr)$/i,Rx=function(e){return e.focusNode&&Ix(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)},zx=typeof navigator<`u`?navigator:null,Bx=typeof document<`u`?document:null,Vx=zx&&zx.userAgent||``,Hx=/Edge\/(\d+)/.exec(Vx),Ux=/MSIE \d/.exec(Vx),Wx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vx),Gx=!!(Ux||Wx||Hx),Kx=Ux?document.documentMode:Wx?+Wx[1]:Hx?+Hx[1]:0,qx=!Gx&&/gecko\/(\d+)/i.test(Vx),qx&&+(/Firefox\/(\d+)/.exec(Vx)||[0,0])[1],Jx=!Gx&&/Chrome\/(\d+)/.exec(Vx),Yx=!!Jx,Xx=Jx?+Jx[1]:0,Zx=!Gx&&!!zx&&/Apple Computer/.test(zx.vendor),Qx=Zx&&(/Mobile\/\w+/.test(Vx)||!!zx&&zx.maxTouchPoints>2),$x=Qx||(zx?/Mac/.test(zx.platform):!1),eS=zx?/Win/.test(zx.platform):!1,tS=/Android \d/.test(Vx),nS=!!Bx&&`webkitFontSmoothing`in Bx.documentElement.style,rS=nS?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,iS=null,aS=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,oS=/[\u0590-\u08ac]/,sS=null,cS=null,lS=!1,uS=0,dS=1,fS=2,pS=3,mS=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=uS,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tjx(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;te||i instanceof bS){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof hS&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?jx(e.dom)+1:0}}else{let e,r=!0;for(;e=n=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=jx(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;es&&at){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r=n:en){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?fS:dS,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=pS:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?fS:pS}n=a}this.dirty=fS}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?fS:dS;t.dirty{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==uS&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},gS=class extends mS{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},_S=class e extends mS{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Xh.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&pS||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=pS&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=uS){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty0&&(a=ky(a,0,t,r));for(let e=0;e{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Xh.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=xy(u,r,n),l?c=new xS(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new yS(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>V.empty)}return e}matchesNode(e,t,n){return this.dirty==uS&&e.eq(this.node)&&Sy(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new wS(this,a&&a.node,e);Ey(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?H.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==fS)&&(a&&this.protectLocalComposition(e,a),_y(this.contentDOM,this.children,e),Qx&&Dy(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof G)||nt+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=Oy(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new gS(this,i,t,r);e.input.compositionNodes.push(a),this.children=ky(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==pS||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=uS}updateOuterDeco(e){if(Sy(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=yy(this.dom,this.nodeDOM,vy(this.outerDeco,this.node,t),vy(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}},yS=class e extends vS{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==pS||this.dirty!=uS&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=uS||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=uS,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=pS)}get domAtom(){return!1}isText(e){return this.node.text==e}},bS=class extends mS{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==uS&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},xS=class extends vS{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==pS)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}},SS=function(e){e&&(this.nodeName=e)},SS.prototype=Object.create(null),CS=[new SS],wS=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=wy(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n>1,o=Math.min(a,e.length);for(;i-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=_S.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Vb(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(tS&&Yx&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Qx&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Vv(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||cb(e,n)?n.preventDefault():Cb(e,`key`)},jS.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},jS.keypress=(e,t)=>{let n=t;if(Vb(e)||!n.charCode||n.ctrlKey&&!n.altKey||$x&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof G)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}},PS=$x?`metaKey`:`ctrlKey`,AS.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Bb(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Ab(n,e.input.lastClick)&&!n[PS]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(kb(n));o&&(a==`singleClick`?e.input.mouseDown=new IS(e,o,n,!!r):(a==`doubleClick`?Ib:Lb)(e,o.pos,o.inside,n)?n.preventDefault():Cb(e,`pointer`))},FS=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},IS=class extends FS{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[PS],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof K&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qx&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),Cb(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||My(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(kb(e))),this.updateAllowDefault(e),this.allowDefault||!t?Cb(this.view,`pointer`):Fb(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Zx&&this.mightDrag&&!this.mightDrag.node.isAtom||Yx&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Mb(this.view,W.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):Cb(this.view,`pointer`)}move(e){this.updateAllowDefault(e),Cb(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},LS=class extends FS{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),Cb(this.view,`pointer`);let t=this.view.posAtCoords(kb(e)),n=t&&zb(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from{e.input.lastTouch=Date.now(),Bb(e),Cb(e,`pointer`)},AS.touchmove=e=>{e.input.lastTouch=Date.now(),Cb(e,`pointer`)},AS.contextmenu=e=>Bb(e),RS=tS?5e3:-1,jS.compositionstart=jS.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof G&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Yx&&eS&&Hb(e)))e.markCursor=e.state.storedMarks||n.marks(),Kb(e,!0),e.markCursor=null;else if(Kb(e,!t.selection.empty),qx&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Ub(e,RS)},jS.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Ub(e,20))},zS=Gx&&Kx<15||Qx&&rS<604,AS.copy=jS.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=zS?null:n.clipboardData,{dom:o,text:s}=lb(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):qb(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))},jS.paste=(e,t)=>{let n=t;if(e.composing&&!tS)return;let r=zS?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Xb(e,Zb(r),r.getData(`text/html`),i,n)?n.preventDefault():Yb(e,n)},BS=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},VS=$x?`altKey`:`ctrlKey`,AS.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(kb(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof K?i.to-1:i.to))){if(r&&r.mightDrag)o=K.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=K.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=lb(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Yx||Xx>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(zS?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,zS||n.dataTransfer.setData(`text/plain`,c),e.dragging=new BS(l,Qb(e,n),o)},AS.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},jS.dragover=jS.dragenter=(e,t)=>t.preventDefault(),jS.drop=(e,t)=>{try{$b(e,t,e.dragging)}finally{e.dragging=null}},AS.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&My(e)},20))},AS.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},AS.beforeinput=(e,t)=>{if(Yx&&tS&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Vv(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in jS)AS[e]=jS[e];HS=class e{constructor(e,t){this.toDOM=e,this.spec=t||qS,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new GS(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ex(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},US=class e{constructor(e,t){this.attrs=e,this.spec=t||qS}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new GS(i,a,this)}valid(e,t){return t.from=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;ae){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==YS||e.maps.length==0?this:this.mapInner(e,t,0,0,n||qS)}mapInner(t,n,r,i,a){let o;for(let e=0;e{let o=t+r,s;if(s=ix(n,e,o)){for(i||=this.children.slice();aa&&n.to=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;ea&&t.type instanceof US){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;ee.map(t,n,qS));return e.from(r)}forChild(t,n){if(n.isLeaf)return JS.empty;let r=[];for(let i=0;ie instanceof JS)?t:t.reduce((e,t)=>e.concat(t instanceof JS?t:t.members),[]))}}forEachSet(e){for(let t=0;t{for(let e=0;ee.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():Zx&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),QS&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ZS)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vy(this.view)){if(this.suppressingSelectionUpdates)return My(this.view);if(Gx&&Kx<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ix(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Mx(n))t.add(n);for(let r=e.anchorNode;r;r=Mx(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Vy(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;ee.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Yx&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(qx&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||mx(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||r)&&(i>-1&&(e.docView.markDirty(i,a),dx(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,hx(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||My(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;nvx(this,e,t,n,r)),this.domObserver.start(),Sb(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Tb(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ax),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Wb(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Ox(this);kx(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Tb(this),this.editable=Ex(this),Tx(this);let o=ux(this),s=wx(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Jv(this);if(i){this.domObserver.stop();let t=l&&(Gx||Yx)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Dx(n.selection,e.selection);if(l){let n=Yx?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Gb(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=gy(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Uy(this)&&i.delaySelUpdate())?My(this,t):(Ry(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Xv(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof K){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&qv(this,t.getBoundingClientRect(),e)}else qv(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e0&&ee.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return oy(this,e)}coordsAtPos(e,t=1){return ly(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return hy(this,t||this.state,e)}pasteHTML(e,t){return Xb(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Xb(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return lb(this,e)}destroy(){this.docView&&(wb(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ux(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Fx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ob(this,e)}domSelectionRange(){let e=this.domSelection();return e?Zx&&this.root.nodeType===11&&Hv(this.dom.ownerDocument)==this.dom&&px(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}},iC.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}})),oC=t((()=>{aC()}));function sC(e){var t=!(uC&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||dC&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?lC:cC)[e.keyCode]||e.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}var cC,lC,uC,dC,fC,pC=t((()=>{for(cC={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},lC={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},uC=typeof navigator<`u`&&/Mac/.test(navigator.platform),dC=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),fC=0;fC<10;fC++)cC[48+fC]=cC[96+fC]=String(fC);for(fC=1;fC<=24;fC++)cC[fC+111]=`F`+fC;for(fC=65;fC<=90;fC++)cC[fC]=String.fromCharCode(fC+32),lC[fC]=String.fromCharCode(fC);for(var e in cC)lC.hasOwnProperty(e)||(lC[e]=cC[e])}));function mC(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e{pC(),R_(),yC=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),bC=typeof navigator<`u`&&/Win/.test(navigator.platform)})),SC=t((()=>{xC()}));function CC(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}function wC(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function TC(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function EC(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:TC(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function DC(e,t,n={}){return e.find(e=>e.type===t&&EC(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function OC(e,t,n={}){return!!DC(e,t,n)}function kC(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!DC([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&OC([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`${e}`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return FT(n)}function RC(e,t,n){if(e instanceof Nh||e instanceof V)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return V.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),RC(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Bh({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Vh.fromSchema(a).parseSlice(LC(e),n.parseOptions):Vh.fromSchema(a).parse(LC(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Vh.fromSchema(t);return n.slice?r.parseSlice(LC(e),n.parseOptions).content:r.parse(LC(e),n.parseOptions)}return RC(``,t,n)}function zC(e,t,n){let r=e.steps.length-1;if(r{o===0&&(o=r)}),e.setSelection(W.near(e.doc.resolve(o),n))}function BC(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function VC(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>EC(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}function UC(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function WC(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}function GC(e,t,n={},r={}){return RC(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function KC(e,t){let n=AC(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function qC(e,t){let n=new d_(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function JC(e){for(let t=0;t{n(e)&&r.push({node:e,pos:t})}),r}function XC(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function ZC(e){return t=>XC(t.$from,e)}function q(e,t,n){return e.config[t]===void 0&&e.parent?q(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?q(e.parent,t,n):null}):e.config[t]}function QC(e){return e.map(e=>{let t=q(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...QC(t())]:e}).flat(10)}function $C(e,t){let n=Xh.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function ew(e){return typeof e==`function`}function J(e,t=void 0,...n){return ew(e)?t?e.bind(t)(...n):e(...n):e}function tw(e={}){return Object.keys(e).length===0&&e.constructor===Object}function nw(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function rw(e){let t=[],{nodeExtensions:n,markExtensions:r}=nw(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=q(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=q(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function iw(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function aw(e){let t=[],n=iw(e||``),r=n.length;for(let e=0;e!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...aw(n[e]),...aw(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function ow(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Y(e,t),{})}function sw(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function cw(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):sw(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function lw(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&tw(t)?!1:t!=null))}function uw(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function dw(e,t){let n=rw(e),{nodeExtensions:r,markExtensions:i}=nw(e);return new Bh({topNode:r.find(e=>q(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=lw({...e.reduce((e,t)=>{let n=q(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:J(q(r,`content`,a)),marks:J(q(r,`marks`,a)),group:J(q(r,`group`,a)),inline:J(q(r,`inline`,a)),atom:J(q(r,`atom`,a)),selectable:J(q(r,`selectable`,a)),draggable:J(q(r,`draggable`,a)),code:J(q(r,`code`,a)),whitespace:J(q(r,`whitespace`,a)),linebreakReplacement:J(q(r,`linebreakReplacement`,a)),defining:J(q(r,`defining`,a)),isolating:J(q(r,`isolating`,a)),attrs:Object.fromEntries(i.map(uw))}),s=J(q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>cw(e,i)));let c=q(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:ow(e,i)}));let l=q(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=lw({...e.reduce((e,t)=>{let n=q(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:J(q(r,`inclusive`,a)),excludes:J(q(r,`excludes`,a)),group:J(q(r,`group`,a)),spanning:J(q(r,`spanning`,a)),code:J(q(r,`code`,a)),attrs:Object.fromEntries(i.map(uw))}),s=J(q(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>cw(e,i)));let c=q(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:ow(e,i)})),[r.name,o]}))})}function fw(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function pw(e){return e.sort((e,t)=>{let n=q(e,`priority`)||100,r=q(t,`priority`)||100;return n>r?-1:+(ne.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function hw(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=` + +`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function gw(e,t){return hw(e,{from:0,to:e.content.size},t)}function _w(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function vw(e,t){let n=wC(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function yw(e,t){let n=UC(typeof t==`string`?t:t.name,e.schema);return n===`node`?vw(e,t):n===`mark`?KC(e,t):{}}function bw(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function xw(e){let t=bw(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Sw(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),xw(r)}function Cw(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=kC(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function ww(e,t){return t.nodes[e]||t.marks[e]||null}function Tw(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}function Ew(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?AC(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>EC(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>EC(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Dw(e,t,n={}){if(!t)return HC(e,null,n)||Ew(e,null,n);let r=UC(t,e.schema);return r===`node`?HC(e,t,n):r===`mark`?Ew(e,t,n):!1}function Ow(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function kw(e,t){let{nodeExtensions:n}=nw(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=J(q(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function Aw(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Aw(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function jw(e){return e instanceof K}function Mw(e,t){let n=t.mapping.mapResult(e.position);return{position:new uE(n.pos),mapResult:n}}function Nw(e){return new uE(e)}function Pw(e,t,n){let{selection:r}=t,i=null;if(jC(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}function Fw(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}function Iw(e){return!e||e===`1`?null:e}function Lw(e,t){return Iw(e)===Iw(t)}function Rw(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return G.between(r,i)}function zw(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof K){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function Bw(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function Vw(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}function Hw(e){return typeof e==`number`}function Uw(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ww(e){return Uw(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function Gw(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([\w-]+)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([\w-]+)/g,``).replace(/(?:^|\s)#([\w-]+)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Kw(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function qw(e){let{nodeName:t,name:n,parseAttributes:r=Gw,serializeAttributes:i=Kw,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function Jw(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Gw,serializeAttributes:a=Kw,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``} + +${t.renderChildren(e.content||[],` + +`)} + +:::`}}}function Yw(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function Xw(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function Zw(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Yw,serializeAttributes:a=Xw,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function Qw(e,t,n){let r=e.split(` +`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o0)break;if(e.trim()===``){o+=1,a=`${a}${e} +`;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e} +`;let f=[d];for(o+=1;oe.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e} +`,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e} +`,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(` +`);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function $w(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(` +`).map(e=>e?t.indent(e):t.indent(``)).join(` +`);s+=e.type===`paragraph`?` + +${n}`:` +${n}`}}),s}function eT(e,t){let n={...e};return Ww(e)&&Ww(t)&&Object.keys(t).forEach(r=>{Ww(t[r])&&Ww(e[r])?n[r]=eT(e[r],t[r]):n[r]=t[r]}),n}function tT(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}function nT(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=sE(c)+i;return a.forEach(e=>{if(l)return;let a=IE(u,e.find);if(!a)return;let c=s.state.tr,d=CC({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new pT({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function rT(e){let{editor:t,rules:n}=e,r=new F_({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:$C(V.from(e),a.schema);let{from:i}=s;nT({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return nT({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&nT({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?nT({editor:t,from:a.pos,to:a.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function iT(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new pT({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||BE(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}function aT(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!iT({editor:t,state:CC({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new F_({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(VE=t)},i=()=>{VE&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=VE;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:$C(V.from(t),r.schema);let{from:n}=d,i=n+t.length,a=HE(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!Hw(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}function oT(e){return new FE({find:e.find,handler:({state:t,range:n,match:r})=>{let i=J(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Cw(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;ln.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function sT(e){return new FE({find:e.find,handler:({state:t,range:n,match:r})=>{let i=J(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function cT(e){return new FE({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=J(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function lT(e){return new FE({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=J(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&ug(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Sg(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}function uT(e){return new zE({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=J(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Cw(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;dn.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var dT,fT,pT,mT,hT,gT,_T,vT,yT,bT,xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,X,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD,iD,aD,oD,sD,cD=t((()=>{p_(),Cv(),wv(),Tv(),Pv(),oC(),SC(),dT=Object.defineProperty,fT=(e,t)=>{for(var n in t)dT(e,n,{get:t[n],enumerable:!0})},pT=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:CC({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},mT={},fT(mT,{blur:()=>hT,clearContent:()=>gT,clearNodes:()=>_T,command:()=>vT,createParagraphNear:()=>yT,cut:()=>bT,deleteCurrentNode:()=>xT,deleteNode:()=>ST,deleteRange:()=>CT,deleteSelection:()=>DT,enter:()=>OT,exitCode:()=>kT,extendMarkRange:()=>AT,first:()=>jT,focus:()=>MT,forEach:()=>NT,insertContent:()=>PT,insertContentAt:()=>LT,joinBackward:()=>BT,joinDown:()=>zT,joinForward:()=>VT,joinItemBackward:()=>HT,joinItemForward:()=>UT,joinTextblockBackward:()=>WT,joinTextblockForward:()=>GT,joinUp:()=>RT,keyboardShortcut:()=>KT,lift:()=>qT,liftEmptyBlock:()=>JT,liftListItem:()=>YT,newlineInCode:()=>XT,resetAttributes:()=>ZT,scrollIntoView:()=>QT,selectAll:()=>$T,selectNodeBackward:()=>eE,selectNodeForward:()=>tE,selectParentNode:()=>nE,selectTextblockEnd:()=>rE,selectTextblockStart:()=>iE,setContent:()=>aE,setMark:()=>dE,setMeta:()=>fE,setNode:()=>pE,setNodeSelection:()=>mE,setTextDirection:()=>hE,setTextSelection:()=>gE,sinkListItem:()=>_E,splitBlock:()=>vE,splitListItem:()=>yE,toggleList:()=>SE,toggleMark:()=>CE,toggleNode:()=>wE,toggleWrap:()=>TE,undoInputRule:()=>EE,unsetAllMarks:()=>DE,unsetMark:()=>OE,unsetTextDirection:()=>kE,updateAttributes:()=>AE,wrapIn:()=>jE,wrapInList:()=>ME}),hT=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),gT=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),_T=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=cg(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},vT=e=>t=>e(t),yT=()=>({state:e,dispatch:t})=>dv(e,t),bT=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new G(r.doc.resolve(Math.max(o-1,0)))),!0},xT=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1},ST=e=>({tr:t,state:n,dispatch:r})=>{let i=wC(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},CT=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},wT=e=>e.content?/^text(\*|\+)/.test(e.content):!1,TT=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos({from:TT(e,n,`left`),to:TT(t,n,`right`)}),DT=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:a}=ET(n,r,e.schema);return t&&(e.tr.deleteRange(i,a).scrollIntoView(),t(e.tr)),!0},OT=()=>({commands:e})=>e.keyboardShortcut(`Enter`),kT=()=>({state:e,dispatch:t})=>uv(e,t),AT=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=AC(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=kC(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=G.create(o,e.from,e.to);n.setSelection(t)}}return!0},jT=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(FC()||PC())&&r.dom.focus(),IC()&&!FC()&&!PC()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!jC(n.state.selection))return o(),!0;let s=NC(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},NT=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),PT=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),FT=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&FT(r)}return e},IT=e=>!(`type`in e),LT=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{RC(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=RC(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((IT(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof V){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&zC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},RT=()=>({state:e,dispatch:t})=>ov(e,t),zT=()=>({state:e,dispatch:t})=>sv(e,t),BT=()=>({state:e,dispatch:t})=>ev(e,t),VT=()=>({state:e,dispatch:t})=>iv(e,t),HT=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Tg(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},UT=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Tg(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},WT=()=>({state:e,dispatch:t})=>tv(e,t),GT=()=>({state:e,dispatch:t})=>nv(e,t),KT=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=VC(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0},qT=(e,t={})=>({state:n,dispatch:r})=>HC(n,wC(e,n.schema),t)?cv(n,r):!1,JT=()=>({state:e,dispatch:t})=>fv(e,t),YT=e=>({state:t,dispatch:n})=>kv(wC(e,t.schema))(t,n),XT=()=>({state:e,dispatch:t})=>lv(e,t),ZT=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=UC(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=wC(e,r.schema)),s===`mark`&&(o=AC(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,WC(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(WC(a.attrs,t))))})})}),c},QT=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),$T=()=>({tr:e,dispatch:t})=>{if(t){let t=new T_(e.doc);e.setSelection(t)}return!0},eE=()=>({state:e,dispatch:t})=>rv(e,t),tE=()=>({state:e,dispatch:t})=>av(e,t),nE=()=>({state:e,dispatch:t})=>mv(e,t),rE=()=>({state:e,dispatch:t})=>_v(e,t),iE=()=>({state:e,dispatch:t})=>gv(e,t),aE=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=GC(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})},oE=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},sE=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n},cE=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=ZC(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)},uE=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}},dE=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=AC(e,r.schema);if(i)if(o){let e=KC(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Pw(r,n,c)},fE=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),pE=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=wC(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>Z_(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>Z_(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},mE=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=MC(e,0,n.content.size),i=K.create(n,r);t.setSelection(i)}return!0},hE=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},gE=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=G.atStart(n).from,o=G.atEnd(n).to,s=MC(r,a,o),c=MC(i,a,o),l=G.create(n,s,c);t.setSelection(l)}return!0},_E=e=>({state:t,dispatch:n})=>Mv(wC(e,t.schema))(t,n),vE=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Tw(l,s.node().type.name,s.node().attrs);if(a instanceof K&&a.node.isBlock)return!s.parentOffset||!bg(o,s.pos)?!1:(r&&(e&&Fw(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:JC(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=bg(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&bg(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof G&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&Fw(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},yE=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=wC(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=V.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=V.from(s.node(t).copy(e));let i=s.indexAfter(-1){if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(G.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Tw(d,u.type.name,u.attrs),...t},m={...Tw(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!bg(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},bE=(e,t)=>{let n=ZC(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Sg(e.doc,n.pos))||!Lw(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},xE=(e,t)=>{let n=ZC(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&Sg(e.doc,r))||!Lw(n.node.attrs.type,i?.attrs.type)||e.join(r),!0},SE=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=wC(e,o.schema),m=wC(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=ZC(e=>kw(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,ee=S&&w&&kw(w.type.name,d)?{node:w,pos:0,depth:0}:null,T=x??ee,E=!!x&&y.depth>=1&&y.depth-x.depth<=1,D=!!ee;if((E||D)&&T){if(T.node.type===p)return S&&D?c().command(({tr:e,dispatch:t})=>{let n=Rw(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(kw(T.node.type.name,d)&&p.validContent(T.node.content))return c().command(()=>(a.setNodeMarkup(T.pos,p),!0)).command(()=>bE(a,p)).command(()=>xE(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>bE(a,p)).command(()=>xE(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>bE(a,p)).command(()=>xE(a,p)).run()},CE=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=AC(e,r.schema);return Ew(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},wE=(e,t,n={})=>({state:r,commands:i})=>{let a=wC(e,r.schema),o=wC(t,r.schema),s=HC(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},TE=(e,t={})=>({state:n,commands:r})=>{let i=wC(e,n.schema);return HC(n,i,t)?r.lift(i):r.wrapIn(i,t)},EE=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},DE=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},OE=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=AC(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=kC(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},kE=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},AE=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=UC(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=wC(e,r.schema)),s===`mark`&&(o=AC(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},jE=(e,t={})=>({state:n,dispatch:r})=>X_(wC(e,n.schema),t)(n,r),ME=(e,t={})=>({state:n,dispatch:r})=>Ev(wC(e,n.schema),t)(n,r),NE=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},PE={},fT(PE,{createAtomBlockMarkdownSpec:()=>qw,createBlockMarkdownSpec:()=>Jw,createInlineMarkdownSpec:()=>Zw,parseAttributes:()=>Gw,parseIndentedBlocks:()=>Qw,renderNestedMarkdownContent:()=>$w,serializeAttributes:()=>Kw}),FE=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},IE=(e,t)=>{if(TC(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r},LE=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...J(q(this,`addOptions`,{name:this.name}))}}get storage(){return{...J(q(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>eT(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},RE=class e extends LE{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},zE=class{constructor(e){this.find=e.find,this.handler=e.handler}},BE=(e,t,n)=>{if(TC(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]},VE=null,HE=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n},UE=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=mw(e),this.schema=dw(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=q(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:ww(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return pw([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ww(t.name,this.schema)},r=[],i=q(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&q(t,`exitable`,n)&&(a.ArrowRight=()=>RE.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=_C(a);r.push(o);let s=q(t,`addInputRules`,n);if(Ow(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=rT({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=q(t,`addPasteRules`,n);if(Ow(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=aT({editor:e,rules:t});r.push(...n)}}let l=q(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return rw(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=nw(this.extensions);return Object.fromEntries(t.filter(e=>!!q(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=q(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:wC(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:ow(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return pw([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ww(n.name,this.schema)},i=q(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return pw([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ww(n.name,this.schema)},i=q(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=nw(this.extensions);return Object.fromEntries(t.filter(e=>!!q(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=q(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:AC(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=ow(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{tT(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ww(e.name,this.schema)};e.type===`mark`&&((J(q(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(J(q(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=q(e,`onBeforeCreate`,t),r=q(e,`onCreate`,t),i=q(e,`onUpdate`,t),a=q(e,`onSelectionUpdate`,t),o=q(e,`onTransaction`,t),s=q(e,`onFocus`,t),c=q(e,`onBlur`,t),l=q(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}},UE.resolve=mw,UE.sort=pw,UE.flatten=QC,WE={},fT(WE,{ClipboardTextSerializer:()=>GE,Commands:()=>KE,Delete:()=>qE,Drop:()=>JE,Editable:()=>YE,FocusEvents:()=>ZE,Keymap:()=>QE,Paste:()=>$E,Tabindex:()=>eD,TextDirection:()=>tD,focusEventsPluginKey:()=>XE}),X=class e extends LE{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},GE=X.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new F_({key:new L_(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=_w(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>hw(r,{from:e.pos,to:t.pos},s)).join(o??` + +`)}}})]}}),KE=X.create({name:`commands`,addCommands(){return{...mT}}}),qE=X.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=qC(e.before,[e,...t]);Sw(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof n_){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),JE=X.create({name:`drop`,addProseMirrorPlugins(){return[new F_({key:new L_(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),YE=X.create({name:`editable`,addProseMirrorPlugins(){return[new F_({key:new L_(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),XE=new L_(`focusEvents`),ZE=X.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new F_({key:XE,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),QE=X.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:W.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return FC()||BC()?i:r},addProseMirrorPlugins(){return[new F_({key:new L_(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=W.atStart(t.doc).from,l=W.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!Aw(n.doc))return;let u=n.tr,d=CC({state:n,transaction:u}),{commands:f}=new pT({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),$E=X.create({name:`paste`,addProseMirrorPlugins(){return[new F_({key:new L_(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),eD=X.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new F_({key:new L_(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),tD=X.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=nw(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new F_({key:new L_(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),nD=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},rD=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`,iD=class extends NE{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Mw,createMappablePosition:Nw},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=NC(t,this.options.autofocus);this.editorState=P_.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=Bw(rD,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=ew(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[YE,GE.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),KE,ZE,QE,eD.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),JE,$E,qE,tD.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new UE(e,this)}createCommandManager(){this.commandManager=new pT({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=GC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=GC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new iC(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return yw(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Dw(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $C(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` + +`,textSerializers:n={}}=e||{};return gw(this.state.doc,{blockSeparator:t,textSerializers:{..._w(this.schema),...n}})}get isEmpty(){return Aw(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new nD(t,this,!1,n)}get $doc(){return this.$pos(0)}},aD=e=>`touches`in e,oD=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,aD(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return rthis.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},sD=class e extends LE{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}}})),lD,uD=t((()=>{lD=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]}})),dD=t((()=>{uD()}));function fD(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=fD(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function pD(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;ee.depth)throw new $D(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new $D(`Inconsistent open depths`);return yD(e,t,n,0)}function yD(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function CD(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(SD(e.nodeAfter,r),a++));for(let e=a;ei&&xD(e,t,i+1),o=r.depth>i&&xD(n,r,i+1),s=[];return CD(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(bD(a,o),SD(wD(a,TD(e,t,n,r,i+1)),s)):(a&&SD(wD(a,ED(e,t,i+1)),s),CD(t,n,i,s),o&&SD(wD(o,ED(n,r,i+1)),s)),CD(r,null,i,s),new XD(s)}function ED(e,t,n){let r=[];return CD(null,e,n,r),e.depth>n&&SD(wD(xD(e,t,n+1),ED(e,t,n+1)),r),CD(t,null,n,r),new XD(r)}function DD(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(XD.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}function OD(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function kD(e){let t=[];do t.push(AD(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function AD(e){let t=[];do t.push(jD(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function jD(e){let t=FD(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=ND(e,t);else break;return t}function MD(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function ND(e,t){let n=MD(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:MD(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function PD(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function FD(e){if(e.eat(`(`)){let t=kD(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=PD(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function ID(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new cO(r.indexOf(e.length-1)>-1);for(let e=0;e0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function KD(e){!NO&&!e.parent.inlineContent&&(NO=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}function qD(e,t,n,r,i,a=!1){if(t.inlineContent)return PO.create(e,n);for(let o=r-(i>0?0:1);i>0?o=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=qD(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&IO.isSelectable(r))return IO.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function JD(e,t,n){let r=e.steps.length-1;if(r{o??=r}),e.setSelection(jO.near(e.doc.resolve(o),n))}function YD(e,t){return!t||!e?e:e.bind(t)}var XD,ZD,QD,$D,eO,tO,nO,rO,iO,aO,oO,sO,cO,lO,uO,dO,fO,pO,mO,hO,gO,_O,vO,yO,bO,xO,SO,CO,wO,TO,EO,DO,OO,kO,AO,jO,MO,NO,PO,FO,IO,LO,RO,zO,BO,VO,HO,UO,WO=t((()=>{cD(),dD(),XD=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;te&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);at)for(let e=0,a=0;at&&((an)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?mD(t+1,i):mD(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;ethis.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;te.type.rank-t.type.rank),n}},QD.none=[],$D=class extends Error{},eO=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=_D(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(gD(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(XD.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}},eO.empty=new eO(XD.empty,0,0),tO=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new aO(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=iO.get(t);if(r)for(let e=0;ee&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),OD(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=XD.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;ee.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=XD.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}},sO.prototype.text=void 0,cO=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new lO(t,n);if(r.next==null)return e.empty;let i=kD(r);r.next&&r.err(`Unexpected trailing text`);let a=zD(ID(i));return BD(a,r),a}matchType(e){for(let t=0;te.createAndFill()));for(let e=0;e=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n`+e.indexOf(t.next[n].next);return r}).join(` +`)}},cO.empty=new cO(!0),lO=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}},uO=65535,dO=2**16,fO=1,pO=2,mO=4,hO=8,gO=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&hO)>0}get deletedBefore(){return(this.delInfo&(fO|mO))>0}get deletedAfter(){return(this.delInfo&(pO|mO))>0}get deletedAcross(){return(this.delInfo&mO)>0}},_O=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=HD(e);if(!this.inverted)for(let e=0;ee)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:VD(o/3,e-s),f=e==s?pO:e==u?fO:mO;return(t<0?e!=s:e!=u)&&(f|=hO),new gO(a,f,d)}r+=l-c}return n?e+r:new gO(e+r,0,null)}touches(e,t){let n=0,r=HD(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;te)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return bO.fromReplace(e,this.from,this.to,i)}invert(){return new SO(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}},yO.jsonID(`addMark`,xO),SO=class e extends yO{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new eO(WD(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return bO.fromReplace(e,this.from,this.to,n)}invert(){return new xO(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}},yO.jsonID(`removeMark`,SO),CO=class e extends yO{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return bO.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return bO.fromReplace(e,this.pos,this.pos+1,new eO(XD.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;rr.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,eO.fromJSON(t,n.slice),n.insert,!!n.structure)}},yO.jsonID(`replaceAround`,EO),DO=class e extends yO{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return bO.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return bO.fromReplace(e,this.pos,this.pos+1,new eO(XD.from(r),0,+!t.isLeaf))}getMap(){return _O.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}},yO.jsonID(`attr`,DO),OO=class e extends yO{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return bO.ok(n)}getMap(){return _O.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}},yO.jsonID(`docAttr`,OO),kO=class extends Error{},kO=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},kO.prototype=Object.create(Error.prototype),kO.prototype.constructor=kO,kO.prototype.name=`TransformError`,AO=Object.create(null),jO=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new MO(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;r--){let i=t<0?qD(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):qD(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new RO(e.node(0))}static atStart(e){return qD(e,e,0,0,1)||new RO(e)}static atEnd(e){return qD(e,e,e.content.size,e.childCount,-1)||new RO(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=AO[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in AO)throw RangeError(`Duplicate use of selection JSON ID `+e);return AO[e]=t,t.prototype.jsonID=e,t}getBookmark(){return PO.between(this.$anchor,this.$head).getBookmark()}},jO.prototype.visible=!0,MO=class{constructor(e,t){this.$from=e,this.$to=t}},NO=!1,PO=class e extends jO{constructor(e,t=e){KD(e),KD(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return jO.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=eO.empty){if(super.replace(e,t),t==eO.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new FO(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=jO.findFrom(n,r,!0)||jO.findFrom(n,-r,!0);if(e)n=e.$head;else return jO.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(jO.findFrom(t,-r,!0)||jO.findFrom(t,r,!0)).$anchor,t.pos{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(PO.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},HO=/^\s*>\s$/,UO=sD.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return lD(`blockquote`,{...Y(this.options.HTMLAttributes,e),children:lD(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(` +`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(` +`))}),n.join(` +> +`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>VO(this.editor,this.type)}},addInputRules(){return[lT({find:HO,type:this.type})]}})})),GO,KO,qO,JO,YO,XO=t((()=>{cD(),dD(),GO=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,KO=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,qO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,JO=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,YO=RE.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return lD(`strong`,{...Y(this.options.HTMLAttributes,e),children:lD(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:``,close:``}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[oT({find:GO,type:this.type}),oT({find:qO,type:this.type})]},addPasteRules(){return[uT({find:KO,type:this.type}),uT({find:JO,type:this.type})]}})})),ZO,QO,$O,ek=t((()=>{cD(),ZO=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},QO=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},$O=RE.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,Y(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[oT({find:ZO,type:this.type})]},addPasteRules(){return[uT({find:QO,type:this.type})]}})})),tk,nk,rk,ik,ak=t((()=>{cD(),wv(),tk=4,nk=/^```([a-z]+)?[\s\n]$/,rk=/^~~~([a-z]+)?[\s\n]$/,ik=sD.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:tk,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,Y(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(` +`):`\`\`\`${r} + +\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??tk,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,` +`,` +`).split(` +`).map(e=>o+e).join(` +`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??tk,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,` +`,` +`).split(` +`),c=0,l=0,u=r-a;for(let e=0;e=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,` +`,` +`).split(` +`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(` +`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(W.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[cT({find:nk,type:this.type,getAttributes:e=>({language:e[1]})}),cT({find:rk,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new F_({key:new L_(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,` +`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(G.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}})})),ok,sk=t((()=>{cD(),ok=sD.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` + +`):``})})),ck,lk=t((()=>{cD(),ck=sD.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,Y(this.options.HTMLAttributes,e)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})})),uk,dk=t((()=>{cD(),uk=sD.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Y(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>cT({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}})})),fk,pk=t((()=>{cD(),wv(),fk=sD.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,Y(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!zw(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return jw(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(G.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(K.create(t.doc,n.pos)):t.setSelection(G.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(G.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[sT({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}})})),mk,hk,gk,_k,vk,yk=t((()=>{cD(),mk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,hk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,gk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,_k=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vk=RE.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,Y(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:``,close:``}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[oT({find:mk,type:this.type}),oT({find:gk,type:this.type})]},addPasteRules(){return[uT({find:hk,type:this.type}),uT({find:_k,type:this.type})]}})}));function bk(e,t){return e in t||(t[e]=[]),t[e]}function xk(e,t,n){t[Uk]&&(t[Kk]=!0,t[qk]=!0),t[Wk]&&(t[Kk]=!0,t[Gk]=!0),t[Kk]&&(t[qk]=!0),t[Gk]&&(t[qk]=!0),t[qk]&&(t[Jk]=!0),t[Yk]&&(t[Jk]=!0);for(let r in t){let t=bk(r,n);t.indexOf(e)<0&&t.push(e)}}function Sk(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Ck(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}function wk(e=[]){let t={};Ck.groups=t;let n=new Ck;pj??=Ok(Vk),mj??=Ok(Hk),Q(n,`'`,AA),Q(n,`{`,pA),Q(n,`}`,mA),Q(n,`[`,hA),Q(n,`]`,gA),Q(n,`(`,_A),Q(n,`)`,vA),Q(n,`<`,yA),Q(n,`>`,bA),Q(n,`(`,xA),Q(n,`)`,SA),Q(n,`「`,CA),Q(n,`」`,wA),Q(n,`『`,TA),Q(n,`』`,EA),Q(n,`<`,DA),Q(n,`>`,OA),Q(n,`&`,kA),Q(n,`*`,jA),Q(n,`@`,MA),Q(n,"`",PA),Q(n,`^`,FA),Q(n,`:`,IA),Q(n,`,`,LA),Q(n,`$`,RA),Q(n,`.`,zA),Q(n,`=`,BA),Q(n,`!`,VA),Q(n,`-`,HA),Q(n,`%`,UA),Q(n,`|`,WA),Q(n,`+`,GA),Q(n,`#`,KA),Q(n,`?`,qA),Q(n,`"`,JA),Q(n,`/`,ZA),Q(n,`;`,XA),Q(n,`~`,QA),Q(n,`_`,$A),Q(n,`\\`,NA),Q(n,`・`,YA);let r=$k(n,oj,uA,{[Uk]:!0});$k(r,oj,r);let i=$k(r,rj,rA,{[Kk]:!0}),a=$k(r,ij,iA,{[qk]:!0}),o=$k(n,rj,tA,{[Wk]:!0});$k(o,oj,i),$k(o,rj,o),$k(i,oj,i),$k(i,rj,i);let s=$k(n,ij,nA,{[Gk]:!0});$k(s,rj),$k(s,oj,a),$k(s,ij,s),$k(a,oj,a),$k(a,rj),$k(a,ij,a);let c=Q(n,lj,fA,{[Qk]:!0}),l=Q(n,cj,dA,{[Qk]:!0}),u=$k(n,sj,dA,{[Qk]:!0});Q(n,fj,u),Q(l,lj,c),Q(l,fj,u),$k(l,sj,u),Q(u,cj),Q(u,lj),$k(u,sj,u),Q(u,fj,u);let d=$k(n,aj,ej,{[Yk]:!0});Q(d,`#`),$k(d,aj,d),Q(d,uj,d);let f=Q(d,dj);Q(f,`#`),$k(f,aj,d);let p=[[rj,o],[oj,i]],m=[[rj,null],[ij,s],[oj,a]];for(let e=0;ee[0]>t[0]?1:-1);for(let t=0;t=0?i[Jk]=!0:rj.test(r)?oj.test(r)?i[Kk]=!0:i[Wk]=!0:i[Uk]=!0,eA(n,r,r,i)}return eA(n,`localhost`,aA,{ascii:!0}),n.jd=new Ck(tj),{start:n,tokens:Object.assign({groups:t},nj)}}function Tk(e,t){let n=Ek(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function Ek(e){let t=[],n=e.length,r=0;for(;r56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function Dk(e,t,n,r,i){let a,o=t.length;for(let n=0;n=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}function kk(e,t=null){let n=Object.assign({},hj);e&&(n=Object.assign(n,e instanceof kk?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e=0&&f++,i++,u++;if(f<0)i-=u,i0&&(a.push(Fk(_j,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(Fk(e,t,r))}}return o.length>0&&a.push(Fk(_j,t,o)),a}function Fk(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}function Ik(){return Ck.groups={},Cj.scanner=null,Cj.parser=null,Cj.tokenQueue=[],Cj.pluginQueue=[],Cj.customSchemes=[],Cj.initialized=!1,Cj}function Lk(e,t=!1){if(Cj.initialized&&xj(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Sj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);Cj.customSchemes.push([e,t])}function Rk(){Cj.scanner=wk(Cj.customSchemes);for(let e=0;e{Vk=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,Hk=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,Uk=`numeric`,Wk=`ascii`,Gk=`alpha`,Kk=`asciinumeric`,qk=`alphanumeric`,Jk=`domain`,Yk=`emoji`,Xk=`scheme`,Zk=`slashscheme`,Qk=`whitespace`,Ck.groups={},Ck.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;ne.ta(t,n,r,i),$k=(e,t,n,r,i)=>e.tr(t,n,r,i),eA=(e,t,n,r,i)=>e.ts(t,n,r,i),Q=(e,t,n,r,i)=>e.tt(t,n,r,i),tA=`WORD`,nA=`UWORD`,rA=`ASCIINUMERICAL`,iA=`ALPHANUMERICAL`,aA=`LOCALHOST`,oA=`TLD`,sA=`UTLD`,cA=`SCHEME`,lA=`SLASH_SCHEME`,uA=`NUM`,dA=`WS`,fA=`NL`,pA=`OPENBRACE`,mA=`CLOSEBRACE`,hA=`OPENBRACKET`,gA=`CLOSEBRACKET`,_A=`OPENPAREN`,vA=`CLOSEPAREN`,yA=`OPENANGLEBRACKET`,bA=`CLOSEANGLEBRACKET`,xA=`FULLWIDTHLEFTPAREN`,SA=`FULLWIDTHRIGHTPAREN`,CA=`LEFTCORNERBRACKET`,wA=`RIGHTCORNERBRACKET`,TA=`LEFTWHITECORNERBRACKET`,EA=`RIGHTWHITECORNERBRACKET`,DA=`FULLWIDTHLESSTHAN`,OA=`FULLWIDTHGREATERTHAN`,kA=`AMPERSAND`,AA=`APOSTROPHE`,jA=`ASTERISK`,MA=`AT`,NA=`BACKSLASH`,PA=`BACKTICK`,FA=`CARET`,IA=`COLON`,LA=`COMMA`,RA=`DOLLAR`,zA=`DOT`,BA=`EQUALS`,VA=`EXCLAMATION`,HA=`HYPHEN`,UA=`PERCENT`,WA=`PIPE`,GA=`PLUS`,KA=`POUND`,qA=`QUERY`,JA=`QUOTE`,YA=`FULLWIDTHMIDDLEDOT`,XA=`SEMI`,ZA=`SLASH`,QA=`TILDE`,$A=`UNDERSCORE`,ej=`EMOJI`,tj=`SYM`,nj=Object.freeze({__proto__:null,ALPHANUMERICAL:iA,AMPERSAND:kA,APOSTROPHE:AA,ASCIINUMERICAL:rA,ASTERISK:jA,AT:MA,BACKSLASH:NA,BACKTICK:PA,CARET:FA,CLOSEANGLEBRACKET:bA,CLOSEBRACE:mA,CLOSEBRACKET:gA,CLOSEPAREN:vA,COLON:IA,COMMA:LA,DOLLAR:RA,DOT:zA,EMOJI:ej,EQUALS:BA,EXCLAMATION:VA,FULLWIDTHGREATERTHAN:OA,FULLWIDTHLEFTPAREN:xA,FULLWIDTHLESSTHAN:DA,FULLWIDTHMIDDLEDOT:YA,FULLWIDTHRIGHTPAREN:SA,HYPHEN:HA,LEFTCORNERBRACKET:CA,LEFTWHITECORNERBRACKET:TA,LOCALHOST:aA,NL:fA,NUM:uA,OPENANGLEBRACKET:yA,OPENBRACE:pA,OPENBRACKET:hA,OPENPAREN:_A,PERCENT:UA,PIPE:WA,PLUS:GA,POUND:KA,QUERY:qA,QUOTE:JA,RIGHTCORNERBRACKET:wA,RIGHTWHITECORNERBRACKET:EA,SCHEME:cA,SEMI:XA,SLASH:ZA,SLASH_SCHEME:lA,SYM:tj,TILDE:QA,TLD:oA,UNDERSCORE:$A,UTLD:sA,UWORD:nA,WORD:tA,WS:dA}),rj=/[a-z]/,ij=/\p{L}/u,aj=/\p{Emoji}/u,oj=/\d/,sj=/\s/,cj=`\r`,lj=` +`,uj=`️`,dj=`‍`,fj=``,pj=null,mj=null,hj={defaultProtocol:`http`,events:null,format:Ak,formatHref:Ak,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null},kk.prototype={o:hj,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:hj[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}},jk.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=hj.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}},gj=Mk(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),_j=Mk(`text`),vj=Mk(`nl`),yj=Mk(`url`,{isLink:!0,toHref(e=hj.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==aA&&e[1].t===IA}}),bj=e=>new Ck(e),xj=typeof console<`u`&&console&&console.warn||(()=>{}),Sj=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,Cj={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1},zk.scan=Tk}));function Tj(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function Ej(e){return new F_({key:new L_(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(Sw(qC(n.doc,[...t])).forEach(({newRange:t})=>{let n=YC(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!Mj.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(jj).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=zk(n).map(t=>t.toObject(e.defaultProtocol));if(!Tj(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Cw(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function Dj(e){return new F_({key:new L_(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=yw(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function Oj(e){return new F_({key:new L_(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=Bk(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function kj(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(Nj,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var Aj,jj,Mj,Nj,Pj,Fj=t((()=>{cD(),wj(),wv(),Aj=`[\0- \xA0 ᠎ -\u2029  ]`,jj=new RegExp(Aj),Mj=RegExp(`${Aj}$`),Nj=new RegExp(Aj,`g`),Pj=RE.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){Lk(e);return}Lk(e.scheme,e.optionalSlashes)})},onDestroy(){Ik()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!kj(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!kj(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!kj(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,Y(this.options.HTMLAttributes,e),0]:[`a`,Y(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!kj(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!kj(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[uT({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=Bk(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!kj(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Ej({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!kj(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(Dj({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Oj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}})}));function Ij(e){let t=e,n=``;for(let[e,r]of hM)for(;t>=e;)n+=r,t-=e;return n}function Lj(e){return Ij(e).toUpperCase()}function Rj(e){let t=e.toLowerCase(),n=0,r=0;for(;n0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function Wj(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return Vj(t);case`A`:return Vj(t).toUpperCase();case`i`:return Ij(t);case`I`:return Lj(t);default:return String(t)}}function Gj(e){if(e.length===0)return!1;let t=Hj(e[0])??`numeric`,n=Uj(e[0]);if(n<1)return!1;for(let r=0;r\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function $j(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&Qj(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function eM(e){let t=[],n=0,r=0;for(;ne.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(PM);if(!t)return null;n.push({marker:t[1],content:t[3]})}return Gj(n.map(e=>e.marker))?{type:`orderedList`,attrs:qj(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function nM(e,t,n){let r=[],i=0;for(;it;)f.push(e[d]),d+=1;if(f.length>0){let e=nM(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(` +`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function rM(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}function iM(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM=t((()=>{cD(),Tv(),wv(),aM=Object.defineProperty,oM=(e,t)=>{for(var n in t)aM(e,n,{get:t[n],enumerable:!0})},sM=`listItem`,cM=`textStyle`,lM=/^\s*([-+*])\s$/,uM=sD.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,Y(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sM,this.editor.getAttributes(cM)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=lT({find:lM,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=lT({find:lM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(cM),editor:this.editor})),[e]}}),dM=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},fM=(e,t,n,r)=>{let i=dM(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,V.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},pM=(e,t,n)=>fM(e.state,e.view.dispatch,t,n),mM=(e,t)=>X.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>pM(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),hM=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],gM=`abcdefghijklmnopqrstuvwxyz`,_M=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`,vM=sD.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,Y(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(Yj(e))return{type:`listItem`,content:[{type:`paragraph`,content:Xj(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>$w(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){let t=e.meta?.parentAttrs?.start||1;return Jj(e.meta?.parentAttrs?.type,t-1+(e.index||0),`. `)}return`- `},n),addExtensions(){return[mM(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),yM={},oM(yM,{findListItemPos:()=>bM,getNextListDepth:()=>xM,handleBackspace:()=>CM,handleDelete:()=>EM,hasListBefore:()=>SM,hasListItemAfter:()=>DM,hasListItemBefore:()=>OM,listItemHasSubList:()=>kM,nextListIsDeeper:()=>wM,nextListIsHigher:()=>TM}),bM=(e,t)=>{let{$from:n}=t.selection,r=wC(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},xM=(e,t)=>{let n=bM(e,t);if(!n)return!1;let[,r]=oE(t,e,n.$pos.pos+4);return r},SM=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},CM=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!HC(e.state,t)&&SM(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}return!HC(e.state,t)||!lE(e.state)?!1:e.chain().liftListItem(t).run()},wM=(e,t)=>{let n=xM(e,t),r=bM(e,t);return!r||!n?!1:n>r.depth},TM=(e,t)=>{let n=xM(e,t),r=bM(e,t);return!r||!n?!1:n{if(!HC(e.state,t)||!cE(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:wM(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():TM(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},DM=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},OM=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},kM=(e,t,n)=>{if(!n)return!1;let r=wC(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},AM=X.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&EM(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&EM(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&CM(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&CM(e,n,r)&&(t=!0)}),t}}}}),jM=RegExp(`^(\\s*)(${_M})([.)])\\s+(.*)$`),MM=RegExp(`^(\\s*)(${_M})([.)])\\s+`),NM=/^\s/,PM=RegExp(`^(${_M})([.)])\\s+(.+)$`),FM=`listItem`,IM=`textStyle`,LM=/^(\d+)\.\s$/,RM=sD.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=iM(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=iM(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=Y(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?rM(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(MM)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(` +`),[i,a]=eM(r);if(i.length===0)return;let o=nM(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,typeMarker:i[0]?.type,items:o,raw:r.slice(0,a).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(FM,this.editor.getAttributes(IM)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new F_({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=tM(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=lT({find:LM,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=lT({find:LM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(IM)}),joinPredicate:e,editor:this.editor})),[t]}}),zM=/^\s*(\[([( |x])?\])\s$/,BM=sD.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,Y(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>$w(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[mM(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=ow(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[lT({find:zM,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),VM=sD.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,Y(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Qw(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=Qw(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),X.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(uM.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(vM.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(AM.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(RM.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(BM.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(VM.configure(this.options.taskList)),e}})})),UM,WM,GM,KM=t((()=>{cD(),UM=` `,WM=`\xA0`,GM=sD.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,Y(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===UM||n[0].text===UM||n[0].raw===WM||n[0].text===WM)&&r.length===1&&r[0].type===`text`&&(r[0].text===UM||r[0].text===WM)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?UM:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})})),qM,JM,YM,XM=t((()=>{cD(),qM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,JM=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,YM=RE.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,Y(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[oT({find:qM,type:this.type})]},addPasteRules(){return[uT({find:JM,type:this.type})]}})})),ZM,QM=t((()=>{cD(),ZM=sD.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``})})),$M,eN=t((()=>{cD(),$M=RE.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,Y(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}})}));function tN(e={}){return new F_({view(t){return new nN(t,e)}})}var nN,rN=t((()=>{R_(),f_(),nN=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Og(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}})),iN=t((()=>{rN()}));function aN(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function oN(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||aN(e.type))return!0;if(e.inlineContent)return!1}}return!0}function sN(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||aN(e.type))return!0;if(e.inlineContent)return!1}}return!0}function cN(){return new F_({props:{decorations:fN,createSelectionBetween(e,t,n){return t.pos==n.pos&&pN.valid(n)?new pN(n):null},handleClick:uN,handleKeyDown:hN,handleDOMEvents:{beforeinput:dN}}})}function lN(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof G){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=pN.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new pN(c))),!0):!1}}function uN(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!pN.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&K.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new pN(r))),!0)}function dN(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof pN))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let e=r.length-1;e>=0;e--)i=V.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new U(i,0,0));return a.setSelection(G.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function fN(e){if(!(e.selection instanceof pN))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,JS.create(e.doc,[GS.widget(e.selection.head,t,{key:`gapcursor`})])}var pN,mN,hN,gN=t((()=>{xC(),R_(),Qh(),aC(),pN=class e extends W{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):W.near(r)}content(){return U.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new mN(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!oN(e)||!sN(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!K.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}},pN.prototype.visible=!1,pN.findFrom=pN.findGapCursorFrom,W.jsonID(`gapcursor`,pN),mN=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return pN.valid(t)?new pN(t):W.near(t)}},hN=vC({ArrowLeft:lN(`horiz`,-1),ArrowRight:lN(`horiz`,1),ArrowUp:lN(`vert`,-1),ArrowDown:lN(`vert`,1)})})),_N=t((()=>{gN()})),vN,yN,bN,xN,SN=t((()=>{vN=200,yN=function(){},yN.prototype.append=function(e){return e.length?(e=yN.from(e),!this.length&&e||e.length=t?yN.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},yN.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},yN.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},yN.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},yN.from=function(e){return e instanceof yN?e:e&&e.length?new bN(e):yN.empty},bN=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=vN)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=vN)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(yN),yN.empty=new bN([]),xN=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return ei&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(yN)}));function CN(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}function wN(e,t,n,r){let i=n.getMeta(zN),a;if(i)return i.historyState;n.getMeta(BN)&&(e=new FN(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(zN))return o.getMeta(zN).redo?new FN(e.done.addTransform(n,void 0,r,kN(t)),e.undone,EN(n.mapping.maps),e.prevTime,e.prevComposition):new FN(e.done,e.undone.addTransform(n,void 0,r,kN(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!TN(n,e.prevRanges)),s=o?DN(e.prevRanges,n.mapping):EN(n.mapping.maps);return new FN(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,kN(t)),NN.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new FN(e.done.rebased(n,a),e.undone.rebased(n,a),DN(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new FN(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),DN(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function TN(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i=t[i]&&(n=!0)}),n}function EN(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function DN(e,t){if(!e)return null;let n=[];for(let r=0;r{let i=zN.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=ON(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN=t((()=>{SN(),f_(),R_(),MN=500,NN=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new PN(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new PN(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;eIN&&(s=CN(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Zg;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new PN(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new PN(i,o,l))}else r.push(new PN(i))},i);let l=[];for(let e=n;eMN&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new PN(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(yN.from(i.reverse()),a)}},NN.empty=new NN(yN.empty,0),PN=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},FN=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},IN=20,LN=!1,RN=null,zN=new L_(`history`),BN=new L_(`closeHistory`),VN=jN(!1,!0),HN=jN(!0,!0)})),WN=t((()=>{UN()}));function GN(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),GS.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function KN(e,t){return typeof e==`function`?e(t):e}function qN({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Aw(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(GN({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:KN(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else{let i=aP.getState(e.state),c=i?.topPos??0,l=i?.bottomPos??r.content.size;r.nodesBetween(c,l,(r,i)=>{let c=a>=i&&a<=i+r.nodeSize,l=!r.isLeaf&&Aw(r);return r.type.isTextblock&&(c||!t.showOnlyCurrent)&&l&&o.push(GN({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:c,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:KN(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:c})},node:r,pos:i})),t.includeChildren})}return JS.create(r,o)}function JN(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function YN(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function XN(e){let t=e;for(;t;){if(YN(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function ZN(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function QN({view:e,scrollContainer:t}){let n=e.dom.getBoundingClientRect();if(n.width<=0||n.height<=0)return null;let r=t?ZN(t):{top:0,bottom:window.innerHeight},i=Math.max(n.top,r.top)-oP,a=Math.min(n.bottom,r.bottom)+oP;if(i>=a)return null;let o=n.left+1,s=n.right-1;if(o>s)return null;let c=getComputedStyle(e.dom).direction===`rtl`?n.right-2:n.left+2,l=Math.min(Math.max(c,o),s),u=Math.max(i+2,n.top+1),d=Math.min(a-2,n.bottom-1);if(u>d)return null;let f=e.posAtCoords({left:l,top:u}),p=e.posAtCoords({left:l,top:d});return!f||!p?null:{top:f.pos,bottom:p.pos}}function $N(e){let t=XN(e.dom),n=()=>{let n=QN({view:e,scrollContainer:t});if(n===null)return;let r=aP.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(aP,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};t.addEventListener(`scroll`,a,{passive:!0});let o=typeof ResizeObserver<`u`?new ResizeObserver(a):null;o?.observe(e.dom);let s=typeof IntersectionObserver<`u`?new IntersectionObserver(a):null;return s?.observe(e.dom),e.dom.addEventListener(`focus`,a),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a),o?.disconnect(),s?.disconnect(),e.dom.removeEventListener(`focus`,a)}}}function eP({editor:e,options:t}){let n=t.dataAttribute?`data-${JN(t.dataAttribute)}`:`data-${iP}`;return new F_({key:aP,state:sP,view:$N,props:{decorations:({doc:r,selection:i})=>qN({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}function tP({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var nP,rP,iP,aP,oP,sP,cP,lP,uP,dP=t((()=>{cD(),wv(),iN(),oC(),_N(),WN(),X.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new F_({key:new L_(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),nP=X.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[tN(this.options)]}}),X.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new F_({key:new L_(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return JS.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(GS.node(t,t+e.nodeSize,{class:this.options.className}))}),JS.create(e,a)}}})]}}),rP=X.create({name:`gapCursor`,addProseMirrorPlugins(){return[cN()]},extendNodeSchema(e){return{allowGapCursor:J(q(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),iP=`placeholder`,aP=new L_(`tiptap__placeholder`),oP=200,sP={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(aP);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}},X.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:iP,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[eP({editor:this.editor,options:this.options})]}}),cP=`.ProseMirror:not(.ProseMirror-focused) *::selection { + background: transparent; +} + +.ProseMirror:not(.ProseMirror-focused) *::-moz-selection { + background: transparent; +}`,X.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&Bw(cP,e.options.injectNonce,`selection`),[new F_({key:new L_(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||jw(n.selection)||e.view.dragging?null:JS.create(n.doc,[GS.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}}),lP=X.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new L_(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new F_({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!tP({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!tP({node:r,types:n})}}})]}}),uP=X.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>VN(e,t),redo:()=>({state:e,dispatch:t})=>HN(e,t)}},addProseMirrorPlugins(){return[AN(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}})})),fP,pP=t((()=>{cD(),WO(),XO(),ek(),ak(),sk(),lk(),dk(),pk(),yk(),Fj(),HM(),KM(),XM(),QM(),eN(),dP(),fP=X.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(YO.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(UO.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(uM.configure(this.options.bulletList)),this.options.code!==!1&&e.push($O.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(ik.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(ok.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(nP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(rP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(ck.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(uk.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(uP.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(fk.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(vk.configure(this.options.italic)),this.options.listItem!==!1&&e.push(vM.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(AM.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Pj.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(RM.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(GM.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(YM.configure(this.options.strike)),this.options.text!==!1&&e.push(ZM.configure(this.options.text)),this.options.underline!==!1&&e.push($M.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(lP.configure(this.options?.trailingNode)),e}})})),mP,hP,gP,_P,vP,yP,bP,xP,SP,CP=t((()=>{cD(),mP=20,hP=(e,t=0)=>{let n=[];return!e.children.length||t>mP||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...hP(e,t+1))}),n},gP=e=>{if(!e.children.length)return;let t=hP(e);t&&t.forEach(e=>{let t=e.getAttribute(`style`),n=(e.parentElement?.closest(`span`))?.getAttribute(`style`);e.setAttribute(`style`,`${n};${t}`)})},_P=RE.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&gP(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,Y(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),vP=X.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>(Vw(e,`background-color`)??e.style.backgroundColor)?.replace(/['"]+/g,``),renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),yP=X.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>(Vw(e,`color`)??e.style.color)?.replace(/['"]+/g,``),renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),bP=X.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>Vw(e,`font-family`)??e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),xP=X.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>Vw(e,`font-size`)??e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),SP=X.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>Vw(e,`line-height`)??e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}}),X.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(vP.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(yP.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(bP.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(xP.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(SP.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(_P.configure(this.options.textStyle)),e}})})),wP=t((()=>{CP()})),TP,EP,DP,OP=t((()=>{cD(),TP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,EP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,DP=RE.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||Vw(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,Y(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[oT({find:TP,type:this.type})]},addPasteRules(){return[uT({find:EP,type:this.type})]}})})),kP,AP,jP=t((()=>{cD(),kP=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,AP=sD.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,Y(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?`![${n}](${t} "${r}")`:`![${n}](${t})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=Y(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new oD({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[sT({find:kP,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}})}));function MP(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=NP(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;er&&(a+=i.attrs.colspan)}}for(let e=0;e1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function PP(e,t,n){e.problems||=[];let r={};for(let i=0;i0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function RP(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function zP(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function BP(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=LP(t.$head)||VP(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function VP(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function HP(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function UP(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function WP(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function GP(e,t,n){let r=e.node(-1),i=sI.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function KP(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function qP(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e{t.push(GS.node(n,n+e.nodeSize,{class:`selectedCell`}))}),JS.create(e.doc,t)}function XP({$from:e,$to:t}){if(e.pos==t.pos||e.pos=0&&!(e.after(i+1)=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function ZP({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function QP(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof K&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=$.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=$.rowSelection(e,e)}else if(!n){let e=sI.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=$.create(i,t+1,n)}}else r instanceof G&&XP(r)?a=G.create(i,r.from):r instanceof G&&ZP(r)&&(a=G.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}function $P(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o{t.type.spec.tableRole==`table`&&(n=tF(e,t,r,n))};return t?t.doc!=e.doc&&$P(t.doc,e.doc,0,r):e.doc.descendants(r),n}function tF(e,t,n,r){let i=sI.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n0?-1:0;JP(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o0&&i0&&t.map[s-1]==c||i0?-1:0;cF(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a0&&i0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i0&&n[a]==n[a-1]||r.right0&&n[i]==n[i-e]||r.bottom0){let e=s+1+c.content.size,t=mF(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new $(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function _F(e,t){let n=IP(e.schema);return vF(({node:e})=>n[e.type.spec.tableRole])(e,t)}function vF(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof $){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=RP(r.$from),!i)return!1;a=LP(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=nF(t),u=t.tr;for(let e=0;e{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function bF(e){return function(t,n){if(!zP(t))return!1;if(n){let r=IP(t.schema),i=nF(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}function CF(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function EF(e,t){let n=e.selection;if(!(n instanceof $))return!1;if(t){let r=e.tr,i=IP(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new U(i,0,0))}),r.docChanged&&t(r)}return!0}function DF(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t=t.length&&t.push(V.empty),n[i]r&&(s=s.type.createChecked(KP(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;ni&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(V.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function jF(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=IP(s),l,u;if(i>t.width)for(let a=0,s=0;at.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,V.from(s)),f=[];for(let e=t.height;e{if(!i)return!1;let a=n.selection;if(a instanceof $)return FF(n,r,W.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=VF(i,e,t);if(o==null)return!1;if(e==`horiz`)return FF(n,r,W.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=GP(i,e,t),s;return s=a?W.near(a,1):t<0?W.near(n.doc.resolve(i.before(-1)),-1):W.near(n.doc.resolve(i.after(-1)),1),FF(n,r,s)}}}function LF(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof $)o=a;else{let r=VF(i,e,t);if(r==null)return!1;o=new $(n.doc.resolve(r))}let s=GP(o.$headCell,e,t);return s?FF(n,r,new $(o.$anchorCell,s)):!1}}function RF(e,t){let n=e.state.doc,r=LP(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new $(r))),!0):!1}function zF(e,t,n){if(!zP(e.state))return!1;let r=DF(n),i=e.state.selection;if(i instanceof $){r||={width:1,height:1,rows:[V.from(kF(IP(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=sI.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=AF(r,o.right-o.left,o.bottom-o.top),PF(e.state,e.dispatch,a,o,r),!0}else if(r){let t=BP(e.state),n=t.start(-1);return PF(e.state,e.dispatch,n,sI.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function BF(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=HF(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof $)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=LP(e.state.selection.$anchor))!=null&&UF(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=UF(e,n),i=cI.getState(e.state)==null;if(!r||!WP(t,r))if(i)r=t;else return;let a=new $(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(cI,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),cI.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(cI,-1))}function o(r){let o=r,s=cI.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(HF(e,o.target)!=n&&(c=UF(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function VF(e,t,n){if(!(e.state.selection instanceof G))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function HF(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function UF(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&LP(e.state.doc.resolve(r))||LP(e.state.doc.resolve(i))}function WF(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;enew r(e,n,t)),new hI(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=mI.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{KF(t,n,e,i)},mouseleave:e=>{qF(e)},mousedown:(e,r)=>{JF(e,r,t,n)}},decorations:e=>{let t=mI.getState(e);if(t&&t.activeHandle>-1)return rI(e,t.activeHandle)},nodeViews:{}}});return a}function KF(e,t,n,r){if(!e.editable)return;let i=mI.getState(e.state);if(i&&!i.dragging){let a=XF(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=ZF(e,t,`left`,n):i-t.clientX<=n&&(o=ZF(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=sI.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}$F(e,o)}}}function qF(e){if(!e.editable)return;let t=mI.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&$F(e,-1)}function JF(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=mI.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=YF(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(mI,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=mI.getState(e.state);r?.dragging&&(eI(e,r.activeHandle,QF(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(mI,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=mI.getState(e.state);if(i&&i.dragging){let a=QF(i.dragging,t,n);tI(e,i.activeHandle,a,r)}}return tI(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function YF(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e{if(R_(),Qh(),aC(),xC(),f_(),typeof WeakMap<`u`){let e=new WeakMap;aI=t=>e.get(t),oI=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;aI=t=>{for(let n=0;n(t==10&&(t=0),e[t++]=n,e[t++]=r)}sI=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;te!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new x_(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(HP(r)&&HP(i)&&WP(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return G.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=sI.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n0||u>0){let e=c.attrs;if(l>0&&(e=KP(e,0,l)),u>0&&(e=KP(e,e.colspan-u,u)),s.leftr.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=sI.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom0&&(n=c.resolve(a+i.map[s.left])),o.bottom0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=sI.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return HP(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}}})),_I=t((()=>{gI()}));function vI(e){return e===`left`||e===`right`||e===`center`?e:null}function yI(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return vI(t||n)}function bI(e){return vI(e?.align)}function xI(){return{default:null,parseHTML:e=>yI(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function SI(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function CI(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function DI(e,t,n,r,i){let a=EI(e),o=[],s=[];for(let e=0;e{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=kI(i),o=e.type===`tableHeader`,s=bI(e.attrs);n.push({text:a,isHeader:o,align:s})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array.from({length:a}).fill(0);i.forEach(e=>{for(let t=0;to[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=Array.from({length:a}).fill(null);i.forEach(e=>{for(let t=0;tl&&c[t]&&c[t].text||``);return d+=`| ${f.map((e,t)=>s(e,o[t])).join(` | `)} | +`,d+=`| ${o.map((e,t)=>{let n=Math.max(3,e),r=u[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} | +`,(l?i.slice(1):i).forEach(e=>{d+=`| ${Array.from({length:a}).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} | +`}),d}var jI,MI,NI,PI,FI,II,LI,RI=t((()=>{cD(),wv(),_I(),jI=sD.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`),n=t?t.split(`,`).map(e=>parseInt(e,10)):null;if(!n){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),n=Array.from(e.parentElement?.children||[]).indexOf(e);if(n&&n>-1&&t&&t[n]){let e=t[n].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return n}},align:xI()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,Y(this.options.HTMLAttributes,e),0]}}),MI=sD.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}},align:xI()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,Y(this.options.HTMLAttributes,e),0]}}),NI=sD.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,Y(this.options.HTMLAttributes,e),0]}}),PI=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),CI(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,CI(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}},FI=({editor:e})=>{let{selection:t}=e.state;if(!OI(t))return!1;let n=0;return XC(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},II=AI,LI=sD.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:PI,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=wI(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,Y(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=vI(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=vI(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>II(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=DI(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(G.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>iF(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>aF(e,t),deleteColumn:()=>({state:e,dispatch:t})=>sF(e,t),addRowBefore:()=>({state:e,dispatch:t})=>uF(e,t),addRowAfter:()=>({state:e,dispatch:t})=>dF(e,t),deleteRow:()=>({state:e,dispatch:t})=>pF(e,t),deleteTable:()=>({state:e,dispatch:t})=>TF(e,t),mergeCells:()=>({state:e,dispatch:t})=>gF(e,t),splitCell:()=>({state:e,dispatch:t})=>_F(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>SF(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>SF(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>dI(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>gF(e,t)?!0:_F(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>yF(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>wF(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>wF(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&eF(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=$.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:FI,"Mod-Backspace":FI,Delete:FI,"Mod-Delete":FI}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[GF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],iI({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=Y(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:J(q(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),X.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(LI.configure(this.options.table)),this.options.tableCell!==!1&&e.push(jI.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(MI.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(NI.configure(this.options.tableRow)),e}})})),zI=t((()=>{RI()})),BI=t((()=>{RI()})),VI=t((()=>{RI()})),HI=t((()=>{HM()})),UI=t((()=>{HM()})),WI,GI,KI,qI,JI,YI,XI,ZI,QI=t((()=>{ts(),cD(),pP(),CP(),wP(),OP(),jP(),RI(),zI(),BI(),VI(),HI(),UI(),WI={class:`editor-wrap`},GI={class:`editor-pane`},KI={class:`editor-inner`},qI={class:`tb-bar`},JI={class:`editor-pane`},YI=[`innerHTML`],XI=[`src`],ZI={__name:`NoteEditor`,props:{viewMode:String},emits:[`update`],setup(e,{expose:t,emit:n}){let r=n,i=null,a=N(``),o=N(``);Pi(()=>{i=new iD({element:document.querySelector(`#tiptap-editor`),extensions:[fP,_P,yP,DP.configure({multicolor:!0}),AP.configure({inline:!0}),LI,NI,jI,MI,VM,BM.configure({nested:!0})],onUpdate:()=>{a.value=i.getHTML(),r(`update`,i.getHTML())},editorProps:{handlePaste:(e,t)=>{let n=t.clipboardData?.items;if(!n)return!1;for(let e of n)if(e.type.startsWith(`image/`))return t.preventDefault(),p(e.getAsFile()),!0;return!1},handleDrop:(e,t)=>{let n=t.dataTransfer?.files;if(!n?.length)return!1;for(let e of n)if(e.type.startsWith(`image/`))return t.preventDefault(),p(e),!0;return!1}}}),i.view.dom.addEventListener(`click`,e=>{e.target.tagName===`IMG`&&(o.value=e.target.src)})}),Ri(()=>{i?.destroy()});function s(e,...t){i?.chain().focus()[e](...t).run()}function c(e){i&&i.commands.setContent(e||``)}function l(){return i?.getHTML()||``}let u=window.location.hostname===`localhost`,d=u?`http://localhost:4006`:`https://gw.server.zgitm.com`,f=u?`http://localhost:4006`:`https://mokeetext.server.zgitm.com`;async function p(e){let t=new FormData;t.append(`file`,e);try{let e={};if(u)e[`X-Dev-Mock-User`]=`admin`;else{let t=document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1];t&&(e.Authorization=`Bearer ${t}`),e[`X-System-Code`]=`mokeetext-edit`}let n=await fetch(d+`/api/upload/image`,{method:`POST`,body:t,headers:e});if(!n.ok){m((await n.text()).substring(0,100));return}let r=await n.json();if(r.url){let e=r.url.startsWith(`http`)?r.url:f+r.url;i?.chain().focus().setImage({src:e}).run()}else m(r.error||`上传失败`)}catch(e){m(`上传失败: `+e.message)}}function m(e){let t=document.createElement(`div`);t.className=`toast`,t.textContent=e,document.body.appendChild(t),setTimeout(()=>t.remove(),3e3)}function h(){let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=()=>{let t=e.files[0];t&&p(t)},e.click()}function g(){i?.chain().focus().insertContent(`😊`).run()}return t({setContent:c,getHTML:l}),(t,n)=>(P(),F(ga,null,[I(`div`,WI,[On(I(`div`,GI,[I(`div`,KI,[I(`div`,qI,[I(`button`,{class:`tb-btn`,onClick:n[0]||=e=>s(`toggleHeading`,{level:1})},`H1`),I(`button`,{class:`tb-btn`,onClick:n[1]||=e=>s(`toggleHeading`,{level:2})},`H2`),I(`button`,{class:`tb-btn`,onClick:n[2]||=e=>s(`toggleHeading`,{level:3})},`H3`),n[17]||=I(`span`,{class:`tb-divider`},null,-1),I(`button`,{class:`tb-btn`,onClick:n[3]||=e=>s(`toggleBold`),style:{"font-weight":`bold`}},`B`),I(`button`,{class:`tb-btn`,onClick:n[4]||=e=>s(`toggleItalic`),style:{"font-style":`italic`}},`I`),I(`button`,{class:`tb-btn`,onClick:n[5]||=e=>s(`toggleStrike`),style:{"text-decoration":`line-through`}},`S`),n[18]||=I(`span`,{class:`tb-divider`},null,-1),I(`input`,{type:`color`,class:`tb-color`,title:`文字颜色`,onInput:n[6]||=e=>s(`setColor`,e.target.value)},null,32),I(`input`,{type:`color`,class:`tb-color`,title:`背景高亮`,value:`#FFF3CD`,onInput:n[7]||=e=>s(`toggleHighlight`,{color:e.target.value})},null,32),n[19]||=I(`span`,{class:`tb-divider`},null,-1),I(`button`,{class:`tb-btn`,onClick:h},`🖼 图片`),I(`button`,{class:`tb-btn`,onClick:g},`😊 表情`),n[20]||=I(`span`,{class:`tb-divider`},null,-1),I(`button`,{class:`tb-btn`,onClick:n[8]||=e=>s(`toggleBulletList`)},`• 列表`),I(`button`,{class:`tb-btn`,onClick:n[9]||=e=>s(`toggleOrderedList`)},`1. 列表`),I(`button`,{class:`tb-btn`,onClick:n[10]||=e=>s(`toggleTaskList`)},`✅ 任务`),I(`button`,{class:`tb-btn`,onClick:n[11]||=e=>s(`toggleBlockquote`)},`❝ 引用`),I(`button`,{class:`tb-btn`,onClick:n[12]||=e=>s(`toggleCodeBlock`)},` 代码`),n[21]||=I(`span`,{class:`tb-divider`},null,-1),I(`button`,{class:`tb-btn`,onClick:n[13]||=e=>s(`insertTable`,{rows:3,cols:3,withHeaderRow:!0})},`📋 表格`)]),n[22]||=I(`div`,{id:`tiptap-editor`},null,-1)])],512),[[To,e.viewMode!==`preview`]]),On(I(`div`,JI,[I(`div`,{class:`editor-inner`,innerHTML:a.value},null,8,YI)],512),[[To,e.viewMode!==`edit`]])]),o.value?(P(),F(`div`,{key:0,class:`lightbox`,onClick:n[16]||=e=>o.value=null},[I(`button`,{class:`lightbox-close`,onClick:n[14]||=e=>o.value=null},`✕`),I(`img`,{src:o.value,onClick:n[15]||=Jo(()=>{},[`stop`])},null,8,XI)])):Zr(``,!0)],64))}}})),$I,eL,tL,nL,rL,iL=t((()=>{ts(),$I={class:`modal-header`},eL={class:`modal-title`},tL={class:`modal-body`},nL={key:0,class:`modal-footer`},rL={__name:`Modal`,props:{show:Boolean,title:String,width:Number},emits:[`close`],setup(e){return(t,n)=>e.show?(P(),F(`div`,{key:0,class:`modal-overlay`,onClick:n[1]||=Jo(e=>t.$emit(`close`),[`self`])},[I(`div`,{class:`modal`,style:a(e.width?{width:e.width+`px`}:{})},[I(`div`,$I,[I(`span`,eL,j(e.title),1),I(`button`,{class:`modal-close`,onClick:n[0]||=e=>t.$emit(`close`)},`×`)]),I(`div`,tL,[Qn(t.$slots,`default`)]),t.$slots.footer?(P(),F(`div`,nL,[Qn(t.$slots,`footer`)])):Zr(``,!0)],4)])):Zr(``,!0)}}})),aL,oL,sL=t((()=>{ts(),iL(),aL={style:{color:`var(--text-secondary)`,"font-size":`14px`,"line-height":`1.6`}},oL={__name:`ConfirmModal`,props:{show:Boolean,title:String,message:String,confirmText:String,cancelText:String},emits:[`confirm`,`cancel`],setup(e){return(t,n)=>(P(),Wr(rL,{show:e.show,title:e.title,width:420,onClose:n[2]||=e=>t.$emit(`cancel`)},{footer:Dn(()=>[e.cancelText?(P(),F(`button`,{key:0,class:`btn btn-ghost`,onClick:n[0]||=e=>t.$emit(`cancel`)},j(e.cancelText),1)):Zr(``,!0),I(`button`,{class:`btn btn-primary`,onClick:n[1]||=e=>t.$emit(`confirm`)},j(e.confirmText||`确定`),1)]),default:Dn(()=>[I(`p`,aL,j(e.message),1)]),_:1},8,[`show`,`title`]))}}})),cL,lL,uL,dL,fL=t((()=>{ts(),iL(),cL={class:`form-group`},lL={class:`form-label`},uL=[`placeholder`],dL={__name:`PromptModal`,props:{show:Boolean,title:String,label:String,placeholder:String,initial:String},emits:[`confirm`,`cancel`],setup(e){let t=e,n=N(t.initial||``);return Mn(()=>t.show,e=>{e&&(n.value=t.initial||``)}),(t,r)=>(P(),Wr(rL,{show:e.show,title:e.title,width:400,onClose:r[4]||=e=>t.$emit(`cancel`)},{footer:Dn(()=>[I(`button`,{class:`btn btn-ghost`,onClick:r[2]||=e=>t.$emit(`cancel`)},`取消`),I(`button`,{class:`btn btn-primary`,onClick:r[3]||=e=>t.$emit(`confirm`,n.value)},`确定`)]),default:Dn(()=>[I(`div`,cL,[I(`label`,lL,j(e.label),1),On(I(`input`,{class:`input`,"onUpdate:modelValue":r[0]||=e=>n.value=e,placeholder:e.placeholder,onKeyup:r[1]||=Xo(e=>t.$emit(`confirm`,n.value),[`enter`])},null,40,uL),[[Vo,n.value]])])]),_:1},8,[`show`,`title`]))}}})),pL=t((()=>{})),mL,hL,gL,_L,vL,yL,bL,xL,SL,CL,wL,TL,EL,DL,OL,kL,AL,jL,ML,NL,PL,FL,IL,LL,RL,zL,BL,VL,HL,UL,WL,GL,KL,qL,JL,YL,XL,ZL,QL,$L=t((()=>{ts(),Dm(),QI(),iL(),sL(),fL(),pL(),dl(),mL={class:`layout`},hL={class:`sidebar-label`},gL=[`title`],_L={style:{flex:`1`,"overflow-y":`auto`}},vL={class:`count`},yL=[`onClick`],bL={style:{flex:`1`}},xL={class:`count`},SL=[`onClick`],CL={class:`folder-menu`},wL=[`onClick`],TL=[`onClick`],EL={key:0,class:`content`},DL={class:`content-header`},OL={style:{"font-size":`15px`,"font-weight":`600`}},kL={style:{display:`flex`,"align-items":`center`,gap:`8px`}},AL={style:{flex:`1`,"overflow-y":`auto`,padding:`0 20px 20px`}},jL={key:0,style:{"text-align":`center`,padding:`80px 20px`,color:`var(--text-placeholder)`}},ML={key:1,class:`doc-table`},NL=[`onClick`],PL={class:`doc-title-cell`,"data-label":`标题`},FL={"data-label":`创建人`,style:{"font-size":`12px`,color:`var(--text-secondary)`}},IL={"data-label":`创建时间`,style:{"font-size":`12px`,color:`var(--text-tertiary)`,"font-family":`monospace`}},LL={"data-label":`修改时间`,style:{"font-size":`12px`,color:`var(--text-tertiary)`,"font-family":`monospace`}},RL=[`onClick`],zL={key:1,class:`content`},BL={class:`content-header`,style:{"flex-wrap":`wrap`,gap:`8px`}},VL={style:{"font-size":`11px`,color:`var(--text-tertiary)`,"white-space":`nowrap`,display:`flex`,"align-items":`center`,gap:`4px`}},HL={class:`toggle-group`},UL={class:`save-badge`},WL={class:`form-group`},GL=[`value`],KL={style:{display:`flex`,"flex-direction":`column`,gap:`6px`,"margin-bottom":`16px`}},qL={key:0,style:{background:`#F0FAF0`,border:`1px solid #A3E4A7`,"border-radius":`8px`,padding:`12px 14px`}},JL={style:{display:`flex`,gap:`6px`}},YL=[`value`],XL={style:{"font-size":`10px`,color:`var(--text-tertiary)`,"margin-top":`4px`}},ZL={__name:`NotesView`,setup(e){let t=Cm(),n=N(null),r=N([]),i=N([]),a=it({}),o=N(null),c=N(!1),l=N(``),u=N(null),d=N(null),f=N(`edit`),p=N(`已保存`),m=N(``),h=N(`forever`),g=N(``),_=N(!1),v=N(!1),y=N(null),b=null,x=null,S=it({show:!1,title:``,message:``}),C=null;function w(e,t){return new Promise(n=>{S.title=e,S.message=t,S.show=!0,C=n})}function ee(){S.show=!1,C&&C(!0)}function T(){S.show=!1,C&&C(!1)}let E=it({show:!1,title:``,label:``,initial:``}),D=null,O=N(``);function te(e,t,n){return new Promise(r=>{E.title=e,E.label=t,E.initial=n||``,E.show=!0,O.value=n||``,D=r})}function k(e){E.show=!1,D&&D(e)}function ne(){E.show=!1,D&&D(null)}let re=La(()=>{let e=i.value;if(o.value&&(e=e.filter(e=>(e.folder_id||x)===o.value)),l.value){let t=l.value.toLowerCase();e=e.filter(e=>(e.title||``).toLowerCase().includes(t))}return e});Pi(async()=>{let[e,n]=await Promise.all([t.listFolders(`note`),t.listNotes()]);r.value=e,i.value=n,x=e.find(e=>e.name===`未分类`)?.id||null,ie(n)});function ie(e){e||=i.value,Object.keys(a).forEach(e=>delete a[e]),e.forEach(e=>{let t=e.folder_id||x||0;a[t]=(a[t]||0)+1})}function ae(e){if(!e)return`未分类`;let t=r.value.find(t=>t.id===e);return t?t.name:`未分类`}function oe(e){return e?e.replace(`T`,` `).substring(0,19):`-`}async function se(e){let r=await t.getNote(e.id);d.value=r,await vn(),await vn(),n.value?.setContent(r.content||``)}function ce(){fe(),d.value=null,ue()}async function le(){se(await t.createNote({title:`无标题笔记`,content:``,folder_id:o.value||x})),await ue()}async function ue(){i.value=await t.listNotes(),ie()}function A(e){d.value&&(d.value.content=e),de()}function de(){p.value=`保存中…`,clearTimeout(b),b=setTimeout(fe,800)}async function fe(){d.value?.id&&(await t.updateNote(d.value.id,{title:d.value.title,content:d.value.content}),p.value=`已保存`)}async function pe(){let e=d.value?.title||`无标题`;!d.value?.id||!await w(`删除笔记`,`确定删除「${e}」吗?`)||(await t.deleteNote(d.value.id),d.value=null,await ue())}async function me(e){await w(`删除笔记`,`确定删除「${i.value.find(t=>t.id===e)?.title||`无标题`}」吗?`)&&(await t.deleteNote(e),await ue())}async function he(){let e=await te(`新建文件夹`,`名称`,``);if(!e)return;let n=await t.createFolder({name:e,type:`note`});r.value.push(n)}async function ge(e){let n=await te(`重命名`,`新名称`,e.name);n&&(await t.updateFolder(e.id,{name:n}),e.name=n)}async function _e(e){await w(`删除文件夹`,`确定删除文件夹「${e.name}」吗?\n内容将移至「未分类」`)&&(await t.deleteFolder(e.id),r.value=r.value.filter(t=>t.id!==e.id),o.value===e.id&&(o.value=null),await ue())}function ve(e){u.value=u.value===e.id?null:e.id}async function ye(e){if(!d.value?.id)return;let n=await t.shareNote(d.value.id,e);m.value=(window.location.hostname===`localhost`?``:`https://mokeetext.server.zgitm.com`)+n.url,g.value=`有效期至 `+n.expires_at}function be(){m.value&&(navigator.clipboard.writeText(m.value),Se(`链接已复制`))}function xe(){_.value=!1,h.value=`forever`,m.value=``}function Se(e){let t=document.createElement(`div`);t.className=`toast`,t.textContent=e,document.body.appendChild(t),setTimeout(()=>t.remove(),2e3)}async function Ce(){!d.value?.id||!y.value||(await t.moveNote(d.value.id,y.value),d.value.folder_id=y.value,v.value=!1,Se(`已移动`),await ue())}function we(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),fe().then(()=>Se(`已保存(Ctrl+S)`)))}function Te(){u.value=null}return Pi(()=>{document.addEventListener(`click`,Te),document.addEventListener(`keydown`,we)}),Ri(()=>{document.removeEventListener(`click`,Te),document.removeEventListener(`keydown`,we)}),(e,t)=>(P(),F(`div`,mL,[I(`aside`,{class:s([`sidebar`,{collapsed:c.value}])},[I(`div`,hL,[I(`span`,{class:`add-btn`,onClick:t[0]||=e=>c.value=!c.value,title:c.value?`展开`:`收起`,style:{cursor:`pointer`}},j(c.value?`▶`:`◀`),9,gL),c.value?Zr(``,!0):(P(),F(`span`,{key:0,class:`add-btn`,onClick:he,style:{"font-size":`11px`,"font-weight":`600`,width:`auto`,padding:`0 6px`}},`新增文件夹`))]),On(I(`div`,_L,[I(`div`,{class:s([`folder-item`,{active:o.value===null}]),onClick:t[1]||=e=>o.value=null},[t[18]||=I(`span`,{class:`folder-dot`,style:{opacity:`.8`,width:`8px`,height:`8px`}},null,-1),t[19]||=I(`span`,{style:{flex:`1`}},`全部笔记`,-1),I(`span`,vL,j(i.value.length),1)],2),(P(!0),F(ga,null,Zn(r.value,e=>(P(),F(`div`,{key:e.id},[I(`div`,{class:s([`folder-item`,{active:o.value===e.id}]),onClick:t=>o.value=o.value===e.id?null:e.id,style:{position:`relative`}},[t[20]||=I(`span`,{class:`folder-dot`},null,-1),I(`span`,bL,j(e.name),1),I(`span`,xL,j(a[e.id]||0),1),I(`span`,{class:`folder-more`,onClick:Jo(t=>ve(e),[`stop`])},`⋮`,8,SL),On(I(`div`,CL,[I(`div`,{class:`folder-menu-item`,onClick:Jo(t=>ge(e),[`stop`])},`✏️ 重命名`,8,wL),I(`div`,{class:`folder-menu-item danger`,onClick:Jo(t=>_e(e),[`stop`])},`🗑 删除`,8,TL)],512),[[To,u.value===e.id]])],10,yL)]))),128))],512),[[To,!c.value]])],2),d.value?(P(),F(`section`,zL,[I(`div`,BL,[I(`button`,{class:`btn btn-ghost btn-sm`,onClick:ce},`← 返回`),On(I(`input`,{class:`content-title`,"onUpdate:modelValue":t[3]||=e=>d.value.title=e,placeholder:`无标题笔记`,onInput:de,style:{"min-width":`120px`}},null,544),[[Vo,d.value.title]]),I(`span`,VL,` 📂 `+j(ae(d.value.folder_id)),1),I(`button`,{class:`btn btn-ghost btn-sm`,onClick:t[4]||=e=>v.value=!0,title:`移动到其他文件夹`},`📦 移动`),m.value?(P(),F(`button`,{key:1,class:`btn btn-ghost btn-sm`,onClick:be,style:{color:`var(--success)`}},`✅ 已分享`)):(P(),F(`button`,{key:0,class:`btn btn-ghost btn-sm`,onClick:t[5]||=e=>_.value=!0},`🔗 分享`)),I(`div`,HL,[I(`button`,{class:s({active:f.value===`edit`}),onClick:t[6]||=e=>f.value=`edit`},`编辑`,2),I(`button`,{class:s({active:f.value===`preview`}),onClick:t[7]||=e=>f.value=`preview`},`预览`,2),I(`button`,{class:s({active:f.value===`split`}),onClick:t[8]||=e=>f.value=`split`},`分屏`,2)]),I(`span`,UL,j(p.value),1),I(`button`,{class:`btn btn-danger-ghost btn-sm`,onClick:pe},`删除`)]),L(ZI,{ref_key:`editorRef`,ref:n,viewMode:f.value,onUpdate:A},null,8,[`viewMode`])])):(P(),F(`section`,EL,[I(`div`,DL,[I(`span`,OL,j(o.value?ae(o.value):`全部笔记`),1),I(`div`,kL,[On(I(`input`,{class:`input`,style:{width:`200px`},type:`text`,placeholder:`搜索标题…`,"onUpdate:modelValue":t[2]||=e=>l.value=e},null,512),[[Vo,l.value]]),I(`button`,{class:`btn btn-primary btn-sm`,onClick:le},`+ 新建笔记`)])]),I(`div`,AL,[re.value.length?(P(),F(`table`,ML,[t[22]||=I(`thead`,null,[I(`tr`,null,[I(`th`,{style:{width:`40%`}},`标题`),I(`th`,{style:{width:`10%`}},`创建人`),I(`th`,{style:{width:`22%`}},`创建时间`),I(`th`,{style:{width:`22%`}},`修改时间`),I(`th`,{style:{width:`6%`}},`操作`)])],-1),I(`tbody`,null,[(P(!0),F(ga,null,Zn(re.value,e=>(P(),F(`tr`,{key:e.id,onClick:t=>se(e),class:`clickable-row`},[I(`td`,PL,j(e.title||`无标题笔记`),1),I(`td`,FL,j(e.created_by||`admin`),1),I(`td`,IL,j(oe(e.created_at)),1),I(`td`,LL,j(oe(e.updated_at)),1),I(`td`,null,[I(`button`,{class:`btn btn-danger-ghost btn-xs`,onClick:Jo(t=>me(e.id),[`stop`])},`删除`,8,RL)])],8,NL))),128))])])):(P(),F(`div`,jL,[...t[21]||=[I(`p`,null,`暂无笔记`,-1)]]))])])),L(rL,{show:v.value,title:`移动到文件夹`,onClose:t[11]||=e=>v.value=!1},{footer:Dn(()=>[I(`button`,{class:`btn btn-ghost`,onClick:t[10]||=e=>v.value=!1},`取消`),I(`button`,{class:`btn btn-primary`,onClick:Ce},`移动`)]),default:Dn(()=>[I(`div`,WL,[t[23]||=I(`label`,{class:`form-label`},`选择目标文件夹`,-1),On(I(`select`,{class:`select`,"onUpdate:modelValue":t[9]||=e=>y.value=e},[(P(!0),F(ga,null,Zn(r.value,e=>(P(),F(`option`,{key:e.id,value:e.id},j(e.name),9,GL))),128))],512),[[Wo,y.value]])])]),_:1},8,[`show`]),L(rL,{show:_.value,title:`生成分享链接`,width:420,onClose:xe},{footer:Dn(()=>[m.value?Zr(``,!0):(P(),F(`button`,{key:0,class:`btn btn-ghost`,onClick:xe},`取消`)),m.value?(P(),F(`button`,{key:2,class:`btn btn-primary`,onClick:xe},`完成`)):(P(),F(`button`,{key:1,class:`btn btn-primary`,onClick:t[17]||=e=>ye(h.value)},`生成链接`))]),default:Dn(()=>[t[29]||=I(`p`,{style:{color:`var(--text-secondary)`,"font-size":`13px`,"margin-bottom":`12px`}},`选择有效期:`,-1),I(`div`,KL,[I(`label`,{class:s([`share-radio`,{active:h.value===`7d`}]),onClick:t[12]||=e=>h.value=`7d`},[...t[24]||=[I(`span`,{class:`share-radio-dot`},null,-1),Xr(` 7 天`,-1),I(`span`,{style:{"font-size":`11px`,color:`var(--text-tertiary)`,"margin-left":`8px`}},`一周后失效`,-1)]],2),I(`label`,{class:s([`share-radio`,{active:h.value===`30d`}]),onClick:t[13]||=e=>h.value=`30d`},[...t[25]||=[I(`span`,{class:`share-radio-dot`},null,-1),Xr(` 30 天`,-1),I(`span`,{style:{"font-size":`11px`,color:`var(--text-tertiary)`,"margin-left":`8px`}},`一个月后失效`,-1)]],2),I(`label`,{class:s([`share-radio`,{active:h.value===`1y`}]),onClick:t[14]||=e=>h.value=`1y`},[...t[26]||=[I(`span`,{class:`share-radio-dot`},null,-1),Xr(` 1 年`,-1),I(`span`,{style:{"font-size":`11px`,color:`var(--text-tertiary)`,"margin-left":`8px`}},`一年后失效`,-1)]],2),I(`label`,{class:s([`share-radio`,{active:h.value===`forever`}]),onClick:t[15]||=e=>h.value=`forever`},[...t[27]||=[I(`span`,{class:`share-radio-dot`},null,-1),Xr(` 永久有效 `,-1)]],2)]),m.value?(P(),F(`div`,qL,[t[28]||=I(`div`,{style:{"font-size":`12px`,"font-weight":`600`,color:`#166534`,"margin-bottom":`6px`}},`✅ 链接已生成`,-1),I(`div`,JL,[I(`input`,{class:`input`,style:{"font-size":`12px`},value:m.value,readonly:``,onFocus:t[16]||=e=>e.target.select()},null,40,YL),I(`button`,{class:`btn btn-primary btn-sm`,onClick:be},`复制`)]),I(`div`,XL,j(g.value),1)])):Zr(``,!0)]),_:1},8,[`show`]),L(oL,{show:S.show,title:S.title,message:S.message,onConfirm:ee,onCancel:T},null,8,[`show`,`title`,`message`]),L(dL,{show:E.show,title:E.title,label:E.label,initial:E.initial,onConfirm:k,onCancel:ne},null,8,[`show`,`title`,`label`,`initial`])]))}},QL=ul(ZL,[[`__scopeId`,`data-v-e7f3da17`]])})),eR,tR,nR,rR,iR,aR,oR,sR,cR,lR,uR,dR,fR,pR,mR,hR,gR,_R,vR,yR,bR,xR,SR,CR,wR,TR,ER,DR,OR,kR,AR,jR,MR,NR,PR,FR,IR,LR,RR,zR,BR,VR,HR,UR,WR,GR,KR,qR,JR,YR,XR,ZR,QR,$R,ez,tz,nz,rz,iz,az,oz,sz,cz,lz,uz,dz,fz,pz,mz,hz,gz,_z=t((()=>{ts(),Dm(),iL(),sL(),fL(),eR={class:`layout`},tR={class:`sidebar`},nR={class:`stat-row`},rR={class:`stat`},iR={class:`stat-num`,style:{color:`var(--brand)`}},aR={class:`stat`},oR={class:`stat-num`,style:{color:`var(--success)`}},sR={style:{flex:`1`,"overflow-y":`auto`}},cR=[`onClick`],lR={class:`folder-arrow`},uR={style:{flex:`1`,"font-weight":`500`}},dR={class:`count`},fR=[`onClick`],pR={class:`folder-menu`},mR=[`onClick`],hR=[`onClick`],gR={class:`folder-children`},_R=[`onClick`],vR={class:`site-name`},yR={class:`site-count`},bR=[`onClick`],xR={class:`site-name`},SR={class:`site-count`},CR={class:`content`},wR={class:`content-header`},TR={key:0,style:{display:`flex`,"align-items":`center`,gap:`8px`}},ER={style:{"font-size":`11px`,color:`var(--text-tertiary)`}},DR={style:{"font-size":`15px`,"font-weight":`600`}},OR=[`href`],kR={key:1,class:`text-muted`},AR={key:2,style:{display:`flex`,gap:`6px`}},jR={class:`editor-pane`,style:{flex:`1`}},MR={key:0,style:{"text-align":`center`,padding:`80px 20px`,color:`var(--text-placeholder)`}},NR={key:1,style:{"text-align":`center`,padding:`80px 20px`,color:`var(--text-placeholder)`}},PR={key:2},FR={class:`card-header`},IR={class:`card-title`},LR={style:{display:`flex`,gap:`4px`,"align-items":`center`}},RR=[`onClick`,`disabled`],zR=[`onClick`,`disabled`],BR=[`onClick`],VR=[`onClick`],HR={class:`card-body`},UR={style:{"font-family":`monospace`}},WR=[`onClick`],GR={style:{"font-family":`monospace`}},KR={style:{display:`flex`,gap:`4px`}},qR=[`onClick`],JR=[`onClick`],YR={style:{color:`var(--text-secondary)`,"font-size":`12px`}},XR={class:`form-group`},ZR={class:`form-group`},QR={class:`form-group`},$R=[`value`],ez={class:`form-group`},tz={class:`form-group`},nz={class:`form-row`},rz=[`type`],iz={class:`form-group`},az={class:`form-group`},oz={class:`form-group`},sz={key:0,class:`result-box`},cz={class:`result-grid`},lz={style:{"font-family":`monospace`}},uz={style:{"font-family":`monospace`}},dz={class:`form-group`,style:{"margin-top":`12px`}},fz={class:`form-row`},pz=[`value`],mz={key:0,class:`alert alert-warning mb-md`},hz={class:`modal-footer`,style:{padding:`0`,border:`none`}},gz={__name:`WebsitesView`,setup(e){let t=Cm(),n=N([]),r=N([]),i=N(null),a=N(``),o=it({}),c=N(null),l=it({}),u=La(()=>n.value.reduce((e,t)=>e+(t.accounts?.length||0),0)),d=La(()=>{let e={};return n.value.forEach(t=>{let n=t.folder_id||`__none__`;e[n]=(e[n]||0)+1}),e});function f(e){return n.value.filter(t=>t.folder_id===e)}let p=La(()=>n.value.filter(e=>!e.folder_id)),m=N(!1),h=N(null),g=it({name:``,url:``,folder_id:null}),_=N(!1),v=N(null),y=it({username:``,password:``,remark:``,sort_order:0}),b=N(!1),x=N(!1),S=N(``),C=N(null),w=N(null),ee=N(``),T=it({show:!1,title:``,message:``}),E=null;function D(e,t){return new Promise(n=>{T.title=e,T.message=t,T.show=!0,E=n})}function O(){T.show=!1,E&&E(!0)}function te(){T.show=!1,E&&E(!1)}let k=it({show:!1,title:``,label:``,initial:``}),ne=null;function re(e,t,n){return new Promise(r=>{k.title=e,k.label=t,k.initial=n||``,k.show=!0,ne=r})}function ie(e){k.show=!1,ne&&ne(e)}function ae(){k.show=!1,ne&&ne(null)}function oe(e,t){T.title=e,T.message=t,T.show=!0,E=()=>{T.show=!1}}Pi(async()=>{let[e,i]=await Promise.all([t.listWebsites(),t.listFolders(`website`)]);n.value=e,r.value=i,i.forEach(e=>{o[e.id]=!0})});function se(e){i.value=e}function ce(e){if(!e)return`未分类`;let t=r.value.find(t=>t.id===e);return t?t.name:`未分类`}function le(e){o[e.id]=!o[e.id]}function ue(e,t){c.value=c.value===e.id?null:e.id}async function A(){let e=await re(`新建文件夹`,`文件夹名称`,``);if(!e)return;let n=await t.createFolder({name:e,type:`website`});r.value.push(n),o[n.id]=!0}async function de(e){let n=await re(`重命名文件夹`,`新名称`,e.name);n&&(await t.updateFolder(e.id,{name:n}),e.name=n)}function fe(e){h.value=e||null,e?(g.name=e.name,g.url=e.url,g.folder_id=e.folder_id):(g.name=``,g.url=``,g.folder_id=null),m.value=!0}async function pe(){h.value?await t.updateWebsite(h.value.id,{...g}):await t.createWebsite({...g}),m.value=!1,await Ce()}function me(e){v.value=e||null,b.value=!1,e?(y.username=e.username,y.password=e.password,y.remark=e.remark||``,y.sort_order=e.sort_order||0):(y.username=``,y.password=``,y.remark=``,y.sort_order=(i.value?.accounts?.length||0)+1),_.value=!0}async function he(){let e={username:y.username,password:y.password,remark:y.remark,sort_order:y.sort_order};v.value?await t.updateAccount(v.value.id,e):await t.addAccount(i.value.id,e),_.value=!1,i.value=await t.getWebsite(i.value.id)}async function ge(){!i.value||!await D(`删除网站`,`确定删除「${i.value.name}」及其所有账号?`)||(await t.deleteWebsite(i.value.id),i.value=null,await Ce())}async function _e(e,n){await t.moveAccount(e,n),i.value=await t.getWebsite(i.value.id)}async function ve(e){let n=i.value?.accounts?.find(t=>t.id===e);await D(`删除账号`,`确定删除「${n?.remark||n?.username||`账号`}」吗?`)&&(await t.deleteAccount(e),i.value=await t.getWebsite(i.value.id))}async function ye(e){await D(`删除文件夹`,`确定删除文件夹「${e.name}」吗?内容将移至「未分类」`)&&(await t.deleteFolder(e.id),r.value=r.value.filter(t=>t.id!==e.id),await Ce())}async function be(){let e=S.value.trim();if(!e)return oe(`提示`,`请先粘贴文本`);let n=await t.parseImport(e);if(!n.ok)return oe(`识别失败`,n.error);C.value=n,n.matched_site?.folder_id&&(w.value=n.matched_site.folder_id)}async function xe(){let e=C.value;if(!e)return;let n=w.value;ee.value&&(n=(await t.createFolder({name:ee.value,type:`website`})).id);let r=e.matched_site;r||=await t.createWebsite({name:e.site_name,url:e.url,folder_id:n}),await t.addAccount(r.id,{username:e.username,password:e.password,remark:e.remark}),x.value=!1,await Ce()}function Se(e){navigator.clipboard.writeText(e)}async function Ce(){n.value=await t.listWebsites()}function we(){c.value=null}return Pi(()=>document.addEventListener(`click`,we)),Ri(()=>document.removeEventListener(`click`,we)),(e,t)=>(P(),F(`div`,eR,[I(`aside`,tR,[I(`div`,nR,[I(`div`,rR,[I(`div`,iR,j(n.value.length),1),t[22]||=I(`div`,{class:`stat-label`},`网站`,-1)]),I(`div`,aR,[I(`div`,oR,j(u.value),1),t[23]||=I(`div`,{class:`stat-label`},`账号`,-1)])]),I(`button`,{class:`btn btn-primary btn-block`,onClick:t[0]||=e=>fe()},`添加网站`),I(`button`,{class:`btn btn-outline btn-block`,onClick:t[1]||=e=>x.value=!0},`智能导入`),I(`div`,{class:`sidebar-label`},[t[24]||=I(`span`,null,`文件夹`,-1),I(`span`,{class:`add-btn`,onClick:A},`+`)]),On(I(`input`,{class:`input mb-sm`,type:`text`,placeholder:`搜索网站或网址…`,"onUpdate:modelValue":t[2]||=e=>a.value=e},null,512),[[Vo,a.value]]),I(`div`,sR,[(P(!0),F(ga,null,Zn(r.value,e=>(P(),F(`div`,{key:e.id,class:`folder-group`},[I(`div`,{class:`folder-item`,onClick:t=>le(e),style:{position:`relative`}},[I(`span`,lR,j(o[e.id]?`▼`:`▶`),1),I(`span`,uR,`📁 `+j(e.name),1),I(`span`,dR,j(d.value[e.id]||0),1),I(`span`,{class:`folder-more`,onClick:Jo(t=>ue(e,t),[`stop`])},`⋮`,8,fR),On(I(`div`,pR,[I(`div`,{class:`folder-menu-item`,onClick:Jo(t=>de(e),[`stop`])},`✏️ 重命名`,8,mR),I(`div`,{class:`folder-menu-item danger`,onClick:Jo(t=>ye(e),[`stop`])},`🗑 删除`,8,hR)],512),[[To,c.value===e.id]])],8,cR),On(I(`div`,gR,[(P(!0),F(ga,null,Zn(f(e.id),e=>(P(),F(`div`,{key:e.id,class:s([`site-item`,{active:i.value?.id===e.id}]),onClick:t=>se(e)},[t[25]||=I(`span`,null,`🌐`,-1),I(`span`,vR,j(e.name),1),I(`span`,yR,j(e.accounts?.length||0)+`个`,1)],10,_R))),128))],512),[[To,o[e.id]]])]))),128)),t[27]||=I(`div`,{class:`sidebar-label`},`未分类`,-1),(P(!0),F(ga,null,Zn(p.value,e=>(P(),F(`div`,{key:e.id,class:s([`site-item`,{active:i.value?.id===e.id}]),onClick:t=>se(e)},[t[26]||=I(`span`,null,`🌐`,-1),I(`span`,xR,j(e.name),1),I(`span`,SR,j(e.accounts?.length||0)+`个`,1)],10,bR))),128))])]),I(`section`,CR,[I(`div`,wR,[i.value?(P(),F(`div`,TR,[I(`span`,ER,j(ce(i.value.folder_id))+` /`,1),I(`span`,DR,j(i.value.name),1),I(`a`,{href:i.value.url,target:`_blank`,style:{"font-size":`11px`,color:`var(--brand)`,"text-decoration":`none`}},j(i.value.url),9,OR)])):(P(),F(`div`,kR,`选择左侧网站查看账号`)),i.value?(P(),F(`div`,AR,[I(`button`,{class:`btn btn-ghost btn-sm`,onClick:t[3]||=e=>fe(i.value)},`✏️ 编辑`),I(`button`,{class:`btn btn-outline btn-sm`,onClick:t[4]||=e=>me()},`+ 添加账号`),I(`button`,{class:`btn btn-danger-ghost btn-sm`,onClick:ge},`🗑 删除网站`)])):Zr(``,!0)]),I(`div`,jR,[i.value?i.value.accounts?.length?(P(),F(`div`,PR,[(P(!0),F(ga,null,Zn(i.value.accounts,(e,n)=>(P(),F(`div`,{key:e.id,class:`card`},[I(`div`,FR,[I(`span`,IR,`👤 `+j(e.remark||`账号`),1),I(`div`,LR,[I(`button`,{class:`card-btn`,onClick:t=>_e(e.id,`up`),disabled:n===0,title:`上移`},`↑`,8,RR),I(`button`,{class:`card-btn`,onClick:t=>_e(e.id,`down`),disabled:n===i.value.accounts.length-1,title:`下移`},`↓`,8,zR),I(`button`,{class:`card-btn edit-btn`,onClick:t=>me(e)},`✏️ 编辑`,8,BR),I(`button`,{class:`card-btn danger-btn`,onClick:t=>ve(e.id)},`🗑 删除`,8,VR)])]),I(`div`,HR,[t[30]||=I(`span`,{class:`label`},`账号`,-1),I(`span`,UR,j(e.username),1),I(`button`,{class:`card-btn`,onClick:t=>Se(e.username)},`复制`,8,WR),t[31]||=I(`span`,{class:`label`},`密码`,-1),I(`span`,GR,j(l[e.id]?e.password:`••••••••`),1),I(`div`,KR,[I(`button`,{class:`card-btn`,onClick:t=>l[e.id]=!l[e.id]},j(l[e.id]?`隐藏`:`显示`),9,qR),I(`button`,{class:`card-btn`,onClick:t=>Se(e.password)},`复制`,8,JR)]),t[32]||=I(`span`,{class:`label`},`说明`,-1),I(`span`,YR,j(e.remark||`-`),1),t[33]||=I(`span`,null,null,-1)])]))),128))])):(P(),F(`div`,NR,[...t[29]||=[I(`p`,null,`暂无账号`,-1)]])):(P(),F(`div`,MR,[...t[28]||=[I(`div`,{style:{"font-size":`48px`,"margin-bottom":`16px`,opacity:`0.4`}},`🔐`,-1),I(`p`,null,`选择左侧网站查看账号密码`,-1)]]))])]),L(rL,{show:m.value,title:h.value?`编辑网站`:`添加网站`,onClose:t[9]||=e=>m.value=!1},{footer:Dn(()=>[I(`button`,{class:`btn btn-ghost`,onClick:t[8]||=e=>m.value=!1},`取消`),I(`button`,{class:`btn btn-primary`,onClick:pe},`保存`)]),default:Dn(()=>[I(`div`,XR,[t[34]||=I(`label`,{class:`form-label`},`网站名`,-1),On(I(`input`,{class:`input`,"onUpdate:modelValue":t[5]||=e=>g.name=e,placeholder:`例如:GitHub`},null,512),[[Vo,g.name]])]),I(`div`,ZR,[t[35]||=I(`label`,{class:`form-label`},`网址`,-1),On(I(`input`,{class:`input`,"onUpdate:modelValue":t[6]||=e=>g.url=e,placeholder:`https://github.com`},null,512),[[Vo,g.url]])]),I(`div`,QR,[t[37]||=I(`label`,{class:`form-label`},`文件夹`,-1),On(I(`select`,{class:`select`,"onUpdate:modelValue":t[7]||=e=>g.folder_id=e},[t[36]||=I(`option`,{value:null},`未分类`,-1),(P(!0),F(ga,null,Zn(r.value,e=>(P(),F(`option`,{key:e.id,value:e.id},j(e.name),9,$R))),128))],512),[[Wo,g.folder_id]])])]),_:1},8,[`show`,`title`]),L(rL,{show:_.value,title:v.value?`编辑账号`:`添加账号`,onClose:t[16]||=e=>_.value=!1},{footer:Dn(()=>[I(`button`,{class:`btn btn-ghost`,onClick:t[15]||=e=>_.value=!1},`取消`),I(`button`,{class:`btn btn-primary`,onClick:he},`保存`)]),default:Dn(()=>[I(`div`,ez,[t[38]||=I(`label`,{class:`form-label`},`账号 / 用户名`,-1),On(I(`input`,{class:`input`,"onUpdate:modelValue":t[10]||=e=>y.username=e,placeholder:`user@example.com`},null,512),[[Vo,y.username]])]),I(`div`,tz,[t[39]||=I(`label`,{class:`form-label`},`密码`,-1),I(`div`,nz,[On(I(`input`,{class:`input`,type:b.value?`text`:`password`,"onUpdate:modelValue":t[11]||=e=>y.password=e,placeholder:`输入密码`,style:{flex:`1`}},null,8,rz),[[Go,y.password]]),I(`button`,{class:`btn btn-ghost btn-sm`,type:`button`,onClick:t[12]||=e=>b.value=!b.value},j(b.value?`隐藏`:`显示`),1)])]),I(`div`,iz,[t[40]||=I(`label`,{class:`form-label`},`备注`,-1),On(I(`textarea`,{class:`textarea`,"onUpdate:modelValue":t[13]||=e=>y.remark=e,rows:`2`,placeholder:`例如:主账号、小号…`},null,512),[[Vo,y.remark]])]),I(`div`,az,[t[41]||=I(`label`,{class:`form-label`},`排序`,-1),On(I(`input`,{class:`input`,"onUpdate:modelValue":t[14]||=e=>y.sort_order=e,type:`number`,placeholder:`数字越小越靠前`,style:{width:`120px`}},null,512),[[Vo,y.sort_order,void 0,{number:!0}]])])]),_:1},8,[`show`,`title`]),L(rL,{show:x.value,title:`智能导入`,width:520,onClose:t[21]||=e=>x.value=!1},{default:Dn(()=>[I(`div`,oz,[t[42]||=I(`label`,{class:`form-label`},`粘贴账号信息`,-1),On(I(`textarea`,{class:`import-textarea`,"onUpdate:modelValue":t[17]||=e=>S.value=e,placeholder:`https://github.com 代码网站 +zhangsan@qq.com +Abc123 +个人开发账号`},null,512),[[Vo,S.value]]),t[43]||=I(`div`,{class:`import-hint`},`首行=网址+空格+网站名 | 第2行=账号 | 第3行=密码 | 第4行=备注`,-1)]),I(`button`,{class:`btn btn-primary btn-block mb-md`,onClick:be},`🔍 自动识别`),C.value?(P(),F(`div`,sz,[t[53]||=I(`div`,{style:{"font-weight":`600`,color:`#166534`,"margin-bottom":`10px`}},`识别结果`,-1),I(`div`,cz,[t[44]||=I(`span`,{style:{color:`var(--text-secondary)`}},`网址`,-1),I(`span`,null,j(C.value.url),1),t[45]||=I(`span`,{style:{color:`var(--text-secondary)`}},`网站名`,-1),I(`span`,null,j(C.value.site_name),1),t[46]||=I(`span`,{style:{color:`var(--text-secondary)`}},`账号`,-1),I(`span`,lz,j(C.value.username),1),t[47]||=I(`span`,{style:{color:`var(--text-secondary)`}},`密码`,-1),I(`span`,uz,j(C.value.password),1),t[48]||=I(`span`,{style:{color:`var(--text-secondary)`}},`备注`,-1),I(`span`,null,j(C.value.remark||`(无)`),1)]),I(`div`,dz,[t[51]||=I(`label`,{class:`form-label`},`存放文件夹`,-1),I(`div`,fz,[On(I(`select`,{class:`select`,"onUpdate:modelValue":t[18]||=e=>w.value=e},[t[49]||=I(`option`,{value:null},`已有文件夹…`,-1),(P(!0),F(ga,null,Zn(r.value,e=>(P(),F(`option`,{key:e.id,value:e.id},j(e.name),9,pz))),128))],512),[[Wo,w.value]]),t[50]||=I(`span`,{class:`text-muted`},`或`,-1),On(I(`input`,{class:`input`,"onUpdate:modelValue":t[19]||=e=>ee.value=e,placeholder:`新建文件夹…`,style:{flex:`1`}},null,512),[[Vo,ee.value]])])]),C.value.matched_site?(P(),F(`div`,mz,[t[52]||=Xr(` ⚠️ `,-1),I(`strong`,null,j(C.value.matched_site.name),1),Xr(` 已存在(`+j(C.value.matched_site.account_count)+`个账号),将追加进去 `,1)])):Zr(``,!0),I(`div`,hz,[I(`button`,{class:`btn btn-ghost`,onClick:t[20]||=e=>x.value=!1},`取消`),I(`button`,{class:`btn btn-primary`,onClick:xe},`确认添加`)])])):Zr(``,!0)]),_:1},8,[`show`]),L(oL,{show:T.show,title:T.title,message:T.message,onConfirm:O,onCancel:te},null,8,[`show`,`title`,`message`]),L(dL,{show:k.show,title:k.title,label:k.label,initial:k.initial,onConfirm:ie,onCancel:ae},null,8,[`show`,`title`,`label`,`initial`])]))}}})),vz=t((()=>{})),yz,bz,xz,Sz,Cz,wz,Tz,Ez,Dz,Oz,kz,Az,jz,Mz,Nz,Pz,Fz,Iz,Lz=t((()=>{ts(),sL(),vz(),dl(),yz={class:`layout`},bz={class:`content`},xz={class:`content-header`},Sz={class:`text-muted`},Cz={style:{flex:`1`,"overflow-y":`auto`,padding:`0 20px 20px`}},wz={key:0,style:{"text-align":`center`,padding:`80px 20px`,color:`var(--text-placeholder)`}},Tz={key:1,class:`doc-table`},Ez={class:`doc-title-cell`,"data-label":`标题`},Dz={"data-label":`链接`,style:{"font-size":`12px`,"font-family":`monospace`}},Oz=[`href`],kz={"data-label":`有效期`,style:{"font-size":`12px`,color:`var(--text-secondary)`}},Az={"data-label":`创建人`,style:{"font-size":`12px`,color:`var(--text-secondary)`}},jz={"data-label":`更新时间`,style:{"font-size":`12px`,color:`var(--text-tertiary)`,"font-family":`monospace`}},Mz={style:{display:`flex`,gap:`4px`}},Nz=[`onClick`],Pz=[`onClick`],Fz={__name:`SharesView`,setup(e){let t=N([]),n=it({show:!1,title:``,message:``}),r=null;function i(e,t){return new Promise(i=>{n.title=e,n.message=t,n.show=!0,r=i})}function a(){n.show=!1,r&&r(!0)}function o(){n.show=!1,r&&r(!1)}let s=window.location.hostname===`localhost`?``:`https://mokeetext.server.zgitm.com`;Pi(c);async function c(){t.value=await(await fetch(s+`/api/shares`)).json()}function l(e){return e?e.replace(`T`,` `).substring(0,19):`-`}function u(e){let t=s+e.share_url;navigator.clipboard.writeText(t);let n=document.createElement(`div`);n.className=`toast`,n.textContent=`已复制`,document.body.appendChild(n),setTimeout(()=>n.remove(),1500)}async function d(e){await i(`取消分享`,`确定取消「${e.title}」的分享链接?`)&&(await fetch(s+`/api/notes/${e.id}/share`,{method:`DELETE`}),await c())}return(e,r)=>(P(),F(`div`,yz,[I(`section`,bz,[I(`div`,xz,[r[0]||=I(`span`,{style:{"font-size":`15px`,"font-weight":`600`}},`分享管理`,-1),I(`span`,Sz,j(t.value.length)+` 条分享`,1)]),I(`div`,Cz,[t.value.length?(P(),F(`table`,Tz,[r[2]||=I(`thead`,null,[I(`tr`,null,[I(`th`,{style:{width:`25%`}},`笔记标题`),I(`th`,{style:{width:`30%`}},`分享链接`),I(`th`,{style:{width:`12%`}},`有效期`),I(`th`,{style:{width:`8%`}},`创建人`),I(`th`,{style:{width:`12%`}},`更新时间`),I(`th`,{style:{width:`13%`}},`操作`)])],-1),I(`tbody`,null,[(P(!0),F(ga,null,Zn(t.value,e=>(P(),F(`tr`,{key:e.id},[I(`td`,Ez,j(e.title||`无标题`),1),I(`td`,Dz,[I(`a`,{href:gt(s)+e.share_url,target:`_blank`,style:{color:`var(--brand)`,"text-decoration":`none`}},j(gt(s)+e.share_url),9,Oz)]),I(`td`,kz,j(e.share_expires_at),1),I(`td`,Az,j(e.created_by),1),I(`td`,jz,j(l(e.updated_at)),1),I(`td`,null,[I(`div`,Mz,[I(`button`,{class:`card-btn`,onClick:t=>u(e)},`复制`,8,Nz),I(`button`,{class:`card-btn danger-btn`,onClick:t=>d(e)},`取消分享`,8,Pz)])])]))),128))])])):(P(),F(`div`,wz,[...r[1]||=[I(`p`,null,`暂无分享记录`,-1)]]))])]),L(oL,{show:n.show,title:n.title,message:n.message,onConfirm:a,onCancel:o},null,8,[`show`,`title`,`message`])]))}},Iz=ul(Fz,[[`__scopeId`,`data-v-04fd67c6`]])})),Rz,zz,Bz,Vz,Hz,Uz=t((()=>{cl(),$L(),_z(),Lz(),Rz=`mokeetext-edit`,zz=`https://login.user.zgitm.com`,Bz=window.location.origin,Vz=[{path:`/`,redirect:`/notes`},{path:`/notes`,name:`notes`,component:QL},{path:`/websites`,name:`websites`,component:gz},{path:`/shares`,name:`shares`,component:Iz}],Hz=Kc({history:wc(),routes:Vz}),Hz.beforeEach((e,t,n)=>{if(window.location.hostname===`localhost`){n();return}if(!document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1]){window.location.href=`${zz}?systemCode=${Rz}&redirect=${encodeURIComponent(Bz)}`;return}n()})}));function Wz(){let e=document.cookie.match(/(?:^|;\s*)token=([^;]*)/)?.[1];if(!e)return[];try{return JSON.parse(atob(e.split(`.`)[1])).permissions??[]}catch{return[]}}var Gz,Kz=t((()=>{Gz={mounted(e,t){let n=Wz(),r=t.value;r&&!n.includes(r)&&e.parentNode?.removeChild(e)}}})),qz=t((()=>{}));n((()=>{ts(),wl(),Uz(),Kz(),qz();var e=$o(Cl);e.use(Hz),e.directive(`permission`,Gz),e.mount(`#app`)}))(); \ No newline at end of file diff --git a/frontend/static/dist/index.html b/frontend/static/dist/index.html new file mode 100644 index 0000000..a3cd94d --- /dev/null +++ b/frontend/static/dist/index.html @@ -0,0 +1,13 @@ + + + + + + MoKeeText + + + + +
+ + diff --git a/frontend/static/js/editor.js b/frontend/static/js/editor.js new file mode 100644 index 0000000..73fc21b --- /dev/null +++ b/frontend/static/js/editor.js @@ -0,0 +1,133 @@ +/** + * Tiptap 增强编辑器初始化 + * 支持:文字颜色、背景高亮、图片、表格、任务列表、代码块 + */ +let editor = null; + +function initEditor(content) { + content = content || ''; + if (editor) { + editor.destroy(); + } + + editor = new tiptap.Editor({ + element: document.querySelector("#tiptapEditor"), + extensions: [ + tiptap.StarterKit, + tiptap.TextStyle, + tiptap.Color, + tiptap.Highlight.configure({ multicolor: true }), + tiptap.Image.configure({ inline: true, allowBase64: true }), + tiptap.Table.configure({ resizable: true }), + tiptap.TableRow, + tiptap.TableCell, + tiptap.TableHeader, + tiptap.TaskList, + tiptap.TaskItem.configure({ nested: true }), + ], + content: content, + onUpdate: function() { + updatePreview(); + scheduleSave(); + }, + }); + + renderToolbar(); +} + +function renderToolbar() { + var toolbar = document.querySelector("#tiptapToolbar"); + if (!toolbar) return; + + var html = ''; + + // 标题 + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + // 内联格式 + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + // 颜色 + html += ''; + html += ''; + html += ''; + html += ''; + + // 媒体 + html += ''; + html += ''; + html += ''; + html += ''; + + // 块级元素 + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + // 表格 + html += ''; + html += ''; + html += ''; + + toolbar.innerHTML = html; + + // 绑定按钮事件 + var actions = { + 'h1': function() { editor.chain().focus().toggleHeading({ level: 1 }).run(); }, + 'h2': function() { editor.chain().focus().toggleHeading({ level: 2 }).run(); }, + 'h3': function() { editor.chain().focus().toggleHeading({ level: 3 }).run(); }, + 'bold': function() { editor.chain().focus().toggleBold().run(); }, + 'italic': function() { editor.chain().focus().toggleItalic().run(); }, + 'strike': function() { editor.chain().focus().toggleStrike().run(); }, + 'image': function() { + var url = prompt('输入图片 URL(支持直接粘贴图片链接):'); + if (url) editor.chain().focus().setImage({ src: url }).run(); + }, + 'emoji': function() { + var emoji = prompt('输入表情符号(Win+. 打开系统表情面板粘贴):'); + if (emoji) editor.chain().focus().insertContent(emoji).run(); + }, + 'bulletList': function() { editor.chain().focus().toggleBulletList().run(); }, + 'orderedList': function() { editor.chain().focus().toggleOrderedList().run(); }, + 'taskList': function() { editor.chain().focus().toggleTaskList().run(); }, + 'blockquote': function() { editor.chain().focus().toggleBlockquote().run(); }, + 'codeBlock': function() { editor.chain().focus().toggleCodeBlock().run(); }, + 'table': function() { editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(); }, + }; + + toolbar.querySelectorAll('.tb-btn').forEach(function(btn) { + var action = btn.dataset.action; + if (actions[action]) { + btn.addEventListener('click', actions[action]); + } + }); + + // 颜色选择器 + var textColor = document.querySelector('#textColor'); + var bgColor = document.querySelector('#bgColor'); + if (textColor) textColor.addEventListener('input', function(e) { + editor.chain().focus().setColor(e.target.value).run(); + }); + if (bgColor) bgColor.addEventListener('input', function(e) { + editor.chain().focus().toggleHighlight({ color: e.target.value }).run(); + }); +} + +function updatePreview() { + var preview = document.querySelector("#previewContent"); + if (preview && editor) { + preview.innerHTML = editor.getHTML(); + } +} diff --git a/frontend/static/js/notes.js b/frontend/static/js/notes.js new file mode 100644 index 0000000..f806bda --- /dev/null +++ b/frontend/static/js/notes.js @@ -0,0 +1,150 @@ +/** + * 笔记页面交互逻辑 + */ +var currentNoteId = null; +var saveTimer = null; +var viewMode = "edit"; + +function setViewMode(mode) { + viewMode = mode; + var editPane = document.querySelector("#editPane"); + var previewPane = document.querySelector("#previewPane"); + document.querySelectorAll(".toggle-group button").forEach(function(b) { + b.classList.toggle("active", b.dataset.mode === mode); + }); + editPane.classList.remove("hidden"); + previewPane.classList.remove("hidden"); + if (mode === "edit") { previewPane.classList.add("hidden"); } + else if (mode === "preview") { editPane.classList.add("hidden"); } + updatePreview(); +} + +function createNote() { + var folderId = getActiveFolderId(); + fetch("/api/notes", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ title: "无标题笔记", content: "", folder_id: folderId }), + }).then(function(r) { return r.json(); }) + .then(function(note) { loadNote(note.id); refreshFolderNotes(); }); +} + +function loadNote(noteId) { + fetch("/api/notes/" + noteId) + .then(function(r) { return r.json(); }) + .then(function(note) { + currentNoteId = note.id; + document.querySelector("#currentNoteId").value = note.id; + document.querySelector("#noteTitle").value = note.title; + initEditor(note.content || ""); + document.querySelectorAll(".note-list-item").forEach(function(el) { + el.classList.toggle("active", parseInt(el.dataset.noteId) === note.id); + }); + }); +} + +function scheduleSave() { + var s = document.querySelector("#saveStatus"); + if (s) { s.textContent = "保存中…"; s.style.color = "#F5A623"; } + clearTimeout(saveTimer); + saveTimer = setTimeout(saveNote, 800); +} + +function saveNote() { + if (!currentNoteId) return; + var title = document.querySelector("#noteTitle").value; + var content = editor ? editor.getHTML() : ""; + fetch("/api/notes/" + currentNoteId, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ title: title, content: content }), + }).then(function(r) { + if (r.ok) { var s = document.querySelector("#saveStatus"); if (s) { s.textContent = "已保存"; s.style.color = ""; } } + }); +} + +function filterByFolder(folderId, el) { + document.querySelectorAll(".folder-item").forEach(function(f) { f.classList.remove("active"); }); + el.classList.add("active"); + fetch("/api/notes?folder_id=" + folderId) + .then(function(r) { return r.json(); }) + .then(function(notes) { renderNoteList(notes); }); +} + +function renderNoteList(notes) { + var listDiv = document.querySelector("#folderNoteList"); + if (!listDiv) return; + listDiv.classList.remove("hidden"); + + var html = '
← 返回文件夹
'; + if (!notes.length) { + html += '
暂无笔记
'; + } else { + notes.forEach(function(note) { + var title = note.title || "无标题"; + var date = (note.updated_at || "").substr(0, 10); + html += '
' + + '' + escapeHtml(title) + '' + + '' + date + '
'; + }); + } + listDiv.innerHTML = html; +} + +function showFolderList() { + var listDiv = document.querySelector("#folderNoteList"); + if (listDiv) listDiv.classList.add("hidden"); +} + +function getActiveFolderId() { + var active = document.querySelector(".folder-item.active"); + return active ? parseInt(active.dataset.folderId) : null; +} + +function refreshFolderNotes() { + var af = document.querySelector(".folder-item.active"); + if (af) filterByFolder(parseInt(af.dataset.folderId), af); +} + +function addFolder() { + var name = prompt("输入新文件夹名称:"); + if (!name) return; + fetch("/api/folders", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: name, type: "note" }) }) + .then(function() { window.location.reload(); }); +} + +function toggleFolderMenu(btn) { + document.querySelectorAll(".folder-menu").forEach(function(m) { if (m !== btn.nextElementSibling) m.classList.add("hidden"); }); + var menu = btn.nextElementSibling; + if (menu) menu.classList.toggle("hidden"); + setTimeout(function() { + document.addEventListener("click", function close() { if (menu) menu.classList.add("hidden"); document.removeEventListener("click", close); }, { once: true }); + }, 0); +} + +function renameFolder(folderId) { + var name = prompt("新名称:"); if (!name) return; + fetch("/api/folders/" + folderId, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: name }) }) + .then(function() { window.location.reload(); }); +} + +function deleteFolder(folderId) { + if (!confirm("确定删除此文件夹?内容将移至「未分类」")) return; + fetch("/api/folders/" + folderId, { method: "DELETE" }).then(function() { window.location.reload(); }); +} + +function deleteCurrentNote() { + if (!currentNoteId || !confirm("确定删除?")) return; + fetch("/api/notes/" + currentNoteId, { method: "DELETE" }).then(function() { window.location.reload(); }); +} + +function filterByTag(tagId, el) { el.classList.toggle("active"); } +function addTag() { var n = prompt("标签名:"); if (n) window.location.reload(); } + +function escapeHtml(s) { return s ? s.replace(/&/g,"&").replace(//g,">").replace(/"/g,""") : ""; } + +document.addEventListener("DOMContentLoaded", function() { + document.querySelector("#noteTitle").addEventListener("input", scheduleSave); + var firstId = document.querySelector("#firstNoteId"); + if (firstId && firstId.value) loadNote(parseInt(firstId.value)); else createNote(); +}); diff --git a/frontend/static/js/vendor/tiptap-bundle.min.js b/frontend/static/js/vendor/tiptap-bundle.min.js new file mode 100644 index 0000000..f2f44b5 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-bundle.min.js @@ -0,0 +1,155 @@ +var __tiptap_bundle__=(()=>{var O=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var nm=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};function fe(n){this.content=n}var Hs,Ba=O(()=>{fe.prototype={constructor:fe,find:function(n){for(var e=0;e>1}};fe.from=function(n){if(n instanceof fe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new fe(e)};Hs=fe});function Ua(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d=56320&&n<57344}function Xa(n){return n>=55296&&n<56320}function Pr(n,e){return $s.index=n,$s.offset=e,$s}function Br(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;rn.depth)throw new kt("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new kt("Inconsistent open depths");return Za(n,e,t,0)}function Za(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Dn(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(It(n.nodeAfter,r),s++));for(let l=s;li&&_s(n,e,i+1),o=r.depth>i&&_s(t,r,i+1),l=[];return Dn(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(ec(s,o),It(Dt(s,tc(n,e,t,r,i+1)),l)):(s&&It(Dt(s,Fr(n,e,i+1)),l),Dn(e,t,i,l),o&&It(Dt(o,Fr(t,r,i+1)),l)),Dn(r,null,i,l),new b(l)}function Fr(n,e,t){let r=[];if(Dn(null,n,t,r),n.depth>t){let i=_s(n,e,t+1);It(Dt(i,Fr(n,e,t+1)),r)}return Dn(e,null,t,r),new b(r)}function im(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}function nc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function rc(n){let e=[];do e.push(lm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function lm(n){let e=[];do e.push(am(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function am(n){let e=dm(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=cm(n,e);else break;return e}function Ha(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function cm(n,e){let t=Ha(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ha(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function um(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function dm(n){if(n.eat("(")){let e=rc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=um(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function fm(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Lt(r.indexOf(n.length-1)>-1);for(let o=0;o{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}function _a(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function gm(n){return n.tag!=null}function ym(n){return n.style!=null}function Va(n,e,t){return e!=null?(e?zn:0)|(e==="full"?Ks:0):n&&n.whitespace=="pre"?zn|Ks:t&~Pn}function km(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&uc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function xm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Wa(n){let e={};for(let t in n)e[t]=n[t];return e}function ja(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;du)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(n.createTextNode(f));else{let{dom:h,contentDOM:p}=zr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var b,$s,W,kt,S,Hr,Vs,sm,Fa,Pt,om,Me,Ws,Lt,js,$r,Js,Ln,ln,je,cc,bm,uc,zn,Ks,Pn,on,_r,tt,Ka,nt=O(()=>{Ba();b=class n{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;re&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new n(r,i)}cutByIndex(e,t){return e==t?n.empty:e==0&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new n(i,s)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Pr(t+1,s):Pr(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return n.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return n.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};W.none=[];kt=class extends Error{},S=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Qa(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(Ya(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return n.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new n(e,r,i)}};S.empty=new S(b.empty,0,0);Hr=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Pt(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new n(t,r,s)}static resolveCached(e,t){let r=Fa.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),nc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=b.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=b.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Me.prototype.text=void 0;Ws=class n extends Me{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};Lt=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new js(e,t);if(r.next==null)return n.empty;let i=rc(r);r.next&&r.err("Unexpected trailing text");let s=hm(fm(i));return pm(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +`)}};Lt.empty=new Lt(!0);js=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};$r=class n{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ac(e,r.attrs),this.defaultAttrs=sc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Lt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:oc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Me(this,this.computeAttrs(e),b.from(t),W.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new Me(this,this.computeAttrs(e),t,W.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(b.empty,!0);return s?new Me(this,e,t.append(s),W.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new n(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};Js=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?mm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Ln=class n{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=ac(e,i.attrs),this.excluded=null;let s=sc(this.attrs);this.instance=s?new W(this,s):null}create(e=null){return!e&&this.instance?this.instance:new W(this,oc(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new n(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}},ln=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Hs.from(e.nodes),t.marks=Hs.from(e.marks||{}),this.nodes=$r.compile(this.spec.nodes,this),this.marks=Ln.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Lt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?_a(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:_a(this,o.split(" "))}this.nodeFromJSON=i=>Me.fromJSON(this,i),this.markFromJSON=i=>W.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof $r){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Ws(r,r.defaultAttrs,e,W.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};je=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(gm(i))this.tags.push(i);else if(ym(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new _r(this,t,!1);return r.addAll(e,W.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new _r(this,t,!0);return r.addAll(e,W.none,t.from,t.to),S.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=Wa(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Wa(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},cc={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},bm={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},uc={ol:!0,ul:!0},zn=1,Ks=2,Pn=4;on=class{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=W.none,this.match=s||(o&Pn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zn)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!cc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},_r=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Va(null,t.preserveWhitespace,0)|(r?Pn:0);i?s=new on(i.type,i.attrs,W.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new on(null,null,W.none,!0,null,o):s=new on(e.schema.topNodeType,null,W.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&Ks?"full":this.localPreserveWS||(i.options&zn)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,` +`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o(o.type?o.type.allowsMarkType(c.type):ja(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new on(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=zn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};tt=class n{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Lr(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&zr(Lr(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:zr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ja(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Ja(e.marks)}};Ka=new WeakMap});function Cm(n,e){return n+e*pc}function dc(n){return n&hc}function vm(n){return(n-(n&hc))/pc}function Qs(n,e,t){let r=[];for(let i=0;i0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Mm(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function Tm(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Ln){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;un.step(new it(o.from,o.to,o.style)))}function Zs(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a=0;a--)n.step(o[a])}function Em(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function st(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+i,a=n.$to.indexAfter(r)-s;if(rt;p--)m||r.index(p)>0?(m=!0,u=b.from(r.node(p).copy(u)),d++):a--;let f=b.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Q(i,s,i,s,new S(r,0,0),t.length,!0))}function Im(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&Dm(n.doc,n.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&kc(n,o,l,s),Zs(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let u=n.mapping.slice(s),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new Q(d,f,d+1,f-1,new S(b.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&bc(n,o,l,s),!1}})}function bc(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function kc(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function Dm(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Pm(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Q(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new S(b.from(o),0,0),1,!0))}function Ne(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Lm(n,e,t=1,r){let i=n.doc.resolve(e),s=b.empty,o=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=b.from(i.node(l).copy(s));let u=r&&r[c];o=b.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new le(e,e,new S(s.append(o),t,t),!0))}function Re(n,e){let t=n.resolve(e),r=t.index();return xc(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function zm(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&xc(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Bm(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);kc(n,u.node(),u.before(),l)}o.inlineContent&&Zs(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new le(c,a.map(e+t,-1),S.empty,!0)),r===!0){let u=n.doc.resolve(c);bc(n,u.node(),u.before(),n.steps.length)}return n}function Fm(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Wn(n,e,t=e,r=S.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Sc(i,s,r)?new le(e,t,r):new Ys(i,s,r).fit()}function Sc(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}function Bn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Bn(n.firstChild.content,e-1,t)))}function Fn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Fn(n.lastChild.content,e-1,t)))}function qs(n,e){for(let t=0;t1&&(r=r.replaceChild(0,wc(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty,!0)))),n.copy(r)}function Gs(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!Hm(t,s.content,o)?l:null}function Hm(n,e,t){for(let r=t;r0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=$m(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function Cc(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(b.empty,!0))}return n}function Vm(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Fm(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new S(b.from(r),0,0))}function Wm(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(t),l=!1;for(let a=r.depth;a>o;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>o;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&t==i.start(a);a--)t=i.before(a);r=n.doc.resolve(e),i=n.doc.resolve(t)}}let s=vc(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function vc(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}var hc,pc,mc,gc,Vr,yc,Hn,rt,$n,Us,re,oe,_n,it,Vn,an,le,Q,Ys,Wr,jr,cn,xt,ot=O(()=>{nt();hc=65535,pc=Math.pow(2,16);mc=1,gc=2,Vr=4,yc=8,Hn=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&yc)>0}get deletedBefore(){return(this.delInfo&(mc|Vr))>0}get deletedAfter(){return(this.delInfo&(gc|Vr))>0}get deletedAcross(){return(this.delInfo&Vr)>0}},rt=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=dc(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Cm(l/3,e-a),m=e==a?gc:e==d?mc:Vr;return(t<0?e!=a:e!=d)&&(m|=yc),new Hn(h,m,p)}i+=u-c}return r?e+i:new Hn(e+i,0,null)}touches(e,t){let r=0,i=dc(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return oe.fromReplace(e,this.from,this.to,s)}invert(){return new it(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};re.jsonID("addMark",_n);it=class n extends re{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new S(Qs(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return oe.fromReplace(e,this.from,this.to,r)}invert(){return new _n(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};re.jsonID("removeMark",it);Vn=class n extends re{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return oe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return oe.fromReplace(e,this.pos,this.pos+1,new S(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new n(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,S.fromJSON(e,t.slice),t.insert,!!t.structure)}};re.jsonID("replaceAround",Q);Ys=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=b.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new S(s,o,l);return e>-1?new Q(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new le(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=qs(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(b.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=qs(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new S(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=qs(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new S(Bn(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new S(Bn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(d=g,u.push(wc(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Fn(this.placed,t,b.from(u)),this.frontier[t].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],u=Gs(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Fn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Fn(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=Fn(this.placed,this.frontier.length,t))}};Wr=class n extends re{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return oe.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return oe.fromReplace(e,this.pos,this.pos+1,new S(b.from(i),0,t.isLeaf?0:1))}getMap(){return rt.empty}invert(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};re.jsonID("attr",Wr);jr=class n extends re{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return oe.ok(r)}getMap(){return rt.empty}invert(e){return new n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};re.jsonID("docAttr",jr);cn=class extends Error{};cn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};cn.prototype=Object.create(Error.prototype);cn.prototype.constructor=cn;cn.prototype.name="TransformError";xt=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $n}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new cn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let r=0;r{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=S.empty){let i=Wn(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new S(b.from(r),0,0))}delete(e,t){return this.replace(e,t,S.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return _m(this,e,t,r),this}replaceRangeWith(e,t,r){return Vm(this,e,t,r),this}deleteRange(e,t){return Wm(this,e,t),this}lift(e,t){return Am(this,e,t),this}join(e,t=1){return Bm(this,e,t),this}wrap(e,t){return Rm(this,e,t),this}setBlockType(e,t=e,r,i=null){return Im(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Pm(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Wr(e,t,r)),this}setDocAttribute(e,t){return this.step(new jr(e,t)),this}addNodeMark(e,t){return this.step(new Vn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof W)t.isInSet(r.marks)&&this.step(new an(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new an(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,r){return Lm(this,e,t,r),this}addMark(e,t,r){return Mm(this,e,t,r),this}removeMark(e,t,r){return Tm(this,e,t,r),this}clearIncompatible(e,t,r){return Zs(this,e,t,r),this}}});var _e=O(()=>{ot()});function Tc(n){!Mc&&!n.parent.inlineContent&&(Mc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}function dn(n,e,t,r,i,s=!1){if(e.inlineContent)return v.create(n,t);for(let o=r-(i>0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&E.isSelectable(l))return E.create(n,t-(i<0?l.nodeSize:0))}else{let a=dn(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Ec(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(N.near(n.doc.resolve(o),t))}function Oc(n,e){return!e||!n?n:n.bind(e)}function Rc(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Rc(i,e,{})),t[r]=i}return t}function Ic(n){return n in to?n+"$"+ ++to[n]:(to[n]=0,n+"$")}var eo,N,fn,Mc,v,Ur,E,no,xe,jm,Ac,Kr,Nc,ro,Bt,Jm,jn,qr,I,to,z,lt=O(()=>{nt();ot();eo=Object.create(null),N=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new fn(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;s--){let o=t<0?dn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):dn(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new xe(e.node(0))}static atStart(e){return dn(e,e,0,0,1)||new xe(e)}static atEnd(e){return dn(e,e,e.content.size,e.childCount,-1)||new xe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=eo[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in eo)throw new RangeError("Duplicate use of selection JSON ID "+e);return eo[e]=t,t.prototype.jsonID=e,t}getBookmark(){return v.between(this.$anchor,this.$head).getBookmark()}};N.prototype.visible=!0;fn=class{constructor(e,t){this.$from=e,this.$to=t}},Mc=!1;v=class n extends N{constructor(e,t=e){Tc(e),Tc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return N.near(r);let i=e.resolve(t.map(this.anchor));return new n(i.parent.inlineContent?i:r,r)}replace(e,t=S.empty){if(super.replace(e,t),t==S.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ur(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=N.findFrom(t,r,!0)||N.findFrom(t,-r,!0);if(s)t=s.$head;else return N.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(N.findFrom(e,-r,!0)||N.findFrom(e,r,!0)).$anchor,e.pos0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Kr,this}ensureMarks(e){return W.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Kr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Kr,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||W.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(N.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Nc,this}get scrolledIntoView(){return(this.updated&Nc)>0}};Bt=class{constructor(e,t,r){this.name=e,this.init=Oc(t.init,r),this.apply=Oc(t.apply,r)}},Jm=[new Bt("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Bt("selection",{init(n,e){return n.selection||N.atStart(e.doc)},apply(n){return n.selection}}),new Bt("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Bt("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],jn=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jm.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Bt(r.key,r.spec.state,r))})}},qr=class n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new jn(e.schema,e.plugins),s=new n(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Me.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=N.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};I=class{constructor(e){this.spec=e,this.props={},e.props&&Rc(e.props,this,this.props),this.key=e.key?e.key.key:Ic("plugin")}getState(e){return e[this.key]}},to=Object.create(null);z=class{constructor(e="key"){this.key=Ic(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}});function Lc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}function Fc(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Wn(n.doc,s,a,S.empty);if(!c||c.from!=s||c instanceof le&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(v.create(u.doc,s)),t(u.scrollIntoView())}return!0}function hn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}function lo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Hc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let{$from:r,$to:i}=e.selection;if(e.selection instanceof E&&e.selection.node.isBlock)return!r.parentOffset||!Ne(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=ho(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let m=n&&n(i.parent,a,r);s.unshift(m||(a&&l?{type:l}:null)),o=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof v||e.selection instanceof xe)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ne(u.doc,d,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Ne(u.doc,d,s.length,s)),!f)return!1;if(u.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let h=u.mapping.map(r.before(o)),p=u.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return t&&t(u.scrollIntoView()),!0}}function Gm(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Re(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function jc(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Gm(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,p=b.empty;for(let y=o.length-1;y>=0;y--)p=b.from(o[y].create(null,p));p=b.from(i.copy(p));let m=n.tr.step(new Q(e.pos-1,h,e.pos,h,new S(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Re(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:N.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&st(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&hn(s,"start",!0)&&hn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=b.empty;for(let w=p.length-1;w>=0;w--)y=b.from(p[w].copy(y));let k=n.tr.step(new Q(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new S(y,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Jc(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(v.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}function Kc(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&un(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function ko(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o{ot();nt();lt();Pc=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);so=(n,e,t)=>{let r=Lc(n,t);if(!r)return!1;let i=lo(r);if(!i){let o=r.blockRange(),l=o&&st(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(jc(n,i,e,-1))return!0;if(r.parent.content.size==0&&(hn(s,"end")||E.isSelectable(s)))for(let o=r.depth;;o--){let l=Wn(n.doc,r.before(o),r.after(o),S.empty);if(l&&l.slice.size1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},zc=(n,e,t)=>{let r=Lc(n,t);if(!r)return!1;let i=lo(r);return i?Fc(n,i,e):!1},Bc=(n,e,t)=>{let r=Hc(n,t);if(!r)return!1;let i=uo(r);return i?Fc(n,i,e):!1};oo=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=lo(r)}let o=s&&s.nodeBefore;return!o||!E.isSelectable(o)?!1:(e&&e(n.tr.setSelection(E.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};ao=(n,e,t)=>{let r=Hc(n,t);if(!r)return!1;let i=uo(r);if(!i)return!1;let s=i.nodeAfter;if(jc(n,i,e,1))return!0;if(r.parent.content.size==0&&(hn(s,"start")||E.isSelectable(s))){let o=Wn(n.doc,r.before(),r.after(),S.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset{let t=n.selection,r=t instanceof E,i;if(r){if(t.node.isTextblock||!Re(n.doc,t.from))return!1;i=t.from}else if(i=zt(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(E.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},_c=(n,e)=>{let t=n.selection,r;if(t instanceof E){if(t.node.isTextblock||!Re(n.doc,t.to))return!1;r=t.to}else if(r=zt(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Vc=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&st(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},fo=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` +`).scrollIntoView()),!0)};po=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=ho(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(N.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},mo=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof xe||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=ho(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Ne(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&st(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};Um=Km(),Wc=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(E.create(n.doc,i))),!0)},qm=(n,e)=>(e&&e(n.tr.setSelection(new xe(n.doc))),!0);yo=Jc(-1),bo=Jc(1);io=xo(Pc,so,oo),Dc=xo(Pc,ao,co),St={Enter:xo(fo,mo,go,Um),"Mod-Enter":po,Backspace:io,"Mod-Backspace":io,"Shift-Backspace":io,Delete:Dc,"Mod-Delete":Dc,"Mod-a":qm},Xm={"Ctrl-h":St.Backspace,"Alt-Backspace":St["Mod-Backspace"],"Ctrl-d":St.Delete,"Ctrl-Alt-Backspace":St["Mod-Delete"],"Alt-Delete":St["Mod-Delete"],"Alt-d":St["Mod-Delete"],"Ctrl-a":yo,"Ctrl-e":bo};for(let n in St)Xm[n]=St[n];dw=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1});var he=O(()=>{Uc()});var F=O(()=>{lt()});var Ie=O(()=>{nt()});function qc(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let l=r?t.tr:null;return Ym(l,o,n,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Ym(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new Pt(a,a,e.depth),e.endIndex=0;u--)s=b.from(t[u].type.create(t[u].attrs,s));n.step(new Q(e.start-(r?2:0),e.end,e.start,e.end,new S(s,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Zm(e,t,n,s):eg(e,t,s):!0:!1}}function Zm(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sm;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?b.empty:b.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new Q(d-(l?1:0),f+(a?1:0),d+1,f-1,new S((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Xc(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=b.from(c?n.create():null),d=new S(b.from(n.create(null,b.from(l.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;t(e.tr.step(new Q(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}var Yc=O(()=>{ot();nt()});var Gr=O(()=>{Yc()});function Qc(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Pe(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Qn(n)||ng.test(n.nodeName)||n.contentEditable=="false")return!1;e=ae(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?Pe(n):0}else return!1}}function Pe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function rg(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Pe(n)}else if(n.parentNode&&!Qn(n))e=ae(n),n=n.parentNode;else return null}}function ig(n,e){for(;;){if(n.nodeType==3&&ec.bottom-at(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+at(i,"top")-c.top:e.bottom-c.bottom+at(i,"bottom")),e.leftc.right-at(r,"right")&&(u=e.right-c.right+at(i,"right")),u||d)if(a)s.defaultView.scrollBy(u,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:yn(o)}}function dg(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Du(n.dom)}}function Du(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=yn(r));return e}function fg({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Pu(t,r==0?0:r-e)}function Pu(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?pg(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Lu(t,i)}function pg(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let s=0;s=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function Jo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function mg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function yg(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right-1?i:n.docView.posFromDOM(e,t,-1)}function zu(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Zn&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=yg(n,r,i,e))}l==null&&(l=gg(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function tu(n){return n.top=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,Jn(wt(ct(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Pe(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return So(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==Pe(r))){let a=r.childNodes[i-1],c=a.nodeType==3?ct(a,Pe(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Jn(wt(c,1),!1)}if(s==null&&i=0)}function Jn(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function So(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Fu(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function xg(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Fu(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Bu(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ct(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}function wg(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!Sg.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Fu(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}function Cg(n,e,t){return nu==e&&ru==t?iu:(nu=e,ru=t,iu=t=="up"||t=="down"?xg(n,e,t):wg(n,e,t))}function ou(n,e,t,r,i){_u(r,e,n);let s=new Mt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}function Hu(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof kn)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function Tg(n,e){return n.type.side-e.type.side}function Eg(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let g=p;o!g.inline):l.slice();r(f,m,e.forChild(s,f),h),s=p}}function Ag(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Ng(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Po(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||u<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function Ko(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(li(t)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&E.isSelectable(d)&&i.parent&&!(d.isInline&&sg(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new E(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,f=o;for(let h=0;h{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Vu(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Rg(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,ae(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Te&&vt<=11&&(t.disabled=!0,t.disabled=!1)}function Wu(n,e){if(e instanceof E){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(du(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else du(n)}function du(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Uo(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||v.between(e,t,r)}function fu(n){return n.editable&&!n.hasFocus()?!1:ju(n)}function ju(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ig(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return jt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Lo(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&N.findFrom(s,e)}function Ct(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function hu(n,e,t){let r=n.state.selection;if(r instanceof v)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ct(n,new v(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Lo(n.state,e);return i&&i instanceof E?Ct(n,i):!1}else if(!(De&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?E.isSelectable(s)?Ct(n,new E(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Zn?Ct(n,new v(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof E&&r.node.isInline)return Ct(n,new v(e>0?r.$to:r.$from));{let i=Lo(n.state,e);return i?Ct(n,i):!1}}}function ei(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Un(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function mn(n,e){return e<0?Dg(n):Pg(n)}function Dg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Le&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Un(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Ju(t))break;{let l=t.previousSibling;for(;l&&Un(l,-1);)i=t.parentNode,s=ae(l),l=l.previousSibling;if(l)t=l,r=ei(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?zo(n,t,r):i&&zo(n,i,s)}function Pg(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=ei(t),s,o;for(;;)if(r{n.state==i&&ft(n)},50)}function pu(n,e){let t=n.state.doc.resolve(e);if(!(ie||Iu)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function mu(n,e,t){let r=n.state.selection;if(r instanceof v&&!r.empty||t.indexOf("s")>-1||De&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Lo(n.state,e);if(o&&o instanceof E)return Ct(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof xe?N.near(o,e):N.findFrom(o,e);return l?Ct(n,l):!1}return!1}function gu(n,e){if(!(n.state.selection instanceof v))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function yu(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Bg(n){if(!me||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;yu(n,r,"true"),setTimeout(()=>yu(n,r,"false"),20)}return!1}function Fg(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Hg(n,e){let t=e.keyCode,r=Fg(e);if(t==8||De&&t==72&&r=="c")return gu(n,-1)||mn(n,-1);if(t==46&&!e.shiftKey||De&&t==68&&r=="c")return gu(n,1)||mn(n,1);if(t==13||t==27)return!0;if(t==37||De&&t==66&&r=="c"){let i=t==37?pu(n,n.state.selection.from)=="ltr"?-1:1:-1;return hu(n,i,r)||mn(n,i)}else if(t==39||De&&t==70&&r=="c"){let i=t==39?pu(n,n.state.selection.from)=="ltr"?1:-1:1;return hu(n,i,r)||mn(n,i)}else{if(t==38||De&&t==80&&r=="c")return mu(n,-1,r)||mn(n,-1);if(t==40||De&&t==78&&r=="c")return Bg(n)||mu(n,1,r)||mn(n,1);if(r==(De?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qo(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||tt.fromSchema(n.state.schema),l=Yu(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Xu[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` + +`);return{dom:a,text:f,slice:e}}function Ku(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=!!e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return l=new S(b.from(n.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),n.someProp("transformPasted",f=>{l=f(l,n,!0)}),l;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)l=d;else{let f=i.marks(),{schema:h}=n.state,p=tt.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Wg(t),Zn&&jg(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||je.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!$g.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Jg(bu(l,+u[1],+u[2]),u[4]);else if(l=S.maxOpen(_g(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d{l=d(l,n,a)}),l}function _g(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&qu(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Gu(o[o.length-1],s.length));let u=Uu(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return b.from(o)}return n}function Uu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function qu(n,e,t,r,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function bu(n,e,t){return et})),Co.createHTML(n)):n}function Wg(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Yu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Xu[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=Vg(n),i)for(let s=0;s=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(r[l+1],i)),s++,o++}return new S(i,s,o)}function Ug(n){for(let e in Se){let t=Se[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Gg(n,r)&&!Go(n,r)&&(n.editable||!(r.type in we))&&t(n,r)},Kg[e]?{passive:!0}:void 0)}me&&n.dom.addEventListener("input",()=>null),Ho(n)}function dt(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function qg(n){n.input.mouseDown&&n.input.mouseDown.done(),n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ho(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Go(n,r))})}function Go(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Gg(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Xg(n,e){!Go(n,e)&&Se[e.type]&&(n.editable||!(e.type in we))&&Se[e.type](n,e)}function er(n){return{left:n.clientX,top:n.clientY}}function Yg(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Xo(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function tr(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Qg(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(tr(n,new E(t),"pointer"),!0):!1}function Zg(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof E&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(E.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(tr(n,E.create(n.state.doc,i),"pointer"),!0):!1}function ey(n,e,t,r,i){return Xo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Zg(n,t):Qg(n,t))}function ty(n,e,t,r){return Xo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function ny(n,e,t,r){return Xo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||ry(n,t,r)}function ry(n,e,t){if(t.button!=0)return!1;let r=Qu(n,e,!0),i=n.state.doc;return r?(tr(n,r,"pointer"),r instanceof v&&i.eq(n.state.doc)&&(n.input.mouseDown=new _o(n,r)),!0):!1}function Qu(n,e,t){let r=n.state.doc;if(e==-1)return r.inlineContent?v.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)return v.create(r,l+1,l+1+o.content.size);if(t&&E.isSelectable(o))return E.create(r,l)}return null}function Yo(n){return ni(n)}function ed(n,e){return n.composing?!0:me&&Math.abs(Date.now()-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}function sy(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}function td(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ni(n),e))}function nd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function oy(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=rg(e.focusNode,e.focusOffset),r=ig(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function ni(n,e=!1){if(!(ut&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),nd(n),e||n.docView&&n.docView.dirty){let t=Ko(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function ly(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}function ay(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function cy(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Gn(n,r.value,null,i,e):Gn(n,r.textContent,r.innerHTML,i,e)},50)}function Gn(n,e,t,r,i){let s=Ku(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||S.empty)))return!0;if(!s)return!1;let o=ay(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function rd(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}function id(n,e){let t;return n.someProp("dragCopies",r=>{t=t||r(e)}),t!=null?!t:!e[uy]}function dy(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(er(e));if(!r)return;let i=n.state.doc.resolve(r.pos),s=t&&t.slice;s?n.someProp("transformPasted",h=>{s=h(s,n,!1)}):s=Ku(n,rd(e.dataTransfer),qn?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&id(n,e));if(n.someProp("handleDrop",h=>h(n,e,s||S.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?Jr(n.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let a=n.state.tr;if(o){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,s.content.firstChild):a.replaceRange(c,c,s),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&E.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))a.setSelection(new E(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,g,y)=>h=y),a.setSelection(Uo(n,f,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}function Xn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}function fy(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c{let g=m-p-(h-f);for(let y=0;yk+u-d)continue;let w=l[y]+u-d;h>=w?l[y+1]=f<=w?-2:-1:f>=u&&g&&(l[y]+=g,l[y+1]+=g)}d+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=l[c+2].mapInner(t,g,u+1,n[c]+s+1,o);y!=pe?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=hy(l,n,e,t,i,s,o),u=oi(c,r,0,o);e=u.local;for(let d=0;dt&&o.to{let c=od(n,l,a+t);if(c){s=!0;let u=oi(c,l,t+a+1,r);u!=pe&&i.push(a,a+l.nodeSize,u)}});let o=sd(s?ld(n):n,-t).sort(Wt);for(let l=0;l0;)e++;n.splice(e,0,t)}function vo(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=pe&&e.push(r)}),n.cursorWrapper&&e.push(J.create(n.state.doc,[n.cursorWrapper.deco])),si.from(e)}function gy(n){if(!Su.has(n)&&(Su.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Le,wu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),wu=!0}}function Cu(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return jt(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function yy(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Cu(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Cu(n,t):null}function by(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function ky(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(s,l.firstChild),r==s&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function xy(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],li(a)||c.push({node:a.focusNode,offset:a.focusOffset})),ie&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let y=r.childNodes[g-1],k=y.pmViewDesc;if(y.nodeName=="BR"&&!k){s=g;break}if(!k||k.size)break}let d=n.state.doc,f=n.someProp("domParser")||je.fromSchema(n.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Sy,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:l}}function Sy(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(me&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||me&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}function Cy(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let T=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,B=Ko(n,T);if(B&&!n.state.selection.eq(B)){if(ie&&ut&&n.input.lastKeyCode===13&&Date.now()-100te(n,Ft(13,"Enter"))))return;let _=n.state.tr.setSelection(B);T=="pointer"?_.setMeta("pointer",!0):T=="key"&&_.scrollIntoView(),s&&_.setMeta("composition",s),n.dispatch(_)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=xy(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ut)&&i.some(T=>T.nodeType==1&&!wy.test(T.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",T=>T(n,Ft(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof v&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let T=vu(n,n.state.doc,c.sel);if(T&&!T.eq(n.state.selection)){let B=n.state.tr.setSelection(T);s&&B.setMeta("composition",s),n.dispatch(B)}}return}n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Te&&vt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=u.resolve(p.start),k=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA;if((bn&&n.input.lastIOSEnter>Date.now()-225&&(!k||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!k&&m.posT(n,Ft(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&My(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",T=>T(n,Ft(8,"Backspace")))){ut&&ie&&n.domObserver.suppressSelectionUpdates();return}ie&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),ut&&!k&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(T){return T(n,Ft(13,"Enter"))})},20));let w=p.start,C=p.endA,M=T=>{let B=T||n.state.tr.replace(w,C,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let _=vu(n,B.doc,c.sel);_&&!(ie&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDeleteft(n),20));let T=M(n.state.tr.delete(w,C)),B=u.resolve(p.start).marksAcross(u.resolve(p.endA));B&&T.ensureMarks(B),n.dispatch(T)}else if(p.endA==p.endB&&(P=vy(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let T=M(n.state.tr);P.type=="add"?T.addMark(w,C,P.mark):T.removeMark(w,C,P.mark),n.dispatch(T)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,g.parentOffset),B=()=>M(n.state.tr.insertText(T,w,C));n.someProp("handleTextInput",_=>_(n,w,C,T,B))||n.dispatch(B())}else n.dispatch(M());else n.dispatch(M())}function vu(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Uo(n,e.resolve(t.anchor),e.resolve(t.head))}function vy(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;uu.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||Mo(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Ty(n,e,t,r,i){let s=n.findDiffStart(e,t),o=t+n.size,l=t+e.size;if(s==null)return null;let{a,b:c}=n.findDiffEnd(e,o,l);if(i=="end"){let u=Math.max(0,s-Math.min(a,c));r-=a+u-s}if(a=a?s-r:0;s-=u,c=s+(c-a),a=s}else if(c=c?s-r:0;s-=u,a=s+(a-c),c=s}return{start:s,endA:a,endB:c}}function Mu(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Z.node(0,n.state.doc.content.size,e)]}function Tu(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Z.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Eu(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ey(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Au(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Ay(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Nu(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ae,yn,To,ct,tg,jt,ng,li,Je,Zc,Tt,Eo,Ou,Ao,Te,vt,Le,No,ie,Ru,me,bn,De,Iu,ut,Zn,ag,pn,kg,Sg,nu,ru,iu,ze,su,Ht,Ke,Jt,Xr,Oo,kn,Mt,Yr,Qr,Ro,Kn,$t,Do,au,$g,Xu,ku,Co,Se,we,Kg,Fo,Zu,ti,$o,_o,iy,qn,ri,uy,ii,_t,Vo,Z,gn,Vt,J,pe,si,py,my,Wo,jo,Su,wu,wy,Yn,ai=O(()=>{lt();nt();ot();ae=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},yn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},To=null,ct=function(n,e,t){let r=To||(To=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},tg=function(){To=null},jt=function(n,e,t,r){return t&&(Qc(n,e,t,r,-1)||Qc(n,e,t,r,1))},ng=/^(img|br|input|textarea|hr)$/i;li=function(n){return n.focusNode&&jt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};Je=typeof navigator<"u"?navigator:null,Zc=typeof document<"u"?document:null,Tt=Je&&Je.userAgent||"",Eo=/Edge\/(\d+)/.exec(Tt),Ou=/MSIE \d/.exec(Tt),Ao=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tt),Te=!!(Ou||Ao||Eo),vt=Ou?document.documentMode:Ao?+Ao[1]:Eo?+Eo[1]:0,Le=!Te&&/gecko\/(\d+)/i.test(Tt);Le&&+(/Firefox\/(\d+)/.exec(Tt)||[0,0])[1];No=!Te&&/Chrome\/(\d+)/.exec(Tt),ie=!!No,Ru=No?+No[1]:0,me=!Te&&!!Je&&/Apple Computer/.test(Je.vendor),bn=me&&(/Mobile\/\w+/.test(Tt)||!!Je&&Je.maxTouchPoints>2),De=bn||(Je?/Mac/.test(Je.platform):!1),Iu=Je?/Win/.test(Je.platform):!1,ut=/Android \d/.test(Tt),Zn=!!Zc&&"webkitFontSmoothing"in Zc.documentElement.style,ag=Zn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;pn=null;kg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;Sg=/[\u0590-\u08ac]/;nu=null,ru=null,iu=!1;ze=0,su=1,Ht=2,Ke=3,Jt=class{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ze,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tae(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof Qr){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Xr&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?ae(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=ae(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;up&&ot){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?Ht:su,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ke:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ht:Ke}r=o}this.dirty=Ht}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Ht:su;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==ze&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Oo=class extends Jt{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},kn=class n extends Jt{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=tt.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ke||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ke&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ze){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=Po(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=tt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=_u(u,r,t),c?a=new Ro(e,t,r,i,u,d||null,f,c,s,o+1):t.isText?new Yr(e,t,r,i,u,f,s):new n(e,t,r,i,u,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>b.empty)}return e}matchesNode(e,t,r){return this.dirty==ze&&e.eq(this.node)&&Zr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new Do(this,o&&o.node,e);Eg(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?W.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e,f);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Ht)&&(o&&this.protectLocalComposition(e,o),Hu(this.contentDOM,this.children,e),bn&&Ag(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof v)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=Ng(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Oo(this,s,t,i);e.input.compositionNodes.push(o),this.children=Po(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Ke||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ze}updateOuterDeco(e){if(Zr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$u(this.dom,this.nodeDOM,Io(this.outerDeco,this.node,t),Io(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};Yr=class n extends Mt{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Ke||this.dirty!=ze&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ze||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ze,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ke)}get domAtom(){return!1}isText(e){return this.node.text==e}},Qr=class extends Jt{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ze&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Ro=class extends Mt{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Ke)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};Kn=function(n){n&&(this.nodeName=n)};Kn.prototype=Object.create(null);$t=[new Kn];Do=class{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Mg(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r>1,l=Math.min(o,e.length);for(;s-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=kn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!ed(n)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ut&&ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),bn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Ft(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Hg(n,t)?t.preventDefault():dt(n,"key")};we.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};we.keypress=(n,e)=>{let t=e;if(ed(n)||!t.charCode||t.ctrlKey&&!t.altKey||De&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof v)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};Zu=De?"metaKey":"ctrlKey";Se.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Yo(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Yg(t,n.input.lastClick)&&!t[Zu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button},n.input.mouseDown&&n.input.mouseDown.done();let o=n.posAtCoords(er(t));o&&(s=="singleClick"?n.input.mouseDown=new $o(n,o,t,!!r):(s=="doubleClick"?ty:ny)(n,o.pos,o.inside,t)?t.preventDefault():dt(n,"pointer"))};ti=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},$o=class extends ti{constructor(e,t,r,i){super(e),this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Zu],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}let l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof E&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Le&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),dt(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||ft(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(er(e))),this.updateAllowDefault(e),this.allowDefault||!t?dt(this.view,"pointer"):ey(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||me&&this.mightDrag&&!this.mightDrag.node.isAtom||ie&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(tr(this.view,N.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):dt(this.view,"pointer")}move(e){this.updateAllowDefault(e),dt(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},_o=class extends ti{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),dt(this.view,"pointer");let t=this.view.posAtCoords(er(e)),r=t&&Qu(this.view,t.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,l]=r.from{n.input.lastTouch=Date.now(),Yo(n),dt(n,"pointer")};Se.touchmove=n=>{n.input.lastTouch=Date.now(),dt(n,"pointer")};Se.contextmenu=n=>Yo(n);iy=ut?5e3:-1;we.compositionstart=we.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof v&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ie&&Iu&&sy(n)))n.markCursor=n.state.storedMarks||t.marks(),ni(n,!0),n.markCursor=null;else if(ni(n,!e.selection.empty),Le&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}td(n,iy)};we.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Date.now(),n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,td(n,20))};qn=Te&&vt<15||bn&&ag<604;Se.copy=we.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=qn?null:t.clipboardData,o=r.content(),{dom:l,text:a}=qo(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):ly(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};we.paste=(n,e)=>{let t=e;if(n.composing&&!ut)return;let r=qn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Gn(n,rd(r),r.getData("text/html"),i,t)?t.preventDefault():cy(n,t)};ri=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},uy=De?"altKey":"ctrlKey";Se.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(er(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)o=E.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(o=E.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=qo(n,l);(!t.dataTransfer.files.length||!ie||Ru>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(qn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",qn||t.dataTransfer.setData("text/plain",c),n.dragging=new ri(u,id(n,t),o)};Se.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};we.dragover=we.dragenter=(n,e)=>e.preventDefault();we.drop=(n,e)=>{try{dy(n,e,n.dragging)}finally{n.dragging=null}};Se.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ft(n)},20))};Se.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Se.beforeinput=(n,e)=>{if(ie&&ut&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Ft(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in we)Se[n]=we[n];ii=class n{constructor(e,t){this.toDOM=e,this.spec=t||Vt,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Z(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Xn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},_t=class n{constructor(e,t){this.attrs=e,this.spec=t||Vt}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Z(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==pe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Vt)}mapInner(e,t,r,i,s){let o;for(let l=0;l{let c=a+r,u;if(u=od(t,l,c)){for(i||(i=this.children.slice());sl&&d.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof _t){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;ci.map(e,t,Vt));return n.from(r)}forChild(e,t){if(t.isLeaf)return J.empty;let r=[];for(let i=0;it instanceof J)?e:e.reduce((t,r)=>t.concat(r instanceof J?r:r.members),[]))}}forEachSet(e){for(let t=0;t{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():me&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),my&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,py)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fu(this.view)){if(this.suppressingSelectionUpdates)return ft(this.view);if(Te&&vt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&jt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=yn(s))t.add(s);for(let s=e.anchorNode;s;s=yn(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fu(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;uu.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ie&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Le&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||by(e,d)!=h)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),gy(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,ky(e,a)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ft(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;uCy(this,r,i,s,o)),this.domObserver.start(),Ug(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ho(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Nu),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(nd(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Au(this);Ay(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ho(this),this.editable=Eu(this),Tu(this);let a=vo(this),c=Mu(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&dg(this);if(o){this.domObserver.stop();let h=d&&(Te||ie)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Ey(i.selection,e.selection);if(d){let m=ie?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=oy(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ou(e.doc,c,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ig(this)&&p.delaySelUpdate())?ft(this,h):(Wu(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&fg(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof E){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&eu(this,t.getBoundingClientRect(),e)}else eu(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&st.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return bg(this,e)}coordsAtPos(e,t=1){return Bu(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Cg(this,t||this.state,e)}pasteHTML(e,t){return Gn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Gn(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return qo(this,e)}destroy(){this.docView&&(qg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tg())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Xg(this,e)}domSelectionRange(){let e=this.domSelection();return e?me&&this.root.nodeType===11&&og(this.dom.ownerDocument)==this.dom&&yy(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Yn.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))}});var xn=O(()=>{ai()});function ad(n){var e=Ny&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Oy&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ui:ht)[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}var ht,ui,Ny,Oy,ee,ee,ee,ci,cd=O(()=>{ht={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ui={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ny=typeof navigator<"u"&&/Mac/.test(navigator.platform),Oy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ee=0;ee<10;ee++)ht[48+ee]=ht[96+ee]=String(ee);for(ee=1;ee<=24;ee++)ht[ee+111]="F"+ee;for(ee=65;ee<=90;ee++)ht[ee]=String.fromCharCode(ee+32),ui[ee]=String.fromCharCode(ee);for(ci in ht)ui.hasOwnProperty(ci)||(ui[ci]=ht[ci])});function Dy(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l{cd();lt();Ry=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Iy=typeof navigator<"u"&&/Win/.test(navigator.platform)});var dd=O(()=>{di()});function ki(n){let{state:e,transaction:t}=n,{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}function U(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function ol(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function yi(n,e,t={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ol(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function vd(n,e,t={}){return n.find(r=>r.type===e&&yi(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function hd(n,e,t={}){return!!vd(n,e,t)}function ll(n,e,t){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!t){let c=r.node.marks.find(u=>u.type===e);c&&(t=c.attrs)}if(!vd([...r.node.marks],e,t))return;let s=r.index,o=n.start()+r.offset,l=s+1,a=o+r.node.nodeSize;for(;s>0&&hd([...n.parent.child(s-1).marks],e,t);)s-=1,o-=n.parent.child(s).nodeSize;for(;l"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Ed(t)}function or(n,e,t){if(n instanceof Me||n instanceof b)return n;t={slice:!0,parseOptions:{},...t};let r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return b.fromArray(n.map(l=>e.nodeFromJSON(l)));let o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),or("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="",a=new ln({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?je.fromSchema(a).parseSlice(fi(n),t.parseOptions):je.fromSchema(a).parse(fi(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let s=je.fromSchema(e);return t.slice?s.parseSlice(fi(n),t.parseOptions).content:s.parse(fi(n),t.parseOptions)}return or("",e,t)}function n0(n,e,t){let r=n.steps.length-1;if(r{o===0&&(o=u)}),n.setSelection(N.near(n.doc.resolve(o),t))}function Ad(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function h0(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l{if(d.isText)return;let h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);l.push({node:d,from:h,to:p})});let a=i-r,c=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>yi(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}function Si(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function md(n,e){let t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}function rl(n,e,t={},r={}){return or(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}function Nd(n,e){let t=pt(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});let l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function al(n,e){let t=new xt(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function A0(n){for(let e=0;e{t(i)&&r.push({node:i,pos:s})}),r}function cl(n,e){for(let t=n.depth;t>0;t-=1){let r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function wi(n){return e=>cl(e.$from,n)}function A(n,e,t){return n.config[e]===void 0&&n.parent?A(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?A(n.parent,e,t):null}):n.config[e]}function ul(n){return n.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},r=A(e,"addExtensions",t);return r?[e,...ul(r())]:e}).flat(10)}function dl(n,e){let t=tt.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Rd(n){return typeof n=="function"}function V(n,e=void 0,...t){return Rd(n)?e?n.bind(e)(...t):n(...t):n}function N0(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Sn(n){let e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Id(n){let e=[],{nodeExtensions:t,markExtensions:r}=Sn(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...o,...l];return n.forEach(c=>{let u={name:c.name,options:c.options,storage:c.storage,extensions:i},d=A(c,"addGlobalAttributes",u);if(!d)return;d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=a:h.types==="nodes"?p=o:h.types==="marks"?p=l:p=[],p.forEach(m=>{Object.entries(h.attributes).forEach(([g,y])=>{e.push({type:m,name:g,attribute:{...s,...y}})})})})}),i.forEach(c=>{let u={name:c.name,options:c.options,storage:c.storage},d=A(c,"addAttributes",u);if(!d)return;let f=d();Object.entries(f).forEach(([h,p])=>{let m={...s,...p};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:c.name,name:h,attribute:m})})}),e}function O0(n){let e=[],t="",r=!1,i=!1,s=0,o=n.length;for(let l=0;l0){s-=1,t+=a;continue}if(a===";"&&s===0){e.push(t),t="";continue}}t+=a}return t&&e.push(t),e}function gd(n){let e=[],t=O0(n||""),r=t.length;for(let i=0;i!!e).reduce((e,t)=>{let r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){let l=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else if(i==="style"){let l=new Map([...gd(r[i]),...gd(s)]);r[i]=Array.from(l.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[i]=s}),r},{})}function wn(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>D(t,r),{})}function R0(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function yd(n,e){return"style"in n?n:{...n,getAttrs:t=>{let r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;let i=e.reduce((s,o)=>{let l=o.attribute.parseHTML?o.attribute.parseHTML(t):R0(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...i}}}}function bd(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&N0(t)?!1:t!=null))}function kd(n){var e,t;let r={};return!((e=n?.attribute)!=null&&e.isRequired)&&"default"in(n?.attribute||{})&&(r.default=n.attribute.default),((t=n?.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function I0(n,e){var t;let r=Id(n),{nodeExtensions:i,markExtensions:s}=Sn(n),o=(t=i.find(c=>A(c,"topNode")))==null?void 0:t.name,l=Object.fromEntries(i.map(c=>{let u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((y,k)=>{let w=A(k,"extendNodeSchema",d);return{...y,...w?w(c):{}}},{}),h=bd({...f,content:V(A(c,"content",d)),marks:V(A(c,"marks",d)),group:V(A(c,"group",d)),inline:V(A(c,"inline",d)),atom:V(A(c,"atom",d)),selectable:V(A(c,"selectable",d)),draggable:V(A(c,"draggable",d)),code:V(A(c,"code",d)),whitespace:V(A(c,"whitespace",d)),linebreakReplacement:V(A(c,"linebreakReplacement",d)),defining:V(A(c,"defining",d)),isolating:V(A(c,"isolating",d)),attrs:Object.fromEntries(u.map(kd))}),p=V(A(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>yd(y,u)));let m=A(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:wn(y,u)}));let g=A(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(s.map(c=>{let u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,y)=>{let k=A(y,"extendMarkSchema",d);return{...g,...k?k(c):{}}},{}),h=bd({...f,inclusive:V(A(c,"inclusive",d)),excludes:V(A(c,"excludes",d)),group:V(A(c,"group",d)),spanning:V(A(c,"spanning",d)),code:V(A(c,"code",d)),attrs:Object.fromEntries(u.map(kd))}),p=V(A(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>yd(g,u)));let m=A(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:wn(g,u)})),[c.name,h]}));return new ln({topNode:o,nodes:l,marks:a})}function D0(n){let e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function sr(n){return n.sort((t,r)=>{let i=A(t,"priority")||100,s=A(r,"priority")||100;return i>s?-1:ir.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Pd(n,e,t){let{from:r,to:i}=e,{blockSeparator:s=` + +`,textSerializers:o={}}=t||{},l="";return n.nodesBetween(r,i,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=s);let h=o?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c))}),l}function P0(n,e){let t={from:0,to:n.content.size};return Pd(n,t,e)}function Ld(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function L0(n,e){let t=U(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});let o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function fl(n,e){let t=Si(typeof e=="string"?e:e.name,n.schema);return t==="node"?L0(n,e):t==="mark"?Nd(n,e):{}}function z0(n,e=JSON.stringify){let t={};return n.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function B0(n){let e=z0(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function hl(n){let{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{let o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{let{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{let c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),B0(r)}function Ci(n,e,t){let r=[];return n===e?t.resolve(n).marks().forEach(i=>{let s=t.resolve(n),o=ll(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function rr(n,e){return e.nodes[n]||e.marks[n]||null}function gi(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{let i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function il(n,e,t={}){let{empty:r,ranges:i}=n.selection,s=e?pt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>yi(d.attrs,t,{strict:!1}));let o=0,l=[];if(i.forEach(({$from:d,$to:f})=>{let h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;let y=Math.max(h,g),k=Math.min(p,g+m.nodeSize),w=k-y;o+=w,l.push(...m.marks.map(C=>({mark:C,from:y,to:k})))})}),o===0)return!1;let a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>yi(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=o}function H0(n,e,t={}){if(!e)return Ue(n,null,t)||il(n,null,t);let r=Si(e,n.schema);return r==="node"?Ue(n,e,t):r==="mark"?il(n,e,t):!1}function xd(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function el(n,e){let{nodeExtensions:t}=Sn(e),r=t.find(o=>o.name===n);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},s=V(A(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cn(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return!/\S/.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(Cn(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function vi(n){return n instanceof E}function $0(n,e){let t=e.mapping.mapResult(n.position);return{position:new Hd(t.pos),mapResult:t}}function _0(n){return new Hd(n)}function V0(n,e,t){var r;let{selection:i}=e,s=null;if(Md(i)&&(s=i.$cursor),s){let l=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(c=>c.type.excludes(t)))}let{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){let h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}function Sd(n,e){let t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){let r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}function wd(n){return!n||n==="1"?null:n}function _d(n,e){return wd(n)===wd(e)}function Q0(n){let e=n.doc,t=e.firstChild;if(!t)return null;let r=e.resolve(1),i=e.resolve(t.nodeSize-1);return v.between(r,i)}function Vd(n,e){let{selection:t}=n,{$from:r}=t;if(t instanceof E){let s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){let s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function pl(n,e,t){let r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}function Be(n,e){let t=n.getAttribute("style");if(!t)return null;let r=t.split(";").map(s=>s.trim()).filter(Boolean),i=e.toLowerCase();for(let s=r.length-1;s>=0;s-=1){let o=r[s],l=o.indexOf(":");if(l===-1)continue;if(o.slice(0,l).trim().toLowerCase()===i)return o.slice(l+1).trim()}return null}function db(n){return typeof n=="number"}function fb(n){return Object.prototype.toString.call(n).slice(8,-1)}function hi(n){return fb(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ml(n){if(!n?.trim())return{};let e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);if(i){let c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}let s=r.match(/(?:^|\s)#([\w-]+)/);s&&(e.id=s[1]);let o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;let f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=t[f];h&&(e[c]=h.slice(1,-1))});let a=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function gl(n){if(!n||Object.keys(n).length===0)return"";let e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function pb(n){let{nodeName:e,name:t,parseAttributes:r=ml,serializeAttributes:i=gl,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=n,a=t||e,c=u=>{if(!l)return u;let d={};return l.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{let f={...s,...u.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;let f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=u.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(u,d,f){let h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=u.match(h);if(!p)return;let m=p[1]||"",g=r(m);if(!o.find(k=>!(k in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:u=>{let d=c(u.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function mb(n){let{nodeName:e,name:t,getContent:r,parseAttributes:i=ml,serializeAttributes:s=gl,defaultAttributes:o={},content:l="block",allowedAttributes:a}=n,c=t||e,u=d=>{if(!a)return d;let f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){let m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);let p={...o,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;let h=new RegExp(`^:::${c}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;let m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=d.match(m);if(!g)return;let[y,k=""]=g,w=i(k),C=1,M=y.length,P="",T=/^:::([\w-]*)(\s.*)?/gm,B=d.slice(M);for(T.lastIndex=0;;){let _=T.exec(B);if(_===null)break;let te=_.index,et=_[1];if(!((p=_[2])!=null&&p.endsWith(":::"))){if(et)C+=1;else if(C-=1,C===0){let We=B.slice(0,te);P=We.trim();let de=d.slice(0,M+te+_[0].length),ne=[];if(P)if(l==="block")for(ne=h.blockTokens(We),ne.forEach(Y=>{Y.text&&(!Y.tokens||Y.tokens.length===0)&&(Y.tokens=h.inlineTokens(Y.text))});ne.length>0;){let Y=ne[ne.length-1];if(Y.type==="paragraph"&&(!Y.text||Y.text.trim()===""))ne.pop();else break}else ne=h.inlineTokens(P);return{type:e,raw:de,attributes:w,content:P,tokens:ne}}}}}},renderMarkdown:(d,f)=>{let h=u(d.attrs||{}),p=s(h),m=p?` {${p}}`:"",g=f.renderChildren(d.content||[],` + +`);return`:::${c}${m} + +${g} + +:::`}}}function gb(n){if(!n.trim())return{};let e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=t.exec(n);for(;r!==null;){let[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}function yb(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function bb(n){let{nodeName:e,name:t,getContent:r,parseAttributes:i=gb,serializeAttributes:s=yb,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=n,c=t||e,u=f=>{if(!a)return f;let h={};return a.forEach(p=>{let m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){let y=f[m];if(g!==void 0&&y===g)return;h[m]=y}}),h},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{let p={...o,...f.attributes};if(l)return h.createNode(e,p);let m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){let h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){let m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),g=f.match(m);if(!g)return;let y="",k="";if(l){let[,C]=g;k=C}else{let[,C,M]=g;k=C,y=M||""}let w=i(k.trim());return{type:e,raw:g[0],content:y.trim(),attributes:w}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));let p=u(f.attrs||{}),m=s(p),g=m?` ${m}`:"";return l?`[${c}${g}]`:`[${c}${g}]${h}[/${c}]`}}}function Mi(n,e,t){var r,i,s,o;let l=n.split(` +`),a=[],c="",u=0,d=e.baseIndentSize||2;for(;u0)break;if(f.trim()===""){u+=1,c=`${c}${f} +`;continue}else return}let p=e.extractItemData(h),{indentLevel:m,mainContent:g}=p;c=`${c}${f} +`;let y=[g];for(u+=1;ute.trim()!=="");if(T===-1)break;if((((i=(r=l[u+1+T].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){y.push(M),c=`${c}${M} +`,u+=1;continue}else break}if((((o=(s=M.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)y.push(M),c=`${c}${M} +`,u+=1;else break}let k,w=y.slice(1);if(w.length>0){let M=w.map(P=>P.slice(m+d)).join(` +`);M.trim()&&(e.customNestedParser?k=e.customNestedParser(M):k=t.blockTokens(M))}let C=e.createToken(p,k);a.push(C)}if(a.length!==0)return{items:a,raw:c}}function lr(n,e,t,r){if(!n||!Array.isArray(n.content))return"";let i=typeof t=="function"?t(r):t,[s,...o]=n.content,l=e.renderChildren([s]),a=`${i}${l}`;return o&&o.length>0&&o.forEach((c,u)=>{var d,f;let h=(f=(d=e.renderChild)==null?void 0:d.call(e,c,u+1))!=null?f:e.renderChildren([c]);if(h!=null){let p=h.split(` +`).map(m=>m?e.indent(m):e.indent("")).join(` +`);a+=c.type==="paragraph"?` + +${p}`:` +${p}`}}),a}function Wd(n,e){let t={...n};return hi(n)&&hi(e)&&Object.keys(e).forEach(r=>{hi(e[r])&&hi(n[r])?t[r]=Wd(n[r],e[r]):t[r]=e[r]}),t}function kb(n,e,t={}){let{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((l,a)=>{let c=s.mapping.map(a),u=s.mapping.map(a)+l.nodeSize,d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){let h=n.type.create({...n.attrs,...t});s.removeMark(c,u,n.type),s.addMark(c,u,h)}}),s.docChanged&&e.view.dispatch(s)}function pi(n){var e;let{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1,d=F0(c)+s;return o.forEach(f=>{if(u)return;let h=xb(d,f.find);if(!h)return;let p=a.state.tr,m=ki({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:y,chain:k,can:w}=new xi({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:y,chain:k,can:w})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),u=!0)}),u}function Sb(n){let{editor:e,rules:t}=n,r=new I({state:{init(){return null},apply(i,s,o){let l=i.getMeta(r);if(l)return l;let a=i.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=dl(b.from(u),o.schema);let{from:d}=a,f=d+u.length;pi({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return pi({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:s}=i.state.selection;s&&pi({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;let{$cursor:o}=i.state.selection;return o?pi({editor:e,from:o.pos,to:o.pos,text:` +`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function vb(n){let{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:u}=new xi({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{var m,g,y,k,w;if((g=(m=h.type)==null?void 0:m.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;let C=(w=(k=(y=h.content)==null?void 0:y.size)!=null?k:h.nodeSize)!=null?w:0,M=Math.max(r,p),P=Math.min(i,p+C);if(M>=P)return;let T=h.isText?h.text||"":h.textBetween(M-p,P-p,void 0,"\uFFFC");Cb(T,s.find,o).forEach(_=>{if(_.index===void 0)return;let te=M+_.index+1,et=te+_[0].length,We={from:t.tr.mapping.map(te),to:t.tr.mapping.map(et)},de=s.handler({state:t,range:We,match:_,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(de)})}),d.every(h=>h!==null)}function Tb(n){let{editor:e,rules:t}=n,r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{let m=u.tr,g=ki({state:u,transaction:m});if(!(!vb({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new I({view(d){let f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(mi=e)},h=()=>{mi&&(mi=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=r===d.dom.parentElement,l=f,!s){let h=mi;h?.isEditable&&setTimeout(()=>{let p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;let p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{let p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),k=!!y;if(!m&&!g&&!k)return;if(k){let{text:M}=y;typeof M=="string"?M=M:M=dl(b.from(M),h.schema);let{from:P}=y,T=P+M.length,B=Mb(M);return a({rule:u,state:h,from:P,to:{b:T},pasteEvt:B})}let w=f.doc.content.findDiffStart(h.doc.content),C=f.doc.content.findDiffEnd(h.doc.content);if(!(!db(w)||!C||w===C.b))return a({rule:u,state:h,from:w,to:C,pasteEvt:o})}}))}function Fe(n){return new Ti({find:n.find,handler:({state:e,range:t,match:r})=>{let i=V(n.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:s}=e,o=r[r.length-1],l=r[0];if(o){let a=l.search(/\S/),c=t.from+l.indexOf(o),u=c+o.length;if(Ci(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;ut.from&&s.delete(t.from+a,c);let f=t.from+a+o.length;s.addMark(t.from+a,f,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Ai(n){return new Ti({find:n.find,handler:({state:e,range:t,match:r})=>{let i=V(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from,l=t.to,a=n.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),u=o+c;u>l?u=l:l=u+r[1].length;let d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,l,a)}else if(r[0]){let c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:n.undoable})}function ar(n){return new Ti({find:n.find,handler:({state:e,range:t,match:r})=>{let i=e.doc.resolve(t.from),s=V(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function qe(n){return new Ti({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{let s=V(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&un(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){let{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){let m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){let d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}let u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Re(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)},undoable:n.undoable})}function Ee(n){return new wb({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{let s=V(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;let{tr:o}=e,l=r[r.length-1],a=r[0],c=t.to;if(l){let u=a.search(/\S/),d=t.from+a.indexOf(l),f=d+l.length;if(Ci(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>d).length)return null;ft.from&&o.delete(t.from+u,d),c=t.from+u+l.length,o.addMark(t.from+u,c,n.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(n.type)}}})}var Ly,sl,xi,Cd,zy,By,Fy,Hy,$y,_y,Vy,Wy,jy,Jy,fd,Ky,Uy,qy,Gy,Xy,Yy,Zy,e0,t0,Ed,r0,i0,s0,o0,l0,a0,c0,u0,d0,f0,p0,m0,g0,y0,b0,k0,x0,S0,w0,C0,v0,M0,T0,E0,zd,F0,Bd,Fd,Hd,W0,j0,J0,K0,U0,q0,G0,X0,Y0,tl,nl,Z0,eb,tb,nb,rb,ib,sb,ob,lb,ab,cb,ub,hb,Ti,xb,yl,ce,wb,Cb,mi,Mb,Ei,Eb,L,Kd,Ud,qd,Gd,Xd,Yd,Qd,Zd,ef,tf,nf,Ab,Nb,rf,Ob,sf,$,R=O(()=>{_e();he();F();he();F();F();F();Ie();Ie();F();_e();he();_e();_e();he();he();he();he();Gr();he();F();he();he();he();he();he();_e();Ie();Ie();Ie();Ie();Ie();F();he();F();F();Gr();F();_e();Ie();F();_e();F();_e();he();Gr();F();xn();dd();F();Ie();F();Ie();F();F();_e();F();F();F();F();F();F();F();_e();F();Ly=Object.defineProperty,sl=(n,e)=>{for(var t in e)Ly(n,t,{get:e[t],enumerable:!0})};xi=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,l])=>[o,(...c)=>{let u=l(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){let{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],l=!!n,a=n||i.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(t).map(([d,f])=>[d,(...p)=>{let m=this.buildProps(a,e),g=f(...p)(m);return o.push(g),u}])),run:c};return u}createCan(n){let{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){let{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:ki({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},Cd={};sl(Cd,{blur:()=>zy,clearContent:()=>By,clearNodes:()=>Fy,command:()=>Hy,createParagraphNear:()=>$y,cut:()=>_y,deleteCurrentNode:()=>Vy,deleteNode:()=>Wy,deleteRange:()=>jy,deleteSelection:()=>Uy,enter:()=>qy,exitCode:()=>Gy,extendMarkRange:()=>Xy,first:()=>Yy,focus:()=>Zy,forEach:()=>e0,insertContent:()=>t0,insertContentAt:()=>i0,joinBackward:()=>l0,joinDown:()=>o0,joinForward:()=>a0,joinItemBackward:()=>c0,joinItemForward:()=>u0,joinTextblockBackward:()=>d0,joinTextblockForward:()=>f0,joinUp:()=>s0,keyboardShortcut:()=>p0,lift:()=>m0,liftEmptyBlock:()=>g0,liftListItem:()=>y0,newlineInCode:()=>b0,resetAttributes:()=>k0,scrollIntoView:()=>x0,selectAll:()=>S0,selectNodeBackward:()=>w0,selectNodeForward:()=>C0,selectParentNode:()=>v0,selectTextblockEnd:()=>M0,selectTextblockStart:()=>T0,setContent:()=>E0,setMark:()=>W0,setMeta:()=>j0,setNode:()=>J0,setNodeSelection:()=>K0,setTextDirection:()=>U0,setTextSelection:()=>q0,sinkListItem:()=>G0,splitBlock:()=>X0,splitListItem:()=>Y0,toggleList:()=>Z0,toggleMark:()=>eb,toggleNode:()=>tb,toggleWrap:()=>nb,undoInputRule:()=>rb,unsetAllMarks:()=>ib,unsetMark:()=>sb,unsetTextDirection:()=>ob,updateAttributes:()=>lb,wrapIn:()=>ab,wrapInList:()=>cb});zy=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),By=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Fy=()=>({state:n,tr:e,dispatch:t})=>{let{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;let p=st(h);if(l.type.isTextblock){let{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Hy=n=>e=>n(e),$y=()=>({state:n,dispatch:e})=>mo(n,e),_y=(n,e)=>({editor:t,tr:r})=>{let{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);let o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new v(r.doc.resolve(Math.max(o-1,0)))),!0},Vy=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;let i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){let l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1};Wy=n=>({tr:e,state:t,dispatch:r})=>{let i=U(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){let a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},jy=n=>({tr:e,dispatch:t})=>{let{from:r,to:i}=n;return t&&e.delete(r,i),!0},Jy=n=>n.content?/^text(\*|\+)/.test(n.content):!1,fd=(n,e,t)=>{if(!n.parent.isInline||t==="left"&&n.pos>n.start()||t==="right"&&n.pos{let r=fd(n,t,"left"),i=fd(e,t,"right");return{from:r,to:i}},Uy=()=>({state:n,dispatch:e})=>{let{$from:t,$to:r}=n.selection;if(n.selection.empty)return!1;let{from:i,to:s}=Ky(t,r,n.schema);return e&&(n.tr.deleteRange(i,s).scrollIntoView(),e(n.tr)),!0},qy=()=>({commands:n})=>n.keyboardShortcut("Enter"),Gy=()=>({state:n,dispatch:e})=>po(n,e);Xy=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=pt(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){let d=ll(a,s,e);if(d&&d.from<=c&&d.to>=u){let f=v.create(o,d.from,d.to);t.setSelection(f)}}return!0},Yy=n=>e=>{let t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};let o=()=>{(bi()||pd())&&r.dom.focus(),Qy()&&!bi()&&!pd()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!Md(t.state.selection))return o(),!0;let l=Td(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},e0=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),t0=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Ed=n=>{let e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){let r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Ed(r)}return n};r0=n=>!("type"in n),i0=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l,a=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{or(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=or(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return a(g),!1}let{from:u,to:d}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,h=!0;if((r0(l)?l:[l]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===d&&h){let{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof b){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,d)}else{m=l;let g=r.doc.resolve(u),y=g.node(),k=g.parentOffset===0,w=y.isText||y.isTextblock,C=y.content.size>0;k&&w&&C&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,m)}t.updateSelection&&n0(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},s0=()=>({state:n,dispatch:e})=>$c(n,e),o0=()=>({state:n,dispatch:e})=>_c(n,e),l0=()=>({state:n,dispatch:e})=>so(n,e),a0=()=>({state:n,dispatch:e})=>ao(n,e),c0=()=>({state:n,dispatch:e,tr:t})=>{try{let r=zt(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},u0=()=>({state:n,dispatch:e,tr:t})=>{try{let r=zt(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},d0=()=>({state:n,dispatch:e})=>zc(n,e),f0=()=>({state:n,dispatch:e})=>Bc(n,e);p0=n=>({editor:e,view:t,tr:r,dispatch:i})=>{let s=h0(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a?.steps.forEach(c=>{let u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};m0=(n,e={})=>({state:t,dispatch:r})=>{let i=U(n,t.schema);return Ue(t,i,e)?Vc(t,r):!1},g0=()=>({state:n,dispatch:e})=>go(n,e),y0=n=>({state:e,dispatch:t})=>{let r=U(n,e.schema);return Gc(r)(e,t)},b0=()=>({state:n,dispatch:e})=>fo(n,e);k0=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null,l=Si(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(s=U(n,r.schema)),l==="mark"&&(o=pt(n,r.schema));let a=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{s&&s===u.type&&(a=!0,i&&t.setNodeMarkup(d,void 0,md(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(f=>{o===f.type&&(a=!0,i&&t.addMark(d,d+u.nodeSize,o.create(md(f.attrs,e))))})})}),a},x0=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),S0=()=>({tr:n,dispatch:e})=>{if(e){let t=new xe(n.doc);n.setSelection(t)}return!0},w0=()=>({state:n,dispatch:e})=>oo(n,e),C0=()=>({state:n,dispatch:e})=>co(n,e),v0=()=>({state:n,dispatch:e})=>Wc(n,e),M0=()=>({state:n,dispatch:e})=>bo(n,e),T0=()=>({state:n,dispatch:e})=>yo(n,e);E0=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{let{doc:a}=s;if(r.preserveWhitespace!=="full"){let c=rl(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};zd=(n,e,t,r=20)=>{let i=n.doc.resolve(t),s=r,o=null;for(;s>0&&o===null;){let l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};F0=(n,e=500)=>{let t="",r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;let u=((c=(a=i.type.spec).toText)==null?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),t};Bd=(n,e)=>{let{$from:t,$to:r,$anchor:i}=n.selection;if(e){let s=wi(l=>l.type.name===e)(n.selection);if(!s)return!1;let o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset{let{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};Hd=class $d{constructor(e){this.position=e}static fromJSON(e){return new $d(e.position)}toJSON(){return{position:this.position}}};W0=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let{selection:s}=t,{empty:o,ranges:l}=s,a=pt(n,r.schema);if(i)if(o){let c=Nd(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{let u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{let p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&t.addMark(p,m,a.create({...y.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return V0(r,t,a)},j0=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),J0=(n,e={})=>({state:t,dispatch:r,chain:i})=>{let s=U(n,t.schema),o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>ko(s,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>ko(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},K0=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,i=Kt(n,0,r.content.size),s=E.create(r,i);e.setSelection(s)}return!0},U0=(n,e)=>({tr:t,state:r,dispatch:i})=>{let{selection:s}=r,o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&t.doc.nodesBetween(o,l,(a,c)=>{a.isText||t.setNodeMarkup(c,void 0,{...a.attrs,dir:n})}),!0},q0=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=v.atStart(r).from,l=v.atEnd(r).to,a=Kt(i,o,l),c=Kt(s,o,l),u=v.create(r,a,c);e.setSelection(u)}return!0},G0=n=>({state:e,dispatch:t})=>{let r=U(n,e.schema);return Xc(r)(e,t)};X0=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{let{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,u=gi(c,l.node().type.name,l.node().attrs);if(s instanceof E&&s.node.isBlock)return!l.parentOffset||!Ne(o,l.pos)?!1:(r&&(n&&Sd(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:A0(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=d&&f?[{type:f,attrs:u}]:void 0,p=Ne(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ne(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(s instanceof v&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){let m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&Sd(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Y0=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;let l=U(n,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;let d=a.node(-1);if(d.type!==l)return!1;let f=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let y=b.empty,k=a.index(-1)?1:a.index(-2)?2:3;for(let B=a.depth-k;B>=a.depth-3;B-=1)y=b.from(a.node(B).copy(y));let w=a.indexAfter(-1){if(T>-1)return!1;B.isTextblock&&B.content.size===0&&(T=_+1)}),T>-1&&t.setSelection(v.near(t.doc.resolve(T))),t.scrollIntoView()}return!0}let h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...gi(f,d.type.name,d.attrs),...e},m={...gi(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);let g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Ne(t.doc,a.pos,2))return!1;if(i){let{selection:y,storedMarks:k}=r,{splittableMarks:w}=s.extensionManager,C=k||y.$to.parentOffset&&y.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!C||!i)return!0;let M=C.filter(P=>w.includes(P.type.name));t.ensureMarks(M)}return!0};tl=(n,e)=>{let t=wi(o=>o.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return!(t.node.type===i?.type&&Re(n.doc,t.pos))||!_d(t.node.attrs.type,i?.attrs.type)||n.join(t.pos),!0},nl=(n,e)=>{let t=wi(o=>o.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return!(t.node.type===i?.type&&Re(n.doc,r))||!_d(t.node.attrs.type,i?.attrs.type)||n.join(r),!0};Z0=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,h=U(n,o.schema),p=U(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:k}=m,w=y.blockRange(k),C=g||m.$to.parentOffset&&m.$from.marks();if(!w)return!1;let M=wi(de=>el(de.type.name,d))(m),P=m.from===0&&m.to===o.doc.content.size,T=o.doc.content.content,B=T.length===1?T[0]:null,_=P&&B&&el(B.type.name,d)?{node:B,pos:0,depth:0}:null,te=M??_,et=!!M&&w.depth>=1&&w.depth-M.depth<=1,We=!!_;if((et||We)&&te){if(te.node.type===h)return P&&We?a().command(({tr:de,dispatch:ne})=>{let Y=Q0(de);return Y?(de.setSelection(Y),ne&&ne(de),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(el(te.node.type.name,d)&&h.validContent(te.node.content))return a().command(()=>(s.setNodeMarkup(te.pos,h),!0)).command(()=>tl(s,h)).command(()=>nl(s,h)).run()}return!t||!C||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>tl(s,h)).command(()=>nl(s,h)).run():a().command(()=>{let de=u().wrapInList(h,r),ne=C.filter(Y=>f.includes(Y.type.name));return s.ensureMarks(ne),de?!0:c.clearNodes()}).wrapInList(h,r).command(()=>tl(s,h)).command(()=>nl(s,h)).run()},eb=(n,e={},t={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:s=!1}=t,o=pt(n,r.schema);return il(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},tb=(n,e,t={})=>({state:r,commands:i})=>{let s=U(n,r.schema),o=U(e,r.schema),l=Ue(r,s,t),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...t})},nb=(n,e={})=>({state:t,commands:r})=>{let i=U(n,t.schema);return Ue(t,i,e)?r.lift(i):r.wrapIn(i,e)},rb=()=>({state:n,dispatch:e})=>{let t=n.plugins;for(let r=0;r=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){let a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},ib=(n={})=>({tr:e,dispatch:t,editor:r})=>{let{ignoreClearable:i=!1}=n,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;let{nonClearableMarks:a}=r.extensionManager;if(t){let c=Object.values(r.schema.marks).filter(u=>i||!a.includes(u.name));l.forEach(u=>{for(let d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},sb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;let{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=pt(n,r.schema),{$from:c,empty:u,ranges:d}=l;if(!i)return!0;if(u&&o){let{from:f,to:h}=l,p=(s=c.marks().find(g=>g.type===a))==null?void 0:s.attrs,m=ll(c,a,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,a)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},ob=n=>({tr:e,state:t,dispatch:r})=>{let{selection:i}=t,s,o;return typeof n=="number"?(s=n,o=n):n&&"from"in n&&"to"in n?(s=n.from,o=n.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(l,a)=>{if(l.isText)return;let c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},lb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null,l=Si(typeof n=="string"?n:n.name,r.schema);if(!l)return!1;l==="node"&&(s=U(n,r.schema)),l==="mark"&&(o=pt(n,r.schema));let a=!1;return t.selection.ranges.forEach(c=>{let u=c.$from.pos,d=c.$to.pos,f,h,p,m;t.selection.empty?r.doc.nodesBetween(u,d,(g,y)=>{s&&s===g.type&&(a=!0,p=Math.max(y,u),m=Math.min(y+g.nodeSize,d),f=y,h=g)}):r.doc.nodesBetween(u,d,(g,y)=>{y=u&&y<=d&&(s&&s===g.type&&(a=!0,i&&t.setNodeMarkup(y,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(k=>{if(o===k.type&&(a=!0,i)){let w=Math.max(y,u),C=Math.min(y+g.nodeSize,d);t.addMark(w,C,o.create({...k.attrs,...e}))}}))}),h&&(f!==void 0&&i&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&i&&t.addMark(p,m,o.create({...g.attrs,...e}))}))}),a},ab=(n,e={})=>({state:t,dispatch:r})=>{let i=U(n,t.schema);return Kc(i,e)(t,r)},cb=(n,e={})=>({state:t,dispatch:r})=>{let i=U(n,t.schema);return qc(i,e)(t,r)},ub=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){let t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){let t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){let t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};hb={};sl(hb,{createAtomBlockMarkdownSpec:()=>pb,createBlockMarkdownSpec:()=>mb,createInlineMarkdownSpec:()=>bb,parseAttributes:()=>ml,parseIndentedBlocks:()=>Mi,renderNestedMarkdownContent:()=>lr,serializeAttributes:()=>gl});Ti=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},xb=(n,e)=>{if(ol(e))return e.exec(n);let t=e(n);if(!t)return null;let r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};yl=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...V(A(this,"addOptions",{name:this.name}))}}get storage(){return{...V(A(this,"addStorage",{name:this.name,options:this.options}))}}configure(n={}){let e=this.extend({...this.config,addOptions:()=>Wd(this.options,n)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(n={}){let e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},ce=class jd extends yl{constructor(){super(...arguments),this.type="mark"}static create(e={}){let t=typeof e=="function"?e():e;return new jd(t)}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!!!o.find(c=>c?.type.name===t.name))return!1;let a=o.find(c=>c?.type.name===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e=="function"?e():e;return super.extend(t)}},wb=class{constructor(n){this.find=n.find,this.handler=n.handler}},Cb=(n,e,t)=>{if(ol(e))return[...n.matchAll(e)];let r=e(n,t);return r?r.map(i=>{let s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};mi=null,Mb=n=>{var e;let t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};Ei=class{constructor(n,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Dd(n),this.schema=I0(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:rr(e.name,this.schema)},r=A(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){let{editor:n}=this;return sr([...this.extensions].reverse()).flatMap(r=>{let i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:rr(r.name,this.schema)},s=[],o=A(r,"addKeyboardShortcuts",i),l={};if(r.type==="mark"&&A(r,"exitable",i)&&(l.ArrowRight=()=>ce.handleExit({editor:n,mark:r})),o){let f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:n})]));l={...l,...f}}let a=ud(l);s.push(a);let c=A(r,"addInputRules",i);if(xd(r,n.options.enableInputRules)&&c){let f=c();if(f&&f.length){let h=Sb({editor:n,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}let u=A(r,"addPasteRules",i);if(xd(r,n.options.enablePasteRules)&&u){let f=u();if(f&&f.length){let h=Tb({editor:n,rules:f});s.push(...h)}}let d=A(r,"addProseMirrorPlugins",i);if(d){let f=d();s.push(...f)}return s})}get attributes(){return Id(this.extensions)}get nodeViews(){let{editor:n}=this,{nodeExtensions:e}=Sn(this.extensions);return Object.fromEntries(e.filter(t=>!!A(t,"addNodeView")).map(t=>{let r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:U(t.name,this.schema)},s=A(t,"addNodeView",i);if(!s)return[];let o=s();if(!o)return[];let l=(a,c,u,d,f)=>{let h=wn(a,r);return o({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){let{editor:e}=this;return sr([...this.extensions].reverse()).reduceRight((r,i)=>{let s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:rr(i.name,this.schema)},o=A(i,"dispatchTransaction",s);return o?l=>{o.call(s,{transaction:l,next:r})}:r},n)}transformPastedHTML(n){let{editor:e}=this;return sr([...this.extensions]).reduce((r,i)=>{let s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:rr(i.name,this.schema)},o=A(i,"transformPastedHTML",s);return o?(l,a)=>{let c=r(l,a);return o.call(s,c)}:r},n||(r=>r))}get markViews(){let{editor:n}=this,{markExtensions:e}=Sn(this.extensions);return Object.fromEntries(e.filter(t=>!!A(t,"addMarkView")).map(t=>{let r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:pt(t.name,this.schema)},s=A(t,"addMarkView",i);if(!s)return[];let o=(l,a,c)=>{let u=wn(l,r);return s()({mark:l,view:a,inline:c,editor:n,extension:t,HTMLAttributes:u,updateAttributes:d=>{kb(l,n,d)}})};return[t.name,o]}))}destroy(){this.extensions.forEach(n=>{let e=n;for(;e.parent;){let t=e.parent;t.child===e&&(t.child=null),e=t}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t,r;let i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:rr(e.name,this.schema)};e.type==="mark"&&(((t=V(A(e,"keepOnSplit",i)))==null||t)&&this.splittableMarks.push(e.name),(r=V(A(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));let s=A(e,"onBeforeCreate",i),o=A(e,"onCreate",i),l=A(e,"onUpdate",i),a=A(e,"onSelectionUpdate",i),c=A(e,"onTransaction",i),u=A(e,"onFocus",i),d=A(e,"onBlur",i),f=A(e,"onDestroy",i);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Ei.resolve=Dd;Ei.sort=sr;Ei.flatten=ul;Eb={};sl(Eb,{ClipboardTextSerializer:()=>Kd,Commands:()=>Ud,Delete:()=>qd,Drop:()=>Gd,Editable:()=>Xd,FocusEvents:()=>Qd,Keymap:()=>Zd,Paste:()=>ef,Tabindex:()=>tf,TextDirection:()=>nf,focusEventsPluginKey:()=>Yd});L=class Jd extends yl{constructor(){super(...arguments),this.type="extension"}static create(e={}){let t=typeof e=="function"?e():e;return new Jd(t)}configure(e){return super.configure(e)}extend(e){let t=typeof e=="function"?e():e;return super.extend(t)}},Kd=L.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new I({key:new z("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,s=Ld(t),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((c,u)=>c.$from.pos-u.$from.pos).map(({$from:c,$to:u})=>Pd(r,{from:c.pos,to:u.pos},l)).join(o??` + +`)}}})]}}),Ud=L.create({name:"commands",addCommands(){return{...Cd}}}),qd=L.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;let s=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?c:n.getMeta("y-sync$"))return;let u=al(n.before,[n,...e]);hl(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{let g=m+p.nodeSize-2,y=h.oldRange.from<=m&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:u})})});let f=u.mapping;u.steps.forEach((h,p)=>{var m,g;if(h instanceof it){let y=f.slice(p).map(h.from,-1),k=f.slice(p).map(h.to),w=f.invert().map(y,-1),C=f.invert().map(k),M=y>0?(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(T=>T.eq(h.mark)):!1,P=(g=u.doc.nodeAt(k))==null?void 0:g.marks.some(T=>T.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:C},newRange:{from:y,to:k},partial:!!(P||M),editor:this.editor,transaction:n,combinedTransform:u})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Gd=L.create({name:"drop",addProseMirrorPlugins(){return[new I({key:new z("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Xd=L.create({name:"editable",addProseMirrorPlugins(){return[new I({key:new z("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Yd=new z("focusEvents"),Qd=L.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:n}=this;return[new I({key:Yd,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;let r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;let r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Zd=L.create({name:"keymap",addKeyboardShortcuts(){let n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:N.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return bi()||Ad()?s:i},addProseMirrorPlugins(){return[new I({key:new z("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;let r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;let{empty:s,from:o,to:l}=e.selection,a=N.atStart(e.doc).from,c=N.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!Cn(t.doc))return;let f=t.tr,h=ki({state:t,transaction:f}),{commands:p}=new xi({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),ef=L.create({name:"paste",addProseMirrorPlugins(){return[new I({key:new z("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),tf=L.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new I({key:new z("tabindex"),props:{attributes:()=>{var n;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(n=this.options.value)!=null?n:"0"}}}})]}}),nf=L.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:n}=Sn(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new I({key:new z("textDirection"),props:{attributes:()=>{let n=this.options.direction;return n?{dir:n}:{}}}})]}}),Ab=class ir{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new ir(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ir(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ir(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,r)=>{let i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=t.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!o&&a.depth<=this.depth)return;let c=new ir(a,this.editor,i,i||o?t:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){let s=i.node.attrs,o=Object.keys(t);for(let l=0;l{r&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Nb=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`,rf=class extends ub{constructor(n={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:$0,createMappablePosition:_0},this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);let e=this.createDoc(),t=Td(e,this.options.autofocus);this.editorState=qr.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=pl(Nb,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){let t=Rd(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;let e=this.state.plugins,t=e;if([].concat(n).forEach(i=>{let s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;let r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e,t,r;let s=[...this.options.enableCoreExtensions?[Xd,Kd.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Ud,Qd,Zd,tf.configure({value:(r=(t=this.options.coreExtensionOptions)==null?void 0:t.tabindex)==null?void 0:r.value}),Gd,ef,qd,nf.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Ei(s,this)}createCommandManager(){this.commandManager=new xi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=rl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=rl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){let{editorProps:e,enableExtensionDispatchTransaction:t}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=t?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new Yn(n,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();let a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;let e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}let{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),i=t.includes(n),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});let o=t.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=o?.getMeta("focus"),a=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(n.getMeta("preventUpdate")||!t.some(c=>c.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return fl(this.state,n)}isActive(n,e){let t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return H0(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dl(this.state.doc.content,this.schema)}getText(n){let{blockSeparator:e=` + +`,textSerializers:t={}}=n||{};return P0(this.state.doc,{blockSeparator:e,textSerializers:{...Ld(this.schema),...t}})}get isEmpty(){return Cn(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){let e=this.state.doc.resolve(n),t=n>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new Ab(e,this,!1,t)}get $doc(){return this.$pos(0)}};Ob=n=>"touches"in n,sf=class{constructor(n){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;let a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;let a=l.touches[0];if(!a)return;let c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;let l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,t,r,i,s,o;this.node=n.node,this.editor=n.editor,this.element=n.element,this.element.draggable=!1,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,(e=n.options)!=null&&e.min&&(this.minSize={...this.minSize,...n.options.min}),(t=n.options)!=null&&t.max&&(this.maxSize=n.options.max),(r=n?.options)!=null&&r.directions&&(this.directions=n.options.directions),(i=n.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),(s=n.options)!=null&&s.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),(o=n.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!=null?n:null}handleEditorUpdate(){let n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){let n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){let e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){let t=e.includes("top"),r=e.includes("bottom"),i=e.includes("left"),s=e.includes("right");t&&(n.style.top="0"),r&&(n.style.bottom="0"),i&&(n.style.left="0"),s&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){let n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,Ob(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight);let t=this.getPos();this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;let t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,n,e),s=this.applyConstraints(r,i,t);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(n,e,t){let r=this.startWidth,i=this.startHeight,s=n.includes("right"),o=n.includes("left"),l=n.includes("bottom"),a=n.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?i=this.startHeight+t:a&&(i=this.startHeight-t),(n==="right"||n==="left")&&(r=this.startWidth+(s?e:-e)),(n==="top"||n==="bottom")&&(i=this.startHeight+(l?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,n):{width:r,height:i}}applyConstraints(n,e,t){var r,i,s,o;if(!t){let c=Math.max(this.minSize.width,n),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(i=this.maxSize)!=null&&i.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=n,a=e;return lthis.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(n,e,t){let r=t==="left"||t==="right",i=t==="top"||t==="bottom";return r?{width:n,height:n/this.aspectRatio}:i?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}},$=class of extends yl{constructor(){super(...arguments),this.type="node"}static create(e={}){let t=typeof e=="function"?e():e;return new of(t)}configure(e){return super.configure(e)}extend(e){let t=typeof e=="function"?e():e;return super.extend(t)}}});var vn,lf=O(()=>{vn=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);let{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]}});var bl=O(()=>{lf()});function bf(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=bf(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function kf(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;cn.depth)throw new zi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new zi("Inconsistent open depths");return wf(n,e,t,0)}function wf(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function mr(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(qt(n.nodeAfter,r),s++));for(let l=s;li&&Cl(n,e,i+1),o=r.depth>i&&Cl(t,r,i+1),l=[];return mr(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Cf(s,o),qt(Gt(s,vf(n,e,t,r,i+1)),l)):(s&&qt(Gt(s,Bi(n,e,i+1)),l),mr(e,t,i,l),o&&qt(Gt(o,Bi(t,r,i+1)),l)),mr(r,null,i,l),new ge(l)}function Bi(n,e,t){let r=[];if(mr(null,n,t,r),n.depth>t){let i=Cl(n,e,t+1);qt(Gt(i,Bi(n,e,t+1)),r)}return mr(e,null,t,r),new ge(r)}function Ib(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(ge.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}function Fb(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Tf(n){let e=[];do e.push($b(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function $b(n){let e=[];do e.push(_b(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _b(n){let e=jb(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Vb(n,e);else break;return e}function uf(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vb(n,e){let t=uf(n),r=t;return n.eat(",")&&(n.next!="}"?r=uf(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Wb(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function jb(n){if(n.eat("(")){let e=Tf(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Wb(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Jb(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Tl(r.indexOf(n.length-1)>-1);for(let o=0;o0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function mf(n){!pf&&!n.parent.inlineContent&&(pf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}function En(n,e,t,r,i,s=!1){if(e.inlineContent)return An.create(n,t);for(let o=r-(i>0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&Nn.isSelectable(l))return Nn.create(n,t-(i<0?l.nodeSize:0))}else{let a=En(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function gf(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(se.near(n.doc.resolve(o),t))}function yf(n,e){return!e||!n?n:n.bind(e)}var ge,kl,Ut,zi,q,af,Db,Pb,cf,Lb,zb,Bb,Tl,Hb,Af,Nf,Of,Rf,Ri,If,hf,Xt,xl,ye,ve,Df,Pf,Lf,zf,Rl,Bf,Xb,Yb,yr,Sl,se,Qb,pf,An,Ff,Nn,Zb,gr,ek,Oi,oC,tk,nk,_f,Vf=O(()=>{R();bl();ge=class Ce{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;re&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new Ce(r,i)}cutByIndex(e,t){return e==t?Ce.empty:e==0&&t==this.content.length?this:new Ce(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new Ce(i,s)}addToStart(e){return new Ce([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ce(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Ni(t+1,s):Ni(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Ce.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return Ce.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ce.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};Ut.none=[];zi=class extends Error{},q=class Mn{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Sf(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new Mn(r,this.openStart,this.openEnd)}removeBetween(e,t){return new Mn(xf(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Mn.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Mn(ge.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new Mn(e,r,i)}};q.empty=new q(ge.empty,0,0);af=class vl{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Lb(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new vl(t,r,s)}static resolveCached(e,t){let r=cf.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Fb(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=ge.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=ge.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Bb.prototype.text=void 0;Tl=class Mf{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Hb(e,t);if(r.next==null)return Mf.empty;let i=Tf(r);r.next&&r.err("Unexpected trailing text");let s=Kb(Jb(i));return Ub(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +`)}};Tl.empty=new Tl(!0);Hb=class{constructor(n,e){this.string=n,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=n.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(n){return this.next==n&&(this.pos++||!0)}err(n){throw new SyntaxError(n+" (in content expression '"+this.string+"')")}};Af=65535,Nf=Math.pow(2,16);Of=1,Rf=2,Ri=4,If=8,hf=class{constructor(n,e,t){this.pos=n,this.delInfo=e,this.recover=t}get deleted(){return(this.delInfo&If)>0}get deletedBefore(){return(this.delInfo&(Of|Ri))>0}get deletedAfter(){return(this.delInfo&(Rf|Ri))>0}get deletedAcross(){return(this.delInfo&Ri)>0}},Xt=class Tn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Tn.empty)return Tn.empty}recover(e){let t=0,r=ff(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:qb(l/3,e-a),m=e==a?Rf:e==d?Of:Ri;return(t<0?e!=a:e!=d)&&(m|=If),new hf(h,m,p)}i+=u-c}return r?e+i:new hf(e+i,0,null)}touches(e,t){let r=0,i=ff(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,s)}invert(){return new Pf(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ur(t.pos,r.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ur(t.from,t.to,e.markFromJSON(t.mark))}};ye.jsonID("addMark",Df);Pf=class dr extends ye{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new q(Ol(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new Df(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new dr(t.pos,r.pos,this.mark)}merge(e){return e instanceof dr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new dr(t.from,t.to,e.markFromJSON(t.mark))}};ye.jsonID("removeMark",Pf);Lf=class fr extends ye{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new q(ge.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new Ii(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ii(t.from,t.to,t.gapFrom,t.gapTo,q.fromJSON(e,t.slice),t.insert,!!t.structure)}};ye.jsonID("replaceAround",Bf);Xb=class Di extends ye{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ve.fromReplace(e,this.pos,this.pos+1,new q(ge.from(i),0,t.isLeaf?0:1))}getMap(){return Xt.empty}invert(e){return new Di(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Di(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Di(t.pos,t.attr,t.value)}};ye.jsonID("attr",Xb);Yb=class Nl extends ye{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ve.ok(r)}getMap(){return Xt.empty}invert(e){return new Nl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Nl(t.attr,t.value)}};ye.jsonID("docAttr",Yb);yr=class extends Error{};yr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};yr.prototype=Object.create(Error.prototype);yr.prototype.constructor=yr;yr.prototype.name="TransformError";Sl=Object.create(null),se=class{constructor(n,e,t){this.$anchor=n,this.$head=e,this.ranges=t||[new Qb(n.min(e),n.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let n=this.ranges;for(let e=0;e=0;i--){let s=e<0?En(n.node(0),n.node(i),n.before(i+1),n.index(i),e,t):En(n.node(0),n.node(i),n.after(i+1),n.index(i)+1,e,t);if(s)return s}return null}static near(n,e=1){return this.findFrom(n,e)||this.findFrom(n,-e)||new gr(n.node(0))}static atStart(n){return En(n,n,0,0,1)||new gr(n)}static atEnd(n){return En(n,n,n.content.size,n.childCount,-1)||new gr(n)}static fromJSON(n,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let t=Sl[e.type];if(!t)throw new RangeError(`No selection type ${e.type} defined`);return t.fromJSON(n,e)}static jsonID(n,e){if(n in Sl)throw new RangeError("Duplicate use of selection JSON ID "+n);return Sl[n]=e,e.prototype.jsonID=n,e}getBookmark(){return An.between(this.$anchor,this.$head).getBookmark()}};se.prototype.visible=!0;Qb=class{constructor(n,e){this.$from=n,this.$to=e}},pf=!1;An=class hr extends se{constructor(e,t=e){mf(e),mf(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return se.near(r);let i=e.resolve(t.map(this.anchor));return new hr(i.parent.inlineContent?i:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof hr&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ff(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new hr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=se.findFrom(t,r,!0)||se.findFrom(t,-r,!0);if(s)t=s.$head;else return se.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(se.findFrom(e,-r,!0)||se.findFrom(e,r,!0)).$anchor,e.pos{var t;let{state:r,view:i}=n,{selection:s}=r;if(!s.empty)return!1;let{$from:o}=s;if(o.parentOffset!==0)return!1;let l=o.depth-1,a=o.node(l),c=o.index(l);if(c===0)return!1;if(a.type===e)return n.commands.lift(e.name);let u=a.child(c-1);if(u.type!==e||!((t=u.lastChild)!=null&&t.isTextblock))return!1;let d=o.before(),h=d-1-1,{tr:p}=r;return p.delete(d,o.after()).insert(h,o.parent.content),p.setSelection(An.create(p.doc,h)),i.dispatch(p.scrollIntoView()),!0},nk=/^\s*>\s$/,_f=$.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return vn("blockquote",{...D(this.options.HTMLAttributes,n),children:vn("slot",{})})},parseMarkdown:(n,e)=>{var t;let r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";let t=">",r=[];return n.content.forEach((i,s)=>{var o,l;let u=((l=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?l:e.renderChildren([i])).split(` +`).map(d=>d.trim()===""?t:`${t} ${d}`);r.push(u.join(` +`))}),r.join(` +${t} +`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>tk(this.editor,this.type)}},addInputRules(){return[qe({find:nk,type:this.type})]}})});var rk,ik,sk,ok,Wf,jf=O(()=>{R();bl();rk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ik=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,sk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ok=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Wf=ce.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return vn("strong",{...D(this.options.HTMLAttributes,n),children:vn("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"",close:""}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Fe({find:rk,type:this.type}),Fe({find:sk,type:this.type})]},addPasteRules(){return[Ee({find:ik,type:this.type}),Ee({find:ok,type:this.type})]}})});var lk,ak,Jf,Kf=O(()=>{R();lk=n=>{let e=/`([^`]+)`(?!`)$/.exec(n);return!e||e.index>0&&n[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},ak=n=>{let e=/`([^`]+)`(?!`)/g,t=[],r;for(;(r=e.exec(n))!==null;)r.index>0&&n[r.index-1]==="`"||t.push({index:r.index,text:r[0],replaceWith:r[1]});return t},Jf=ce.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",D(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Fe({find:lk,type:this.type})]},addPasteRules(){return[Ee({find:ak,type:this.type})]}})});var Il,ck,uk,Uf,qf=O(()=>{R();F();Il=4,ck=/^```([a-z]+)?[\s\n]$/,uk=/^~~~([a-z]+)?[\s\n]$/,Uf=$.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Il,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;let{languageClassPrefix:t}=this.options;if(!t)return null;let s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",D(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&((r=n.raw)==null?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="",i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(` +`):r=`\`\`\`${i} + +\`\`\``,r},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;let t=(e=this.options.tabSize)!=null?e:Il,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;let l=" ".repeat(t);return o?n.commands.insertContent(l):n.commands.command(({tr:a})=>{let{from:c,to:u}=i,h=r.doc.textBetween(c,u,` +`,` +`).split(` +`).map(p=>l+p).join(` +`);return a.replaceWith(c,u,r.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;let t=(e=this.options.tabSize)!=null?e:Il,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:l})=>{var a;let{pos:c}=s,u=s.start(),d=s.end(),h=r.doc.textBetween(u,d,` +`,` +`).split(` +`),p=0,m=0,g=c-u;for(let P=0;P=g){p=P;break}m+=h[P].length+1}let k=((a=h[p].match(/^ */))==null?void 0:a[0])||"",w=Math.min(k.length,t);if(w===0)return!0;let C=u;for(let P=0;P{let{from:a,to:c}=i,f=r.doc.textBetween(a,c,` +`,` +`).split(` +`).map(h=>{var p;let m=((p=h.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,t);return h.slice(g)}).join(` +`);return l.replaceWith(a,c,r.schema.text(f)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;let s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!s||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;let l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(N.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[ar({find:ck,type:this.type,getAttributes:n=>({language:n[1]})}),ar({find:uk,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new I({key:new z("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;let{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(v.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}})});var Gf,Xf=O(()=>{R();Gf=$.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` + +`):""})});var Yf,Qf=O(()=>{R();Yf=$.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",D(this.options.HTMLAttributes,n)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{let{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){let d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})});var Zf,eh=O(()=>{R();Zf=$.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,D(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;let r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>ar({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}})});var th,nh=O(()=>{R();F();th=$.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",D(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Vd(e,e.schema.nodes[this.name]))return!1;let{selection:t}=e,{$to:r}=t,i=n();return vi(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:l})=>{if(l){let{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(v.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(E.create(o.doc,a.pos)):o.setSelection(v.create(o.doc,a.pos));else{let u=s.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(o.insert(c,d),o.setSelection(v.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Ai({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}})});var dk,fk,hk,pk,rh,ih=O(()=>{R();dk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,fk=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,hk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pk=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rh=ce.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"",close:""}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Fe({find:dk,type:this.type}),Fe({find:hk,type:this.type})]},addPasteRules(){return[Ee({find:fk,type:this.type}),Ee({find:pk,type:this.type})]}})});function kk(n,e){return n in e||(e[n]=[]),e[n]}function Yt(n,e,t){e[Hl]&&(e[xr]=!0,e[kr]=!0),e[$l]&&(e[xr]=!0,e[_l]=!0),e[xr]&&(e[kr]=!0),e[_l]&&(e[kr]=!0),e[kr]&&(e[Vl]=!0),e[uh]&&(e[Vl]=!0);for(let r in e){let i=kk(r,t);i.indexOf(n)<0&&i.push(n)}}function xk(n,e){let t={};for(let r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Ae(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}function Ck(n=[]){let e={};Ae.groups=e;let t=new Ae;Fi==null&&(Fi=lh(mk)),Hi==null&&(Hi=lh(gk)),x(t,"'",rs),x(t,"{",Sr),x(t,"}",wr),x(t,"[",Vi),x(t,"]",Wi),x(t,"(",ji),x(t,")",Ji),x(t,"<",Ki),x(t,">",Ui),x(t,"\uFF08",qi),x(t,"\uFF09",Gi),x(t,"\u300C",Xi),x(t,"\u300D",Yi),x(t,"\u300E",Qi),x(t,"\u300F",Zi),x(t,"\uFF1C",es),x(t,"\uFF1E",ts),x(t,"&",ns),x(t,"*",is),x(t,"@",Nt),x(t,"`",ls),x(t,"^",as),x(t,":",Qt),x(t,",",Gl),x(t,"$",cs),x(t,".",Ge),x(t,"=",us),x(t,"!",Xl),x(t,"-",$e),x(t,"%",Cr),x(t,"|",ds),x(t,"+",fs),x(t,"#",hs),x(t,"?",vr),x(t,'"',Yl),x(t,"/",Xe),x(t,";",Ql),x(t,"~",Mr),x(t,"_",ps),x(t,"\\",ss),x(t,"\u30FB",hh);let r=G(t,gt,Ul,{[Hl]:!0});G(r,gt,r);let i=G(r,mt,dh,{[xr]:!0}),s=G(r,br,fh,{[kr]:!0}),o=G(t,mt,yt,{[$l]:!0});G(o,gt,i),G(o,mt,o),G(i,gt,i),G(i,mt,i);let l=G(t,br,Wl,{[_l]:!0});G(l,mt),G(l,gt,s),G(l,br,l),G(s,gt,s),G(s,mt),G(s,br,s);let a=x(t,zl,ql,{[Dl]:!0}),c=x(t,oh,Kl,{[Dl]:!0}),u=G(t,Ll,Kl,{[Dl]:!0});x(t,Bl,u),x(c,zl,a),x(c,Bl,u),G(c,Ll,u),x(u,oh),x(u,zl),G(u,Ll,u),x(u,Bl,u);let d=G(t,Pl,ph,{[uh]:!0});x(d,"#"),G(d,Pl,d),x(d,Sk,d);let f=x(d,wk);x(f,"#"),G(f,Pl,d);let h=[[mt,o],[gt,i]],p=[[mt,null],[br,l],[gt,s]];for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?k[Vl]=!0:mt.test(g)?gt.test(g)?k[xr]=!0:k[$l]=!0:k[Hl]=!0,sh(t,g,g,k)}return sh(t,"localhost",Tr,{ascii:!0}),t.jd=new Ae(ms),{start:t,tokens:Object.assign({groups:e},mh)}}function gh(n,e){let t=vk(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[],s=0,o=0;for(;o=0&&(d+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=d,o-=f,c-=d,i.push({t:u.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function vk(n){let e=[],t=n.length,r=0;for(;r56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function At(n,e,t,r,i){let s,o=e.length;for(let l=0;l=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}function Zl(n,e=null){let t=Object.assign({},Er);n&&(t=Object.assign(t,n instanceof Zl?n.o:n));let r=t.ignoreTags,i=[];for(let s=0;s=0&&f++,i++,u++;if(f<0)i-=u,i0&&(s.push(Fl(ch,e,o)),o=[]),i-=f,u-=f;let h=d.t,p=t.slice(i-u,i);s.push(Fl(h,e,p))}}return o.length>0&&s.push(Fl(ch,e,o)),s}function Fl(n,e,t){let r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}function bh(){return Ae.groups={},K.scanner=null,K.parser=null,K.tokenQueue=[],K.pluginQueue=[],K.customSchemes=[],K.initialized=!1,K}function ea(n,e=!1){if(K.initialized&&Nk(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Ok}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);K.customSchemes.push([n,e])}function Rk(){K.scanner=Ck(K.customSchemes);for(let n=0;n{mk="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",gk="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Hl="numeric",$l="ascii",_l="alpha",xr="asciinumeric",kr="alphanumeric",Vl="domain",uh="emoji",yk="scheme",bk="slashscheme",Dl="whitespace";Ae.groups={};Ae.prototype={accepts(){return!!this.t},go(n){let e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,i),G=(n,e,t,r,i)=>n.tr(e,t,r,i),sh=(n,e,t,r,i)=>n.ts(e,t,r,i),x=(n,e,t,r,i)=>n.tt(e,t,r,i),yt="WORD",Wl="UWORD",dh="ASCIINUMERICAL",fh="ALPHANUMERICAL",Tr="LOCALHOST",jl="TLD",Jl="UTLD",_i="SCHEME",On="SLASH_SCHEME",Ul="NUM",Kl="WS",ql="NL",Sr="OPENBRACE",wr="CLOSEBRACE",Vi="OPENBRACKET",Wi="CLOSEBRACKET",ji="OPENPAREN",Ji="CLOSEPAREN",Ki="OPENANGLEBRACKET",Ui="CLOSEANGLEBRACKET",qi="FULLWIDTHLEFTPAREN",Gi="FULLWIDTHRIGHTPAREN",Xi="LEFTCORNERBRACKET",Yi="RIGHTCORNERBRACKET",Qi="LEFTWHITECORNERBRACKET",Zi="RIGHTWHITECORNERBRACKET",es="FULLWIDTHLESSTHAN",ts="FULLWIDTHGREATERTHAN",ns="AMPERSAND",rs="APOSTROPHE",is="ASTERISK",Nt="AT",ss="BACKSLASH",ls="BACKTICK",as="CARET",Qt="COLON",Gl="COMMA",cs="DOLLAR",Ge="DOT",us="EQUALS",Xl="EXCLAMATION",$e="HYPHEN",Cr="PERCENT",ds="PIPE",fs="PLUS",hs="POUND",vr="QUERY",Yl="QUOTE",hh="FULLWIDTHMIDDLEDOT",Ql="SEMI",Xe="SLASH",Mr="TILDE",ps="UNDERSCORE",ph="EMOJI",ms="SYM",mh=Object.freeze({__proto__:null,ALPHANUMERICAL:fh,AMPERSAND:ns,APOSTROPHE:rs,ASCIINUMERICAL:dh,ASTERISK:is,AT:Nt,BACKSLASH:ss,BACKTICK:ls,CARET:as,CLOSEANGLEBRACKET:Ui,CLOSEBRACE:wr,CLOSEBRACKET:Wi,CLOSEPAREN:Ji,COLON:Qt,COMMA:Gl,DOLLAR:cs,DOT:Ge,EMOJI:ph,EQUALS:us,EXCLAMATION:Xl,FULLWIDTHGREATERTHAN:ts,FULLWIDTHLEFTPAREN:qi,FULLWIDTHLESSTHAN:es,FULLWIDTHMIDDLEDOT:hh,FULLWIDTHRIGHTPAREN:Gi,HYPHEN:$e,LEFTCORNERBRACKET:Xi,LEFTWHITECORNERBRACKET:Qi,LOCALHOST:Tr,NL:ql,NUM:Ul,OPENANGLEBRACKET:Ki,OPENBRACE:Sr,OPENBRACKET:Vi,OPENPAREN:ji,PERCENT:Cr,PIPE:ds,PLUS:fs,POUND:hs,QUERY:vr,QUOTE:Yl,RIGHTCORNERBRACKET:Yi,RIGHTWHITECORNERBRACKET:Zi,SCHEME:_i,SEMI:Ql,SLASH:Xe,SLASH_SCHEME:On,SYM:ms,TILDE:Mr,TLD:jl,UNDERSCORE:ps,UTLD:Jl,UWORD:Wl,WORD:yt,WS:Kl}),mt=/[a-z]/,br=/\p{L}/u,Pl=/\p{Emoji}/u,gt=/\d/,Ll=/\s/,oh="\r",zl=` +`,Sk="\uFE0F",wk="\u200D",Bl="\uFFFC",Fi=null,Hi=null;Er={defaultProtocol:"http",events:null,format:ah,formatHref:ah,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};Zl.prototype={o:Er,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){let r=e!=null,i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Er[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){let e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};yh.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){let e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Er.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){let e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:i,attributes:o,content:s,eventListeners:d}}};Mk=gs("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ch=gs("text"),Tk=gs("nl"),$i=gs("url",{isLink:!0,toHref(n=Er.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){let n=this.tk;return n.length>=2&&n[0].t!==Tr&&n[1].t===Qt}}),He=n=>new Ae(n);Nk=typeof console<"u"&&console&&console.warn||(()=>{}),Ok="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",K={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};ys.scan=gh});function Lk(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function zk(n){return new I({key:new z("autolink"),appendTransaction:(e,t,r)=>{let i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;let{tr:o}=r,l=al(t.doc,[...e]);if(hl(l).forEach(({newRange:c})=>{let u=Od(r.doc,c,h=>h.isTextblock),d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){let h=r.doc.textBetween(c.from,c.to," "," ");if(!Dk.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){let h=f.split(Ik).filter(Boolean);if(h.length<=0)return!1;let p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;let g=ys(p).map(y=>y.toObject(n.defaultProtocol));if(!Lk(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{Ci(y.from,y.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function Bk(n){return new I({key:new z("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let a=r.target;if(!a)return!1;let c=n.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){let a=fl(e.state,n.type.name),c=(i=o.href)!=null?i:a.href,u=(s=o.target)!=null?s:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function Fk(n){return new I({key:new z("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});let c=bs(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||i!==void 0&&!i(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function Zt(n,e){let t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(Pk,"").match(new RegExp(`^(?:(?:${t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var ta,Ik,Dk,Pk,kh,xh=O(()=>{R();ks();R();F();ks();R();F();F();ks();ta="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",Ik=new RegExp(ta),Dk=new RegExp(`${ta}$`),Pk=new RegExp(ta,"g");kh=ce.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){ea(n);return}ea(n.scheme,n.optionalSlashes)})},onDestroy(){bh()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Zt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;let i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{let e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Zt(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Zt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",D(this.options.HTMLAttributes,n),0]:["a",D(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,i,s;let o=(r=(t=n.attrs)==null?void 0:t.href)!=null?r:"",l=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"",a=e.renderChildren(n);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{let{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Zt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{let{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Zt(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ee({find:n=>{let e=[];if(n){let{protocols:t,defaultProtocol:r}=this.options,i=bs(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Zt(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){let n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(zk({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Zt(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(Bk({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Fk({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}})});function ws(n){let e=n,t="";for(let[r,i]of Eh)for(;e>=r;)t+=i,e-=r;return t}function la(n){return ws(n).toUpperCase()}function Ah(n){let e=n.toLowerCase(),t=0,r=0;for(;t0?r:1}let t=parseInt(n,10);return Number.isNaN(t)?1:t}function qk(n,e){if(n==="numeric")return String(e);switch(n){case"a":return Ss(e);case"A":return Ss(e).toUpperCase();case"i":return ws(e);case"I":return la(e);default:return String(e)}}function Gk(n){var e;if(n.length===0)return!1;let t=(e=Cs(n[0]))!=null?e:"numeric",r=aa(n[0]);if(r<1)return!1;for(let i=0;i\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function cx(n){let e=[],t=[],r=!1;return n.forEach(i=>{if(r){t.push(i);return}if(i.trim()===""){r=!0,t.push(i);return}if(e.length>0&&ax(i)){r=!0,t.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:t}}function ux(n){let e=[],t=0,r=0;for(;ts.trim().length>0);if(e.length===0)return null;let t=[];for(let s of e){let o=s.trim().match(dx);if(!o)return null;t.push({marker:o[1],content:o[3]})}let r=t.map(s=>s.marker);return Gk(r)?{type:"orderedList",attrs:Yk(t[0].marker),content:t.map(s=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:s.content}]}]}))}:null}function Ih(n,e,t){let r=[],i=0;for(;ie;)f.push(n[d]),d+=1;if(f.length>0){let h=Math.min(...f.map(m=>m.indent)),p=Ih(f,h,t);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:p,raw:f.map(m=>m.raw).join(` +`)})}r.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return r}function hx(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];let r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){let s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{let s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}function Mh(n){let e=n.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var Hk,$k,_k,Sh,wh,sa,Vk,Wk,jk,Th,Eh,xs,Jk,oa,ca,tx,vs,ua,Nh,na,Oh,Rh,ra,nx,rx,ix,da,ia,sx,ox,dx,px,Ch,vh,fa,mx,Ar,Nr,uv,Rn=O(()=>{R();R();R();Ie();R();R();R();R();R();R();R();F();R();R();R();Hk=Object.defineProperty,$k=(n,e)=>{for(var t in e)Hk(n,t,{get:e[t],enumerable:!0})},_k="listItem",Sh="textStyle",wh=/^\s*([-+*])\s$/,sa=$.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",D(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` +`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_k,this.editor.getAttributes(Sh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=qe({find:wh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=qe({find:wh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Sh),editor:this.editor})),[n]}}),Vk=(n,e,t)=>{let{selection:r}=n;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let s=-1;for(let h=i.depth;h>0;h-=1)if(i.node(h).type.name===e){s=h;break}if(s<0)return null;let o=i.node(s),l=i.index(s);if(l+1>=o.childCount)return null;let a=o.child(l+1);if(!t.includes(a.type.name))return null;let c=n.schema.nodes[e],u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;let d=n.doc.resolve(i.after()).nodeAfter;if(!d||!t.includes(d.type.name))return null;let f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:s,nestedList:d,nestedListPos:i.after(),insertPos:i.after(s),items:f}},Wk=(n,e,t,r)=>{let i=Vk(n,t,r);if(!i)return!1;let{selection:s}=n,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=i,u=n.tr;u.delete(l,l+o.nodeSize);let d=u.mapping.map(a);return u.insert(d,b.from(c)),u.setSelection(s.map(u.doc,u.mapping)),e&&e(u),!0},jk=(n,e,t)=>Wk(n.state,n.view.dispatch,e,t),Th=(n,e)=>L.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let t=()=>jk(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}}),Eh=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],xs="abcdefghijklmnopqrstuvwxyz",Jk="[a-zA-Z]{1,2}",oa=String.raw`\d+|[ivxlcdmIVXLCDM]+|${Jk}`;ca=$.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",D(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];let r=(t=e.parseBlockChildren)!=null?t:e.parseChildren,i=[];if(n.tokens&&n.tokens.length>0){if(Zk(n))return{type:"listItem",content:[{type:"paragraph",content:ex(n.text||"",e)}]};if(n.tokens.some(o=>o.type==="paragraph"))i=r(n.tokens);else{let o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){let a=n.tokens.slice(1),c=r(a);i.push(...c)}}else i=r(n.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(n,e,t)=>lr(n,e,r=>{var i,s,o,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){let a=((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1,c=(l=(o=r.meta)==null?void 0:o.parentAttrs)==null?void 0:l.type,u=a-1+(r.index||0);return Qk(c,u,". ")}return"- "},t),addExtensions(){return[Th(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),tx={};$k(tx,{findListItemPos:()=>vs,getNextListDepth:()=>ua,handleBackspace:()=>na,handleDelete:()=>ra,hasListBefore:()=>Nh,hasListItemAfter:()=>nx,hasListItemBefore:()=>rx,listItemHasSubList:()=>ix,nextListIsDeeper:()=>Oh,nextListIsHigher:()=>Rh});vs=(n,e)=>{let{$from:t}=e.selection,r=U(n,e.schema),i=null,s=t.depth,o=t.pos,l=null;for(;s>0&&l===null;)i=t.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},ua=(n,e)=>{let t=vs(n,e);if(!t)return!1;let[,r]=zd(e,n,t.$pos.pos+4);return r},Nh=(n,e,t)=>{let{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},na=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Ue(n.state,e)&&Nh(n.state,e,t)){let{$anchor:r}=n.state.selection,i=n.state.doc.resolve(r.before()-1),s=[];i.node().descendants((a,c)=>{a.type.name===e&&s.push({node:a,pos:c})});let o=s.at(-1);if(!o)return!1;let l=n.state.doc.resolve(i.start()+o.pos+1);return n.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!Ue(n.state,e)||!Fd(n.state)?!1:n.chain().liftListItem(e).run()},Oh=(n,e)=>{let t=ua(n,e),r=vs(n,e);return!r||!t?!1:t>r.depth},Rh=(n,e)=>{let t=ua(n,e),r=vs(n,e);return!r||!t?!1:t{if(!Ue(n.state,e)||!Bd(n.state,e))return!1;let{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:Oh(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Rh(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},nx=(n,e)=>{var t;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},rx=(n,e)=>{var t;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},ix=(n,e,t)=>{if(!t)return!1;let r=U(n,e.schema),i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},da=L.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ra(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ra(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&na(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&na(n,t,r)&&(e=!0)}),e}}}}),ia=new RegExp(`^(\\s*)(${oa})([.)])\\s+(.*)$`),sx=new RegExp(`^(\\s*)(${oa})([.)])\\s+`),ox=/^\s/;dx=new RegExp(`^(${oa})([.)])\\s+(.+)$`);px="listItem",Ch="textStyle",vh=/^(\d+)\.\s$/;fa=$.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>{let e=n.getAttribute("type");if(e)return e;let t=n.getAttribute("style");if(t){let i=Mh(t);if(i)return i}let r=n.querySelector("li");if(r){let i=r.getAttribute("style");if(i){let s=Mh(i);if(s)return s}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){let{start:e,type:t,...r}=n,i=D(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),t&&t!=="1"&&(i.type=t),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];let t=n.start||1,r=n.typeMarker,i=n.items?hx(n.items,e):[],s={};return t!==1&&(s.start=t),r&&(s.type=r),Object.keys(s).length>0?{type:"orderedList",attrs:s,content:i}:{type:"orderedList",content:i}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` +`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{let e=n.match(sx),t=e?.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r,i;let s=n.split(` +`),[o,l]=ux(s);if(o.length===0)return;let a=Ih(o,0,t);if(a.length===0)return;let c=((r=o[0])==null?void 0:r.number)||1,u=(i=o[0])==null?void 0:i.type;return{type:"list",ordered:!0,start:c,typeMarker:u,items:a,raw:s.slice(0,l).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(px,this.editor.getAttributes(Ch)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new I({props:{handlePaste:(n,e)=>{var t,r;let i=(t=e.clipboardData)==null?void 0:t.getData("text/html");if(i?.trim())return!1;let s=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!s)return!1;let o=fx(s);if(!o)return!1;try{let l=n.state.schema.nodeFromJSON(o),a=n.state.tr.replaceSelectionWith(l);return n.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){let n=(t,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+t[1],e=qe({find:vh,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:n});return(this.options.keepMarks||this.options.keepAttributes)&&(e=qe({find:vh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Ch)}),joinPredicate:n,editor:this.editor})),[e]}}),mx=/^\s*(\[([( |x])?\])\s$/,Ar=$.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{let e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",D(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{let t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){let r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;let i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return lr(n,e,i)},addExtensions(){return this.options.nested?[Th(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{let i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(n),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:f}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{let p=t();if(typeof p!="number")return!1;let m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{i.setAttribute(d,f)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,f])=>{i.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);let f=r.extensionManager.attributes,h=wn(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return u.forEach(g=>{p.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(h).forEach(([g,y])=>{y==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,y)}),u=p,!0}}}},addInputRules(){return[qe({find:mx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Nr=$.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",D(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,` +`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;let t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){let r=s=>{let o=Mi(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=Mi(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),uv=L.create({name:"listKit",addExtensions(){let n=[];return this.options.bulletList!==!1&&n.push(sa.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(ca.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(da.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(fa.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Ar.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Nr.configure(this.options.taskList)),n}})});var Ms,ha,Dh,Ph=O(()=>{R();Ms=" ",ha="\xA0",Dh=$.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",D(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{let t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);let r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===Ms||t[0].text===Ms||t[0].raw===ha||t[0].text===ha)&&r.length===1&&r[0].type==="text"&&(r[0].text===Ms||r[0].text===ha)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{var r,i;if(!n)return"";let s=Array.isArray(n.content)?n.content:[];if(s.length===0){let o=Array.isArray((r=t?.previousNode)==null?void 0:r.content)?t.previousNode.content:[];return((i=t?.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?Ms:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})});var gx,yx,Lh,zh=O(()=>{R();gx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,yx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Lh=ce.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",D(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Fe({find:gx,type:this.type})]},addPasteRules(){return[Ee({find:yx,type:this.type})]}})});var Bh,Fh=O(()=>{R();Bh=$.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""})});var Hh,$h=O(()=>{R();Hh=ce.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",D(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){let i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;let s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}})});function _h(n={}){return new I({view(e){return new pa(e,n)}})}var pa,Vh=O(()=>{lt();ot();pa=class{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Jr(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}});var Wh=O(()=>{Vh()});function jh(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function bx(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||jh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function kx(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||jh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Jh(){return new I({props:{decorations:Cx,createSelectionBetween(n,e,t){return e.pos==t.pos&&be.valid(t)?new be(t):null},handleClick:Sx,handleKeyDown:xx,handleDOMEvents:{beforeinput:wx}}})}function Ts(n,e){let t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof v){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=be.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new be(c))),!0):!1}}function Sx(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!be.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&E.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new be(r))),!0)}function wx(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof be))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=b.empty;for(let o=r.length-1;o>=0;o--)i=b.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new S(i,0,0));return s.setSelection(v.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Cx(n){if(!(n.selection instanceof be))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",J.create(n.doc,[Z.widget(n.selection.head,e,{key:"gapcursor"})])}var be,ma,xx,Kh=O(()=>{di();lt();nt();ai();be=class n extends N{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return n.valid(r)?new n(r):N.near(r)}content(){return S.empty}eq(e){return e instanceof n&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(e.resolve(t.pos))}getBookmark(){return new ma(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!bx(e)||!kx(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&n.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(n.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!E.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(n.valid(l))return l}return null}}};be.prototype.visible=!1;be.findFrom=be.findGapCursorFrom;N.jsonID("gapcursor",be);ma=class n{constructor(e){this.pos=e}map(e){return new n(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return be.valid(t)?new be(t):N.near(t)}};xx=nr({ArrowLeft:Ts("horiz",-1),ArrowRight:Ts("horiz",1),ArrowUp:Ts("vert",-1),ArrowDown:Ts("vert",1)})});var Uh=O(()=>{Kh()});var Es,ue,qh,vx,ga,Gh=O(()=>{Es=200,ue=function(){};ue.prototype.append=function(e){return e.length?(e=ue.from(e),!this.length&&e||e.length=t?ue.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ue.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ue.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ue.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};ue.from=function(e){return e instanceof ue?e:e&&e.length?new qh(e):ue.empty};qh=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Es)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Es)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(ue);ue.empty=new qh([]);vx=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rl&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(ue),ga=ue});function Tx(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}function Ax(n,e,t,r){let i=t.getMeta(en),s;if(i)return i.historyState;t.getMeta(Rx)&&(n=new Qe(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(en))return o.getMeta(en).redo?new Qe(n.done.addTransform(t,void 0,r,As(e)),n.undone,Xh(t.mapping.maps),n.prevTime,n.prevComposition):new Qe(n.done,n.undone.addTransform(t,void 0,r,As(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Nx(t,n.prevRanges)),c=o?ya(n.prevRanges,t.mapping):Xh(t.mapping.maps);return new Qe(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,As(e)),tn.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Qe(n.done.rebased(t,s),n.undone.rebased(t,s),ya(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Qe(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),ya(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Nx(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function Xh(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function ya(n,e){if(!n)return null;let t=[];for(let r=0;r{let i=en.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=Ox(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}var Mx,tn,Ye,Qe,Ex,ba,Yh,en,Rx,ka,xa,zv,Bv,Zh=O(()=>{Gh();ot();lt();Mx=500,tn=class n{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new Ye(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new Ye(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new n(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;uEx&&(l=Tx(l,c),o-=c),new n(l.append(s),o)}remapping(e,t){let r=new $n;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new n(this.items.append(e.map(t=>new Ye(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(s.slice(a+1,h));g&&l++,r.push(new Ye(p,m,g))}else r.push(new Ye(p))},i);let c=[];for(let f=t;fMx&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let d=new Ye(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new n(ga.from(i.reverse()),s)}};tn.empty=new tn(ga.empty,0);Ye=class n{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new n(t.getMap().invert(),t,this.selection)}}},Qe=class{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}},Ex=20;ba=!1,Yh=null;en=new z("history"),Rx=new z("closeHistory");ka=Ns(!1,!0),xa=Ns(!0,!0),zv=Ns(!1,!1),Bv=Ns(!0,!1)});var ep=O(()=>{Zh()});function np(n){let{editor:e,placeholder:t,dataAttribute:r,pos:i,node:s,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=n,u=[a];return o&&u.push(c),Z.node(i,i+s.nodeSize,{class:u.join(" "),[r]:typeof t=="function"?t({editor:e,node:s,pos:i,hasAnchor:l}):t})}function rp(n,e){return typeof n=="function"?n(e):n}function Ix({editor:n,options:e,dataAttribute:t,doc:r,selection:i}){var s,o;if(!(n.isEditable||!e.showOnlyWhenEditable))return null;let{anchor:a}=i,c=[],u=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){let f=r.resolve(a),h=f.depth>0?f.node(1):f.nodeAfter,p=f.depth>0?f.before(1):a;if(h&&h.type.isTextblock&&Cn(h)){let m=a>=p&&a<=p+h.nodeSize;c.push(np({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:m,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:rp(e.emptyNodeClass,{editor:n,node:h,pos:p,hasAnchor:m})},node:h,pos:p}))}}else{let f=Or.getState(n.state),h=(s=f?.topPos)!=null?s:0,p=(o=f?.bottomPos)!=null?o:r.content.size;r.nodesBetween(h,p,(m,g)=>{let y=a>=g&&a<=g+m.nodeSize,k=!m.isLeaf&&Cn(m);return m.type.isTextblock&&(y||!e.showOnlyCurrent)&&k&&c.push(np({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:rp(e.emptyNodeClass,{editor:n,node:m,pos:g,hasAnchor:y})},node:m,pos:g})),e.includeChildren})}return J.create(r,c)}function Dx(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Px(n){let e=getComputedStyle(n),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function Lx(n){let e=n;for(;e;){if(Px(e))return e;let t=e.parentElement;if(!t){let r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=t}return window}function zx(n){return n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect()}function Bx({view:n,scrollContainer:e}){let t=n.dom.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;let r=e?zx(e):{top:0,bottom:window.innerHeight},i=Math.max(t.top,r.top)-tp,s=Math.min(t.bottom,r.bottom)+tp;if(i>=s)return null;let o=t.left+1,l=t.right-1;if(o>l)return null;let c=getComputedStyle(n.dom).direction==="rtl"?t.right-2:t.left+2,u=Math.min(Math.max(c,o),l),d=Math.max(i+2,t.top+1),f=Math.min(s-2,t.bottom-1);if(d>f)return null;let h=n.posAtCoords({left:u,top:d}),p=n.posAtCoords({left:u,top:f});return!h||!p?null:{top:h.pos,bottom:p.pos}}function Hx(n){let e=Lx(n.dom),t=()=>{let c=Bx({view:n,scrollContainer:e});if(c===null)return;let u=Or.getState(n.state);if(u?.topPos===c.top&&u?.bottomPos===c.bottom)return;let d=n.state.tr.setMeta(Or,{positions:c});n.dispatch(d)},r=null,i=0,s=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let c=performance.now();c-i>=s?(i=c,t()):o()}))};e.addEventListener("scroll",o,{passive:!0});let l=typeof ResizeObserver<"u"?new ResizeObserver(o):null;l?.observe(n.dom);let a=typeof IntersectionObserver<"u"?new IntersectionObserver(o):null;return a?.observe(n.dom),n.dom.addEventListener("focus",o),t(),{update(c,u){n.state.doc.content.size!==u.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o),l?.disconnect(),a?.disconnect(),n.dom.removeEventListener("focus",o)}}}function $x({editor:n,options:e}){let t=e.dataAttribute?`data-${Dx(e.dataAttribute)}`:`data-${lp}`;return new I({key:Or,state:Fx,view:Hx,props:{decorations:({doc:r,selection:i})=>Ix({editor:n,options:e,dataAttribute:t,doc:r,selection:i})}})}function ip({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Wv,sp,Gv,op,lp,Or,tp,Fx,iM,_x,aM,Vx,ap,cp,up=O(()=>{R();F();R();Wh();R();F();xn();R();Uh();F();R();F();R();xn();xn();R();F();xn();R();F();R();ep();Wv=L.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{let e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){let r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{let e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new I({key:new z("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;let i=this.options.limit,s=this.options.autoTrim;if(i==null||i===0||s===!1){n=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let l=o-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let u=r.tr.deleteRange(a,c);return n=!0,u}n=!0},filterTransaction:(e,t)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;let i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;let l=e.selection.$head.pos,a=s-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}}),sp=L.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[_h(this.options)]}}),Gv=L.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new I({key:new z("focus"),props:{decorations:({doc:n,selection:e})=>{let{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return J.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Z.node(c,c+a.nodeSize,{class:this.options.className}))}),J.create(n,s)}}})]}}),op=L.create({name:"gapCursor",addProseMirrorPlugins(){return[Jh()]},extendNodeSchema(n){var e;let t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=V(A(n,"allowGapCursor",t)))!=null?e:null}}}),lp="placeholder",Or=new z("tiptap__placeholder"),tp=200;Fx={init(){return{topPos:null,bottomPos:null}},apply(n,e){let t=n.getMeta(Or);return t?.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:n.docChanged?{topPos:e.topPos!==null?n.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?n.mapping.map(e.bottomPos):null}:e}};iM=L.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:lp,placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[$x({editor:this.editor,options:this.options})]}}),_x=`.ProseMirror:not(.ProseMirror-focused) *::selection { + background: transparent; +} + +.ProseMirror:not(.ProseMirror-focused) *::-moz-selection { + background: transparent; +}`,aM=L.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){let{editor:n,options:e}=this;return n.options.injectCSS&&typeof document<"u"&&pl(_x,n.options.injectNonce,"selection"),[new I({key:new z("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||vi(t.selection)||n.view.dragging?null:J.create(t.doc,[Z.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}}),Vx="skipTrailingNode";ap=L.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;let e=new z(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new I({key:e,appendTransaction:(i,s,o)=>{let{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,f=c.nodes[t];if(!i.some(h=>h.getMeta(Vx))&&u)return a.insert(d,f.create())},state:{init:(i,s)=>{let o=s.tr.doc.lastChild;return!ip({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;let o=i.doc.lastChild;return!ip({node:o,types:r})}}})]}}),cp=L.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>ka(n,e),redo:()=>({state:n,dispatch:e})=>xa(n,e)}},addProseMirrorPlugins(){return[Qh(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}})});var dp,fp=O(()=>{R();Vf();jf();Kf();qf();Xf();Qf();eh();nh();ih();xh();Rn();Ph();zh();Fh();$h();up();dp=L.create({name:"starterKit",addExtensions(){var n,e,t,r;let i=[];return this.options.bold!==!1&&i.push(Wf.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(_f.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(sa.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Jf.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Uf.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Gf.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(sp.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(op.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Yf.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Zf.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(cp.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(th.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(rh.configure(this.options.italic)),this.options.listItem!==!1&&i.push(ca.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(da.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(kh.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(fa.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Dh.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Lh.configure(this.options.strike)),this.options.text!==!1&&i.push(Bh.configure(this.options.text)),this.options.underline!==!1&&i.push(Hh.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(ap.configure((r=this.options)==null?void 0:r.trailingNode)),i}})});var Wx,hp,jx,Sa,Jx,Os,Kx,Ux,qx,HM,wa=O(()=>{R();R();R();R();R();R();R();Wx=20,hp=(n,e=0)=>{let t=[];return!n.children.length||e>Wx||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...hp(r,e+1))}),t},jx=n=>{if(!n.children.length)return;let e=hp(n);e&&e.forEach(t=>{var r,i;let s=t.getAttribute("style"),o=(i=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:i.getAttribute("style");t.setAttribute("style",`${o};${s}`)})},Sa=ce.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&jx(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",D(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{let{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),Jx=L.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;let t=(e=Be(n,"background-color"))!=null?e:n.style.backgroundColor;return t?.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Os=L.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;let t=(e=Be(n,"color"))!=null?e:n.style.color;return t?.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Kx=L.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>{var e;return(e=Be(n,"font-family"))!=null?e:n.style.fontFamily},renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ux=L.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>{var e;return(e=Be(n,"font-size"))!=null?e:n.style.fontSize},renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),qx=L.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>{var e;return(e=Be(n,"line-height"))!=null?e:n.style.lineHeight},renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),HM=L.create({name:"textStyleKit",addExtensions(){let n=[];return this.options.backgroundColor!==!1&&n.push(Jx.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(Os.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Kx.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(Ux.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(qx.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(Sa.configure(this.options.textStyle)),n}})});var pp=O(()=>{wa()});var Gx,Xx,mp,gp=O(()=>{R();Gx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Xx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,mp=ce.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||Be(n,"background-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",D(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){let i=/^(==)([^=]+)(==)/.exec(n);if(i){let s=i[2].trim(),o=t.inlineTokens(s);return{type:"highlight",raw:i[0],text:s,tokens:o}}}},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Fe({find:Gx,type:this.type})]},addPasteRules(){return[Ee({find:Xx,type:this.type})]}})});var Yx,yp,bp=O(()=>{R();Yx=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,yp=$.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",D(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,r,i,s,o;let l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(i=(r=n.attrs)==null?void 0:r.alt)!=null?i:"",c=(o=(s=n.attrs)==null?void 0:s.title)!=null?o:"";return c?`![${a}](${l} "${c}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;let{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:s,HTMLAttributes:o,editor:l})=>{let a=document.createElement("img");a.draggable=!1;let c=D(this.options.HTMLAttributes,o);Object.entries(c).forEach(([f,h])=>{if(h!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,h);break}}),c.src!==null&&(a.src=c.src);let u=new sf({element:a,editor:l,node:i,getPos:s,onResize:(f,h)=>{a.style.width=`${f}px`,a.style.height=`${h}px`},onCommit:(f,h)=>{let p=s();p!==void 0&&this.editor.chain().setNodeSelection(p).updateAttributes(this.name,{width:f,height:h}).run()},onUpdate:(f,h,p)=>f.type===i.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Ai({find:Yx,type:this.type,getAttributes:n=>{let[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}})});function Qx(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=Zx(n),t=n.childCount,r=[],i=0,s=null,o=[];for(let c=0,u=e*t;c=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:y-w});break}let C=i+w*e;for(let M=0;Mr&&(s+=c.attrs.colspan)}}for(let o=0;o1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function eS(n,e,t){n.problems||(n.problems=[]);let r={};for(let i=0;i0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function nS(n){for(let e=n.depth;e>0;e--){let t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ve(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function zs(n){let e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let t=nn(e.$head)||rS(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function rS(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Ta(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function iS(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Na(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Ap(n,e,t){let r=n.node(-1),i=X.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function rn(n,e,t=1){let r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Np(n,e,t=1){let r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i{e.push(Z.node(r,r+t.nodeSize,{class:"selectedCell"}))}),J.create(n.doc,e)}function aS({$from:n,$to:e}){if(n.pos==e.pos||n.pos=0&&!(n.after(i+1)=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function cS({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){let s=n.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){let s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function uS(n,e,t){let r=(e||n).selection,i=(e||n).doc,s,o;if(r instanceof E&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=j.create(i,r.from);else if(o=="row"){let l=i.resolve(r.from+1);s=j.rowSelection(l,l)}else if(!t){let l=X.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=j.create(i,a+1,c)}}else r instanceof v&&aS(r)?s=v.create(i,r.from):r instanceof v&&cS(r)&&(s=v.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}function Rp(n,e,t,r){let i=n.childCount,s=e.childCount;e:for(let o=0,l=0;o{i.type.spec.tableRole=="table"&&(t=fS(n,i,s,t))};return e?e.doc!=n.doc&&Rp(e.doc,n.doc,0,r):n.doc.descendants(r),t}function fS(n,e,t,r){let i=X.get(e);if(!i.problems)return r;r||(r=n.tr);let s=[];for(let a=0;a0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let g=0;g0?-1:0;sS(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o0&&i0&&e.map[l-1]==a||i0?-1:0;pS(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c0&&i0&&d==e.map[u-e.width]){let f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i0&&t[s]==t[s-1]||r.right0&&t[i]==t[i-n]||r.bottom0){let u=a+1+c.content.size,d=kp(c)?a+1:u;s.replaceWith(d+r.tableStart,u+r.tableStart,l)}s.setSelection(new j(s.doc.resolve(a+r.tableStart))),e(s)}return!0}function Ia(n,e){let t=ke(n.schema);return yS(({node:r})=>t[r.type.spec.tableRole])(n,e)}function yS(n){return(e,t)=>{let r=e.selection,i,s;if(r instanceof j){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=nS(r.$from),!i)return!1;s=(o=nn(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let u=Ze(e),d=e.tr;for(let h=0;h{o.attrs[n]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function bS(n){return function(e,t){if(!Ve(e))return!1;if(t){let r=ke(e.schema),i=Ze(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a{let h=f+s.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}function kS(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){let s=n.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(n.index()0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Rs(n,e){let t=n.selection;if(!(t instanceof j))return!1;if(e){let r=n.tr,i=ke(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new S(i,0,0))}),r.docChanged&&e(r)}return!0}function xS(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;let i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="row")for(let a=0;a=0;o--){let{rowspan:l,colspan:a}=s.child(o).attrs;for(let c=i;c=e.length&&e.push(b.empty),t[i]r&&(f=f.type.createChecked(rn(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;hi&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}s.push(b.from(a))}t=s,e=i}return{width:n,height:e,rows:t}}function CS(n,e,t,r,i,s,o){let l=n.doc.type.schema,a=ke(l),c,u;if(i>e.width)for(let d=0,f=0;de.height){let d=[];for(let p=0,m=(e.height-1)*e.width;p=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;d.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,b.from(d)),h=[];for(let p=e.height;p{if(!i)return!1;let s=t.selection;if(s instanceof j)return Ps(t,r,N.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;let o=Wp(i,n,e);if(o==null)return!1;if(n=="horiz")return Ps(t,r,N.near(t.doc.resolve(s.head+e),e));{let l=t.doc.resolve(o),a=Ap(l,n,e),c;return a?c=N.near(a,1):e<0?c=N.near(t.doc.resolve(l.before(-1)),-1):c=N.near(t.doc.resolve(l.after(-1)),1),Ps(t,r,c)}}}function Ds(n,e){return(t,r,i)=>{if(!i)return!1;let s=t.selection,o;if(s instanceof j)o=s;else{let a=Wp(i,n,e);if(a==null)return!1;o=new j(t.doc.resolve(a))}let l=Ap(o.$headCell,n,e);return l?Ps(t,r,new j(o.$anchorCell,l)):!1}}function MS(n,e){let t=n.state.doc,r=nn(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new j(r))),!0):!1}function TS(n,e,t){if(!Ve(n.state))return!1;let r=xS(t),i=n.state.selection;if(i instanceof j){r||(r={width:1,height:1,rows:[b.from(Ea(ke(n.state.schema).cell,t))]});let s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=X.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=wS(r,l.right-l.left,l.bottom-l.top),Cp(n.state,n.dispatch,o,l,r),!0}else if(r){let s=zs(n.state),o=s.start(-1);return Cp(n.state,n.dispatch,o,X.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function ES(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=vp(n,e.target),i;if(e.shiftKey&&n.state.selection instanceof j)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=nn(n.state.selection.$anchor))!=null&&((t=Ca(n,e))===null||t===void 0?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(a,c){let u=Ca(n,c),d=Ot.getState(n.state)==null;if(!u||!Na(a,u))if(d)u=a;else return;let f=new j(a,u);if(d||!n.state.selection.eq(f)){let h=n.state.tr.setSelection(f);d&&h.setMeta(Ot,a.pos),n.dispatch(h)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",l),Ot.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Ot,-1))}function l(a){let c=a,u=Ot.getState(n.state),d;if(u!=null)d=n.state.doc.resolve(u);else if(vp(n,c.target)!=r&&(d=Ca(n,e),!d))return o();d&&s(d,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",l)}function Wp(n,e,t){if(!(n.state.selection instanceof v))return null;let{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){let s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){let o=r.before(i),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?o:null}}return null}function vp(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ca(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:r,pos:i}=t;return r>=0&&nn(n.state.doc.resolve(r))||nn(n.state.doc.resolve(i))}function Aa(n,e,t,r,i,s){let o=0,l=!0,a=e.firstChild,c=n.firstChild;if(c){for(let d=0,f=0;dnew r(d,t,f)),new NS(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{let l=Oe.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{OS(o,l,n,i)},mouseleave:o=>{RS(o)},mousedown:(o,l)=>{IS(o,l,e,t)}},decorations:o=>{let l=Oe.getState(o);if(l&&l.activeHandle>-1)return BS(o,l.activeHandle)},nodeViews:{}}});return s}function OS(n,e,t,r){if(!n.editable)return;let i=Oe.getState(n.state);if(i&&!i.dragging){let s=PS(e.target),o=-1;if(s){let{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=t?o=Mp(n,e,"left",t):a-e.clientX<=t&&(o=Mp(n,e,"right",t))}if(o!=i.activeHandle){if(!r&&o!==-1){let l=n.state.doc.resolve(o),a=l.node(-1),c=X.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Jp(n,o)}}}function RS(n){if(!n.editable)return;let e=Oe.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Jp(n,-1)}function IS(n,e,t,r){var i;if(!n.editable)return!1;let s=(i=n.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=Oe.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;let l=n.state.doc.nodeAt(o.activeHandle),a=DS(n,o.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Oe,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);let f=Oe.getState(n.state);f?.dragging&&(LS(n,f.activeHandle,Tp(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Oe,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=Oe.getState(n.state);if(f&&f.dragging){let h=Tp(f.dragging,d,t);Ep(n,f.activeHandle,h,r)}}return Ep(n,o.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function DS(n,e,{colspan:t,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let s=n.domAtPos(e),o=s.node.childNodes[s.offset].offsetWidth,l=t;if(r)for(let a=0;a{lt();nt();ai();di();ot();if(typeof WeakMap<"u"){let n=new WeakMap;va=e=>n.get(e),Ma=(e,t)=>(n.set(e,t),t)}else{let n=[],t=0;va=r=>{for(let i=0;i(t==10&&(t=0),n[t++]=r,n[t++]=i)}X=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;eu!=t.pos-s);a.unshift(t.pos-s);let c=a.map(u=>{let d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);let f=s+u+1;return new fn(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Ta(r)&&Ta(i)&&Na(r,i)){let s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?bt.rowSelection(r,i):s&&this.isColSelection()?bt.colSelection(r,i):new bt(r,i)}return v.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=X.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a0||g>0){let y=p.attrs;if(m>0&&(y=rn(y,0,m)),g>0&&(y=rn(y,y.colspan-g,g)),h.lefti.bottom){let y={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=e.node(-1),i=X.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom0&&(t=a.resolve(s+i.map[l.left])),o.bottom0)return!1;let o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof bt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=e.node(-1),i=X.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return Ta(e.doc.resolve(i))||(i=-1),new Ls(i,t.dragging)}return t}}});var Pa=O(()=>{Up()});function Fs(n){return n==="left"||n==="right"||n==="center"?n:null}function FS(n){let e=(n.style.textAlign||"").trim().toLowerCase(),t=(n.getAttribute("align")||"").trim().toLowerCase();return Fs(e||t)}function HS(n){return Fs(n?.align)}function Xp(){return{default:null,parseHTML:n=>FS(n),renderHTML:n=>n.align?{style:`text-align: ${n.align}`}:{}}}function La(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function qp(n,e,t,r,i,s){var o;let l=0,a=!0,c=e.firstChild,u=n.firstChild;if(u!==null)for(let f=0,h=0;f{let r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function WS(n,e,t,r,i){let s=VS(n),o=[],l=[];for(let c=0;c{let g=[];m.content&&m.content.forEach(y=>{let k="";y.content&&Array.isArray(y.content)&&y.content.length>1?k=y.content.map(T=>e.renderChildren(T)).join(i):k=y.content?e.renderChildren(y.content):"";let w=KS(k),C=y.type==="tableHeader",M=HS(y.attrs);g.push({text:w,isHeader:C,align:M})}),s.push(g)});let o=s.reduce((m,g)=>Math.max(m,g.length),0);if(o===0)return"";let l=Array.from({length:o}).fill(0);s.forEach(m=>{var g;for(let y=0;yl[y]&&(l[y]=w),l[y]<3&&(l[y]=3)}});let a=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),c=s[0],u=c.some(m=>m.isHeader),d=Array.from({length:o}).fill(null);s.forEach(m=>{var g;for(let y=0;yu&&c[g]&&c[g].text||"");return f+=`| ${h.map((m,g)=>a(m,l[g])).join(" | ")} | +`,f+=`| ${l.map((m,g)=>{let y=Math.max(3,m),k=d[g];return k==="left"?`:${"-".repeat(y)}`:k==="right"?`${"-".repeat(y)}:`:k==="center"?`:${"-".repeat(y)}:`:"-".repeat(y)}).join(" | ")} | +`,(u?s.slice(1):s).forEach(m=>{f+=`| ${Array.from({length:o}).fill(0).map((g,y)=>a(m[y]&&m[y].text||"",l[y])).join(" | ")} | +`}),f}var Rr,Ir,Dr,$S,Bs,JS,qS,za,pT,Rt=O(()=>{R();R();R();R();R();F();Pa();R();Pa();Rr=$.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;let r=n.getAttribute("colwidth"),i=r?r.split(",").map(s=>parseInt(s,10)):null;if(!i){let s=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(o&&o>-1&&s&&s[o]){let l=s[o].getAttribute("width");return l?[parseInt(l,10)]:null}}return i}},align:Xp()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",D(this.options.HTMLAttributes,n),0]}}),Ir=$.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{let e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}},align:Xp()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",D(this.options.HTMLAttributes,n),0]}}),Dr=$.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",D(this.options.HTMLAttributes,n),0]}});$S=class{constructor(n,e,t,r={}){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(let[i,s]of Object.entries(r))s!=null&&(i==="style"?this.table.style.cssText=String(s):this.table.setAttribute(i,String(s)));n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),qp(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,qp(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){let e=n.target,t=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(t&&!r&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};Bs=({editor:n})=>{let{selection:e}=n.state;if(!jS(e))return!1;let t=0,r=cl(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},JS="";qS=US,za=$.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:$S,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let{colgroup:t,tableWidth:r,tableMinWidth:i}=_S(n,this.options.cellMinWidth),s=e.style;function o(){return s||(r?`width: ${r}`:`min-width: ${i}`)}let l=["table",D(this.options.HTMLAttributes,e,{style:o()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{let t=[],r=Array.isArray(n.align)?n.align:[];if(n.header){let i=[];n.header.forEach((s,o)=>{var l;let a=Fs((l=r[o])!=null?l:s.align),c=a?{align:a}:{};i.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),t.push(e.createNode("tableRow",{},i))}return n.rows&&n.rows.forEach(i=>{let s=[];i.forEach((o,l)=>{var a;let c=Fs((a=r[l])!=null?a:o.align),u=c?{align:c}:{};s.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),t.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>qS(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:s})=>{let o=WS(s.schema,n,e,t);if(i){let l=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(v.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>Dp(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>Pp(n,e),deleteColumn:()=>({state:n,dispatch:e})=>Lp(n,e),addRowBefore:()=>({state:n,dispatch:e})=>Bp(n,e),addRowAfter:()=>({state:n,dispatch:e})=>Fp(n,e),deleteRow:()=>({state:n,dispatch:e})=>Hp(n,e),deleteTable:()=>({state:n,dispatch:e})=>Vp(n,e),mergeCells:()=>({state:n,dispatch:e})=>Ra(n,e),splitCell:()=>({state:n,dispatch:e})=>Ia(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>In("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>In("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>_p(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Ra(n,e)?!0:Ia(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>$p(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Da(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Da(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Oa(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){let r=j.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Bs,"Mod-Backspace":Bs,Delete:Bs,"Mod-Delete":Bs}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[jp({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Kp({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let n=this.options.resizable&&this.editor.isEditable,e=this.options.View;return n||!e?null:({node:t,view:r,HTMLAttributes:i})=>{let s=D(this.options.HTMLAttributes,i);return new e(t,this.options.cellMinWidth,r,s)}},extendNodeSchema(n){let e={name:n.name,options:n.options,storage:n.storage};return{tableRole:V(A(n,"tableRole",e))}}}),pT=L.create({name:"tableKit",addExtensions(){let n=[];return this.options.table!==!1&&n.push(za.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Rr.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(Ir.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Dr.configure(this.options.tableRow)),n}})});var Yp=O(()=>{Rt();Rt()});var Qp=O(()=>{Rt();Rt()});var Zp=O(()=>{Rt();Rt()});var em=O(()=>{Rn();Rn()});var tm=O(()=>{Rn();Rn()});var GS=nm(()=>{R();fp();pp();gp();wa();bp();Rt();Yp();Qp();Zp();em();tm();window.tiptap={Editor:rf,StarterKit:dp,Color:Os,Highlight:mp,TextStyle:Sa,Image:yp,Table:za,TableRow:Dr,TableCell:Rr,TableHeader:Ir,TaskList:Nr,TaskItem:Ar}});return GS();})(); diff --git a/frontend/static/js/vendor/tiptap-core.umd.min.js b/frontend/static/js/vendor/tiptap-core.umd.min.js new file mode 100644 index 0000000..36acfc0 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-core.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-core.umd.min.js in @tiptap/core. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-entry.js b/frontend/static/js/vendor/tiptap-entry.js new file mode 100644 index 0000000..26402f0 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-entry.js @@ -0,0 +1,29 @@ +// Tiptap 打包入口 - 将所有需要的模块挂载到全局 window.tiptap +import { Editor } from "@tiptap/core"; +import { StarterKit } from "@tiptap/starter-kit"; +import { Color } from "@tiptap/extension-color"; +import { Highlight } from "@tiptap/extension-highlight"; +import { TextStyle } from "@tiptap/extension-text-style"; +import { Image } from "@tiptap/extension-image"; +import { Table } from "@tiptap/extension-table"; +import { TableRow } from "@tiptap/extension-table-row"; +import { TableCell } from "@tiptap/extension-table-cell"; +import { TableHeader } from "@tiptap/extension-table-header"; +import { TaskList } from "@tiptap/extension-task-list"; +import { TaskItem } from "@tiptap/extension-task-item"; + +// 挂载到全局,保持和 UMD 版本一样的 API +window.tiptap = { + Editor, + StarterKit, + Color, + Highlight, + TextStyle, + Image, + Table, + TableRow, + TableCell, + TableHeader, + TaskList, + TaskItem, +}; diff --git a/frontend/static/js/vendor/tiptap-extension-code-block-lowlight.umd.min.js b/frontend/static/js/vendor/tiptap-extension-code-block-lowlight.umd.min.js new file mode 100644 index 0000000..b9092e5 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-code-block-lowlight.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-code-block-lowlight.umd.min.js in @tiptap/extension-code-block-lowlight. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-color.umd.min.js b/frontend/static/js/vendor/tiptap-extension-color.umd.min.js new file mode 100644 index 0000000..1d3cf9a --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-color.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-color.umd.min.js in @tiptap/extension-color. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-highlight.umd.min.js b/frontend/static/js/vendor/tiptap-extension-highlight.umd.min.js new file mode 100644 index 0000000..570d184 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-highlight.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-highlight.umd.min.js in @tiptap/extension-highlight. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-image.umd.min.js b/frontend/static/js/vendor/tiptap-extension-image.umd.min.js new file mode 100644 index 0000000..e752390 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-image.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-image.umd.min.js in @tiptap/extension-image. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-table-cell.umd.min.js b/frontend/static/js/vendor/tiptap-extension-table-cell.umd.min.js new file mode 100644 index 0000000..a610bdd --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-table-cell.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-table-cell.umd.min.js in @tiptap/extension-table-cell. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-table-header.umd.min.js b/frontend/static/js/vendor/tiptap-extension-table-header.umd.min.js new file mode 100644 index 0000000..d1d8d94 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-table-header.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-table-header.umd.min.js in @tiptap/extension-table-header. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-table-row.umd.min.js b/frontend/static/js/vendor/tiptap-extension-table-row.umd.min.js new file mode 100644 index 0000000..a6541fc --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-table-row.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-table-row.umd.min.js in @tiptap/extension-table-row. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-table.umd.min.js b/frontend/static/js/vendor/tiptap-extension-table.umd.min.js new file mode 100644 index 0000000..73560ba --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-table.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-table.umd.min.js in @tiptap/extension-table. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-task-item.umd.min.js b/frontend/static/js/vendor/tiptap-extension-task-item.umd.min.js new file mode 100644 index 0000000..17b9882 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-task-item.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-task-item.umd.min.js in @tiptap/extension-task-item. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-task-list.umd.min.js b/frontend/static/js/vendor/tiptap-extension-task-list.umd.min.js new file mode 100644 index 0000000..405f3d0 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-task-list.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-task-list.umd.min.js in @tiptap/extension-task-list. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-extension-text-style.umd.min.js b/frontend/static/js/vendor/tiptap-extension-text-style.umd.min.js new file mode 100644 index 0000000..7315fa4 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-extension-text-style.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-extension-text-style.umd.min.js in @tiptap/extension-text-style. \ No newline at end of file diff --git a/frontend/static/js/vendor/tiptap-starter-kit.umd.min.js b/frontend/static/js/vendor/tiptap-starter-kit.umd.min.js new file mode 100644 index 0000000..c1a1b38 --- /dev/null +++ b/frontend/static/js/vendor/tiptap-starter-kit.umd.min.js @@ -0,0 +1 @@ +Couldn't find the requested file /dist/tiptap-starter-kit.umd.min.js in @tiptap/starter-kit. \ No newline at end of file diff --git a/frontend/static/js/websites.js b/frontend/static/js/websites.js new file mode 100644 index 0000000..135b1d1 --- /dev/null +++ b/frontend/static/js/websites.js @@ -0,0 +1,249 @@ +/** + * 网站管理页面交互逻辑 + */ +var currentSiteId = null; +var parsedImportData = null; + +// ===== 网站选择 ===== +function selectWebsite(siteId, el) { + currentSiteId = siteId; + document.querySelector("#currentSiteId").value = siteId; + document.querySelectorAll(".site-item").forEach(function(s) { s.classList.remove("active"); }); + if (el) el.classList.add("active"); + fetch("/api/websites/" + siteId).then(function(r) { return r.json(); }).then(renderSiteDetail); +} + +function renderSiteDetail(site) { + var fName = getFolderName(site.folder_id); + document.querySelector("#siteHeaderInfo").innerHTML = + '' + fName + ' / ' + + '' + site.name + '' + + '' + site.url + ''; + document.querySelector("#editSiteBtn").classList.remove("hidden"); + document.querySelector("#addAccountBtn").classList.remove("hidden"); + + var cards = document.querySelector("#accountCards"); + var accounts = site.accounts || []; + if (!accounts.length) { + cards.innerHTML = '

暂无账号

'; + return; + } + cards.innerHTML = accounts.map(function(a) { + return '
' + + '
' + + '👤 ' + (a.remark || '账号') + '' + + '
' + + '' + + '' + + '
' + + '
' + + '
' + + '账号' + esc(a.username) + '' + + '' + + '密码••••••••' + + '
' + + '' + + '' + + '
' + + '说明' + (a.remark || '-') + '' + + '
'; + }).join(""); +} + +function esc(s) { return (s||"").replace(/'/g,"\\'"); } + +function togglePassword(id) { + var el = document.querySelector("#pw-" + id); + if (!el) return; + el.textContent = el.textContent === "••••••••" ? el.dataset.pw : "••••••••"; +} + +function copyText(t) { + navigator.clipboard.writeText(t).then(function() { + var toast = document.createElement("div"); + toast.className = "toast"; + toast.textContent = "已复制"; + document.body.appendChild(toast); + setTimeout(function() { toast.remove(); }, 1500); + }); +} + +function getFolderName(fid) { + if (!fid) return "未分类"; + var el = document.querySelector('.folder-group[data-folder-id="' + fid + '"] .folder-item span:nth-child(2)'); + return el ? el.textContent.replace(/📁\s*/, "").trim() : "未分类"; +} + +// ===== 文件夹 ===== +function toggleFolder(el) { + var ch = el.parentElement.querySelector(".folder-children"); + var arrow = el.querySelector(".folder-arrow"); + if (!ch) return; + if (ch.style.display === "none") { ch.style.display = "block"; arrow.textContent = "▼"; } + else { ch.style.display = "none"; arrow.textContent = "▶"; } +} + +function toggleFolderMenu(btn) { + document.querySelectorAll(".folder-menu").forEach(function(m) { if (m !== btn.nextElementSibling) m.classList.add("hidden"); }); + var menu = btn.nextElementSibling; + if (menu) menu.classList.toggle("hidden"); + setTimeout(function() { + document.addEventListener("click", function c() { if (menu) menu.classList.add("hidden"); document.removeEventListener("click", c); }, { once: true }); + }, 0); +} + +function renameFolder(id) { var n = prompt("新名称:"); if (n) fetch("/api/folders/" + id, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: n }) }).then(function() { window.location.reload(); }); } +function deleteFolder(id) { if (confirm("确定删除?内容将移至「未分类」")) fetch("/api/folders/" + id, { method: "DELETE" }).then(function() { window.location.reload(); }); } +function showAddFolder() { var n = prompt("文件夹名:"); if (n) fetch("/api/folders", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: n, type: "website" }) }).then(function() { window.location.reload(); }); } + +// ===== 智能导入 ===== +function showImportModal() { + document.querySelector("#importModal").classList.remove("hidden"); + document.querySelector("#parseResult").classList.add("hidden"); + document.querySelector("#importText").value = ""; + document.querySelector("#importNewFolder").value = ""; +} +function hideImportModal() { document.querySelector("#importModal").classList.add("hidden"); } + +function parseImport() { + var text = document.querySelector("#importText").value.trim(); + if (!text) return alert("请先粘贴文本"); + fetch("/api/import/parse", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ text: text }) }) + .then(function(r) { return r.json(); }) + .then(function(d) { + if (!d.ok) return alert(d.error); + parsedImportData = d; + document.querySelector("#parseResult").classList.remove("hidden"); + document.querySelector("#parseGrid").innerHTML = + '网址' + d.url + '' + + '网站名' + d.site_name + '' + + '账号' + d.username + '' + + '密码' + d.password + '' + + '备注' + (d.remark || '(无)') + ''; + var alert = document.querySelector("#duplicateAlert"); + if (d.action === "append") { + alert.classList.remove("hidden"); + alert.innerHTML = '⚠️ ' + d.matched_site.name + ' 已存在(' + d.matched_site.account_count + '个账号),将追加进去'; + if (d.matched_site.folder_id) document.querySelector("#importFolderSelect").value = d.matched_site.folder_id; + } else { alert.classList.add("hidden"); } + }); +} + +function confirmImport() { + if (!parsedImportData) return; + var d = parsedImportData; + var fid = document.querySelector("#importFolderSelect").value || null; + var nf = document.querySelector("#importNewFolder").value.trim(); + if (nf) { + fetch("/api/folders", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: nf, type: "website" }) }) + .then(function(r) { return r.json(); }).then(function(f) { doImport(d, f.id); }); + } else { doImport(d, fid); } +} + +function doImport(d, fid) { + fetch("/api/websites").then(function(r) { return r.json(); }).then(function(sites) { + var s = sites.find(function(x) { return x.url === d.url; }); + if (s) { addAccountToSite(s.id, d); } + else { + fetch("/api/websites", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: d.site_name, url: d.url, folder_id: fid }) }) + .then(function(r) { return r.json(); }).then(function(ns) { addAccountToSite(ns.id, d); }); + } + }); +} + +function addAccountToSite(sid, d) { + fetch("/api/websites/" + sid + "/accounts", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ username: d.username, password: d.password, remark: d.remark }) }) + .then(function() { hideImportModal(); window.location.reload(); }); +} + +// ===== 网站弹窗 ===== +function showAddWebsite() { + document.querySelector("#websiteModalTitle").textContent = "添加网站"; + document.querySelector("#websiteName").value = ""; + document.querySelector("#websiteUrl").value = ""; + document.querySelector("#websiteFolder").value = ""; + document.querySelector("#editWebsiteId").value = ""; + document.querySelector("#websiteModal").classList.remove("hidden"); +} +function hideWebsiteModal() { document.querySelector("#websiteModal").classList.add("hidden"); } + +function editWebsite() { + if (!currentSiteId) return; + document.querySelector("#websiteModalTitle").textContent = "编辑网站"; + document.querySelector("#editWebsiteId").value = currentSiteId; + fetch("/api/websites/" + currentSiteId).then(function(r) { return r.json(); }).then(function(s) { + document.querySelector("#websiteName").value = s.name; + document.querySelector("#websiteUrl").value = s.url; + document.querySelector("#websiteFolder").value = s.folder_id || ""; + document.querySelector("#websiteModal").classList.remove("hidden"); + }); +} + +function saveWebsite() { + var id = document.querySelector("#editWebsiteId").value; + var data = { name: document.querySelector("#websiteName").value, url: document.querySelector("#websiteUrl").value, folder_id: document.querySelector("#websiteFolder").value || null }; + fetch(id ? "/api/websites/" + id : "/api/websites", { method: id ? "PUT" : "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data) }) + .then(function() { hideWebsiteModal(); window.location.reload(); }); +} + +// ===== 账号弹窗 ===== +function showAddAccount() { + if (!currentSiteId) return alert("请先选择网站"); + document.querySelector("#accountModalTitle").textContent = "添加账号"; + document.querySelector("#accountUsername").value = ""; + document.querySelector("#accountPassword").value = ""; + document.querySelector("#accountRemark").value = ""; + document.querySelector("#editAccountId").value = ""; + document.querySelector("#accountPassword").type = "password"; + document.querySelector("#accountModal").classList.remove("hidden"); +} + +function hideAccountModal() { document.querySelector("#accountModal").classList.add("hidden"); } + +function editAccount(accId) { + document.querySelector("#accountModalTitle").textContent = "编辑账号"; + document.querySelector("#editAccountId").value = accId; + document.querySelector("#accountPassword").type = "password"; + fetch("/api/accounts/" + accId).then(function(r) { return r.json(); }).then(function(a) { + document.querySelector("#accountUsername").value = a.username || ""; + document.querySelector("#accountPassword").value = a.password || ""; + document.querySelector("#accountRemark").value = a.remark || ""; + document.querySelector("#accountModal").classList.remove("hidden"); + }); +} + +function togglePwVisibility() { + var pw = document.querySelector("#accountPassword"); + var btn = pw.parentElement.querySelector("button"); + if (pw.type === "password") { pw.type = "text"; btn.textContent = "隐藏"; } + else { pw.type = "password"; btn.textContent = "显示"; } +} + +function saveAccount() { + var sid = document.querySelector("#currentSiteId").value; + var aid = document.querySelector("#editAccountId").value; + var data = { username: document.querySelector("#accountUsername").value, password: document.querySelector("#accountPassword").value, remark: document.querySelector("#accountRemark").value }; + if (aid) { + fetch("/api/accounts/" + aid, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data) }) + .then(function() { hideAccountModal(); selectWebsite(sid); }); + } else { + fetch("/api/websites/" + sid + "/accounts", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data) }) + .then(function() { hideAccountModal(); selectWebsite(sid); }); + } +} + +function deleteAccount(accId) { + if (!confirm("确定删除?")) return; + fetch("/api/accounts/" + accId, { method: "DELETE" }).then(function() { selectWebsite(currentSiteId); }); +} + +// ===== 搜索 ===== +function filterSites() { + var q = document.querySelector("#siteSearch").value.toLowerCase().trim(); + document.querySelectorAll(".site-item").forEach(function(item) { + if (!q) { item.style.display = "flex"; return; } + var name = (item.querySelector(".site-name")?.textContent || "").toLowerCase(); + var url = (item.dataset.siteUrl || "").toLowerCase(); + item.style.display = (name.indexOf(q) !== -1 || url.indexOf(q) !== -1) ? "flex" : "none"; + }); +} diff --git a/frontend/vite.config.js b/frontend/vite.config.js new file mode 100644 index 0000000..128cb6f --- /dev/null +++ b/frontend/vite.config.js @@ -0,0 +1,19 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import { resolve } from 'path' + +export default defineConfig({ + plugins: [vue()], + root: '.', + base: '/', + build: { + outDir: 'static/dist', + emptyOutDir: true, + rollupOptions: { + input: resolve(__dirname, 'index.html'), + }, + }, + server: { + port: 5173, + }, +}) diff --git a/memory/.session-last b/memory/.session-last new file mode 100644 index 0000000..f49f951 --- /dev/null +++ b/memory/.session-last @@ -0,0 +1 @@ +{"projectPath": "E:\\AI\\claude\\new\\mokeeText", "endedAt": "2026-06-28T05:40:00+08:00", "sessionId": "session-20260628-4"} \ No newline at end of file diff --git a/memory/MEMORY.md b/memory/MEMORY.md new file mode 100644 index 0000000..bbf4be9 --- /dev/null +++ b/memory/MEMORY.md @@ -0,0 +1,4 @@ +- [2026-06-23 第1次会话](session-20260623-1.md) — MoKeeText 项目从零搭建到 Docker 部署 +- [2026-06-23 第2次会话](session-20260623-2.md) — 审查 Mokee Gateway 接入文档 + 编写完整接入方案 +- [2026-06-24 第3次会话](session-20260624-3.md) — 修复 UserChip Widget 集成问题,对齐 control-web 成功模式 +- [2026-06-28 第4次会话](session-20260628-4.md) — 添加「切换系统」按钮到顶栏,部署生产环境 diff --git a/memory/session-20260623-1.md b/memory/session-20260623-1.md new file mode 100644 index 0000000..97c77ce --- /dev/null +++ b/memory/session-20260623-1.md @@ -0,0 +1,104 @@ +--- +name: session-20260623-1 +description: 2026-06-23 第1次会话 — MoKeeText 项目从零搭建到 Docker 部署 +metadata: + type: session + date: 2026-06-23 + sessionNumber: 1 + startTime: 2026-06-23T14:00:00+08:00 +--- + +# 2026-06-23 第1次会话 + +## 会话摘要 +从零搭建 Web 记事本 MoKeeText,包含笔记编辑器(Tiptap 增强型)、网站账号密码管理、智能导入。技术栈:FastAPI + Vue 3 + Vite + MySQL。已部署到生产服务器 Docker。 + +## 关键决策 + +### 技术选型 +- **做了什么**: 选择 FastAPI + Vue3 + MySQL,放弃纯 Jinja2 模板方案 +- **原因**: Vue 组件化更适合复杂交互,FastAPI 轻量够用 +- **结果**: 前后端分离,前端 Vite 构建静态文件,后端纯 API + +### 编辑器选型 +- **做了什么**: 使用 Tiptap 增强型编辑器 +- **原因**: 支持文字颜色、图片粘贴上传、表格、表情,飞书级别体验 +- **结果**: Tiptap 通过 esbuild 打包成本地文件(~460KB),无需 CDN + +### 图片存储 +- **做了什么**: 图片存入 MySQL `uploads` 表的 LONGBLOB 字段,不存文件系统 +- **原因**: 部署简单,备份只要导出数据库 +- **结果**: 上传 API 返回 `/api/file/{id}`,支持 20MB 以内的图片 + +### 部署架构 +- **做了什么**: Docker Compose 部署,前端 Nginx :3006,后端 FastAPI :4006 +- **原因**: 生产环境标准化 +- **结果**: 前端不代理 API,Vue 直接跨域请求后端 `https://mokeetext.server.zgitm.com` + +## 代码结构 +``` +mokeeText/ +├── app.py # FastAPI 入口 + CORS +├── models.py # 6个模型:Folder/Note/Tag/Website/Account/Upload +├── routes/ +│ ├── notes.py # 笔记 CRUD + 分享 + 移动 +│ ├── websites.py # 网站/账号/文件夹 CRUD + 排序 +│ ├── import_api.py # 智能导入解析 +│ ├── upload.py # 图片上传/读取(存DB) +│ └── share.py # 分享公开查看页 +├── src/ # Vue 3 源码 +│ ├── App.vue # 左导航 + 顶栏 + 底栏 +│ ├── views/ +│ │ ├── NotesView.vue # 笔记文档列表 + 编辑器 +│ │ ├── WebsitesView.vue # 网站管理 + 弹窗 +│ │ └── SharesView.vue # 分享管理 +│ └── components/ +│ ├── NoteEditor.vue # Tiptap 编辑器(图片粘贴/拖拽/预览) +│ ├── Modal.vue # 通用弹窗 +│ ├── ConfirmModal.vue # 确认弹窗 +│ └── PromptModal.vue # 输入弹窗 +├── static/dist/ # Vue 构建产物 +├── nginx.conf # 前端 Nginx 配置(纯静态,无代理) +├── Dockerfile # 后端镜像 +├── Dockerfile.frontend # 前端镜像 +└── docker-compose.yml # 编排 +``` + +## 数据库(MySQL 10.20.1.122:3306/mokeetext) +- 用户:mokeetext / mokee. +- 所有表均有 `created_by` / `updated_by` 字段(默认 admin) +- `notes.share_token` + `share_expires_at` 支持分享链接有效期 +- `accounts.sort_order` 支持账号排序 + +## 生产环境 +- 服务器:101.132.183.138 root/mokee2016. +- 项目目录:/data/mokee/mokeetext +- 前端:https://mokeetext.zgitm.com (:3006) +- 后端:https://mokeetext.server.zgitm.com (:4006) +- 日志:/data/mokee/mokeetext/logs(按天轮转,保留30天) +- ICP备案:湘ICP备19021539号 + +## UI 特性 +- 左侧可收起导航(展开"mokee编辑器",收起"M") +- 笔记页文件夹侧边栏可收起 +- 分享链接支持 7天/30天/1年/永久 四种有效期 +- 图片点击全屏预览(带关闭按钮) +- Ctrl+S 保存,toast 提示 +- 弹窗全部 Vue 组件(非浏览器 alert/confirm) +- 移动端响应式适配(768px 断点) + +## 最新改动(UI 优化) +- 文件夹用圆点替代 emoji,胶囊数量标签 +- 左侧导航选中项蓝色左边框指示器 +- "mokee编辑器"品牌名(收起显示 M) +- 文件夹侧边栏可收起 +- 分享页卡片宽度 1100px,超宽滚动 +- 图片上传存 DB + 粘贴/拖拽自动上传 + 点击预览带关闭按钮 +- 前端不代理,直接跨域调后端 +- 后端 CORS 已开 +- 全站响应式(768px 断点) + +## 待处理 +- [ ] favicon.ico 前端图标 +- [ ] mokeetext.server.zgitm.com 反向代理配置(运维处理) +- [ ] 后续可加用户登录/权限系统 diff --git a/memory/session-20260623-2.md b/memory/session-20260623-2.md new file mode 100644 index 0000000..61d2c1d --- /dev/null +++ b/memory/session-20260623-2.md @@ -0,0 +1,89 @@ +--- +name: session-20260623-2 +description: 2026-06-23~24 第2次会话 — 审查接入文档 + 编写方案 + 完成代码改造 + 部署到生产服务器 +metadata: + type: session + date: 2026-06-23 + sessionNumber: 2 + startTime: 2026-06-23T16:00:00+08:00 +--- + +# 2026-06-23 第2次会话 + +## 会话摘要 +审查 MoKeeText 接入 Mokee Gateway 统一登录网关的完整文档,发现 8 个问题(3 重大 + 5 中等),编写了完整的接入实施方案。 + +## 关键操作 + +### 接入文档审查 +- **做了什么**: 逐节审查网关接入文档,对比当前 MoKeeText 项目实际情况 +- **发现的问题**: + 1. 🔴 后端中间件:文档给的是 Flask,项目是 FastAPI + 2. 🔴 所有 API 缺少用户数据隔离(当前 created_by 硬编码 admin) + 3. 🔴 前端源码结构分析(Vue 3 + Vite + fetch,非 axios) + 4. 🟡 CORS `allow_origins=["*"]` 与 `allow_credentials=True` 冲突 + 5. 🟡 图片存储是否迁移到文件服务(当前存 MySQL LONGBLOB) + 6. 🟡 本地开发无网关环境如何调试 + 7. 🟡 现有 admin 数据迁移策略 + 8. 🟡 前端 API 请求路径变化(直连后端 → 网关) +- **结果**: 用户澄清了关键问题 — 前端源码在当前目录、不修改当前项目结构(作为基线)、现有数据归属 admin、网关有 admin 用户 + +### 接入方案编写 +- **做了什么**: 编写完整 12 个 Task 的接入实施方案,保存到 `docs/superpowers/plans/2026-06-23-mokeetext-gateway-integration.md` +- **方案覆盖**: + - Task 0: 网关数据库初始化(菜单/角色/管理员 SQL) + - Task 1-2: 后端 FastAPI 中间件 + CORS 改造 + - Task 3: 5 个路由文件用户数据隔离改造 + - Task 4-9: 前端 env/axios/路由守卫/UserChip/v-permission + - Task 10: 按钮权限控制 + - Task 11-12: 部署更新 +- **关键设计决策**: + - 本地开发走 `localhost` 直连后端 + `X-Dev-Mock-User` 头模拟用户 + - 生产环境走网关,axios 拦截器自动携带 Token + X-System-Code + - 图片读取 API 不鉴权(笔记中 img 标签无法带 Authorization) + - 前端保留 fetch(dev 模式)+ axios(生产模式)双通道 +- **结果**: 方案已通过 writing-plans 自检(spec coverage ✓, placeholder scan ✓, type consistency ✓) + +## 重要信息 +- 系统编码: `mokeetext-edit` +- 网关地址: `gw.server.zgitm.com` +- 登录地址: `login.user.zgitm.com` +- UserChip CDN: `web.gw.zgitm.com/widgets/user-chip.css|js` +- 文件服务: `file.wg.zgitm.com`(可选,当前项目不用) +- 网关管理员账号: `admin_mokeetext-edit` / `admin123` BCrypt + +## 已完成的代码改动 + +### 后端(Task 1-3) +- ✅ `middleware/__init__.py` + `middleware/user_context.py` — UserContext 辅助类 + FastAPI 中间件 +- ✅ `app.py` — CORS 更新(3 个域名 + localhost) + 注册 UserContextMiddleware +- ✅ `routes/notes.py` — 所有接口加 created_by 过滤 + request 参数 +- ✅ `routes/websites.py` — 同上(网站/账号/文件夹) +- ✅ `routes/import_api.py` — 同上 +- ✅ `routes/upload.py` — 上传记录 created_by,读取保持公开 +- ✅ `routes/share.py` — 保持原样(公开访问不走网关) + +### 前端(Task 4-6) +- ✅ `.env` / `.env.production` — 环境变量 +- ✅ `src/utils/request.js` — Axios 实例 + 拦截器 +- ✅ `src/composables/useApi.js` — 双模式:dev (fetch+mock) / production (axios+gateway) +- ✅ `src/router.js` — 路由守卫(无 Token → 登录页,localhost 豁免) +- ✅ `src/directives/permission.js` — v-permission 指令 +- ✅ `src/main.js` — 注册 permission + 动态加载 UserChip Widget +- ✅ `src/App.vue` — UserChip 占位 + 本地 mock 头像 +- ✅ `index.html` — UserChip CSS +- ✅ `src/components/NoteEditor.vue` — 双地址:GW_BASE(上传)+ FILE_BASE(读取) +- ✅ `package.json` — 添加 dev/build scripts,安装 axios +- ✅ 构建成功:`static/dist/` 已生成 + +## 设计决策确认 +- X-User-Id = `"admin"` 格式 → 历史数据无需迁移 +- 分享页`/share/{token}`走后端直连(公开),`/api/file/{id}`也走后端直连(公开) +- 图片上传走网关(鉴权),读取走后端直连(标签 + 分享页兼容) +- 网关 Authorization 头为空时从 Cookie 取 Token +- 当前项目代码结构保持不变(不重构) + +## 待处理 +- [ ] Task 0: 网关数据库初始化 SQL(需要网关 DB 访问权限) +- [ ] Task 11-12: 生产环境部署(需要 SSH 到服务器) +- [ ] 对接测试清单逐项验证 diff --git a/memory/session-20260624-3.md b/memory/session-20260624-3.md new file mode 100644 index 0000000..7cde08b --- /dev/null +++ b/memory/session-20260624-3.md @@ -0,0 +1,46 @@ +--- +name: session-20260624-3 +description: 2026-06-24 第3次会话 — 修复 UserChip Widget 集成问题,对齐 control-web 成功模式 +metadata: + type: session + date: 2026-06-24 + sessionNumber: 3 + startTime: 2026-06-24T03:35:00+08:00 +--- + +# 2026-06-24 第3次会话 + +## 会话摘要 +用户反馈登录后页面右上角 UserChip Widget 不显示。通过对比正常工作的 control-web 项目,发现 3 个差异,逐一修复后重新构建部署。 + +## 关键操作 + +### UserChip Widget 问题诊断 +- **做了什么**: 对比 `E:\AI\claude\new\deployServer\control-web`(正常)和当前 mokeeText(异常)的 Widget 接入代码 +- **发现的差异**: + 1. 🔴 `main.js` 中 `window.process = { env: {} }` 和 widget 加载被 `if (hostname !== 'localhost')` 包裹,control-web 是无条件执行 + 2. 🔴 `App.vue` 中 `#mokee-user-chip` 使用自闭合 `
`,control-web 是正常闭合 `
` + 3. 🟡 `App.vue` 使用 `v-if/v-else` 条件渲染 widget 占位 div,control-web 始终渲染 + 4. 🟡 `router.js` 登录重定向缺少 `redirect` 参数 +- **结果**: 全部对齐到 control-web 的成功模式 + +### 代码修改(3 个文件) +- ✅ `src/main.js` — 移除条件判断,无条件执行 polyfill + widget 加载 +- ✅ `src/App.vue` — 正常闭合标签 + 始终渲染 widget 占位 + 移除 mock 头像 +- ✅ `src/router.js` — 添加 `WEBSITE_URL` + `redirect` 参数到登录跳转 + +### 构建部署 +- ✅ `npx vite build` — 构建成功,生成 `index-D7pnBl5K.js` + `index-CH4J61s9.css` +- ✅ SFTP 上传到 101.132.183.138 `/data/mokee/mokeetext/static/dist/` +- ✅ `docker compose up -d --build frontend` — 重建并重启前端容器 +- ✅ 验证:容器运行正常,nginx 返回新 index.html,JS 包含正确代码 + +## 重要信息 +- control-web 参考项目路径: `E:\AI\claude\new\deployServer\control-web` +- control-web 使用 `createWebHashHistory`,mokeeText 使用 `createWebHistory`(保持不变) +- 生产服务器: 101.132.183.138 root/mokee2016. +- 生产地址: https://mokeetext.zgitm.com + +## 待处理 +- [ ] 用户验证线上 Widget 是否正常显示 +- [ ] 如有问题查看浏览器控制台错误 diff --git a/memory/session-20260628-4.md b/memory/session-20260628-4.md new file mode 100644 index 0000000..91d34ec --- /dev/null +++ b/memory/session-20260628-4.md @@ -0,0 +1,96 @@ +--- +name: session-20260628-4 +description: 2026-06-28 第4次会话 — 切换系统按钮 + 目录整理 + 项目/部署文档 + 文件服务接入与回退 +metadata: + type: session + date: 2026-06-28 + sessionNumber: 4 + startTime: 2026-06-28T04:45:00+08:00 +--- + +# 2026-06-28 第4次会话 + +## 会话摘要 +1. 顶栏添加「切换系统」按钮 → `https://web.gw.zgitm.com/select` +2. 项目目录彻底整理:backend/ frontend/ deploy/ 三目录分离 +3. 编写项目文档 `docs/README.md` 和部署文档 `docs/DEPLOY.md` +4. 图片存储接入文件服务 → 部署排错 → 最终回退到 DB 存储,保留文件服务代码备用 + +## 代码改动 + +### 1. src/App.vue — 顶栏右侧加「切换系统」按钮 +- **位置**: 顶栏 [☰ MoKeeText] 右侧空白 +- **跳转**: `https://web.gw.zgitm.com/select`(外部链接,非 Vue 路由) +- **样式**: ghost 风格 `.switch-system-btn`,hover 变蓝 + +### 2. 项目目录整理 + +**整理前** → 根目录混在一起(app.py / index.html / Dockerfile / routes / src / static 等全在一个目录) + +**整理后**: +``` +mokeeText/ +├── backend/ # FastAPI 后端 +│ ├── app.py, models.py, config.py, logger.py, init_db.py +│ ├── file_service.py # 文件服务客户端(备用,当前未启用) +│ ├── requirements.txt, Dockerfile, .dockerignore +│ ├── routes/ # notes, websites, import_api, upload, share +│ └── middleware/ # user_context +├── frontend/ # Vue 3 前端 +│ ├── index.html, package.json, vite.config.js +│ ├── Dockerfile.frontend, nginx.conf, .dockerignore +│ ├── src/ # Vue 源码 +│ └── static/ # dist + js/vendor + css + uploads +├── deploy/ # 部署 +│ ├── docker-compose.yml +│ └── deploy.py # 日常部署(SSH 密钥认证) +├── docs/ +│ ├── README.md # 项目文档 +│ └── DEPLOY.md # 部署文档 +├── memory/ # 会话记忆 +└── templates/ # 旧 Jinja2 模板(已废弃) +``` + +### 3. 配置更新 +- **docker-compose.yml**: build context → `./backend` / `./frontend` +- **Dockerfile**: 新增 COPY file_service.py +- **deploy.py**: 路径更新 + 改用 SSH 密钥(无密码),运行: `python deploy/deploy.py` +- **.dockerignore**: 分别放在 backend/ 和 frontend/ 下 + +### 4. 图片存储 — 接入文件服务后又回退 + +**过程**: +1. 新增 `backend/file_service.py` — 封装文件服务 API(系统码 `mokeetext-edit`,目录 `/mokeetext-images/`) +2. 修改 models.py — Upload 表新增 `file_id` 字段,data 改为 nullable +3. 修改 init_db.py — 新增 migrate() ALTER TABLE +4. 改造 upload.py — 上传走文件服务,读取兼容 file_id + blob 双通道 +5. 添加 requests 依赖 + +**排错过程**: +- 🔴 Dockerfile 遗漏了 COPY file_service.py → 容器内无此文件,上传走旧代码 +- 🔴 SCP 时把 routes/upload.py 传到 backend/ 根目录而非 backend/routes/ 子目录 → 容器用的是旧代码 +- ✅ `--no-cache` 强制重建 + 修正文件路径后成功接入,文件服务出现 2 张图片 + +**最终决定**: 用户要求恢复 DB 存储,保留文件服务代码 +- `upload.py` 改回 DB LONGBLOB 存储 +- 读取优先 blob,file_id 存在时走文件服务(兼容之前 2 张图) +- `file_service.py` 保留不删,注释标注备用切换方式 + +## 当前状态 +- **图片存储**: MySQL LONGBLOB(主) + 文件服务兼容读取(备用) +- **file_service.py**: 保留,如需切换取消注释即可 + +## 部署 +- ✅ 目录迁移(服务器同步整理) +- ✅ Docker 重建(backend + frontend 均在运行) +- ✅ 数据库迁移(file_id 列已添加) +- ✅ deploy.py 改用 SSH 密钥认证 +- ✅ 服务器 SSH 密钥认证正常工作 + +## 重要资产 +- 文件服务 API 文档: `E:\AI\claude\new\fileServer\goFileService\docs\api.md` +- 参考项目 control-web: `E:\AI\claude\new\deployServer\control-web` +- 项目文档: `docs/README.md` + `docs/DEPLOY.md` + +## 待处理 +- [ ] 旧 `templates/` 目录可删除(Jinja2 已废弃) diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..d6dda20 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,37 @@ + + + + + + MoKeeText - Web 记事本 + + {% block head %}{% endblock %} + + + + + + +
+ {% block content %}{% endblock %} +
+ + +
+ MoKeeText v1.0 + ICP备案号:待接入 +
+ + {% block scripts %}{% endblock %} + + diff --git a/templates/notes.html b/templates/notes.html new file mode 100644 index 0000000..af0d7e1 --- /dev/null +++ b/templates/notes.html @@ -0,0 +1,77 @@ +{% extends "base.html" %} +{% block head %} + +{% endblock %} + +{% block content %} + + + + +
+
+ +
+ + + +
+ 已保存 + +
+ +
+
+
+
+
+ +
+
+ + +{% if notes %}{% endif %} +{% endblock %} + +{% block scripts %} + + +{% endblock %} diff --git a/templates/websites.html b/templates/websites.html new file mode 100644 index 0000000..96df17d --- /dev/null +++ b/templates/websites.html @@ -0,0 +1,198 @@ +{% extends "base.html" %} +{% block content %} + + + + +
+
+
选择左侧网站查看账号
+
+ + +
+
+ +
+
+
🔐
+

选择左侧网站查看账号密码

+
+
+
+ + + + + + + + + + + + + +{% endblock %} + +{% block scripts %} + +{% endblock %}