commit 9e346c7d5b38311e8792026a874ac6370a7c7167 Author: Chen Date: Mon Dec 1 10:15:32 2025 +0800 v 1.0.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a7f93af --- /dev/null +++ b/.gitignore @@ -0,0 +1,55 @@ +# 依赖目录 +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# 构建输出 +dist/ +build/ +out/ +*.log + +# 环境变量文件 +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# IDE 和编辑器 +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# 操作系统文件 +Thumbs.db +desktop.ini + +# 临时文件 +*.tmp +*.temp +.cache/ +.temp/ + +# 测试覆盖率 +coverage/ +*.coverage +.nyc_output/ + +# 知识库文件夹 - 不同步到 GitHub +Knowledge base/ +飞牛打包部署指南.md + +# 构建输出 +dist/ + +# 测试数据 +test-library/ +*.db +*.db-shm +*.db-wal diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f0effb2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 ZangXincz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..09d7077 --- /dev/null +++ b/README.md @@ -0,0 +1,109 @@ +# FlyPic + +一个轻量、快速、稳定的图片检索浏览应用,专为飞牛 fnOS 设计。 + +## 核心特性 + +- 🚀 **高性能**: 支持 10万-100万 级别图片浏览 +- 🎨 **Eagle 风格瀑布流**: 固定高度,宽度自适应,视觉整齐 +- 🔍 **智能搜索**: 多关键词组合搜索,快速定位 + +## 🛠️ 技术栈 + +- **前端**:React + Vite + TailwindCSS + react-photo-view + zustand +- **后端**:Node.js + Express + Sharp + better-sqlite3 + Socket.IO +- **部署**:飞牛 fnOS + +## 🚀 快速开始 + +### 开发环境 + +```bash +# 安装依赖 +npm install + +# 启动前端开发服务器(推荐) +npm run dev:frontend +# 访问 http://localhost:5173 + +# 启动后端开发服务器 +npm run dev:backend +# API 运行在 http://localhost:5002 +``` + +### 构建部署 + +```bash +# 方法一:使用 Docker 构建(推荐) +# 包含 Linux 版本的依赖,上传后直接可用 +npm run build:fpk:docker + +# 方法二:普通构建 +# 需要在飞牛上手动安装依赖 +npm run build:fpk + +# 本地测试 Linux 版本 +npm run test:docker +``` + +## 📦 部署到飞牛 fnOS + +详细步骤请查看:**[飞牛打包部署指南](./飞牛打包部署指南.md)** + +### 快速部署 + +1. **构建**:`npm run build:fpk:docker` +2. **上传**:将 `flypic/` 目录上传到飞牛 +3. **打包**:`fnpack build` +4. **安装**:`appcenter-cli install-fpk flypic.fpk` +5. **访问**:`http://你的飞牛IP:5002` + +## 📁 项目结构 + +``` +FlyPic/ +├── frontend/ # React 前端 +├── backend/ # Node.js 后端 +├── flypic/ # 飞牛打包目录(构建生成) +├── scripts/ # 构建脚本 +│ ├── build-fpk.js # 普通构建 +│ ├── build-fpk-docker.js # Docker 构建 +│ └── test-in-docker.js # Docker 测试 +├── dev.bat # Windows 开发启动脚本 +├── start.bat # Windows 生产启动脚本 +└── 飞牛打包部署指南.md # 完整部署文档 +``` + +## 🎯 支持的图片格式 + +jpg, jpeg, png, webp, gif, bmp, tiff + +## 📝 开发说明 + +### 数据存储 + +``` +素材库目录/ +├── 用户图片文件... +└── .flypic/ + ├── thumbnails/200/ # WebP 缩略图 + ├── metadata.db # SQLite 数据库 + └── config.json # 配置文件 +``` + +### 端口配置 + +- 前端开发:5173 +- 后端服务:5002 + +## 🐛 故障排查 + +常见问题请查看 [飞牛打包部署指南 - 故障排查](./飞牛打包部署指南.md#故障排查) + +## 📄 License + +MIT License - 详见 [LICENSE](./LICENSE) 文件 + +--- + +**最后更新**:2025-11-29 diff --git a/backend/database/db.js b/backend/database/db.js new file mode 100644 index 0000000..6f105c0 --- /dev/null +++ b/backend/database/db.js @@ -0,0 +1,281 @@ +const Database = require('better-sqlite3'); +const path = require('path'); +const fs = require('fs'); + +class LibraryDatabase { + constructor(libraryPath) { + this.libraryPath = libraryPath; + this.flypicDir = path.join(libraryPath, '.flypic'); + this.dbPath = path.join(this.flypicDir, 'metadata.db'); + + // Ensure .flypic directory exists + if (!fs.existsSync(this.flypicDir)) { + fs.mkdirSync(this.flypicDir, { recursive: true }); + } + + // Create thumbnails directory (480px 与 Billfish 一致) + const thumbDir = path.join(this.flypicDir, 'thumbnails'); + const thumbDir480 = path.join(thumbDir, '480'); + if (!fs.existsSync(thumbDir)) fs.mkdirSync(thumbDir, { recursive: true }); + if (!fs.existsSync(thumbDir480)) fs.mkdirSync(thumbDir480, { recursive: true }); + + this.db = new Database(this.dbPath); + + // 优化数据库性能 + this.db.pragma('journal_mode = WAL'); // 启用 WAL 模式,支持并发读写 + this.db.pragma('synchronous = NORMAL'); // 平衡性能和安全性 + this.db.pragma('cache_size = -64000'); // 64MB 缓存 + this.db.pragma('temp_store = MEMORY'); // 临时表存储在内存 + this.db.pragma('mmap_size = 268435456'); // 256MB 内存映射 + + this.initTables(); + } + + initTables() { + // Images table + this.db.exec(` + CREATE TABLE IF NOT EXISTS images ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + path TEXT UNIQUE NOT NULL, + filename TEXT NOT NULL, + folder TEXT NOT NULL, + size INTEGER, + width INTEGER, + height INTEGER, + format TEXT, + file_type TEXT DEFAULT 'image', + created_at INTEGER, + modified_at INTEGER, + file_hash TEXT, + thumbnail_path TEXT, + thumbnail_size INTEGER, + indexed_at INTEGER + ) + `); + + // 添加 file_type 列(如果不存在) + try { + this.db.exec(`ALTER TABLE images ADD COLUMN file_type TEXT DEFAULT 'image'`); + } catch (e) { + // 列已存在,忽略错误 + } + + // Folders table + this.db.exec(` + CREATE TABLE IF NOT EXISTS folders ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + path TEXT UNIQUE NOT NULL, + parent_path TEXT, + name TEXT NOT NULL, + image_count INTEGER DEFAULT 0, + last_scan INTEGER + ) + `); + + // Create indexes + this.db.exec(` + CREATE INDEX IF NOT EXISTS idx_filename ON images(filename); + CREATE INDEX IF NOT EXISTS idx_folder ON images(folder); + CREATE INDEX IF NOT EXISTS idx_created_at ON images(created_at DESC); + CREATE INDEX IF NOT EXISTS idx_file_hash ON images(file_hash); + CREATE INDEX IF NOT EXISTS idx_folder_path ON folders(path); + CREATE INDEX IF NOT EXISTS idx_folder_parent ON folders(parent_path); + -- 复合索引:优化文件夹+时间排序查询 + CREATE INDEX IF NOT EXISTS idx_folder_created ON images(folder, created_at DESC); + `); + } + + // Image operations + insertImage(imageData) { + const stmt = this.db.prepare(` + INSERT OR REPLACE INTO images + (path, filename, folder, size, width, height, format, file_type, created_at, modified_at, file_hash, thumbnail_path, thumbnail_size, indexed_at) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + `); + return stmt.run( + imageData.path, + imageData.filename, + imageData.folder, + imageData.size, + imageData.width, + imageData.height, + imageData.format, + imageData.file_type || 'image', + imageData.created_at, + imageData.modified_at, + imageData.file_hash, + imageData.thumbnail_path, + imageData.thumbnail_size, + Date.now() + ); + } + + getImageByPath(imagePath) { + const stmt = this.db.prepare('SELECT * FROM images WHERE path = ?'); + return stmt.get(imagePath); + } + + getAllImages() { + const stmt = this.db.prepare('SELECT * FROM images ORDER BY created_at DESC'); + return stmt.all(); + } + + searchImages(keywords, filters = {}) { + let query = 'SELECT * FROM images WHERE 1=1'; + const params = []; + + // Keyword search (AND logic) + if (keywords && keywords.trim()) { + const terms = keywords.trim().split(/\s+/); + terms.forEach(term => { + query += ' AND filename LIKE ?'; + params.push(`%${term}%`); + }); + } + + // Folder filter + if (filters.folder) { + query += ' AND folder LIKE ?'; + params.push(`${filters.folder}%`); + } + + // Format filter + if (filters.formats && filters.formats.length > 0) { + const placeholders = filters.formats.map(() => '?').join(','); + query += ` AND format IN (${placeholders})`; + params.push(...filters.formats); + } + + // Size filter (in KB) + if (filters.minSize) { + query += ' AND size >= ?'; + params.push(filters.minSize * 1024); + } + if (filters.maxSize) { + query += ' AND size <= ?'; + params.push(filters.maxSize * 1024); + } + + // Date filter + if (filters.startDate) { + query += ' AND created_at >= ?'; + params.push(filters.startDate); + } + if (filters.endDate) { + query += ' AND created_at <= ?'; + params.push(filters.endDate); + } + + query += ' ORDER BY created_at DESC'; + + const stmt = this.db.prepare(query); + return stmt.all(...params); + } + + deleteImage(imagePath) { + const stmt = this.db.prepare('DELETE FROM images WHERE path = ?'); + return stmt.run(imagePath); + } + + // Update folder field for a specific image (by path) + updateImageFolder(imagePath, folderPath) { + const stmt = this.db.prepare('UPDATE images SET folder = ? WHERE path = ?'); + return stmt.run(folderPath, imagePath); + } + + // Folder operations + insertFolder(folderData) { + const stmt = this.db.prepare(` + INSERT OR REPLACE INTO folders (path, parent_path, name, image_count, last_scan) + VALUES (?, ?, ?, ?, ?) + `); + return stmt.run( + folderData.path, + folderData.parent_path, + folderData.name, + folderData.image_count || 0, + Date.now() + ); + } + + getAllFolders() { + const stmt = this.db.prepare('SELECT * FROM folders ORDER BY path'); + return stmt.all(); + } + + getFolderByPath(folderPath) { + const stmt = this.db.prepare('SELECT * FROM folders WHERE path = ?'); + return stmt.get(folderPath); + } + + deleteFolder(folderPath) { + const stmt = this.db.prepare('DELETE FROM folders WHERE path = ?'); + return stmt.run(folderPath); + } + + deleteImagesByFolderPrefix(folderPath) { + // 使用 folderPath/% 确保只匹配真正的子文件夹,避免误删同名前缀文件夹 + const stmt = this.db.prepare('DELETE FROM images WHERE folder = ? OR folder LIKE ?'); + return stmt.run(folderPath, `${folderPath}/%`); + } + + deleteFoldersByPrefix(folderPath) { + // 使用 folderPath/% 确保只匹配真正的子文件夹 + const stmt = this.db.prepare('DELETE FROM folders WHERE path = ? OR path LIKE ?'); + return stmt.run(folderPath, `${folderPath}/%`); + } + + /** + * 更新文件夹的文件数量(包含所有子文件夹中的图片) + */ + updateFolderImageCount(folderPath) { + // 统计该文件夹及其所有子文件夹中的图片总数 + // folder = ? 匹配直接子文件,folder LIKE ?/% 匹配所有子文件夹 + const countStmt = this.db.prepare( + 'SELECT COUNT(*) as count FROM images WHERE folder = ? OR folder LIKE ?' + ); + const result = countStmt.get(folderPath, `${folderPath}/%`); + + // 更新文件夹记录 + const updateStmt = this.db.prepare('UPDATE folders SET image_count = ? WHERE path = ?'); + return updateStmt.run(result.count, folderPath); + } + + /** + * 批量更新所有文件夹的文件数量 + */ + updateAllFolderCounts() { + const folders = this.getAllFolders(); + for (const folder of folders) { + this.updateFolderImageCount(folder.path); + } + } + + getFolderTree() { + const folders = this.getAllFolders(); + const tree = []; + const map = {}; + + // Build folder map + folders.forEach(folder => { + map[folder.path] = { ...folder, children: [] }; + }); + + // Build tree structure + folders.forEach(folder => { + if (folder.parent_path && map[folder.parent_path]) { + map[folder.parent_path].children.push(map[folder.path]); + } else { + tree.push(map[folder.path]); + } + }); + + return tree; + } + + close() { + this.db.close(); + } +} + +module.exports = LibraryDatabase; diff --git a/backend/database/dbPool.js b/backend/database/dbPool.js new file mode 100644 index 0000000..d71fe5b --- /dev/null +++ b/backend/database/dbPool.js @@ -0,0 +1,157 @@ +const LibraryDatabase = require('./db'); + +/** + * 数据库连接池管理器 + * 复用数据库连接,避免频繁创建/关闭 + */ +class DatabasePool { + constructor() { + this.connections = new Map(); // libraryPath -> { db, lastUsed, refCount } + this.maxIdleTime = 60000; // 60秒未使用则关闭 + this.cleanupInterval = null; + + // 启动定期清理 + this.startCleanup(); + } + + /** + * 获取数据库连接(复用或创建) + * 优化:同时只保持一个活跃连接 + */ + acquire(libraryPath) { + let conn = this.connections.get(libraryPath); + + if (!conn) { + // 如果已有其他连接且引用计数为0,先关闭它们 + for (const [path, existingConn] of this.connections.entries()) { + if (existingConn.refCount === 0) { + console.log(`[DBPool] Auto-closing idle connection: ${path}`); + this.close(path); + } + } + + // 创建新连接 + const db = new LibraryDatabase(libraryPath); + conn = { + db, + lastUsed: Date.now(), + refCount: 0 + }; + this.connections.set(libraryPath, conn); + console.log(`[DBPool] Created new connection for: ${libraryPath}`); + } + + // 更新使用时间和引用计数 + conn.lastUsed = Date.now(); + conn.refCount++; + + return conn.db; + } + + /** + * 释放数据库连接(减少引用计数) + */ + release(libraryPath) { + const conn = this.connections.get(libraryPath); + if (conn) { + conn.refCount = Math.max(0, conn.refCount - 1); + conn.lastUsed = Date.now(); + } + } + + /** + * 强制关闭指定连接 + */ + close(libraryPath) { + const conn = this.connections.get(libraryPath); + if (conn) { + try { + // 强制设置引用计数为0 + conn.refCount = 0; + + // 关闭数据库连接 + if (conn.db && conn.db.db) { + // 执行 checkpoint 确保 WAL 写入主数据库 + try { + conn.db.db.pragma('wal_checkpoint(TRUNCATE)'); + } catch (e) { + console.warn(`[DBPool] WAL checkpoint warning:`, e.message); + } + + // 关闭连接 + conn.db.close(); + } + + this.connections.delete(libraryPath); + console.log(`[DBPool] Closed connection for: ${libraryPath}`); + } catch (error) { + console.error(`[DBPool] Error closing connection:`, error); + // 即使出错也删除引用 + this.connections.delete(libraryPath); + } + } + } + + /** + * 关闭所有连接 + */ + closeAll() { + for (const [path, conn] of this.connections.entries()) { + try { + conn.db.close(); + console.log(`[DBPool] Closed connection for: ${path}`); + } catch (error) { + console.error(`[DBPool] Error closing connection:`, error); + } + } + this.connections.clear(); + + if (this.cleanupInterval) { + clearInterval(this.cleanupInterval); + this.cleanupInterval = null; + } + } + + /** + * 启动定期清理空闲连接 + */ + startCleanup() { + this.cleanupInterval = setInterval(() => { + const now = Date.now(); + const toClose = []; + + for (const [path, conn] of this.connections.entries()) { + // 如果连接空闲超过阈值且没有引用,则关闭 + if (conn.refCount === 0 && now - conn.lastUsed > this.maxIdleTime) { + toClose.push(path); + } + } + + toClose.forEach(path => this.close(path)); + + if (toClose.length > 0) { + console.log(`[DBPool] Cleaned up ${toClose.length} idle connections`); + } + }, 30000); // 每30秒检查一次 + } + + /** + * 获取连接池状态 + */ + getStatus() { + const status = []; + for (const [path, conn] of this.connections.entries()) { + status.push({ + path, + refCount: conn.refCount, + idleTime: Date.now() - conn.lastUsed + }); + } + return status; + } +} + +// 单例模式 +const dbPool = new DatabasePool(); + +module.exports = dbPool; diff --git a/backend/package.json b/backend/package.json new file mode 100644 index 0000000..3359488 --- /dev/null +++ b/backend/package.json @@ -0,0 +1,24 @@ +{ + "name": "flypic-backend", + "version": "0.1.0", + "description": "FlyPic backend server", + "main": "server.js", + "scripts": { + "dev": "nodemon server.js", + "start": "node server.js" + }, + "dependencies": { + "better-sqlite3": "^9.2.2", + "chokidar": "^3.6.0", + "cors": "^2.8.5", + "crypto": "^1.0.1", + "express": "^4.18.2", + "glob": "^10.3.10", + "p-limit": "^7.2.0", + "sharp": "^0.33.0", + "socket.io": "^4.6.0" + }, + "devDependencies": { + "nodemon": "^3.0.2" + } +} diff --git a/backend/routes/image.js b/backend/routes/image.js new file mode 100644 index 0000000..c95a227 --- /dev/null +++ b/backend/routes/image.js @@ -0,0 +1,251 @@ +const express = require('express'); +const router = express.Router(); +const path = require('path'); +const fs = require('fs'); +const { exec } = require('child_process'); +const dbPool = require('../database/dbPool'); +const { generateThumbnail } = require('../utils/thumbnail'); +const { getLibrary } = require('../utils/config'); + +// Get images with search and filters +router.get('/', (req, res) => { + try { + const { libraryId, keywords, folder, formats, minSize, maxSize, startDate, endDate } = req.query; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // 使用连接池获取数据库连接 + const db = dbPool.acquire(library.path); + + try { + const filters = {}; + if (folder) filters.folder = folder; + if (formats) filters.formats = formats.split(','); + if (minSize) filters.minSize = parseInt(minSize); + if (maxSize) filters.maxSize = parseInt(maxSize); + if (startDate) filters.startDate = parseInt(startDate); + if (endDate) filters.endDate = parseInt(endDate); + + const images = db.searchImages(keywords || '', filters); + + res.json({ images }); + } finally { + // 释放连接 + dbPool.release(library.path); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get total image count +router.get('/count', (req, res) => { + try { + const { libraryId } = req.query; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const db = dbPool.acquire(library.path); + try { + const row = db.db.prepare('SELECT COUNT(*) as count FROM images').get(); + res.json({ count: row.count }); + } finally { + dbPool.release(library.path); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get folders +router.get('/folders', (req, res) => { + try { + const { libraryId } = req.query; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // 使用连接池 + const db = dbPool.acquire(library.path); + + try { + const folders = db.getFolderTree(); + res.json({ folders }); + } finally { + dbPool.release(library.path); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Serve thumbnail +router.get('/thumbnail/:libraryId/:size/:filename', async (req, res) => { + try { + const { libraryId, size, filename } = req.params; + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // New structure: .flypic/thumbnails/ab/hash.webp + const thumbBase = path.join(library.path, '.flypic', 'thumbnails'); + const hash = filename.replace(/\.[^/.]+$/, ""); // remove extension if present + const shard1 = hash.slice(0, 2); + + const targetPath = path.join(thumbBase, shard1, filename); + + if (!fs.existsSync(targetPath)) { + // 按需生成:尝试通过文件名在数据库中定位原图并生成 + try { + const db = dbPool.acquire(library.path); + try { + const row = db.db.prepare('SELECT path, thumbnail_path FROM images WHERE thumbnail_path LIKE ?').get(`%/${filename}`); + if (row && row.path) { + const originalFull = path.join(library.path, row.path); + // 确保目标目录存在 + fs.mkdirSync(path.dirname(targetPath), { recursive: true }); + // 生成指定尺寸 (default 480) + await generateThumbnail(originalFull, targetPath, parseInt(size, 10) || 480); + } + } finally { + dbPool.release(library.path); + } + } catch (e) { + // 忽略生成失败 + } + } + + if (!fs.existsSync(targetPath)) { + return res.status(404).json({ error: 'Thumbnail not found' }); + } + + // 设置缓存头,减少重复请求(缩略图内容不变) + res.set({ + 'Cache-Control': 'public, max-age=31536000, immutable', + 'Vary': 'Accept-Encoding' + }); + res.sendFile(targetPath); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Serve original image +router.get('/original/:libraryId/*', (req, res) => { + try { + const { libraryId } = req.params; + const imagePath = req.params[0]; + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const fullPath = path.join(library.path, imagePath); + + if (!fs.existsSync(fullPath)) { + return res.status(404).json({ error: 'Image not found' }); + } + + res.sendFile(fullPath); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Open file in system default application +router.post('/:libraryId/open-file', (req, res) => { + try { + const { libraryId } = req.params; + const { path: filePath } = req.body; + + if (!filePath) { + return res.status(400).json({ error: 'Path is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const fullPath = path.join(library.path, filePath); + + if (!fs.existsSync(fullPath)) { + return res.status(404).json({ error: 'File not found' }); + } + + // 使用系统默认应用打开文件 + const command = process.platform === 'win32' + ? `start "" "${fullPath}"` + : process.platform === 'darwin' + ? `open "${fullPath}"` + : `xdg-open "${fullPath}"`; + + exec(command, (error) => { + if (error) { + console.error('打开文件失败:', error); + return res.status(500).json({ error: '打开文件失败' }); + } + res.json({ success: true }); + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Open folder in file explorer +router.post('/:libraryId/open-folder', (req, res) => { + try { + const { path: imagePath } = req.body; + + if (!imagePath) { + return res.status(400).json({ error: 'Path is required' }); + } + + // 获取文件所在文件夹 + const folderPath = path.dirname(imagePath); + + // Windows: 使用 explorer + // Linux: 使用 xdg-open + // macOS: 使用 open + const command = process.platform === 'win32' + ? `explorer "${folderPath}"` + : process.platform === 'darwin' + ? `open "${folderPath}"` + : `xdg-open "${folderPath}"`; + + exec(command, (error) => { + if (error) { + console.error('打开文件夹失败:', error); + return res.status(500).json({ error: '打开文件夹失败' }); + } + res.json({ success: true }); + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/backend/routes/library.js b/backend/routes/library.js new file mode 100644 index 0000000..efff2a3 --- /dev/null +++ b/backend/routes/library.js @@ -0,0 +1,242 @@ +const express = require('express'); +const router = express.Router(); +const fs = require('fs'); +const path = require('path'); +const { + loadConfig, + addLibrary, + removeLibrary, + updateLibrary, + setCurrentLibrary, + updatePreferences, + updateTheme +} = require('../utils/config'); + +// Get all libraries and config +router.get('/', (req, res) => { + try { + const config = loadConfig(); + res.json({ + libraries: config.libraries, + currentLibraryId: config.currentLibraryId, + theme: config.theme, + preferences: config.preferences + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Add new library +router.post('/', (req, res) => { + try { + const { name, path } = req.body; + + if (!name || !path) { + return res.status(400).json({ error: 'Name and path are required' }); + } + + if (!fs.existsSync(path)) { + return res.status(400).json({ error: 'Path does not exist' }); + } + + const id = addLibrary(name, path); + + // Check if .flypic directory exists + const flypicDir = require('path').join(path, '.flypic'); + const hasExistingIndex = fs.existsSync(flypicDir); + + res.json({ + id, + message: 'Library added successfully', + hasExistingIndex + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Update preferences (must be before /:id route) +router.put('/preferences', (req, res) => { + try { + const preferences = updatePreferences(req.body); + res.json({ preferences }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Update theme (must be before /:id route) +router.put('/theme', (req, res) => { + try { + const { theme } = req.body; + updateTheme(theme); + res.json({ theme }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Update library +router.put('/:id', (req, res) => { + try { + const { id } = req.params; + const updates = req.body; + + const success = updateLibrary(id, updates); + if (success) { + res.json({ message: 'Library updated successfully' }); + } else { + res.status(404).json({ error: 'Library not found' }); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Delete library +router.delete('/:id', async (req, res) => { + try { + const { id } = req.params; + + // 获取素材库信息 + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === id); + + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const dbPool = require('../database/dbPool'); + const fileWatcher = require('../utils/fileWatcher'); + const scanManager = require('../utils/scanManager'); + + console.log(`[Delete] Cleaning up library: ${library.name}`); + + // 1. 停止扫描并清理状态 + scanManager.clearState(id); + + // 2. 停止文件监控 + fileWatcher.unwatch(id); + + // 3. 关闭数据库连接 + dbPool.close(library.path); + + // 等待一下,确保连接完全关闭 + await new Promise(resolve => setTimeout(resolve, 300)); + + // 删除索引 + removeLibrary(id); + + console.log(`✅ Library removed: ${library.name}`); + + res.json({ + message: 'Library removed successfully', + path: library.path + }); + } catch (error) { + console.error('Error in delete library:', error); + res.status(500).json({ error: error.message }); + } +}); + +// Set current library +router.post('/:id/set-current', async (req, res) => { + try { + const { id } = req.params; + const config = loadConfig(); + const dbPool = require('../database/dbPool'); + const fileWatcher = require('../utils/fileWatcher'); + const scanManager = require('../utils/scanManager'); + + // 获取旧的当前素材库 + const oldLibraryId = config.currentLibraryId; + if (oldLibraryId && oldLibraryId !== id) { + const oldLibrary = config.libraries.find(lib => lib.id === oldLibraryId); + if (oldLibrary) { + console.log(`[Switch] Cleaning up old library: ${oldLibrary.name}`); + + // 1. 停止扫描(如果正在进行),但保留暂停状态以便恢复 + if (scanManager.isScanning(oldLibraryId)) { + const state = scanManager.getState(oldLibraryId); + if (state.abortController) { + state.abortController.aborted = true; + } + // 不调用 completeScan,让扫描自己暂停并保留待处理文件 + console.log(` ⏸️ Pausing scan (will preserve state)`); + } + + // 3. 关闭数据库连接 + dbPool.close(oldLibrary.path); + console.log(` ⏹️ Closed database`); + } + } + + // 设置新的当前素材库 + setCurrentLibrary(id); + + const newLibrary = config.libraries.find(lib => lib.id === id); + console.log(`[Switch] Switched to library: ${newLibrary?.name}`); + + res.json({ message: 'Current library set successfully' }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Close database connection for a library +router.post('/:id/close-db', (req, res) => { + try { + const { id } = req.params; + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === id); + + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const dbPool = require('../database/dbPool'); + dbPool.close(library.path); + + res.json({ message: 'Database connection closed successfully' }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Release all resources for a library (database + file watcher) +router.post('/:id/release', (req, res) => { + try { + const { id } = req.params; + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === id); + + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + console.log(`[Release] Releasing resources for library: ${library.name}`); + + // 1. 关闭数据库连接 + const dbPool = require('../database/dbPool'); + dbPool.close(library.path); + console.log(`[Release] Database connection closed`); + + // 2. 停止文件监控 + const fileWatcher = req.app.get('fileWatcher'); + if (fileWatcher && fileWatcher.isWatching(id)) { + fileWatcher.unwatch(id); + console.log(`[Release] File watcher stopped`); + } + + res.json({ + message: 'All resources released successfully', + library: library.name + }); + } catch (error) { + console.error('[Release] Error:', error); + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/backend/routes/scan.js b/backend/routes/scan.js new file mode 100644 index 0000000..abc374d --- /dev/null +++ b/backend/routes/scan.js @@ -0,0 +1,283 @@ +const express = require('express'); +const router = express.Router(); +const LibraryDatabase = require('../database/db'); +const { getLibrary, updateLibrary } = require('../utils/config'); +const { scanLibrary, syncLibrary } = require('../utils/scanner'); +const scanManager = require('../utils/scanManager'); + +// Start full scan +router.post('/full', async (req, res) => { + try { + const { libraryId, wait } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const io = req.app.get('io'); + const dbPool = require('../database/dbPool'); + const db = dbPool.acquire(library.path); + + // 如果需要等待扫描完成 + if (wait) { + try { + const results = await scanLibrary(library.path, db, (progress) => { + io.emit('scanProgress', { + libraryId, + ...progress + }); + }); + + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + + res.json({ message: 'Scan completed', results }); + } catch (error) { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + throw error; + } + } else { + // Start scan in background + console.log(`🔍 Starting background scan for library: ${libraryId}`); + res.json({ message: 'Scan started' }); + + scanLibrary(library.path, db, (progress) => { + console.log(`📊 Progress: ${progress.current}/${progress.total} (${progress.percent}%)`); + io.emit('scanProgress', { + libraryId, + ...progress + }); + }, libraryId).then(results => { + console.log(`✅ Scan complete for library: ${libraryId}`, results); + dbPool.release(library.path); + if (!results.stopped) { + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + } else { + io.emit('scanPaused', { libraryId, results }); + } + }).catch(error => { + console.error(`❌ Scan error for library: ${libraryId}`, error); + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + }); + } + + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Start incremental sync +router.post('/sync', async (req, res) => { + try { + const { libraryId, wait } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const io = req.app.get('io'); + const dbPool = require('../database/dbPool'); + const db = dbPool.acquire(library.path); + + // 如果需要等待同步完成 + if (wait) { + try { + const results = await syncLibrary(library.path, db); + + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + + res.json({ message: 'Sync completed', results }); + } catch (error) { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + throw error; + } + } else { + // Start sync in background + console.log(`🔄 Starting background sync for library: ${libraryId}`); + res.json({ message: 'Sync started' }); + + syncLibrary(library.path, db, false, (progress) => { + console.log(`📊 Sync progress: ${progress.current}/${progress.total} (${progress.percent}%)`); + io.emit('scanProgress', { + libraryId, + ...progress + }); + }).then(results => { + console.log(`✅ Sync complete for library: ${libraryId}`, results); + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + }).catch(error => { + console.error(`❌ Sync error for library: ${libraryId}`, error); + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + }); + } + + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Fix folder paths in database (one-time migration) +router.post('/fix-folders', async (req, res) => { + try { + const { libraryId } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const db = dbPool.acquire(library.path); + + try { + const path = require('path'); + const images = db.getAllImages(); + let fixed = 0; + + for (const img of images) { + const expectedFolderRaw = path.dirname(img.path || ''); + const expectedFolder = expectedFolderRaw === '.' ? '' : expectedFolderRaw.replace(/\\/g, '/'); + const currentFolder = (img.folder || '').replace(/\\/g, '/'); + + if (expectedFolder !== currentFolder) { + db.updateImageFolder(img.path, expectedFolder); + fixed++; + } + } + + console.log(`✅ Fixed ${fixed} folder paths`); + res.json({ message: `Fixed ${fixed} folder paths`, fixed }); + } finally { + dbPool.release(library.path); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// 停止扫描 +router.post('/stop', async (req, res) => { + try { + const { libraryId } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + if (!scanManager.isScanning(libraryId)) { + return res.status(400).json({ error: 'No scan in progress' }); + } + + // 设置停止标志(实际停止在下一个批次检查时) + const state = scanManager.getState(libraryId); + state.abortController.aborted = true; + + console.log(`⏸️ Stop requested for library: ${libraryId}`); + res.json({ message: 'Stop requested', libraryId }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// 继续扫描 +router.post('/resume', async (req, res) => { + try { + const { libraryId } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + if (!scanManager.isPaused(libraryId)) { + return res.status(400).json({ error: 'Scan is not paused' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const pendingFiles = scanManager.resumeScan(libraryId); + if (pendingFiles.length === 0) { + return res.status(400).json({ error: 'No pending files to resume' }); + } + + const io = req.app.get('io'); + const dbPool = require('../database/dbPool'); + const db = dbPool.acquire(library.path); + + console.log(`▶️ Resuming scan for library: ${libraryId}, ${pendingFiles.length} files`); + res.json({ message: 'Scan resumed', pendingFiles: pendingFiles.length }); + + // 继续扫描 + scanLibrary(library.path, db, (progress) => { + io.emit('scanProgress', { + libraryId, + ...progress + }); + }, libraryId, pendingFiles).then(results => { + dbPool.release(library.path); + if (!results.stopped) { + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + } else { + io.emit('scanPaused', { libraryId, results }); + } + }).catch(error => { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + }); + + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// 获取扫描状态 +router.get('/status/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + + // 注册素材库路径(用于持久化恢复) + const library = getLibrary(libraryId); + if (library) { + scanManager.registerLibraryPath(libraryId, library.path); + } + + const state = scanManager.getState(libraryId); + res.json({ + libraryId, + status: state.status, + progress: state.progress, + pendingCount: state.pendingFiles?.length || 0, + needsRescan: state.needsRescan || false // 标记是否需要重新扫描 + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/backend/routes/watch.js b/backend/routes/watch.js new file mode 100644 index 0000000..213affa --- /dev/null +++ b/backend/routes/watch.js @@ -0,0 +1,84 @@ +const express = require('express'); +const router = express.Router(); + +// Start watching a library +router.post('/start/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + const fileWatcher = req.app.get('fileWatcher'); + const io = req.app.get('io'); + + // 尝试启动监控,如果失败则返回详细错误 + try { + fileWatcher.watch(libraryId, io); + res.json({ + message: 'File watching started', + libraryId, + isWatching: true + }); + } catch (watchError) { + // 监控启动失败,但不应该导致整个请求失败 + console.error(`Failed to start file watching for ${libraryId}:`, watchError.message); + res.status(200).json({ + message: 'File watching could not be started', + libraryId, + isWatching: false, + error: watchError.message + }); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Stop watching a library +router.post('/stop/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + const fileWatcher = req.app.get('fileWatcher'); + + fileWatcher.unwatch(libraryId); + + res.json({ + message: 'File watching stopped', + libraryId, + isWatching: false + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get watch status +router.get('/status/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + const fileWatcher = req.app.get('fileWatcher'); + + const isWatching = fileWatcher.isWatching(libraryId); + + res.json({ + libraryId, + isWatching + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get all watched libraries +router.get('/list', (req, res) => { + try { + const fileWatcher = req.app.get('fileWatcher'); + const watchedLibraries = fileWatcher.getWatchedLibraries(); + + res.json({ + watchedLibraries, + count: watchedLibraries.length + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/backend/server.js b/backend/server.js new file mode 100644 index 0000000..af83d60 --- /dev/null +++ b/backend/server.js @@ -0,0 +1,192 @@ +const express = require('express'); +const cors = require('cors'); +const path = require('path'); +const http = require('http'); +const { Server } = require('socket.io'); +const fileWatcher = require('./utils/fileWatcher'); + +const app = express(); +const server = http.createServer(app); +const io = new Server(server, { + cors: { + origin: process.env.FRONTEND_DIST ? false : 'http://localhost:5173', + methods: ['GET', 'POST'] + } +}); + +const PORT = process.env.PORT || 3000; + +// Auto-detect frontend dist path +let FRONTEND_DIST = process.env.FRONTEND_DIST; +if (!FRONTEND_DIST) { + // Try common locations + const possiblePaths = [ + path.join(__dirname, 'public'), // 飞牛 fnOS 打包后的位置 + path.join(__dirname, '../frontend/dist'), // 开发环境 + path.join(__dirname, '../public'), + path.join(__dirname, '../../frontend/dist') + ]; + + for (const p of possiblePaths) { + if (require('fs').existsSync(p)) { + FRONTEND_DIST = p; + console.log('✅ Found frontend at:', p); + break; + } + } + + if (!FRONTEND_DIST) { + console.log('⚠️ Frontend not found, tried:', possiblePaths); + } +} + +// Middleware +app.use(cors()); +app.use(express.json()); + +// API Routes +const libraryRouter = require('./routes/library'); +const imageRouter = require('./routes/image'); +const scanRouter = require('./routes/scan'); +const watchRouter = require('./routes/watch'); + +app.use('/api/library', libraryRouter); +app.use('/api/image', imageRouter); +app.use('/api/scan', scanRouter); +app.use('/api/watch', watchRouter); + +// Serve static files (production) +if (FRONTEND_DIST) { + console.log('📁 Serving frontend from:', FRONTEND_DIST); + app.use(express.static(FRONTEND_DIST)); + app.get('*', (req, res) => { + if (!req.path.startsWith('/api')) { + res.sendFile(path.join(FRONTEND_DIST, 'index.html')); + } + }); +} + +// Socket.IO for real-time updates +io.on('connection', (socket) => { + console.log('Client connected:', socket.id); + + socket.on('disconnect', () => { + console.log('Client disconnected:', socket.id); + }); +}); + +// Make io accessible to routes +app.set('io', io); + +// Make fileWatcher accessible to routes +app.set('fileWatcher', fileWatcher); + +server.listen(PORT, () => { + console.log(`🚀 FlyPic server running on http://localhost:${PORT}`); + + // 只为当前选中的素材库启动文件监控和快速同步 + const { loadConfig } = require('./utils/config'); + const config = loadConfig(); + const currentLibraryId = config.currentLibraryId; + const currentLibrary = config.libraries.find(lib => lib.id === currentLibraryId); + + if (currentLibrary) { + console.log(`📡 启动当前素材库监控: ${currentLibrary.name}`); + + // 启动文件监控 + try { + fileWatcher.watch(currentLibrary.id, io); + console.log(` ✅ 文件监控已启动`); + } catch (err) { + console.log(` ❌ 文件监控失败: ${err.message}`); + } + + // 快速同步检测离线变化 + console.log('🔄 检测离线期间的文件变化...'); + const { quickSync } = require('./utils/scanner'); + const dbPool = require('./database/dbPool'); + + (async () => { + try { + const db = dbPool.acquire(currentLibrary.path); + const results = await quickSync(currentLibrary.path, db); + dbPool.release(currentLibrary.path); + + const changes = results.added + results.deleted; + if (changes > 0) { + console.log(` 📊 ${currentLibrary.name}: +${results.added} -${results.deleted}`); + io.emit('scanComplete', { libraryId: currentLibrary.id, results }); + } else { + console.log(` ✅ ${currentLibrary.name}: 无变化`); + } + } catch (err) { + console.log(` ❌ ${currentLibrary.name}: ${err.message}`); + } + console.log('✅ 启动检查完成'); + })(); + } else { + console.log('📭 未选中素材库,等待用户操作...'); + } +}); + +// Graceful shutdown - 优雅关闭,释放所有资源 +const gracefulShutdown = (signal) => { + console.log(`\n🛑 Received ${signal}, shutting down gracefully...`); + + try { + // 1. 停止所有文件监控 + console.log('📡 Stopping file watchers...'); + fileWatcher.unwatchAll(); + + // 2. 关闭所有数据库连接 + console.log('💾 Closing database connections...'); + const dbPool = require('./database/dbPool'); + dbPool.closeAll(); + + // 3. 关闭 HTTP 服务器 + console.log('🌐 Closing HTTP server...'); + server.close(() => { + console.log('✅ All resources released, goodbye!'); + process.exit(0); + }); + + // 如果10秒内没有正常关闭,强制退出 + setTimeout(() => { + console.error('⚠️ Forced shutdown after timeout'); + process.exit(1); + }, 10000); + + } catch (error) { + console.error('❌ Error during shutdown:', error); + process.exit(1); + } +}; + +// 监听各种退出信号 +process.on('SIGINT', () => gracefulShutdown('SIGINT')); // Ctrl+C +process.on('SIGTERM', () => gracefulShutdown('SIGTERM')); // kill +process.on('SIGHUP', () => gracefulShutdown('SIGHUP')); // 终端关闭 + +// Windows 特殊处理(Ctrl+C) +if (process.platform === 'win32') { + const readline = require('readline'); + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + rl.on('SIGINT', () => { + process.emit('SIGINT'); + }); +} + +// 捕获未处理的异常 +process.on('uncaughtException', (error) => { + console.error('❌ Uncaught Exception:', error); + gracefulShutdown('uncaughtException'); +}); + +process.on('unhandledRejection', (reason, promise) => { + console.error('❌ Unhandled Rejection at:', promise, 'reason:', reason); + gracefulShutdown('unhandledRejection'); +}); diff --git a/backend/utils/config.js b/backend/utils/config.js new file mode 100644 index 0000000..e4fa34c --- /dev/null +++ b/backend/utils/config.js @@ -0,0 +1,232 @@ +const fs = require('fs'); +const path = require('path'); +const os = require('os'); + +// 配置缓存 +let configCache = null; +let configCacheTime = 0; +const CONFIG_CACHE_TTL = 5000; // 5秒缓存 + +/** + * Get config directory based on environment + */ +function getConfigDir() { + // Check if running on fnOS + if (process.env.TRIM_PKGVAR) { + return process.env.TRIM_PKGVAR; + } + + // Windows + if (process.platform === 'win32') { + return path.join(process.env.APPDATA || os.homedir(), 'FlyPic'); + } + + // Linux/Mac + return path.join(os.homedir(), '.flypic'); +} + +/** + * Get config file path + */ +function getConfigPath() { + const configDir = getConfigDir(); + if (!fs.existsSync(configDir)) { + fs.mkdirSync(configDir, { recursive: true }); + } + return path.join(configDir, 'config.json'); +} + +/** + * Load configuration + */ +function loadConfig(forceReload = false) { + // 检查缓存是否有效 + const now = Date.now(); + if (!forceReload && configCache && (now - configCacheTime) < CONFIG_CACHE_TTL) { + return configCache; + } + + const configPath = getConfigPath(); + + if (!fs.existsSync(configPath)) { + const defaultConfig = { + libraries: [], + theme: 'light', + currentLibraryId: null, + // UI preferences + preferences: { + thumbnailHeight: 200, + rowGap: 32, + columnGap: 16, + leftPanelWidth: 256, // 左侧边栏宽度 + rightPanelWidth: 320 // 右侧边栏宽度 + } + }; + saveConfig(defaultConfig); + return defaultConfig; + } + + try { + const data = fs.readFileSync(configPath, 'utf8'); + const config = JSON.parse(data); + + // Ensure preferences exist (for backward compatibility) + if (!config.preferences) { + config.preferences = { + thumbnailHeight: 200, + rowGap: 32, + columnGap: 16 + }; + } + + // 更新缓存 + configCache = config; + configCacheTime = now; + + return config; + } catch (error) { + console.error('Error loading config:', error); + return { + libraries: [], + theme: 'light', + currentLibraryId: null, + preferences: { + thumbnailHeight: 200, + rowGap: 32, + columnGap: 16 + } + }; + } +} + +/** + * Save configuration + */ +function saveConfig(config) { + const configPath = getConfigPath(); + try { + fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8'); + // 同步更新缓存 + configCache = config; + configCacheTime = Date.now(); + return true; + } catch (error) { + console.error('Error saving config:', error); + return false; + } +} + +/** + * 清除配置缓存(用于强制重新加载) + */ +function clearConfigCache() { + configCache = null; + configCacheTime = 0; +} + +/** + * Add library to config + */ +function addLibrary(name, libraryPath) { + const config = loadConfig(); + const id = Date.now().toString(); + + config.libraries.push({ + id, + name, + path: libraryPath, + lastScan: null, + createdAt: Date.now() + }); + + if (!config.currentLibraryId) { + config.currentLibraryId = id; + } + + saveConfig(config); + return id; +} + +/** + * Remove library from config + */ +function removeLibrary(libraryId) { + const config = loadConfig(); + config.libraries = config.libraries.filter(lib => lib.id !== libraryId); + + if (config.currentLibraryId === libraryId) { + config.currentLibraryId = config.libraries.length > 0 ? config.libraries[0].id : null; + } + + saveConfig(config); + return true; +} + +/** + * Update library + */ +function updateLibrary(libraryId, updates) { + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === libraryId); + + if (library) { + Object.assign(library, updates); + saveConfig(config); + return true; + } + + return false; +} + +/** + * Get library by ID + */ +function getLibrary(libraryId) { + const config = loadConfig(); + return config.libraries.find(lib => lib.id === libraryId); +} + +/** + * Set current library + */ +function setCurrentLibrary(libraryId) { + const config = loadConfig(); + config.currentLibraryId = libraryId; + saveConfig(config); + return true; +} + +/** + * Update preferences + */ +function updatePreferences(preferences) { + const config = loadConfig(); + config.preferences = { ...config.preferences, ...preferences }; + saveConfig(config); + return config.preferences; +} + +/** + * Update theme + */ +function updateTheme(theme) { + const config = loadConfig(); + config.theme = theme; + saveConfig(config); + return true; +} + +module.exports = { + getConfigDir, + getConfigPath, + loadConfig, + saveConfig, + clearConfigCache, + addLibrary, + removeLibrary, + updateLibrary, + getLibrary, + setCurrentLibrary, + updatePreferences, + updateTheme +}; diff --git a/backend/utils/fileWatcher.js b/backend/utils/fileWatcher.js new file mode 100644 index 0000000..47b1a81 --- /dev/null +++ b/backend/utils/fileWatcher.js @@ -0,0 +1,226 @@ +const chokidar = require('chokidar'); +const path = require('path'); +const { getLibrary } = require('./config'); +const { syncLibrary, applyChangesFromEvents } = require('./scanner'); +const dbPool = require('../database/dbPool'); + +class FileWatcher { + constructor() { + this.watchers = new Map(); // libraryId -> watcher + this.debounceTimers = new Map(); // libraryId -> { timer, forceRebuildFolders } + this.changeBuffers = new Map(); // libraryId -> { filesAdded, filesChanged, filesRemoved, dirsAdded, dirsRemoved } + } + + // 获取或创建变更缓冲区 + _getBuffer(libraryId) { + if (!this.changeBuffers.has(libraryId)) { + this.changeBuffers.set(libraryId, { + filesAdded: new Set(), + filesChanged: new Set(), + filesRemoved: new Set(), + dirsAdded: new Set(), + dirsRemoved: new Set() + }); + } + return this.changeBuffers.get(libraryId); + } + + // 缓冲区事件数量 + _bufferCount(buf) { + return ( + buf.filesAdded.size + + buf.filesChanged.size + + buf.filesRemoved.size + + buf.dirsAdded.size + + buf.dirsRemoved.size + ); + } + + // 启动监控 + watch(libraryId, io) { + // 如果已经在监控,先停止 + if (this.watchers.has(libraryId)) { + this.unwatch(libraryId); + } + + const library = getLibrary(libraryId); + if (!library) { + console.error(`Library ${libraryId} not found`); + return; + } + + // 检查路径是否存在和可访问 + const fs = require('fs'); + try { + fs.accessSync(library.path, fs.constants.R_OK); + } catch (error) { + const errorMsg = `Cannot access library path: ${library.path} - ${error.message}`; + console.error(errorMsg); + console.error('提示:在飞牛 fnOS 上,请确保在应用设置中授予了文件夹访问权限'); + throw new Error(errorMsg); + } + + console.log(`Starting file watcher for library: ${library.name} (${library.path})`); + + // 监控所有文件(使用通配符) + const pattern = '**/*.*'; + + // 创建监控器(监控所有文件和文件夹) + const watcher = chokidar.watch([pattern, '**/'], { + cwd: library.path, + ignored: [ + '**/node_modules/**', + '**/.git/**', + '**/.flypic/**', // 忽略自己的缓存目录 + '**/.*' // 忽略隐藏文件 + ], + persistent: true, + ignoreInitial: true, // 忽略初始扫描 + usePolling: false, // 不使用轮询,减少 CPU 占用 + awaitWriteFinish: { + stabilityThreshold: 1000, // 文件稳定 1 秒后触发,确保复制完成 + pollInterval: 200 + } + }); + + // 防抖处理:多个文件变化合并为一次同步(自适应时长) + const debouncedSync = (forceRebuildFolders = false) => { + const buf = this._getBuffer(libraryId); + const changeCount = this._bufferCount(buf); + + // 清除之前的定时器 + if (this.debounceTimers.has(libraryId)) { + const oldTimer = this.debounceTimers.get(libraryId); + clearTimeout(oldTimer.timer); + // 聚合 forceRebuildFolders 标记 + forceRebuildFolders = forceRebuildFolders || oldTimer.forceRebuildFolders; + } + + // 自适应防抖时间:更快响应 + let debounceMs = 2000; + if (changeCount <= 1) debounceMs = 800; // 单文件 0.8 秒 + else if (changeCount <= 5) debounceMs = 1000; // 少量 1 秒 + else if (changeCount <= 20) debounceMs = 1500; + else if (changeCount <= 100) debounceMs = 2000; + else debounceMs = 3000; // 大批量 3 秒 + + const timer = setTimeout(async () => { + const snapshot = this._getBuffer(libraryId); + // 清空缓冲区(开始新一轮累计) + this.changeBuffers.set(libraryId, { + filesAdded: new Set(), + filesChanged: new Set(), + filesRemoved: new Set(), + dirsAdded: new Set(), + dirsRemoved: new Set() + }); + + // 从连接池获取数据库连接 + const db = dbPool.acquire(library.path); + + try { + const total = this._bufferCount(snapshot); + let results; + + // 始终使用基于事件的快速同步(不再调用 syncLibrary) + results = await applyChangesFromEvents(library.path, db, { + filesAdded: Array.from(snapshot.filesAdded), + filesChanged: Array.from(snapshot.filesChanged), + filesRemoved: Array.from(snapshot.filesRemoved), + dirsAdded: Array.from(snapshot.dirsAdded), + dirsRemoved: Array.from(snapshot.dirsRemoved) + }); + + // 通过 Socket.IO 通知前端 + io.emit('scanComplete', { libraryId, results }); + console.log(`Sync complete for ${library.name}:`, results); + } catch (error) { + console.error(`Sync error for ${library.name}:`, error); + io.emit('scanError', { libraryId, error: error.message }); + } finally { + // 释放数据库连接(不关闭,复用) + dbPool.release(library.path); + } + + this.debounceTimers.delete(libraryId); + }, debounceMs); + + this.debounceTimers.set(libraryId, { timer, forceRebuildFolders }); + }; + + // 监听文件和文件夹变化(写入缓冲,统一合并处理) + watcher + .on('add', (filePath) => { + this._getBuffer(libraryId).filesAdded.add(filePath); + debouncedSync(); + }) + .on('unlink', (filePath) => { + this._getBuffer(libraryId).filesRemoved.add(filePath); + debouncedSync(); + }) + .on('change', (filePath) => { + this._getBuffer(libraryId).filesChanged.add(filePath); + debouncedSync(); + }) + .on('addDir', (dirPath) => { + this._getBuffer(libraryId).dirsAdded.add(dirPath); + debouncedSync(true); // 强制重建文件夹结构 + }) + .on('unlinkDir', (dirPath) => { + this._getBuffer(libraryId).dirsRemoved.add(dirPath); + debouncedSync(true); // 强制重建文件夹结构 + }) + .on('error', (error) => { + console.error(`Watcher error for ${library.name}:`, error); + }) + .on('ready', () => { + console.log(`File watcher ready for: ${library.name}`); + }); + + this.watchers.set(libraryId, watcher); + } + + // 停止监控 + unwatch(libraryId) { + const watcher = this.watchers.get(libraryId); + if (watcher) { + watcher.close(); + this.watchers.delete(libraryId); + console.log(`Stopped file watcher for library: ${libraryId}`); + } + + // 清除防抖定时器 + if (this.debounceTimers.has(libraryId)) { + const timerObj = this.debounceTimers.get(libraryId); + clearTimeout(timerObj.timer); + this.debounceTimers.delete(libraryId); + } + + // 清空缓冲区 + if (this.changeBuffers.has(libraryId)) { + this.changeBuffers.delete(libraryId); + } + } + + // 停止所有监控 + unwatchAll() { + for (const libraryId of this.watchers.keys()) { + this.unwatch(libraryId); + } + } + + // 获取监控状态 + isWatching(libraryId) { + return this.watchers.has(libraryId); + } + + // 获取所有正在监控的库 + getWatchedLibraries() { + return Array.from(this.watchers.keys()); + } +} + +// 单例模式 +const fileWatcher = new FileWatcher(); + +module.exports = fileWatcher; diff --git a/backend/utils/scanManager.js b/backend/utils/scanManager.js new file mode 100644 index 0000000..e251e5e --- /dev/null +++ b/backend/utils/scanManager.js @@ -0,0 +1,245 @@ +/** + * 扫描状态管理器 + * 支持扫描的停止、继续和持久化 + */ + +const fs = require('fs'); +const path = require('path'); + +class ScanManager { + constructor() { + // 每个素材库的扫描状态(内存) + this.scanStates = new Map(); + // 素材库路径映射(用于持久化) + this.libraryPaths = new Map(); + } + + /** + * 注册素材库路径(用于持久化) + */ + registerLibraryPath(libraryId, libraryPath) { + this.libraryPaths.set(libraryId, libraryPath); + } + + /** + * 获取状态文件路径 + */ + getStateFilePath(libraryId) { + const libraryPath = this.libraryPaths.get(libraryId); + if (!libraryPath) return null; + return path.join(libraryPath, '.flypic', 'scan-state.json'); + } + + /** + * 保存状态到文件(轻量:只保存关键信息) + */ + saveState(libraryId) { + const stateFile = this.getStateFilePath(libraryId); + if (!stateFile) return; + + const state = this.scanStates.get(libraryId); + if (!state || state.status === 'idle') { + // 删除状态文件 + try { + if (fs.existsSync(stateFile)) { + fs.unlinkSync(stateFile); + } + } catch (e) { /* ignore */ } + return; + } + + try { + const saveData = { + status: state.status, + progress: state.progress, + pendingCount: state.pendingFiles?.length || 0, + // 只保存文件相对路径,不保存完整路径列表(太大) + savedAt: Date.now() + }; + fs.writeFileSync(stateFile, JSON.stringify(saveData, null, 2)); + } catch (e) { + console.error('Failed to save scan state:', e.message); + } + } + + /** + * 从文件加载状态 + */ + loadState(libraryId) { + const stateFile = this.getStateFilePath(libraryId); + if (!stateFile || !fs.existsSync(stateFile)) return null; + + try { + const data = JSON.parse(fs.readFileSync(stateFile, 'utf8')); + // 状态超过 24 小时视为过期 + if (Date.now() - data.savedAt > 24 * 60 * 60 * 1000) { + fs.unlinkSync(stateFile); + return null; + } + return data; + } catch (e) { + return null; + } + } + + /** + * 获取扫描状态(优先内存,其次文件) + */ + getState(libraryId) { + // 先检查内存中的状态 + const memState = this.scanStates.get(libraryId); + if (memState) return memState; + + // 尝试从文件加载(应用重启后的恢复) + const fileState = this.loadState(libraryId); + if (fileState && fileState.status === 'paused') { + // 重建内存状态(不含 pendingFiles,需要重新扫描确定) + const restored = { + status: 'paused', + progress: fileState.progress, + pendingFiles: [], // 无法恢复完整列表,需要继续扫描时重新计算 + processedCount: fileState.progress?.current || 0, + abortController: { aborted: true }, + needsRescan: true // 标记需要重新扫描 + }; + this.scanStates.set(libraryId, restored); + return restored; + } + + return { + status: 'idle', + progress: null, + pendingFiles: [], + processedCount: 0 + }; + } + + /** + * 开始扫描 + */ + startScan(libraryId, totalFiles) { + this.scanStates.set(libraryId, { + status: 'scanning', + progress: { current: 0, total: totalFiles, percent: 0 }, + pendingFiles: [], + processedCount: 0, + abortController: { aborted: false } + }); + return this.scanStates.get(libraryId); + } + + /** + * 更新进度 + */ + updateProgress(libraryId, current, total) { + const state = this.scanStates.get(libraryId); + if (state) { + state.progress = { + current, + total, + percent: Math.round((current / total) * 100) + }; + state.processedCount = current; + } + } + + /** + * 停止扫描 + */ + stopScan(libraryId, pendingFiles = []) { + const state = this.scanStates.get(libraryId); + if (state) { + state.status = 'paused'; + state.pendingFiles = pendingFiles; + state.abortController.aborted = true; + // 持久化状态 + this.saveState(libraryId); + console.log(`⏸️ Scan paused for ${libraryId}, ${pendingFiles.length} files pending`); + } + } + + /** + * 检查是否应该停止 + */ + shouldStop(libraryId) { + const state = this.scanStates.get(libraryId); + return state?.abortController?.aborted || false; + } + + /** + * 获取待处理文件 + */ + getPendingFiles(libraryId) { + const state = this.scanStates.get(libraryId); + return state?.pendingFiles || []; + } + + /** + * 恢复扫描 + */ + resumeScan(libraryId) { + const state = this.scanStates.get(libraryId); + if (state && state.status === 'paused') { + const pendingFiles = [...state.pendingFiles]; // 复制一份 + state.status = 'scanning'; + state.abortController = { aborted: false }; + state.pendingFiles = []; // 清空待处理列表 + console.log(`▶️ Scan resumed for ${libraryId}, ${pendingFiles.length} files to process`); + return pendingFiles; + } + return []; + } + + /** + * 完成扫描 + */ + completeScan(libraryId) { + const state = this.scanStates.get(libraryId); + if (state) { + state.status = 'idle'; + state.pendingFiles = []; + state.progress = null; + } + // 清除持久化状态 + this.saveState(libraryId); + } + + /** + * 是否正在扫描 + */ + isScanning(libraryId) { + const state = this.scanStates.get(libraryId); + return state?.status === 'scanning'; + } + + /** + * 是否已暂停 + */ + isPaused(libraryId) { + const state = this.scanStates.get(libraryId); + return state?.status === 'paused'; + } + + /** + * 清除素材库状态(删除素材库时调用) + */ + clearState(libraryId) { + this.scanStates.delete(libraryId); + } + + /** + * 清除所有空闲状态(内存清理) + */ + cleanupIdleStates() { + for (const [libraryId, state] of this.scanStates.entries()) { + if (state.status === 'idle') { + this.scanStates.delete(libraryId); + } + } + } +} + +// 单例 +const scanManager = new ScanManager(); + +module.exports = scanManager; diff --git a/backend/utils/scanner.js b/backend/utils/scanner.js new file mode 100644 index 0000000..0a66c5b --- /dev/null +++ b/backend/utils/scanner.js @@ -0,0 +1,723 @@ +const fs = require('fs'); +const path = require('path'); +const { glob } = require('glob'); +const { + isImageFile, + getFileType, + calculateFileHash, + getImageMetadata, + generateImageThumbnails +} = require('./thumbnail'); +const scanManager = require('./scanManager'); + +/** + * Get all image files in a directory + */ +async function getAllImageFiles(libraryPath) { + // 支持所有文件格式(使用通配符 *.*) + const pattern = path.join(libraryPath, '**', '*.*').replace(/\\/g, '/'); + const files = await glob(pattern, { + nodir: true, + nocase: true, // 大小写不敏感(Windows/macOS) + ignore: ['**/.flypic/**', '**/node_modules/**'] + }); + return files; +} + +/** + * Ensure a folder and its parents exist in DB + */ +function ensureFolderChain(db, folderPath) { + if (!folderPath || folderPath === '.' || folderPath === '') return; + let current = folderPath.replace(/\\/g, '/'); + const visited = new Set(); + while (current && current !== '.' && !visited.has(current)) { + visited.add(current); + const parent = path.posix.dirname(current); + const name = current.split('/').pop(); + const existing = db.getFolderByPath(current); + if (!existing) { + db.insertFolder({ + path: current, + parent_path: parent === '.' ? '' : (parent === current ? '' : parent), + name, + image_count: 0 + }); + } + if (parent === current) break; + current = parent; + } +} + +/** + * Apply changes from file system events quickly without full rescan + * events = { + * filesAdded: [relPath], + * filesChanged: [relPath], + * filesRemoved: [relPath], + * dirsAdded: [relDir], + * dirsRemoved: [relDir] + * } + */ +async function applyChangesFromEvents(libraryPath, db, events) { + try { + // Normalize helper: 统一使用正斜杠,与数据库记录格式一致 + const norm = (p) => path.normalize(p).replace(/\\/g, '/'); + + const affectedFolders = new Set(); + const results = { added: 0, modified: 0, deleted: 0, foldersAdded: 0, foldersRemoved: 0 }; + + // Handle directory additions (ensure chain exists) + for (const dir of (events.dirsAdded || [])) { + const d = norm(dir); + ensureFolderChain(db, d); + results.foldersAdded++; + // update parents too + let cur = d; + while (cur && cur !== '.') { + affectedFolders.add(cur); + const parent = path.dirname(cur); + if (parent === cur) break; + cur = parent; + } + } + + // Handle file additions + for (const file of (events.filesAdded || [])) { + try { + const rel = norm(file); + const full = path.join(libraryPath, rel); + + // 检查文件是否存在 + if (!fs.existsSync(full)) { + console.warn(`File not found, skipping: ${full}`); + continue; + } + + const folder = path.dirname(rel); + ensureFolderChain(db, folder); + await processImage(full, libraryPath, db); + affectedFolders.add(folder); + // parents + let cur = folder; + while (cur && cur !== '.') { + affectedFolders.add(cur); + const parent = path.dirname(cur); + if (parent === cur) break; + cur = parent; + } + results.added++; + } catch (error) { + console.error(`Error processing added file ${file}:`, error.message); + } + } + + // Handle file changes + for (const file of (events.filesChanged || [])) { + try { + const rel = norm(file); + const full = path.join(libraryPath, rel); + + // 检查文件是否存在 + if (!fs.existsSync(full)) { + console.warn(`File not found, skipping: ${full}`); + continue; + } + + await processImage(full, libraryPath, db); + const folder = path.dirname(rel); + affectedFolders.add(folder); + results.modified++; + } catch (error) { + console.error(`Error processing changed file ${file}:`, error.message); + } + } + + // Handle file removals + for (const file of (events.filesRemoved || [])) { + try { + const rel = norm(file); + db.deleteImage(rel); + const folder = path.dirname(rel); + affectedFolders.add(folder); + // parents + let cur = folder; + while (cur && cur !== '.') { + affectedFolders.add(cur); + const parent = path.dirname(cur); + if (parent === cur) break; + cur = parent; + } + results.deleted++; + } catch (error) { + console.error(`Error deleting file ${file}:`, error.message); + } + } + + // Handle directory removals (bulk delete) + for (const dir of (events.dirsRemoved || [])) { + try { + const d = norm(dir); + // delete images and folders under this dir + db.deleteImagesByFolderPrefix(d); + db.deleteFoldersByPrefix(d); + const parent = path.dirname(d); + if (parent && parent !== '.') affectedFolders.add(parent); + results.foldersRemoved++; + } catch (error) { + console.error(`Error deleting directory ${dir}:`, error.message); + } + } + + // Update counts for all affected folders + affectedFolders.forEach((folderPath) => { + if (folderPath && folderPath !== '.') { + try { + db.updateFolderImageCount(folderPath); + } catch (error) { + console.error(`Error updating folder count ${folderPath}:`, error.message); + } + } + }); + + return results; + } catch (error) { + console.error('Error in applyChangesFromEvents:', error); + throw error; + } +} + +/** + * Get folder structure + */ +async function getFolderStructure(libraryPath) { + const folders = []; + + function scanDir(dirPath, parentPath = '') { + const items = fs.readdirSync(dirPath, { withFileTypes: true }); + + for (const item of items) { + if (item.isDirectory() && !item.name.startsWith('.')) { + const fullPath = path.join(dirPath, item.name); + const relativePath = path.relative(libraryPath, fullPath); + const relativePathUnix = relativePath.replace(/\\/g, '/'); + const parentUnix = (parentPath || '').replace(/\\/g, '/'); + + folders.push({ + path: relativePathUnix, + parent_path: parentUnix, + name: item.name, + image_count: 0 + }); + + scanDir(fullPath, relativePathUnix); + } + } + } + + scanDir(libraryPath); + return folders; +} + +/** + * Process a single image file + */ +/** + * Process a single image file + * @param {boolean} dryRun - If true, return data instead of inserting into DB (for batch write) + */ +async function processImage(imagePath, libraryPath, db, dryRun = false) { + try { + const relativePath = path.relative(libraryPath, imagePath); + const filename = path.basename(imagePath); + const folderRaw = path.dirname(relativePath); + const folder = folderRaw === '.' ? '' : folderRaw.replace(/\\/g, '/'); + + // Check if image already exists in database + const existing = db.getImageByPath(relativePath.replace(/\\/g, '/')); + const currentHash = calculateFileHash(imagePath); + + // For unchanged files, check whether thumbnails need upgrade/regeneration + let needRegenThumbs = false; + if (existing) { + const flypicDir = path.join(libraryPath, '.flypic'); + const filenameOnly = (existing.thumbnail_path || '').replace(/\\/g, '/').split('/').pop(); + if (filenameOnly) { + // Calculate sharded path + const hash = filenameOnly.replace(/\.[^/.]+$/, ""); // remove extension + const shard1 = hash.slice(0, 2); + // New structure: .flypic/thumbnails/ab/hash.webp + const expectedPath = path.join(flypicDir, 'thumbnails', shard1, filenameOnly); + + // 需要重建的情况:新结构文件不存在 + if (!fs.existsSync(expectedPath)) { + needRegenThumbs = true; + } + } else { + needRegenThumbs = true; + } + } + + // Skip only if unchanged and thumbnails are up-to-date + if (existing && existing.file_hash === currentHash && !needRegenThumbs) { + return { status: 'skipped', path: relativePath }; + } + + // Get image metadata + const metadata = await getImageMetadata(imagePath); + if (!metadata) { + return { status: 'error', path: relativePath, error: 'Failed to read metadata' }; + } + + // Generate thumbnails (also for unchanged files when thumbnails missing/outdated) + const thumbnails = await generateImageThumbnails(imagePath, libraryPath); + const fileType = getFileType(imagePath); + + // 使用缩略图的实际尺寸(对于视频/PSD,这是提取后的真实尺寸) + const actualWidth = thumbnails.width || metadata.width; + const actualHeight = thumbnails.height || metadata.height; + + const imageData = { + path: relativePath.replace(/\\/g, '/'), + filename: filename, + folder: folder, + size: metadata.size, + width: actualWidth, + height: actualHeight, + format: metadata.format, + file_type: fileType, + created_at: Math.floor(metadata.created_at), + modified_at: Math.floor(metadata.modified_at), + file_hash: currentHash, + thumbnail_path: thumbnails.thumbnail_path, + thumbnail_size: thumbnails.thumbnail_size + }; + + if (dryRun) { + return { status: 'processed', path: relativePath, data: imageData }; + } + + // Insert/update in database + db.insertImage(imageData); + + return { status: 'processed', path: relativePath }; + } catch (error) { + console.error('Error processing image:', imagePath, error); + return { status: 'error', path: imagePath, error: error.message }; + } +} + +/** + * Scan library and update database + * @param {string} libraryPath - 素材库路径 + * @param {object} db - 数据库实例 + * @param {function} onProgress - 进度回调 + * @param {string} libraryId - 素材库ID(用于停止控制) + * @param {Array} resumeFiles - 继续扫描时的待处理文件列表 + */ +/** + * Scan library and update database + * @param {string} libraryPath - 素材库路径 + * @param {object} db - 数据库实例 + * @param {function} onProgress - 进度回调 + * @param {string} libraryId - 素材库ID(用于停止控制) + * @param {Array} resumeFiles - 继续扫描时的待处理文件列表 + */ +async function scanLibrary(libraryPath, db, onProgress, libraryId = null, resumeFiles = null) { + try { + let files; + + // 动态导入 p-limit + const pLimit = (await import('p-limit')).default; + + // 根据 CPU 核心数动态调整并发数 + const os = require('os'); + const cpuCount = os.cpus().length; + // 默认并发数:核心数 - 1,最小 4,最大 16 + const concurrency = Math.max(4, Math.min(16, cpuCount - 1)); + const limit = pLimit(concurrency); + + console.log(`🚀 Starting scan with concurrency: ${concurrency} (CPU cores: ${cpuCount})`); + + if (resumeFiles && resumeFiles.length > 0) { + // 继续扫描:使用待处理文件列表 + files = resumeFiles; + console.log(`▶️ Resuming scan with ${files.length} pending files`); + } else { + // 新扫描:获取所有文件 + files = await getAllImageFiles(libraryPath); + console.log(`Found ${files.length} images in library`); + + // Get folder structure + const folders = await getFolderStructure(libraryPath); + // 使用事务批量插入文件夹 + const insertFolders = db.db.transaction((folders) => { + for (const folder of folders) db.insertFolder(folder); + }); + insertFolders(folders); + } + + const total = files.length; + + // 初始化扫描状态 + if (libraryId) { + scanManager.startScan(libraryId, total); + } + + const results = { + processed: 0, + skipped: 0, + errors: 0, + stopped: false + }; + + const startTime = Date.now(); + let processedCount = 0; + + // 批量写入缓冲区 + let writeBuffer = []; + const WRITE_BATCH_SIZE = 100; // 每 100 条写入一次数据库 + + // 批量写入函数(事务) + const batchWrite = db.db.transaction((items) => { + for (const item of items) { + if (item.status === 'processed' && item.data) { + db.insertImage(item.data); + } + } + }); + + // 处理单个文件的包装函数 + const processFile = async (file) => { + // 检查是否需要停止 + if (libraryId && scanManager.shouldStop(libraryId)) { + return { status: 'stopped', file }; + } + + try { + const result = await processImage(file, libraryPath, db, true); // true = dryRun (不直接写入DB) + return result; + } catch (error) { + return { status: 'error', path: file, error: error.message }; + } + }; + + // 创建所有任务 + const tasks = files.map(file => limit(async () => { + // 如果已经停止,直接返回 + if (results.stopped) return; + + const result = await processFile(file); + + if (result.status === 'stopped') { + results.stopped = true; + return; + } + + // 更新统计 + if (result.status === 'processed') results.processed++; + else if (result.status === 'skipped') results.skipped++; + else if (result.status === 'error') results.errors++; + + // 添加到写入缓冲区 + if (result.status === 'processed') { + writeBuffer.push(result); + + // 缓冲区满,执行批量写入 + if (writeBuffer.length >= WRITE_BATCH_SIZE) { + batchWrite(writeBuffer); + writeBuffer = []; + } + } + + processedCount++; + + // 报告进度 (每完成 10 个文件报告一次,避免过于频繁) + if (processedCount % 10 === 0 || processedCount === total) { + const current = processedCount; + + if (libraryId) { + scanManager.updateProgress(libraryId, current, total); + } + + if (onProgress) { + const elapsed = Date.now() - startTime; + const avgTimePerImage = elapsed / current; + const remaining = total - current; + const estimatedTimeLeft = Math.round((remaining * avgTimePerImage) / 1000); + + onProgress({ + total, + current, + percent: Math.round((current / total) * 100), + currentFile: file, + estimatedTimeLeft, + canStop: true + }); + } + } + + // 性能日志 + if (processedCount > 0 && processedCount % 1000 === 0) { + const elapsed = (Date.now() - startTime) / 1000; + const speed = processedCount / elapsed; + console.log(`⚡ Performance: ${speed.toFixed(1)} images/sec, ${processedCount}/${total} completed`); + } + })); + + // 等待所有任务完成 + await Promise.all(tasks); + + // 写入剩余的缓冲区数据 + if (writeBuffer.length > 0) { + batchWrite(writeBuffer); + writeBuffer = []; + } + + // 处理停止情况 + if (results.stopped) { + const pendingFiles = files.slice(processedCount); + scanManager.stopScan(libraryId, pendingFiles); + console.log(`⏸️ Scan stopped at ${processedCount}/${total}, ${pendingFiles.length} files pending`); + return results; + } + + const totalTime = (Date.now() - startTime) / 1000; + console.log(`✅ Scan completed in ${totalTime.toFixed(1)}s, speed: ${(total / totalTime).toFixed(1)} images/sec`); + + // Update folder image counts + db.updateAllFolderCounts(); + + // 标记扫描完成 + if (libraryId) { + scanManager.completeScan(libraryId); + } + + console.log('Scan complete:', results); + return results; + } catch (error) { + console.error('Error scanning library:', error); + if (libraryId) { + scanManager.completeScan(libraryId); + } + throw error; + } +} + +/** + * Sync library (incremental scan) + */ +async function syncLibrary(libraryPath, db, forceRebuildFolders = false, onProgress = null) { + try { + const startTime = Date.now(); + + // Get all current files (统一使用正斜杠) + const currentFiles = await getAllImageFiles(libraryPath); + const currentPaths = new Set( + currentFiles.map(file => path.relative(libraryPath, file).replace(/\\/g, '/')) + ); + + // Get database files (已经是正斜杠格式) + const dbImages = db.getAllImages(); + const dbPaths = new Set(dbImages.map(img => (img.path || '').replace(/\\/g, '/'))); + + // Find new, modified, and deleted files + const toAdd = [...currentPaths].filter(p => !dbPaths.has(p)); + const toCheck = [...currentPaths].filter(p => dbPaths.has(p)); + let toDelete = [...dbPaths].filter(p => !currentPaths.has(p)); + + console.log(`Sync: ${toAdd.length} new, ${toCheck.length} to check, ${toDelete.length} deleted`); + + // 安全检查:如果要删除的文件数量超过数据库中文件的50%,可能是路径匹配问题 + if (toDelete.length > 0 && dbImages.length > 0) { + const deleteRatio = toDelete.length / dbImages.length; + if (deleteRatio > 0.5 && toDelete.length > 10) { + console.warn(`⚠️ 安全检查:要删除 ${toDelete.length}/${dbImages.length} (${(deleteRatio * 100).toFixed(1)}%) 的文件,这可能是路径匹配问题,跳过删除操作`); + console.log('示例 currentPath:', [...currentPaths].slice(0, 3)); + console.log('示例 dbPath:', [...dbPaths].slice(0, 3)); + // 清空 toDelete,不执行删除 + toDelete = []; + } + } + + const total = toAdd.length + toDelete.length; + let processed = 0; + + // Process new files in batches + const batchSize = 100; + for (let i = 0; i < toAdd.length; i += batchSize) { + const batch = toAdd.slice(i, i + batchSize); + await Promise.all( + batch.map(relativePath => { + const fullPath = path.join(libraryPath, relativePath); + return processImage(fullPath, libraryPath, db); + }) + ); + + processed += batch.length; + + // 报告进度 + if (onProgress && total > 0) { + onProgress({ + total, + current: processed, + percent: Math.round((processed / total) * 100), + currentFile: batch[batch.length - 1] + }); + } + } + + // Check modified files in batches (只检查hash,不重新处理) + const modifiedCount = toCheck.filter(relativePath => { + const fullPath = path.join(libraryPath, relativePath); + const existing = db.getImageByPath(relativePath); + const currentHash = calculateFileHash(fullPath); + return existing.file_hash !== currentHash; + }).length; + + console.log(`Found ${modifiedCount} modified files (skipped, hash unchanged)`); + + // Delete removed files + for (const relativePath of toDelete) { + db.deleteImage(relativePath); + // TODO: Clean up thumbnail files + } + + // Rebuild folder structure if there are changes or forced + if (toAdd.length > 0 || toDelete.length > 0 || forceRebuildFolders) { + console.log('Rebuilding folder structure...'); + + // Get current folder structure from file system + const currentFolders = await getFolderStructure(libraryPath); + + // Get existing folders from database + const dbFolders = db.getAllFolders(); + const dbFolderPaths = new Set(dbFolders.map(f => f.path)); + + // Find new and deleted folders + const currentFolderPaths = new Set(currentFolders.map(f => f.path)); + const foldersToAdd = currentFolders.filter(f => !dbFolderPaths.has(f.path)); + const foldersToDelete = dbFolders.filter(f => !currentFolderPaths.has(f.path)); + + // Add new folders + foldersToAdd.forEach(folder => { + db.insertFolder(folder); + }); + + // Delete removed folders + foldersToDelete.forEach(folder => { + db.deleteFolder(folder.path); + }); + + console.log(`Folders: +${foldersToAdd.length}, -${foldersToDelete.length}`); + + // Update folder image counts + console.log('Updating folder image counts...'); + const affectedFolders = new Set(); + + // Collect all affected folders (including parent folders) + [...toAdd, ...toDelete].forEach(relativePath => { + let folderPath = path.dirname(relativePath); + + // Add current folder and all parent folders + while (folderPath && folderPath !== '.') { + affectedFolders.add(folderPath); + const parent = path.dirname(folderPath); + if (parent === folderPath) break; // Reached root + folderPath = parent; + } + }); + + // Update counts for all affected folders + affectedFolders.forEach(folderPath => { + db.updateFolderImageCount(folderPath); + }); + + console.log(`Updated ${affectedFolders.size} folder counts`); + } + + const totalTime = (Date.now() - startTime) / 1000; + console.log(`✅ Sync completed in ${totalTime.toFixed(1)}s`); + + return { + added: toAdd.length, + modified: modifiedCount, + deleted: toDelete.length + }; + } catch (error) { + console.error('Error syncing library:', error); + throw error; + } +} + +/** + * Quick sync - 只检查新增/删除,不检查修改(用于启动时快速检测) + */ +async function quickSync(libraryPath, db) { + const startTime = Date.now(); + + // 获取当前文件(统一使用正斜杠) + const currentFiles = await getAllImageFiles(libraryPath); + const currentPaths = new Set( + currentFiles.map(file => path.relative(libraryPath, file).replace(/\\/g, '/')) + ); + + // 获取数据库文件 + const dbImages = db.getAllImages(); + const dbPaths = new Set(dbImages.map(img => (img.path || '').replace(/\\/g, '/'))); + + // 只检查新增和删除(不检查修改) + const toAdd = [...currentPaths].filter(p => !dbPaths.has(p)); + let toDelete = [...dbPaths].filter(p => !currentPaths.has(p)); + + // 安全检查 + if (toDelete.length > 0 && dbImages.length > 0) { + const deleteRatio = toDelete.length / dbImages.length; + if (deleteRatio > 0.5 && toDelete.length > 10) { + console.warn(`⚠️ 安全检查:跳过删除 ${toDelete.length} 个文件`); + toDelete = []; + } + } + + // 处理新增文件 + for (const relativePath of toAdd) { + try { + const fullPath = path.join(libraryPath, relativePath); + // 确保文件夹链存在 + const folder = path.dirname(relativePath).replace(/\\/g, '/'); + if (folder && folder !== '.') { + ensureFolderChain(db, folder); + } + await processImage(fullPath, libraryPath, db); + } catch (err) { + console.error(`Error adding ${relativePath}:`, err.message); + } + } + + // 删除已移除的文件 + for (const relativePath of toDelete) { + db.deleteImage(relativePath); + } + + // 如果有变化,更新所有文件夹的图片数量 + if (toAdd.length > 0 || toDelete.length > 0) { + db.updateAllFolderCounts(); + } + + const elapsed = Date.now() - startTime; + if (toAdd.length > 0 || toDelete.length > 0) { + console.log(`Quick sync: +${toAdd.length} -${toDelete.length} (${elapsed}ms)`); + } + + return { added: toAdd.length, deleted: toDelete.length }; +} + +module.exports = { + getAllImageFiles, + getFolderStructure, + processImage, + scanLibrary, + syncLibrary, + quickSync, + applyChangesFromEvents +}; diff --git a/backend/utils/thumbnail.js b/backend/utils/thumbnail.js new file mode 100644 index 0000000..d54c2a7 --- /dev/null +++ b/backend/utils/thumbnail.js @@ -0,0 +1,642 @@ +const sharp = require('sharp'); +const path = require('path'); +const fs = require('fs'); +const crypto = require('crypto'); + +// 支持的文件格式(确定可以生成缩略图的) +const IMAGE_FORMATS = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif', 'avif', 'heif', 'heic', 'svg']; + +// 文件类型分类(用于显示和占位图) +const FILE_CATEGORIES = { + // 图片类 + image: ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif', 'avif', 'heif', 'heic', 'svg', 'ico', 'raw', 'cr2', 'nef', 'dng'], + + // 视频类 + video: ['mp4', 'webm', 'mov', 'avi', 'mkv', 'flv', 'm4v', 'wmv', 'mpg', 'mpeg', '3gp', 'ts', 'vob', 'ogv'], + + // 音频类 + audio: ['mp3', 'wav', 'flac', 'aac', 'm4a', 'ogg', 'wma', 'ape', 'alac', 'opus', 'aiff'], + + // 文档类 + document: [ + 'pdf', 'txt', 'md', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', + 'rtf', 'odt', 'ods', 'odp', 'csv', 'pages', 'numbers', 'key' + ], + + // 设计类 + design: ['psd', 'ai', 'sketch', 'xd', 'fig', 'figma', 'indd', 'eps', 'cdr', 'dwg'] +}; + +// 为了兼容旧代码 +const SUPPORTED_FORMATS = { + image: IMAGE_FORMATS, + video: FILE_CATEGORIES.video, + document: FILE_CATEGORIES.document, + special: FILE_CATEGORIES.design +}; + +// 所有支持的格式(扁平化,兼容所有文件) +const ALL_FORMATS = [ + ...FILE_CATEGORIES.image, + ...FILE_CATEGORIES.video, + ...FILE_CATEGORIES.audio, + ...FILE_CATEGORIES.document, + ...FILE_CATEGORIES.design +]; + +/** + * 获取文件类型分类 + */ +function getFileType(filename) { + const ext = path.extname(filename).toLowerCase().slice(1); + + // 检查所有分类 + if (FILE_CATEGORIES.image.includes(ext)) return 'image'; + if (FILE_CATEGORIES.video.includes(ext)) return 'video'; + if (FILE_CATEGORIES.audio.includes(ext)) return 'audio'; + if (FILE_CATEGORIES.document.includes(ext)) return 'document'; + if (FILE_CATEGORIES.design.includes(ext)) return 'design'; + + // 未知类型也兼容,归类为 other + return 'other'; +} + +/** + * 检查文件是否可以用 Sharp 生成缩略图 + */ +function canGenerateThumbnail(filename) { + const ext = path.extname(filename).toLowerCase().slice(1); + return IMAGE_FORMATS.includes(ext); +} + +/** + * Check if file is supported + */ +function isImageFile(filename) { + const ext = path.extname(filename).toLowerCase().slice(1); + return ALL_FORMATS.includes(ext); +} + +/** + * Calculate file hash for change detection + */ +function calculateFileHash(filePath) { + const fileBuffer = fs.readFileSync(filePath); + const hashSum = crypto.createHash('md5'); + hashSum.update(fileBuffer); + return hashSum.digest('hex'); +} + +/** + * Get thumbnail configuration based on original image size + * 分阶段策略:根据原图大小使用不同的缩略图尺寸和质量 + * + * 策略说明: + * - 小图(<1MP):保持原尺寸或轻微缩小,高质量 + * - 中图(1-4MP):缩略图 200px 高,高质量 + * - 大图(4-12MP):缩略图 250px 高,中高质量 + * - 超大图(>12MP):缩略图 300px 高,中等质量 + */ +function getThumbnailConfig(originalWidth, originalHeight, targetHeight = 200) { + const originalPixels = originalWidth * originalHeight; + const aspectRatio = originalWidth / originalHeight; + + let finalHeight, finalQuality, targetSize; + + // 分阶段策略 - 提高质量,扩大文件大小 + if (originalPixels < 1000000) { + // 小图 <1MP(如 1000x1000):保持较小尺寸,极高质量 + finalHeight = Math.min(targetHeight, originalHeight); + finalQuality = 95; + targetSize = { min: 80 * 1024, max: 240 * 1024 }; // 80-240KB + } + else if (originalPixels < 4000000) { + // 中图 1-4MP(如 2000x2000):标准尺寸,极高质量 + finalHeight = Math.min(targetHeight, originalHeight); + finalQuality = 93; + targetSize = { min: 120 * 1024, max: 300 * 1024 }; // 120-300KB + } + else if (originalPixels < 12000000) { + // 大图 4-12MP(如 4000x3000):增大尺寸,高质量 + finalHeight = Math.min(targetHeight, originalHeight); + finalQuality = 91; + targetSize = { min: 160 * 1024, max: 400 * 1024 }; // 160-400KB + } + else { + // 超大图 >12MP(如 6000x4000):更大尺寸,高质量 + finalHeight = Math.min(targetHeight, originalHeight); + finalQuality = 89; + targetSize = { min: 200 * 1024, max: 500 * 1024 }; // 200-500KB + } + + const finalWidth = Math.round(aspectRatio * finalHeight); + + // 计算原图大小(MP) + const megaPixels = (originalPixels / 1000000).toFixed(1); + + return { + width: finalWidth, + height: finalHeight, + quality: finalQuality, + targetSize: targetSize, + format: 'webp', + originalPixels: originalPixels, + megaPixels: megaPixels + }; +} + +/** + * Generate thumbnail for an image with high quality settings + * + * 核心优化点: + * 1. 禁用 smartSubsample,保持色彩锐度(关键!) + * 2. 使用更强的 unsharp mask 锐化 + * 3. 固定高质量 Q96,不动态调整 + * 4. 不修改色彩(饱和度/亮度),保持原图风格 + */ +async function generateThumbnail(inputPath, outputPath, targetHeight = 200) { + try { + // 先读取文件到 Buffer,避免 Sharp 锁定文件句柄 + const inputBuffer = fs.readFileSync(inputPath); + + // Get image metadata from buffer + const metadata = await sharp(inputBuffer).metadata(); + const config = getThumbnailConfig(metadata.width, metadata.height, targetHeight); + const hasAlpha = Boolean(metadata.hasAlpha); + + // 计算缩小比例,用于调整锐化强度 + const downscaleRatio = metadata.height ? (metadata.height / config.height) : 1; + + // 锐化参数:根据缩小比例动态调整 + // sharpen(sigma, flat, jagged) - sigma: 高斯模糊半径, flat: 平坦区域锐化, jagged: 边缘锐化 + let sharpSigma, sharpFlat, sharpJagged; + if (downscaleRatio >= 4) { + // 大幅缩小(如 4000px → 300px):强锐化 + sharpSigma = 1.2; + sharpFlat = 1.0; + sharpJagged = 2.0; + } else if (downscaleRatio >= 2) { + // 中等缩小:中等锐化 + sharpSigma = 1.0; + sharpFlat = 0.8; + sharpJagged = 1.5; + } else { + // 轻微缩小或不缩小:轻度锐化 + sharpSigma = 0.8; + sharpFlat = 0.5; + sharpJagged = 1.0; + } + + // 固定高质量 92(平衡清晰度和体积) + const quality = 92; + + // 生成缩略图(使用 buffer,不锁定原文件) + await sharp(inputBuffer) + .rotate() // 按EXIF旋转 + .resize(config.width, config.height, { + fit: 'cover', + position: 'center', + kernel: 'lanczos3', // 最高质量缩放算法 + withoutEnlargement: true, + fastShrinkOnLoad: false // 禁用快速缩小,保持质量 + }) + // 锐化:使用完整的 unsharp mask 参数(不修改色彩) + .sharpen({ + sigma: sharpSigma, // 高斯模糊半径 + m1: sharpFlat, // 平坦区域锐化强度 + m2: sharpJagged, // 边缘/锯齿区域锐化强度 + x1: 2, // 平坦区域阈值 + y2: 10, // 边缘区域阈值上限 + y3: 20 // 最大锐化限制 + }) + .webp({ + quality: quality, + effort: 4, // 降低 effort,减少编码损失 + smartSubsample: false, // 关键!禁用色度子采样,保持边缘清晰 + nearLossless: false, // 禁用近无损(会增加体积但不增加清晰度) + preset: 'photo', + alphaQuality: hasAlpha ? 100 : undefined + }) + .toFile(outputPath); + + // 获取文件大小 + const stats = fs.statSync(outputPath); + const finalSize = stats.size; + + // 可选:输出详细信息(每100张输出一次,避免日志过多) + const shouldLog = Math.random() < 0.01; // 1% 概率输出 + if (shouldLog) { + const sizeKB = (finalSize / 1024).toFixed(1); + console.log(`📸 Thumbnail: ${config.megaPixels}MP → ${config.width}x${config.height} (${sizeKB}KB, Q${quality}, ratio ${downscaleRatio.toFixed(1)}x)`); + } + + return { + width: config.width, + height: config.height, + size: finalSize, + quality: quality, + originalPixels: config.originalPixels, + path: outputPath + }; + } catch (error) { + console.error('Error generating thumbnail:', error); + throw error; + } +} + +/** + * Get file metadata (支持所有文件类型) + * 优化:优先使用流式读取,避免加载整个文件到内存 + */ +async function getImageMetadata(imagePath) { + try { + const stats = fs.statSync(imagePath); + const fileType = getFileType(imagePath); + + // 对于图片文件,尝试获取详细元数据 + if (fileType === 'image') { + try { + // 优化:直接传入路径,让 sharp 使用流式读取,仅读取头部元数据 + // 只有在失败时才回退到 Buffer 读取 + const metadata = await sharp(imagePath).metadata(); + return { + width: metadata.width, + height: metadata.height, + format: metadata.format, + size: stats.size, + created_at: stats.birthtimeMs, + modified_at: stats.mtimeMs + }; + } catch (sharpError) { + // Sharp 无法处理某些图片格式(如 SVG)或路径问题,回退到基础信息 + // console.warn(`Sharp cannot process ${imagePath}, using basic metadata`); + } + } + + // 对于非图片文件或 Sharp 失败的情况,返回基础信息 + const ext = path.extname(imagePath).toLowerCase().slice(1); + return { + width: 640, // 占位图尺寸 + height: 480, + format: ext, + size: stats.size, + created_at: stats.birthtimeMs, + modified_at: stats.mtimeMs + }; + } catch (error) { + console.error('Error getting file metadata:', imagePath, error); + return null; + } +} + +/** + * Generate thumbnail for a file (image/video/document) + * 使用 480px 高度(与 Billfish 一致) + */ +async function generateImageThumbnails(imagePath, libraryPath) { + const flypicDir = path.join(libraryPath, '.flypic'); + const relativePath = path.relative(libraryPath, imagePath); + const hash = crypto.createHash('md5').update(relativePath).digest('hex'); + const fileType = getFileType(imagePath); + + console.log(`📝 Processing file: ${path.basename(imagePath)}, type: ${fileType}`); + + // Sharding: use first 2 chars of hash for subdirectories (e.g. /ab/) + const shard1 = hash.slice(0, 2); + // 1-level sharding: .flypic/thumbnails/ab/hash.webp + const out480 = path.join(flypicDir, 'thumbnails', shard1, `${hash}.webp`); + fs.mkdirSync(path.dirname(out480), { recursive: true }); + + let thumbnailResult; + + // 根据文件类型生成不同的缩略图 + const ext = path.extname(imagePath).slice(1).toUpperCase(); + + if (fileType === 'image' && canGenerateThumbnail(imagePath)) { + // 图片:使用 Sharp 生成真实缩略图 + thumbnailResult = await generateThumbnail(imagePath, out480, 480); + } else if (fileType === 'video') { + // 视频:尝试提取封面 + console.log(`🎬 Extracting video thumbnail for: ${path.basename(imagePath)}`); + thumbnailResult = await extractVideoThumbnail(imagePath, out480); + + // 如果提取失败,生成占位图 + if (!thumbnailResult) { + console.log(`🎬 Generating video placeholder for: ${path.basename(imagePath)}`); + thumbnailResult = await generatePlaceholderThumbnail(out480, 'video', ext); + } + } else if (fileType === 'design') { + // 设计文件:尝试提取嵌入缩略图(仅 PSD) + if (ext.toLowerCase() === 'psd') { + console.log(`🎨 Extracting PSD thumbnail for: ${path.basename(imagePath)}`); + thumbnailResult = await extractPSDThumbnail(imagePath, out480); + } + + // 如果提取失败或不是 PSD,生成占位图 + if (!thumbnailResult) { + console.log(`🎨 Generating design placeholder for: ${path.basename(imagePath)}`); + thumbnailResult = await generatePlaceholderThumbnail(out480, 'design', ext); + } + } else { + // 其他类型(音频/文档/未知):生成占位图 + console.log(`📦 Generating ${fileType} placeholder for: ${path.basename(imagePath)}`); + thumbnailResult = await generatePlaceholderThumbnail(out480, fileType, ext); + } + + console.log(`✅ Thumbnail generated: ${path.basename(out480)}, ${thumbnailResult.width}x${thumbnailResult.height}, ${(thumbnailResult.size / 1024).toFixed(1)}KB`); + + return { + thumbnail_path: path.relative(flypicDir, out480), + thumbnail_size: thumbnailResult.size, + width: thumbnailResult.width, + height: thumbnailResult.height, + file_type: fileType + }; +} + +/** + * 从 PSD 文件提取嵌入的缩略图 + */ +async function extractPSDThumbnail(psdPath, outputPath) { + try { + const buffer = fs.readFileSync(psdPath); + + // PSD 文件格式: + // 前 4 字节: "8BPS" (签名) + // 偏移 26: Image Resources Section + // 查找 Resource ID 1036 (缩略图资源) + + if (buffer.toString('utf8', 0, 4) !== '8BPS') { + throw new Error('Not a valid PSD file'); + } + + // 读取 Image Resources Section 长度 + const colorModeLength = buffer.readUInt32BE(26); + const imageResourcesOffset = 26 + 4 + colorModeLength; + const imageResourcesLength = buffer.readUInt32BE(imageResourcesOffset); + + let offset = imageResourcesOffset + 4; + const endOffset = offset + imageResourcesLength; + + // 查找缩略图资源 (ID 1033 或 1036) + while (offset < endOffset) { + const signature = buffer.toString('utf8', offset, offset + 4); + if (signature !== '8BIM') break; + + const resourceId = buffer.readUInt16BE(offset + 4); + const nameLength = buffer.readUInt8(offset + 6); + const namePadding = nameLength % 2 === 0 ? nameLength + 2 : nameLength + 1; + const dataSize = buffer.readUInt32BE(offset + 6 + namePadding); + const dataPadding = dataSize % 2 === 0 ? dataSize : dataSize + 1; + + // 1033 = 缩略图 (旧格式), 1036 = 缩略图 (新格式) + if (resourceId === 1033 || resourceId === 1036) { + const dataOffset = offset + 6 + namePadding + 4; + + // 跳过前 28 字节的头部信息 + const jpegOffset = dataOffset + 28; + const jpegData = buffer.slice(jpegOffset, jpegOffset + dataSize - 28); + + // 先获取原始缩略图尺寸 + const metadata = await sharp(jpegData).metadata(); + console.log(` 📐 PSD embedded thumbnail: ${metadata.width}x${metadata.height}`); + + // 使用高质量缩放,保持宽高比 + const aspectRatio = metadata.width / metadata.height; + const targetHeight = 480; + const targetWidth = Math.round(targetHeight * aspectRatio); + + // 根据原始尺寸调整处理策略 + let resizeOptions, sharpenOptions, webpQuality; + + if (metadata.width >= 1000 || metadata.height >= 1000) { + // 高分辨率缩略图(≥1000px):正常缩放 + resizeOptions = { + fit: 'inside', + kernel: 'lanczos3', + withoutEnlargement: true + }; + sharpenOptions = { sigma: 0.8, m1: 0.5, m2: 1.0 }; + webpQuality = 95; + } else if (metadata.width >= 500 || metadata.height >= 500) { + // 中等分辨率(500-1000px):轻微放大 + 强锐化 + resizeOptions = { + fit: 'inside', + kernel: 'lanczos3', + withoutEnlargement: false // 允许放大 + }; + sharpenOptions = { sigma: 1.2, m1: 1.0, m2: 2.0 }; // 强锐化 + webpQuality = 96; + } else { + // 低分辨率(<500px):放大 + 超强锐化 + resizeOptions = { + fit: 'inside', + kernel: 'lanczos3', + withoutEnlargement: false + }; + sharpenOptions = { sigma: 1.5, m1: 1.2, m2: 2.5 }; // 超强锐化 + webpQuality = 98; // 最高质量 + } + + await sharp(jpegData) + .resize(targetWidth, targetHeight, resizeOptions) + .sharpen(sharpenOptions) + .webp({ + quality: webpQuality, + effort: 4, + smartSubsample: false + }) + .toFile(outputPath); + + const stats = fs.statSync(outputPath); + console.log(` ✅ PSD thumbnail extracted: ${(stats.size / 1024).toFixed(1)}KB`); + return { + width: targetWidth, + height: targetHeight, + size: stats.size, + path: outputPath + }; + } + + offset += 6 + namePadding + 4 + dataPadding; + } + + throw new Error('No thumbnail found in PSD'); + } catch (error) { + console.warn(`Failed to extract PSD thumbnail: ${error.message}`); + return null; + } +} + +/** + * 从视频提取封面(使用 ffmpeg 或系统工具) + * 注意:这需要系统安装 ffmpeg,如果没有则回退到占位图 + */ +async function extractVideoThumbnail(videoPath, outputPath) { + try { + const { exec } = require('child_process'); + const util = require('util'); + const execPromise = util.promisify(exec); + + // 检查是否有 ffmpeg + try { + await execPromise('ffmpeg -version', { timeout: 2000 }); + } catch (e) { + console.warn(' ⚠️ ffmpeg not found, skipping video thumbnail extraction'); + return null; + } + + // 使用 ffmpeg 提取第 2 秒的帧(避免黑屏) + const tempJpg = outputPath.replace('.webp', '_temp.jpg'); + const ffmpegCmd = `ffmpeg -i "${videoPath}" -ss 00:00:02 -vframes 1 -q:v 2 "${tempJpg}" -y`; + + await execPromise(ffmpegCmd, { timeout: 10000 }); + + // 如果生成了 JPG,转换为 WebP + if (fs.existsSync(tempJpg)) { + // 先获取实际尺寸 + const metadata = await sharp(tempJpg).metadata(); + console.log(` 📐 Video frame: ${metadata.width}x${metadata.height}`); + + // 保持宽高比缩放到 480 高度 + const aspectRatio = metadata.width / metadata.height; + const targetHeight = 480; + const targetWidth = Math.round(targetHeight * aspectRatio); + + await sharp(tempJpg) + .resize(targetWidth, targetHeight, { + fit: 'cover', + position: 'center', + kernel: 'lanczos3', + withoutEnlargement: true + }) + .webp({ quality: 92, smartSubsample: false }) + .toFile(outputPath); + + fs.unlinkSync(tempJpg); // 删除临时 JPG + + const stats = fs.statSync(outputPath); + console.log(` ✅ Video thumbnail extracted: ${targetWidth}x${targetHeight}, ${(stats.size / 1024).toFixed(1)}KB`); + return { + width: targetWidth, + height: targetHeight, + size: stats.size, + path: outputPath + }; + } + + return null; + } catch (error) { + console.warn(` ⚠️ Failed to extract video thumbnail: ${error.message}`); + return null; + } +} + +/** + * 生成占位缩略图(用于视频/文档等) + */ +async function generatePlaceholderThumbnail(outputPath, type, label) { + // 使用 Sharp 生成简单的占位图 + const width = 640; + const height = 480; + + // 不同类型的背景色和图标 + const typeConfig = { + image: { + color: { r: 99, g: 102, b: 241 }, // 靛蓝色 + icon: '🖼️', + text: '图片' + }, + video: { + color: { r: 59, g: 130, b: 246 }, // 蓝色 + icon: '🎬', + text: '视频' + }, + audio: { + color: { r: 236, g: 72, b: 153 }, // 粉色 + icon: '🎵', + text: '音频' + }, + document: { + color: { r: 16, g: 185, b: 129 }, // 绿色 + icon: '📄', + text: '文档' + }, + design: { + color: { r: 168, g: 85, b: 247 }, // 紫色 + icon: '🎨', + text: '设计' + }, + other: { + color: { r: 107, g: 114, b: 128 }, // 灰色 + icon: '📁', + text: '其他' + } + }; + + const config = typeConfig[type] || typeConfig.other; + + const color = config.color; + + // 创建渐变背景 + 图标 + 文件扩展名 + const svg = ` + + + + + + + + + + ${config.icon} + + + .${label.toLowerCase()} + + + ${config.text}文件 + + + 双击在默认应用中打开 + + + `; + + await sharp(Buffer.from(svg)) + .resize(640, 480) + .webp({ quality: 85 }) + .toFile(outputPath); + + const stats = fs.statSync(outputPath); + return { + width: 640, + height: 480, + size: stats.size, + path: outputPath + }; +} + +/** + * 获取文件类型对应的图标(Unicode) + */ +function getIconForType(type) { + const icons = { + video: '🎬', + document: '📄', + special: '🎨' + }; + return icons[type] || '📁'; +} + +module.exports = { + isImageFile, + getFileType, + calculateFileHash, + getThumbnailConfig, + generateThumbnail, + getImageMetadata, + generateImageThumbnails, + SUPPORTED_FORMATS, + ALL_FORMATS +}; diff --git a/dev.bat b/dev.bat new file mode 100644 index 0000000..b13a052 --- /dev/null +++ b/dev.bat @@ -0,0 +1,18 @@ +@echo off +echo ======================================== +echo FlyPic - Development Mode +echo ======================================== +echo. +echo Starting backend server... +echo Backend: http://localhost:5002 +echo. +echo Please open another terminal and run: +echo npm run dev:frontend +echo. +echo Frontend will be at: http://localhost:5173 +echo. +echo Press Ctrl+C to stop backend +echo. + +cd backend +call npm run dev diff --git a/flypic/ICON.PNG b/flypic/ICON.PNG new file mode 100644 index 0000000..d403d35 Binary files /dev/null and b/flypic/ICON.PNG differ diff --git a/flypic/ICON_256.PNG b/flypic/ICON_256.PNG new file mode 100644 index 0000000..079d8e9 Binary files /dev/null and b/flypic/ICON_256.PNG differ diff --git a/flypic/app/server/database/db.js b/flypic/app/server/database/db.js new file mode 100644 index 0000000..b96e5ab --- /dev/null +++ b/flypic/app/server/database/db.js @@ -0,0 +1,245 @@ +const Database = require('better-sqlite3'); +const path = require('path'); +const fs = require('fs'); + +class LibraryDatabase { + constructor(libraryPath) { + this.libraryPath = libraryPath; + this.flypicDir = path.join(libraryPath, '.flypic'); + this.dbPath = path.join(this.flypicDir, 'metadata.db'); + + // Ensure .flypic directory exists + if (!fs.existsSync(this.flypicDir)) { + fs.mkdirSync(this.flypicDir, { recursive: true }); + } + + // Create thumbnails directory (优化:不再使用子文件夹) + const thumbDir = path.join(this.flypicDir, 'thumbnails'); + if (!fs.existsSync(thumbDir)) { + fs.mkdirSync(thumbDir, { recursive: true }); + } + + this.db = new Database(this.dbPath); + + // 优化数据库性能 + this.db.pragma('journal_mode = WAL'); // 启用 WAL 模式,支持并发读写 + this.db.pragma('synchronous = NORMAL'); // 平衡性能和安全性 + this.db.pragma('cache_size = -64000'); // 64MB 缓存 + this.db.pragma('temp_store = MEMORY'); // 临时表存储在内存 + this.db.pragma('mmap_size = 268435456'); // 256MB 内存映射 + + this.initTables(); + } + + initTables() { + // Images table + this.db.exec(` + CREATE TABLE IF NOT EXISTS images ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + path TEXT UNIQUE NOT NULL, + filename TEXT NOT NULL, + folder TEXT NOT NULL, + size INTEGER, + width INTEGER, + height INTEGER, + format TEXT, + created_at INTEGER, + modified_at INTEGER, + file_hash TEXT, + thumbnail_path TEXT, + thumbnail_size INTEGER, + indexed_at INTEGER + ) + `); + + // Folders table + this.db.exec(` + CREATE TABLE IF NOT EXISTS folders ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + path TEXT UNIQUE NOT NULL, + parent_path TEXT, + name TEXT NOT NULL, + image_count INTEGER DEFAULT 0, + last_scan INTEGER + ) + `); + + // Create indexes + this.db.exec(` + CREATE INDEX IF NOT EXISTS idx_filename ON images(filename); + CREATE INDEX IF NOT EXISTS idx_folder ON images(folder); + CREATE INDEX IF NOT EXISTS idx_created_at ON images(created_at DESC); + CREATE INDEX IF NOT EXISTS idx_file_hash ON images(file_hash); + CREATE INDEX IF NOT EXISTS idx_folder_path ON folders(path); + CREATE INDEX IF NOT EXISTS idx_folder_parent ON folders(parent_path); + `); + } + + // Image operations + insertImage(imageData) { + const stmt = this.db.prepare(` + INSERT OR REPLACE INTO images + (path, filename, folder, size, width, height, format, created_at, modified_at, file_hash, thumbnail_path, thumbnail_size, indexed_at) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + `); + return stmt.run( + imageData.path, + imageData.filename, + imageData.folder, + imageData.size, + imageData.width, + imageData.height, + imageData.format, + imageData.created_at, + imageData.modified_at, + imageData.file_hash, + imageData.thumbnail_path, + imageData.thumbnail_size, + Date.now() + ); + } + + getImageByPath(imagePath) { + const stmt = this.db.prepare('SELECT * FROM images WHERE path = ?'); + return stmt.get(imagePath); + } + + getAllImages() { + const stmt = this.db.prepare('SELECT * FROM images ORDER BY created_at DESC'); + return stmt.all(); + } + + searchImages(keywords, filters = {}) { + let query = 'SELECT * FROM images WHERE 1=1'; + const params = []; + + // Keyword search (AND logic) + if (keywords && keywords.trim()) { + const terms = keywords.trim().split(/\s+/); + terms.forEach(term => { + query += ' AND filename LIKE ?'; + params.push(`%${term}%`); + }); + } + + // Folder filter + if (filters.folder) { + query += ' AND folder LIKE ?'; + params.push(`${filters.folder}%`); + } + + // Format filter + if (filters.formats && filters.formats.length > 0) { + const placeholders = filters.formats.map(() => '?').join(','); + query += ` AND format IN (${placeholders})`; + params.push(...filters.formats); + } + + // Size filter (in KB) + if (filters.minSize) { + query += ' AND size >= ?'; + params.push(filters.minSize * 1024); + } + if (filters.maxSize) { + query += ' AND size <= ?'; + params.push(filters.maxSize * 1024); + } + + // Date filter + if (filters.startDate) { + query += ' AND created_at >= ?'; + params.push(filters.startDate); + } + if (filters.endDate) { + query += ' AND created_at <= ?'; + params.push(filters.endDate); + } + + query += ' ORDER BY created_at DESC'; + + const stmt = this.db.prepare(query); + return stmt.all(...params); + } + + deleteImage(imagePath) { + const stmt = this.db.prepare('DELETE FROM images WHERE path = ?'); + return stmt.run(imagePath); + } + + // Folder operations + insertFolder(folderData) { + const stmt = this.db.prepare(` + INSERT OR REPLACE INTO folders (path, parent_path, name, image_count, last_scan) + VALUES (?, ?, ?, ?, ?) + `); + return stmt.run( + folderData.path, + folderData.parent_path, + folderData.name, + folderData.image_count || 0, + Date.now() + ); + } + + getAllFolders() { + const stmt = this.db.prepare('SELECT * FROM folders ORDER BY path'); + return stmt.all(); + } + + getFolderByPath(folderPath) { + const stmt = this.db.prepare('SELECT * FROM folders WHERE path = ?'); + return stmt.get(folderPath); + } + + deleteFolder(folderPath) { + const stmt = this.db.prepare('DELETE FROM folders WHERE path = ?'); + return stmt.run(folderPath); + } + + deleteImagesByFolderPrefix(folderPath) { + const stmt = this.db.prepare('DELETE FROM images WHERE folder = ? OR folder LIKE ?'); + return stmt.run(folderPath, `${folderPath}%`); + } + + deleteFoldersByPrefix(folderPath) { + const stmt = this.db.prepare('DELETE FROM folders WHERE path = ? OR path LIKE ?'); + return stmt.run(folderPath, `${folderPath}%`); + } + + getFolderTree() { + const folders = this.getAllFolders(); + const tree = []; + const map = {}; + + // Build folder map + folders.forEach(folder => { + map[folder.path] = { ...folder, children: [] }; + }); + + // Build tree structure + folders.forEach(folder => { + if (folder.parent_path && map[folder.parent_path]) { + map[folder.parent_path].children.push(map[folder.path]); + } else { + tree.push(map[folder.path]); + } + }); + + return tree; + } + + updateFolderImageCount(folderPath) { + const stmt = this.db.prepare(` + UPDATE folders + SET image_count = (SELECT COUNT(*) FROM images WHERE folder LIKE ?) + WHERE path = ? + `); + return stmt.run(`${folderPath}%`, folderPath); + } + + close() { + this.db.close(); + } +} + +module.exports = LibraryDatabase; diff --git a/flypic/app/server/database/dbPool.js b/flypic/app/server/database/dbPool.js new file mode 100644 index 0000000..d71fe5b --- /dev/null +++ b/flypic/app/server/database/dbPool.js @@ -0,0 +1,157 @@ +const LibraryDatabase = require('./db'); + +/** + * 数据库连接池管理器 + * 复用数据库连接,避免频繁创建/关闭 + */ +class DatabasePool { + constructor() { + this.connections = new Map(); // libraryPath -> { db, lastUsed, refCount } + this.maxIdleTime = 60000; // 60秒未使用则关闭 + this.cleanupInterval = null; + + // 启动定期清理 + this.startCleanup(); + } + + /** + * 获取数据库连接(复用或创建) + * 优化:同时只保持一个活跃连接 + */ + acquire(libraryPath) { + let conn = this.connections.get(libraryPath); + + if (!conn) { + // 如果已有其他连接且引用计数为0,先关闭它们 + for (const [path, existingConn] of this.connections.entries()) { + if (existingConn.refCount === 0) { + console.log(`[DBPool] Auto-closing idle connection: ${path}`); + this.close(path); + } + } + + // 创建新连接 + const db = new LibraryDatabase(libraryPath); + conn = { + db, + lastUsed: Date.now(), + refCount: 0 + }; + this.connections.set(libraryPath, conn); + console.log(`[DBPool] Created new connection for: ${libraryPath}`); + } + + // 更新使用时间和引用计数 + conn.lastUsed = Date.now(); + conn.refCount++; + + return conn.db; + } + + /** + * 释放数据库连接(减少引用计数) + */ + release(libraryPath) { + const conn = this.connections.get(libraryPath); + if (conn) { + conn.refCount = Math.max(0, conn.refCount - 1); + conn.lastUsed = Date.now(); + } + } + + /** + * 强制关闭指定连接 + */ + close(libraryPath) { + const conn = this.connections.get(libraryPath); + if (conn) { + try { + // 强制设置引用计数为0 + conn.refCount = 0; + + // 关闭数据库连接 + if (conn.db && conn.db.db) { + // 执行 checkpoint 确保 WAL 写入主数据库 + try { + conn.db.db.pragma('wal_checkpoint(TRUNCATE)'); + } catch (e) { + console.warn(`[DBPool] WAL checkpoint warning:`, e.message); + } + + // 关闭连接 + conn.db.close(); + } + + this.connections.delete(libraryPath); + console.log(`[DBPool] Closed connection for: ${libraryPath}`); + } catch (error) { + console.error(`[DBPool] Error closing connection:`, error); + // 即使出错也删除引用 + this.connections.delete(libraryPath); + } + } + } + + /** + * 关闭所有连接 + */ + closeAll() { + for (const [path, conn] of this.connections.entries()) { + try { + conn.db.close(); + console.log(`[DBPool] Closed connection for: ${path}`); + } catch (error) { + console.error(`[DBPool] Error closing connection:`, error); + } + } + this.connections.clear(); + + if (this.cleanupInterval) { + clearInterval(this.cleanupInterval); + this.cleanupInterval = null; + } + } + + /** + * 启动定期清理空闲连接 + */ + startCleanup() { + this.cleanupInterval = setInterval(() => { + const now = Date.now(); + const toClose = []; + + for (const [path, conn] of this.connections.entries()) { + // 如果连接空闲超过阈值且没有引用,则关闭 + if (conn.refCount === 0 && now - conn.lastUsed > this.maxIdleTime) { + toClose.push(path); + } + } + + toClose.forEach(path => this.close(path)); + + if (toClose.length > 0) { + console.log(`[DBPool] Cleaned up ${toClose.length} idle connections`); + } + }, 30000); // 每30秒检查一次 + } + + /** + * 获取连接池状态 + */ + getStatus() { + const status = []; + for (const [path, conn] of this.connections.entries()) { + status.push({ + path, + refCount: conn.refCount, + idleTime: Date.now() - conn.lastUsed + }); + } + return status; + } +} + +// 单例模式 +const dbPool = new DatabasePool(); + +module.exports = dbPool; diff --git a/flypic/app/server/package-lock.json b/flypic/app/server/package-lock.json new file mode 100644 index 0000000..2eb2073 --- /dev/null +++ b/flypic/app/server/package-lock.json @@ -0,0 +1,2789 @@ +{ + "name": "flypic-backend", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "flypic-backend", + "version": "0.1.0", + "dependencies": { + "better-sqlite3": "^9.2.2", + "chokidar": "^3.6.0", + "cors": "^2.8.5", + "crypto": "^1.0.1", + "express": "^4.18.2", + "glob": "^10.3.10", + "sharp": "^0.33.0", + "socket.io": "^4.6.0" + }, + "devDependencies": { + "nodemon": "^3.0.2" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.7.1", + "resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.7.1.tgz", + "integrity": "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmmirror.com/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "license": "MIT" + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmmirror.com/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "license": "MIT", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, + "node_modules/better-sqlite3": { + "version": "9.6.0", + "resolved": "https://registry.npmmirror.com/better-sqlite3/-/better-sqlite3-9.6.0.tgz", + "integrity": "sha512-yR5HATnqeYNVnkaUTf4bOP2dJSnyhP4puJN/QPRyx4YkBEEUxib422n2XzPqDEHjQQqazoYoADdAm5vE15+dAQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.1" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmmirror.com/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "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/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmmirror.com/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmmirror.com/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", + "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.", + "license": "ISC" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmmirror.com/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmmirror.com/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "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==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "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/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/engine.io": { + "version": "6.6.4", + "resolved": "https://registry.npmmirror.com/engine.io/-/engine.io-6.6.4.tgz", + "integrity": "sha512-ZCkIjSYNDyGn0R6ewHDtXgns/Zre/NT6Agvq1/WobF7JXgFff4SeDroKiCO3fNJreU9YG429Sc81o4w5ok/W5g==", + "license": "MIT", + "dependencies": { + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.7.2", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.17.1" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmmirror.com/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/engine.io/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/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.1", + "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmmirror.com/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmmirror.com/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmmirror.com/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmmirror.com/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "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/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmmirror.com/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, + "node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmmirror.com/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "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-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "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/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmmirror.com/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-arrayish": { + "version": "0.3.4", + "resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.3.4.tgz", + "integrity": "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==", + "license": "MIT" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmmirror.com/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "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/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=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/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmmirror.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-abi": { + "version": "3.85.0", + "resolved": "https://registry.npmmirror.com/node-abi/-/node-abi-3.85.0.tgz", + "integrity": "sha512-zsFhmbkAzwhTft6nd3VxcG0cvJsT70rL+BIGHWVq5fi6MwGrHwzqKaxXE+Hl2GmnGItnDKPPkO5/LQqjVkIdFg==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/nodemon": { + "version": "3.1.11", + "resolved": "https://registry.npmmirror.com/nodemon/-/nodemon-3.1.11.tgz", + "integrity": "sha512-is96t8F/1//UHAjNPHpbsNY46ELPpftGUoSVNXwUfMk/qdjSylYrWSu1XavVTBOn526kFiOR733ATgNBCQyH0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/nodemon/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/nodemon/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==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "license": "BlueOak-1.0.0" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmmirror.com/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmmirror.com/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmmirror.com/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmmirror.com/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmmirror.com/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/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/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmmirror.com/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/sharp": { + "version": "0.33.5", + "resolved": "https://registry.npmmirror.com/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.5", + "@img/sharp-darwin-x64": "0.33.5", + "@img/sharp-libvips-darwin-arm64": "1.0.4", + "@img/sharp-libvips-darwin-x64": "1.0.4", + "@img/sharp-libvips-linux-arm": "1.0.5", + "@img/sharp-libvips-linux-arm64": "1.0.4", + "@img/sharp-libvips-linux-s390x": "1.0.4", + "@img/sharp-libvips-linux-x64": "1.0.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", + "@img/sharp-libvips-linuxmusl-x64": "1.0.4", + "@img/sharp-linux-arm": "0.33.5", + "@img/sharp-linux-arm64": "0.33.5", + "@img/sharp-linux-s390x": "0.33.5", + "@img/sharp-linux-x64": "0.33.5", + "@img/sharp-linuxmusl-arm64": "0.33.5", + "@img/sharp-linuxmusl-x64": "0.33.5", + "@img/sharp-wasm32": "0.33.5", + "@img/sharp-win32-ia32": "0.33.5", + "@img/sharp-win32-x64": "0.33.5" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmmirror.com/simple-swizzle/-/simple-swizzle-0.2.4.tgz", + "integrity": "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/socket.io": { + "version": "4.8.1", + "resolved": "https://registry.npmmirror.com/socket.io/-/socket.io-4.8.1.tgz", + "integrity": "sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.3.2", + "engine.io": "~6.6.0", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.5", + "resolved": "https://registry.npmmirror.com/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz", + "integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==", + "license": "MIT", + "dependencies": { + "debug": "~4.3.4", + "ws": "~8.17.1" + } + }, + "node_modules/socket.io-adapter/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-adapter/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/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmmirror.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser/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/socket.io/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/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/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmmirror.com/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "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==", + "license": "0BSD", + "optional": true + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmmirror.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmmirror.com/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmmirror.com/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/flypic/app/server/package.json b/flypic/app/server/package.json new file mode 100644 index 0000000..76a4238 --- /dev/null +++ b/flypic/app/server/package.json @@ -0,0 +1,23 @@ +{ + "name": "flypic-backend", + "version": "0.1.0", + "description": "FlyPic backend server", + "main": "server.js", + "scripts": { + "dev": "nodemon server.js", + "start": "node server.js" + }, + "dependencies": { + "better-sqlite3": "^9.2.2", + "chokidar": "^3.6.0", + "cors": "^2.8.5", + "crypto": "^1.0.1", + "express": "^4.18.2", + "glob": "^10.3.10", + "sharp": "^0.33.0", + "socket.io": "^4.6.0" + }, + "devDependencies": { + "nodemon": "^3.0.2" + } +} diff --git a/flypic/app/server/public/assets/index-Ct4ORqFz.js b/flypic/app/server/public/assets/index-Ct4ORqFz.js new file mode 100644 index 0000000..573ea8d --- /dev/null +++ b/flypic/app/server/public/assets/index-Ct4ORqFz.js @@ -0,0 +1,186 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var ws=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jf={exports:{}},jo={},ed={exports:{}},_e={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var us=Symbol.for("react.element"),rm=Symbol.for("react.portal"),im=Symbol.for("react.fragment"),sm=Symbol.for("react.strict_mode"),om=Symbol.for("react.profiler"),am=Symbol.for("react.provider"),lm=Symbol.for("react.context"),um=Symbol.for("react.forward_ref"),cm=Symbol.for("react.suspense"),fm=Symbol.for("react.memo"),dm=Symbol.for("react.lazy"),nc=Symbol.iterator;function hm(e){return e===null||typeof e!="object"?null:(e=nc&&e[nc]||e["@@iterator"],typeof e=="function"?e:null)}var td={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nd=Object.assign,rd={};function pi(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||td}pi.prototype.isReactComponent={};pi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};pi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function id(){}id.prototype=pi.prototype;function Zl(e,t,n){this.props=e,this.context=t,this.refs=rd,this.updater=n||td}var Ql=Zl.prototype=new id;Ql.constructor=Zl;nd(Ql,pi.prototype);Ql.isPureReactComponent=!0;var rc=Array.isArray,sd=Object.prototype.hasOwnProperty,Gl={current:null},od={key:!0,ref:!0,__self:!0,__source:!0};function ad(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)sd.call(t,r)&&!od.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,A=H[O];if(0>>1;Oi(V,j))cei(Y,V)?(H[O]=Y,H[ce]=j,O=ce):(H[O]=V,H[q]=j,O=q);else if(cei(Y,j))H[O]=Y,H[ce]=j,O=ce;else break e}}return z}function i(H,z){var j=H.sortIndex-z.sortIndex;return j!==0?j:H.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],h=1,y=null,w=3,p=!1,g=!1,d=!1,_=typeof setTimeout=="function"?setTimeout:null,c=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(H){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=H)r(u),z.sortIndex=z.expirationTime,t(l,z);else break;z=n(u)}}function k(H){if(d=!1,x(H),!g)if(n(l)!==null)g=!0,se(R);else{var z=n(u);z!==null&&X(k,z.startTime-H)}}function R(H,z){g=!1,d&&(d=!1,c(L),L=-1),p=!0;var j=w;try{for(x(z),y=n(l);y!==null&&(!(y.expirationTime>z)||H&&!re());){var O=y.callback;if(typeof O=="function"){y.callback=null,w=y.priorityLevel;var A=O(y.expirationTime<=z);z=e.unstable_now(),typeof A=="function"?y.callback=A:y===n(l)&&r(l),x(z)}else r(l);y=n(l)}if(y!==null)var J=!0;else{var q=n(u);q!==null&&X(k,q.startTime-z),J=!1}return J}finally{y=null,w=j,p=!1}}var E=!1,N=null,L=-1,P=5,I=-1;function re(){return!(e.unstable_now()-IH||125O?(H.sortIndex=j,t(u,H),n(l)===null&&H===n(u)&&(d?(c(L),L=-1):d=!0,X(k,j-O))):(H.sortIndex=A,t(l,H),g||p||(g=!0,se(R))),H},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(H){var z=w;return function(){var j=w;w=z;try{return H.apply(this,arguments)}finally{w=j}}}})(dd);fd.exports=dd;var bm=fd.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Em=ne,Ct=bm;function te(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$a=Object.prototype.hasOwnProperty,Cm=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,sc={},oc={};function Nm(e){return $a.call(oc,e)?!0:$a.call(sc,e)?!1:Cm.test(e)?oc[e]=!0:(sc[e]=!0,!1)}function Rm(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Tm(e,t,n,r){if(t===null||typeof t>"u"||Rm(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ht(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Je={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Je[e]=new ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Je[t]=new ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Je[e]=new ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Je[e]=new ht(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Je[e]=new ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Je[e]=new ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Je[e]=new ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Je[e]=new ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Je[e]=new ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var eu=/[\-:]([a-z])/g;function tu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(eu,tu);Je[t]=new ht(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(eu,tu);Je[t]=new ht(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(eu,tu);Je[t]=new ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Je[e]=new ht(e,1,!1,e.toLowerCase(),null,!1,!1)});Je.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Je[e]=new ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function nu(e,t,n,r){var i=Je.hasOwnProperty(t)?Je[t]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` +`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{la=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Pi(e):""}function Om(e){switch(e.tag){case 5:return Pi(e.type);case 16:return Pi("Lazy");case 13:return Pi("Suspense");case 19:return Pi("SuspenseList");case 0:case 2:case 15:return e=ua(e.type,!1),e;case 11:return e=ua(e.type.render,!1),e;case 1:return e=ua(e.type,!0),e;default:return""}}function qa(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ur:return"Fragment";case Mr:return"Portal";case Wa:return"Profiler";case ru:return"StrictMode";case Ha:return"Suspense";case Va:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case md:return(e.displayName||"Context")+".Consumer";case pd:return(e._context.displayName||"Context")+".Provider";case iu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case su:return t=e.displayName||null,t!==null?t:qa(e.type)||"Memo";case $n:t=e._payload,e=e._init;try{return qa(e(t))}catch{}}return null}function Am(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qa(t);case 8:return t===ru?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ir(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Pm(e){var t=yd(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ks(e){e._valueTracker||(e._valueTracker=Pm(e))}function vd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=yd(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function lo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ka(e,t){var n=t.checked;return Be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lc(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ir(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wd(e,t){t=t.checked,t!=null&&nu(e,"checked",t,!1)}function Xa(e,t){wd(e,t);var n=ir(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ya(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ya(e,t.type,ir(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function uc(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ya(e,t,n){(t!=="number"||lo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zi=Array.isArray;function Gr(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Ss.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ki(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Fi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},zm=["Webkit","ms","Moz","O"];Object.keys(Fi).forEach(function(e){zm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fi[t]=Fi[e]})});function Sd(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Fi.hasOwnProperty(e)&&Fi[e]?(""+t).trim():t+"px"}function bd(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Sd(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Lm=Be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ga(e,t){if(t){if(Lm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function Ja(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var el=null;function ou(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tl=null,Jr=null,ei=null;function dc(e){if(e=ds(e)){if(typeof tl!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Mo(t),tl(e.stateNode,e.type,t))}}function Ed(e){Jr?ei?ei.push(e):ei=[e]:Jr=e}function Cd(){if(Jr){var e=Jr,t=ei;if(ei=Jr=null,dc(e),t)for(e=0;e>>=0,e===0?32:31-(Vm(e)/qm|0)|0}var bs=64,Es=4194304;function Li(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ho(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Li(a):(s&=o,s!==0&&(r=Li(s)))}else o=n&~i,o!==0?r=Li(o):s!==0&&(r=Li(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function cs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Xt(t),e[t]=n}function Zm(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Di),_c=" ",kc=!1;function qd(e,t){switch(e){case"keyup":return b0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $r=!1;function C0(e,t){switch(e){case"compositionend":return Kd(t);case"keypress":return t.which!==32?null:(kc=!0,_c);case"textInput":return e=t.data,e===_c&&kc?null:e;default:return null}}function N0(e,t){if($r)return e==="compositionend"||!pu&&qd(e,t)?(e=Hd(),qs=fu=Kn=null,$r=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Cc(n)}}function Qd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gd(){for(var e=window,t=lo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=lo(e.document)}return t}function mu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function I0(e){var t=Gd(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Qd(n.ownerDocument.documentElement,n)){if(r!==null&&mu(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Nc(n,s);var o=Nc(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Wr=null,al=null,Ui=null,ll=!1;function Rc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ll||Wr==null||Wr!==lo(r)||(r=Wr,"selectionStart"in r&&mu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ui&&Ji(Ui,r)||(Ui=r,r=go(al,"onSelect"),0qr||(e.current=pl[qr],pl[qr]=null,qr--)}function Oe(e,t){qr++,pl[qr]=e.current,e.current=t}var sr={},st=ar(sr),gt=ar(!1),Sr=sr;function oi(e,t){var n=e.type.contextTypes;if(!n)return sr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function yt(e){return e=e.childContextTypes,e!=null}function vo(){Le(gt),Le(st)}function jc(e,t,n){if(st.current!==sr)throw Error(te(168));Oe(st,t),Oe(gt,n)}function ah(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(te(108,Am(e)||"Unknown",i));return Be({},n,r)}function wo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sr,Sr=st.current,Oe(st,e),Oe(gt,gt.current),!0}function Ic(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=ah(e,t,Sr),r.__reactInternalMemoizedMergedChildContext=e,Le(gt),Le(st),Oe(st,e)):Le(gt),Oe(gt,n)}var En=null,Uo=!1,Sa=!1;function lh(e){En===null?En=[e]:En.push(e)}function X0(e){Uo=!0,lh(e)}function lr(){if(!Sa&&En!==null){Sa=!0;var e=0,t=Ne;try{var n=En;for(Ne=1;e>=o,i-=o,Nn=1<<32-Xt(t)+i|n<L?(P=N,N=null):P=N.sibling;var I=w(c,N,x[L],k);if(I===null){N===null&&(N=P);break}e&&N&&I.alternate===null&&t(c,N),f=s(I,f,L),E===null?R=I:E.sibling=I,E=I,N=P}if(L===x.length)return n(c,N),je&&hr(c,L),R;if(N===null){for(;LL?(P=N,N=null):P=N.sibling;var re=w(c,N,I.value,k);if(re===null){N===null&&(N=P);break}e&&N&&re.alternate===null&&t(c,N),f=s(re,f,L),E===null?R=re:E.sibling=re,E=re,N=P}if(I.done)return n(c,N),je&&hr(c,L),R;if(N===null){for(;!I.done;L++,I=x.next())I=y(c,I.value,k),I!==null&&(f=s(I,f,L),E===null?R=I:E.sibling=I,E=I);return je&&hr(c,L),R}for(N=r(c,N);!I.done;L++,I=x.next())I=p(N,c,L,I.value,k),I!==null&&(e&&I.alternate!==null&&N.delete(I.key===null?L:I.key),f=s(I,f,L),E===null?R=I:E.sibling=I,E=I);return e&&N.forEach(function(T){return t(c,T)}),je&&hr(c,L),R}function _(c,f,x,k){if(typeof x=="object"&&x!==null&&x.type===Ur&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case _s:e:{for(var R=x.key,E=f;E!==null;){if(E.key===R){if(R=x.type,R===Ur){if(E.tag===7){n(c,E.sibling),f=i(E,x.props.children),f.return=c,c=f;break e}}else if(E.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===$n&&Dc(R)===E.type){n(c,E.sibling),f=i(E,x.props),f.ref=Ni(c,E,x),f.return=c,c=f;break e}n(c,E);break}else t(c,E);E=E.sibling}x.type===Ur?(f=_r(x.props.children,c.mode,k,x.key),f.return=c,c=f):(k=eo(x.type,x.key,x.props,null,c.mode,k),k.ref=Ni(c,f,x),k.return=c,c=k)}return o(c);case Mr:e:{for(E=x.key;f!==null;){if(f.key===E)if(f.tag===4&&f.stateNode.containerInfo===x.containerInfo&&f.stateNode.implementation===x.implementation){n(c,f.sibling),f=i(f,x.children||[]),f.return=c,c=f;break e}else{n(c,f);break}else t(c,f);f=f.sibling}f=Aa(x,c.mode,k),f.return=c,c=f}return o(c);case $n:return E=x._init,_(c,f,E(x._payload),k)}if(zi(x))return g(c,f,x,k);if(ki(x))return d(c,f,x,k);Ps(c,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,f!==null&&f.tag===6?(n(c,f.sibling),f=i(f,x),f.return=c,c=f):(n(c,f),f=Oa(x,c.mode,k),f.return=c,c=f),o(c)):n(c,f)}return _}var li=dh(!0),hh=dh(!1),ko=ar(null),So=null,Yr=null,wu=null;function xu(){wu=Yr=So=null}function _u(e){var t=ko.current;Le(ko),e._currentValue=t}function yl(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ni(e,t){So=e,wu=Yr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(mt=!0),e.firstContext=null)}function Dt(e){var t=e._currentValue;if(wu!==e)if(e={context:e,memoizedValue:t,next:null},Yr===null){if(So===null)throw Error(te(308));Yr=e,So.dependencies={lanes:0,firstContext:e}}else Yr=Yr.next=e;return t}var yr=null;function ku(e){yr===null?yr=[e]:yr.push(e)}function ph(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ku(t)):(n.next=i.next,i.next=n),t.interleaved=n,Pn(e,r)}function Pn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Wn=!1;function Su(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mh(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Tn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Jn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ee&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Pn(e,n)}return i=r.interleaved,i===null?(t.next=t,ku(r)):(t.next=i.next,i.next=t),r.interleaved=t,Pn(e,n)}function Xs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lu(e,n)}}function Mc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function bo(e,t,n,r){var i=e.updateQueue;Wn=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var h=e.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=u:a.next=u,h.lastBaseUpdate=l))}if(s!==null){var y=i.baseState;o=0,h=u=l=null,a=s;do{var w=a.lane,p=a.eventTime;if((r&w)===w){h!==null&&(h=h.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,d=a;switch(w=t,p=n,d.tag){case 1:if(g=d.payload,typeof g=="function"){y=g.call(p,y,w);break e}y=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=d.payload,w=typeof g=="function"?g.call(p,y,w):g,w==null)break e;y=Be({},y,w);break e;case 2:Wn=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,w=i.effects,w===null?i.effects=[a]:w.push(a))}else p={eventTime:p,lane:w,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(u=h=p,l=y):h=h.next=p,o|=w;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;w=a,a=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);if(h===null&&(l=y),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=h,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Cr|=o,e.lanes=o,e.memoizedState=y}}function Uc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ea.transition;Ea.transition={};try{e(!1),t()}finally{Ne=n,Ea.transition=r}}function Ph(){return Mt().memoizedState}function G0(e,t,n){var r=tr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},zh(e))Lh(t,n);else if(n=ph(e,t,n,r),n!==null){var i=ft();Yt(n,e,r,i),jh(n,t,r)}}function J0(e,t,n){var r=tr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(zh(e))Lh(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Zt(a,o)){var l=t.interleaved;l===null?(i.next=i,ku(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=ph(e,t,i,r),n!==null&&(i=ft(),Yt(n,e,r,i),jh(n,t,r))}}function zh(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function Lh(e,t){$i=Co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function jh(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lu(e,n)}}var No={readContext:Dt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useInsertionEffect:tt,useLayoutEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useMutableSource:tt,useSyncExternalStore:tt,useId:tt,unstable_isNewReconciler:!1},eg={readContext:Dt,useCallback:function(e,t){return an().memoizedState=[e,t===void 0?null:t],e},useContext:Dt,useEffect:Wc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Zs(4194308,4,Nh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zs(4,2,e,t)},useMemo:function(e,t){var n=an();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=an();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=G0.bind(null,Fe,e),[r.memoizedState,e]},useRef:function(e){var t=an();return e={current:e},t.memoizedState=e},useState:$c,useDebugValue:Au,useDeferredValue:function(e){return an().memoizedState=e},useTransition:function(){var e=$c(!1),t=e[0];return e=Q0.bind(null,e[1]),an().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Fe,i=an();if(je){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),Xe===null)throw Error(te(349));Er&30||wh(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Wc(_h.bind(null,r,s,e),[e]),r.flags|=2048,as(9,xh.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=an(),t=Xe.identifierPrefix;if(je){var n=Rn,r=Nn;n=(r&~(1<<32-Xt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ss++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ln]=t,e[ns]=r,Vh(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ja(n,r),n){case"dialog":ze("cancel",e),ze("close",e),i=r;break;case"iframe":case"object":case"embed":ze("load",e),i=r;break;case"video":case"audio":for(i=0;ifi&&(t.flags|=128,r=!0,Ri(s,!1),t.lanes=4194304)}else{if(!r)if(e=Eo(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ri(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!je)return nt(t),null}else 2*Me()-s.renderingStartTime>fi&&n!==1073741824&&(t.flags|=128,r=!0,Ri(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Me(),t.sibling=null,n=Ie.current,Oe(Ie,r?n&1|2:n&1),t):(nt(t),null);case 22:case 23:return Fu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?St&1073741824&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function lg(e,t){switch(yu(t),t.tag){case 1:return yt(t.type)&&vo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ui(),Le(gt),Le(st),Cu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Eu(t),null;case 13:if(Le(Ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le(Ie),null;case 4:return ui(),null;case 10:return _u(t.type._context),null;case 22:case 23:return Fu(),null;case 24:return null;default:return null}}var Ls=!1,rt=!1,ug=typeof WeakSet=="function"?WeakSet:Set,le=null;function Zr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){De(e,t,r)}else n.current=null}function Cl(e,t,n){try{n()}catch(r){De(e,t,r)}}var ef=!1;function cg(e,t){if(ul=po,e=Gd(),mu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,h=0,y=e,w=null;t:for(;;){for(var p;y!==n||i!==0&&y.nodeType!==3||(a=o+i),y!==s||r!==0&&y.nodeType!==3||(l=o+r),y.nodeType===3&&(o+=y.nodeValue.length),(p=y.firstChild)!==null;)w=y,y=p;for(;;){if(y===e)break t;if(w===n&&++u===i&&(a=o),w===s&&++h===r&&(l=o),(p=y.nextSibling)!==null)break;y=w,w=y.parentNode}y=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(cl={focusedElem:e,selectionRange:n},po=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var d=g.memoizedProps,_=g.memoizedState,c=t.stateNode,f=c.getSnapshotBeforeUpdate(t.elementType===t.type?d:Ht(t.type,d),_);c.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(k){De(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return g=ef,ef=!1,g}function Wi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Cl(t,n,s)}i=i.next}while(i!==r)}}function Ho(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Nl(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Xh(e){var t=e.alternate;t!==null&&(e.alternate=null,Xh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ln],delete t[ns],delete t[hl],delete t[q0],delete t[K0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Yh(e){return e.tag===5||e.tag===3||e.tag===4}function tf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Rl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yo));else if(r!==4&&(e=e.child,e!==null))for(Rl(e,t,n),e=e.sibling;e!==null;)Rl(e,t,n),e=e.sibling}function Tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Tl(e,t,n),e=e.sibling;e!==null;)Tl(e,t,n),e=e.sibling}var Ze=null,Vt=!1;function Un(e,t,n){for(n=n.child;n!==null;)Zh(e,t,n),n=n.sibling}function Zh(e,t,n){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(Io,n)}catch{}switch(n.tag){case 5:rt||Zr(n,t);case 6:var r=Ze,i=Vt;Ze=null,Un(e,t,n),Ze=r,Vt=i,Ze!==null&&(Vt?(e=Ze,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ze.removeChild(n.stateNode));break;case 18:Ze!==null&&(Vt?(e=Ze,n=n.stateNode,e.nodeType===8?ka(e.parentNode,n):e.nodeType===1&&ka(e,n),Qi(e)):ka(Ze,n.stateNode));break;case 4:r=Ze,i=Vt,Ze=n.stateNode.containerInfo,Vt=!0,Un(e,t,n),Ze=r,Vt=i;break;case 0:case 11:case 14:case 15:if(!rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Cl(n,t,o),i=i.next}while(i!==r)}Un(e,t,n);break;case 1:if(!rt&&(Zr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){De(n,t,a)}Un(e,t,n);break;case 21:Un(e,t,n);break;case 22:n.mode&1?(rt=(r=rt)||n.memoizedState!==null,Un(e,t,n),rt=r):Un(e,t,n);break;default:Un(e,t,n)}}function nf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ug),t.forEach(function(r){var i=wg.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Wt(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*dg(r/1960))-r,10e?16:e,Xn===null)var r=!1;else{if(e=Xn,Xn=null,Oo=0,Ee&6)throw Error(te(331));var i=Ee;for(Ee|=4,le=e.current;le!==null;){var s=le,o=s.child;if(le.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lMe()-ju?xr(e,0):Lu|=n),vt(e,t)}function ip(e,t){t===0&&(e.mode&1?(t=Es,Es<<=1,!(Es&130023424)&&(Es=4194304)):t=1);var n=ft();e=Pn(e,t),e!==null&&(cs(e,t,n),vt(e,n))}function vg(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ip(e,n)}function wg(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(te(314))}r!==null&&r.delete(t),ip(e,n)}var sp;sp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||gt.current)mt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return mt=!1,og(e,t,n);mt=!!(e.flags&131072)}else mt=!1,je&&t.flags&1048576&&uh(t,_o,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Qs(e,t),e=t.pendingProps;var i=oi(t,st.current);ni(t,n),i=Ru(null,t,r,e,i,n);var s=Tu();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,yt(r)?(s=!0,wo(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Su(t),i.updater=Wo,t.stateNode=i,i._reactInternals=t,wl(t,r,e,n),t=kl(null,t,r,!0,s,n)):(t.tag=0,je&&s&&gu(t),ut(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Qs(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=_g(r),e=Ht(r,e),i){case 0:t=_l(null,t,r,e,n);break e;case 1:t=Qc(null,t,r,e,n);break e;case 11:t=Yc(null,t,r,e,n);break e;case 14:t=Zc(null,t,r,Ht(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),_l(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),Qc(e,t,r,i,n);case 3:e:{if($h(t),e===null)throw Error(te(387));r=t.pendingProps,s=t.memoizedState,i=s.element,mh(e,t),bo(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ci(Error(te(423)),t),t=Gc(e,t,r,n,i);break e}else if(r!==i){i=ci(Error(te(424)),t),t=Gc(e,t,r,n,i);break e}else for(bt=Gn(t.stateNode.containerInfo.firstChild),Et=t,je=!0,Kt=null,n=hh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ai(),r===i){t=zn(e,t,n);break e}ut(e,t,r,n)}t=t.child}return t;case 5:return gh(t),e===null&&gl(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,fl(r,i)?o=null:s!==null&&fl(r,s)&&(t.flags|=32),Uh(e,t),ut(e,t,o,n),t.child;case 6:return e===null&&gl(t),null;case 13:return Wh(e,t,n);case 4:return bu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=li(t,null,r,n):ut(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),Yc(e,t,r,i,n);case 7:return ut(e,t,t.pendingProps,n),t.child;case 8:return ut(e,t,t.pendingProps.children,n),t.child;case 12:return ut(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Oe(ko,r._currentValue),r._currentValue=o,s!==null)if(Zt(s.value,o)){if(s.children===i.children&&!gt.current){t=zn(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Tn(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?l.next=l:(l.next=h.next,h.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),yl(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(te(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),yl(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ut(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ni(t,n),i=Dt(i),r=r(i),t.flags|=1,ut(e,t,r,n),t.child;case 14:return r=t.type,i=Ht(r,t.pendingProps),i=Ht(r.type,i),Zc(e,t,r,i,n);case 15:return Dh(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ht(r,i),Qs(e,t),t.tag=1,yt(r)?(e=!0,wo(t)):e=!1,ni(t,n),Ih(t,r,i),wl(t,r,i,n),kl(null,t,r,!0,e,n);case 19:return Hh(e,t,n);case 22:return Mh(e,t,n)}throw Error(te(156,t.tag))};function op(e,t){return zd(e,t)}function xg(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(e,t,n,r){return new xg(e,t,n,r)}function Du(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _g(e){if(typeof e=="function")return Du(e)?1:0;if(e!=null){if(e=e.$$typeof,e===iu)return 11;if(e===su)return 14}return 2}function nr(e,t){var n=e.alternate;return n===null?(n=Ft(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function eo(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Du(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ur:return _r(n.children,i,s,t);case ru:o=8,i|=8;break;case Wa:return e=Ft(12,n,t,i|2),e.elementType=Wa,e.lanes=s,e;case Ha:return e=Ft(13,n,t,i),e.elementType=Ha,e.lanes=s,e;case Va:return e=Ft(19,n,t,i),e.elementType=Va,e.lanes=s,e;case gd:return qo(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pd:o=10;break e;case md:o=9;break e;case iu:o=11;break e;case su:o=14;break e;case $n:o=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=Ft(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function _r(e,t,n,r){return e=Ft(7,e,r,t),e.lanes=n,e}function qo(e,t,n,r){return e=Ft(22,e,r,t),e.elementType=gd,e.lanes=n,e.stateNode={isHidden:!1},e}function Oa(e,t,n){return e=Ft(6,e,null,t),e.lanes=n,e}function Aa(e,t,n){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function kg(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fa(0),this.expirationTimes=fa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fa(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Mu(e,t,n,r,i,s,o,a,l){return e=new kg(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Ft(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Su(s),e}function Sg(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(cp)}catch(e){console.error(e)}}cp(),cd.exports=Nt;var fp=cd.exports,ff=fp;Ua.createRoot=ff.createRoot,Ua.hydrateRoot=ff.hydrateRoot;const dn=Object.create(null);dn.open="0";dn.close="1";dn.ping="2";dn.pong="3";dn.message="4";dn.upgrade="5";dn.noop="6";const to=Object.create(null);Object.keys(dn).forEach(e=>{to[dn[e]]=e});const Ll={type:"error",data:"parser error"},dp=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",hp=typeof ArrayBuffer=="function",pp=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Hu=({type:e,data:t},n,r)=>dp&&t instanceof Blob?n?r(t):df(t,r):hp&&(t instanceof ArrayBuffer||pp(t))?n?r(t):df(new Blob([t]),r):r(dn[e]+(t||"")),df=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function hf(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Pa;function Rg(e,t){if(dp&&e.data instanceof Blob)return e.data.arrayBuffer().then(hf).then(t);if(hp&&(e.data instanceof ArrayBuffer||pp(e.data)))return t(hf(e.data));Hu(e,!1,n=>{Pa||(Pa=new TextEncoder),t(Pa.encode(n))})}const pf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ii=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,s,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),h=new Uint8Array(u);for(r=0;r>4,h[i++]=(o&15)<<4|a>>2,h[i++]=(a&3)<<6|l&63;return u},Og=typeof ArrayBuffer=="function",Vu=(e,t)=>{if(typeof e!="string")return{type:"message",data:mp(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Ag(e.substring(1),t)}:to[n]?e.length>1?{type:to[n],data:e.substring(1)}:{type:to[n]}:Ll},Ag=(e,t)=>{if(Og){const n=Tg(e);return mp(n,t)}else return{base64:!0,data:e}},mp=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},gp="",Pg=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((s,o)=>{Hu(s,!1,a=>{r[o]=a,++i===n&&t(r.join(gp))})})},zg=(e,t)=>{const n=e.split(gp),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{i=new Uint8Array(9);const s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let za;function Fs(e){return e.reduce((t,n)=>t+n.length,0)}function Bs(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,21)-1){a.enqueue(Ll);break}i=h*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Fs(n)e){a.enqueue(Ll);break}}}})}const yp=4;function $e(e){if(e)return Ig(e)}function Ig(e){for(var t in $e.prototype)e[t]=$e.prototype[t];return e}$e.prototype.on=$e.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};$e.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};$e.prototype.off=$e.prototype.removeListener=$e.prototype.removeAllListeners=$e.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;iPromise.resolve().then(t):(t,n)=>n(t,0),It=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Fg="arraybuffer";function vp(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Bg=It.setTimeout,Dg=It.clearTimeout;function Go(e,t){t.useNativeTimers?(e.setTimeoutFn=Bg.bind(It),e.clearTimeoutFn=Dg.bind(It)):(e.setTimeoutFn=It.setTimeout.bind(It),e.clearTimeoutFn=It.clearTimeout.bind(It))}const Mg=1.33;function Ug(e){return typeof e=="string"?$g(e):Math.ceil((e.byteLength||e.size)*Mg)}function $g(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function wp(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Wg(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Hg(e){let t={},n=e.split("&");for(let r=0,i=n.length;r{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};zg(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Pg(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=wp()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let xp=!1;try{xp=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Kg=xp;function Xg(){}class Yg extends qg{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class fn extends $e{constructor(t,n,r){super(),this.createRequest=t,Go(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=vp(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=fn.requestsCount++,fn.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Xg,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete fn.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}fn.requestsCount=0;fn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mf);else if(typeof addEventListener=="function"){const e="onpagehide"in It?"pagehide":"unload";addEventListener(e,mf,!1)}}function mf(){for(let e in fn.requests)fn.requests.hasOwnProperty(e)&&fn.requests[e].abort()}const Zg=function(){const e=_p({xdomain:!1});return e&&e.responseType!==null}();class Qg extends Yg{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Zg&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new fn(_p,this.uri(),t)}}function _p(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Kg))return new XMLHttpRequest}catch{}if(!t)try{return new It[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const kp=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Gg extends qu{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=kp?{}:vp(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{try{this.doWrite(r,s)}catch{}i&&Qo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=wp()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const La=It.WebSocket||It.MozWebSocket;class Jg extends Gg{createSocket(t,n,r){return kp?new La(t,n,r):n?new La(t,n):new La(t)}doWrite(t,n){this.ws.send(n)}}class ey extends qu{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=jg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Lg();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const s=()=>{r.read().then(({done:a,value:l})=>{a||(this.onPacket(l),s())}).catch(a=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n{i&&Qo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ty={websocket:Jg,webtransport:ey,polling:Qg},ny=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ry=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function jl(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=ny.exec(e||""),s={},o=14;for(;o--;)s[ry[o]]=i[o]||"";return n!=-1&&r!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=iy(s,s.path),s.queryKey=sy(s,s.query),s}function iy(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function sy(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(n[i]=s)}),n}const Il=typeof addEventListener=="function"&&typeof removeEventListener=="function",no=[];Il&&addEventListener("offline",()=>{no.forEach(e=>e())},!1);class rr extends $e{constructor(t,n){if(super(),this.binaryType=Fg,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=jl(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=jl(n.host).host);Go(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Hg(this.opts.query)),Il&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},no.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=yp,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&rr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",rr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Qo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const s={type:t,data:n,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(rr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Il&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=no.indexOf(this._offlineEventListener);r!==-1&&no.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}rr.protocol=yp;class oy extends rr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",y=>{if(!r)if(y.type==="pong"&&y.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;rr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=n.name,this.emitReserved("upgradeError",w)}}))};function s(){r||(r=!0,h(),n.close(),n=null)}const o=y=>{const w=new Error("probe error: "+y);w.transport=n.name,s(),this.emitReserved("upgradeError",w)};function a(){o("transport closed")}function l(){o("socket closed")}function u(y){n&&y.name!==n.name&&s()}const h=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",o),n.once("close",a),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;rty[i]).filter(i=>!!i)),super(t,r)}};function ly(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=jl(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}const uy=typeof ArrayBuffer=="function",cy=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Sp=Object.prototype.toString,fy=typeof Blob=="function"||typeof Blob<"u"&&Sp.call(Blob)==="[object BlobConstructor]",dy=typeof File=="function"||typeof File<"u"&&Sp.call(File)==="[object FileConstructor]";function Ku(e){return uy&&(e instanceof ArrayBuffer||cy(e))||fy&&e instanceof Blob||dy&&e instanceof File}function ro(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(s),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,i)=>{const s=(o,a)=>o?i(o):r(a);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...s)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Se.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Se.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Se.EVENT:case Se.BINARY_EVENT:this.onevent(t);break;case Se.ACK:case Se.BINARY_ACK:this.onack(t);break;case Se.DISCONNECT:this.ondisconnect();break;case Se.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Se.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Se.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}yi.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};yi.prototype.reset=function(){this.attempts=0};yi.prototype.setMin=function(e){this.ms=e};yi.prototype.setMax=function(e){this.max=e};yi.prototype.setJitter=function(e){this.jitter=e};class Dl extends $e{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Go(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new yi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||wy;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ay(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=qt(n,"open",function(){r.onopen(),t&&t()}),s=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=qt(n,"error",s);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(qt(t,"ping",this.onping.bind(this)),qt(t,"data",this.ondata.bind(this)),qt(t,"error",this.onerror.bind(this)),qt(t,"close",this.onclose.bind(this)),qt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Qo(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new bp(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Oi={};function io(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=ly(e,t.path||"/socket.io"),r=n.source,i=n.id,s=n.path,o=Oi[i]&&s in Oi[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return a?l=new Dl(r,t):(Oi[i]||(Oi[i]=new Dl(r,t)),l=Oi[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(io,{Manager:Dl,Socket:bp,io,connect:io});const _y={},yf=e=>{let t;const n=new Set,r=(h,y)=>{const w=typeof h=="function"?h(t):h;if(!Object.is(w,t)){const p=t;t=y??(typeof w!="object"||w===null)?w:Object.assign({},t,w),n.forEach(g=>g(t,p))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(_y?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,i,l);return l},ky=e=>e?yf(e):yf;var Ep={exports:{}},Cp={},Np={exports:{}},Rp={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var di=ne;function Sy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var by=typeof Object.is=="function"?Object.is:Sy,Ey=di.useState,Cy=di.useEffect,Ny=di.useLayoutEffect,Ry=di.useDebugValue;function Ty(e,t){var n=t(),r=Ey({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return Ny(function(){i.value=n,i.getSnapshot=t,ja(i)&&s({inst:i})},[e,n,t]),Cy(function(){return ja(i)&&s({inst:i}),e(function(){ja(i)&&s({inst:i})})},[e]),Ry(n),n}function ja(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!by(e,n)}catch{return!0}}function Oy(e,t){return t()}var Ay=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Oy:Ty;Rp.useSyncExternalStore=di.useSyncExternalStore!==void 0?di.useSyncExternalStore:Ay;Np.exports=Rp;var Py=Np.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Jo=ne,zy=Py;function Ly(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jy=typeof Object.is=="function"?Object.is:Ly,Iy=zy.useSyncExternalStore,Fy=Jo.useRef,By=Jo.useEffect,Dy=Jo.useMemo,My=Jo.useDebugValue;Cp.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=Fy(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Dy(function(){function l(p){if(!u){if(u=!0,h=p,p=r(p),i!==void 0&&o.hasValue){var g=o.value;if(i(g,p))return y=g}return y=p}if(g=y,jy(h,p))return g;var d=r(p);return i!==void 0&&i(g,d)?(h=p,g):(h=p,y=d)}var u=!1,h,y,w=n===void 0?null:n;return[function(){return l(t())},w===null?void 0:function(){return l(w())}]},[t,n,r,i]);var a=Iy(e,s[0],s[1]);return By(function(){o.hasValue=!0,o.value=a},[a]),My(a),a};Ep.exports=Cp;var Uy=Ep.exports;const $y=Yl(Uy),Tp={},{useDebugValue:Wy}=ve,{useSyncExternalStoreWithSelector:Hy}=$y;let vf=!1;const Vy=e=>e;function qy(e,t=Vy,n){(Tp?"production":void 0)!=="production"&&n&&!vf&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),vf=!0);const r=Hy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wy(r),r}const wf=e=>{(Tp?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?ky(e):e,n=(r,i)=>qy(t,r,i);return Object.assign(n,t),n},Ky=e=>e?wf(e):wf,Te=Ky((e,t)=>({theme:"light",setTheme:n=>e({theme:n}),toggleTheme:()=>e(n=>({theme:n.theme==="light"?"dark":"light"})),libraries:[],currentLibraryId:null,setLibraries:n=>e({libraries:n}),setCurrentLibrary:n=>e({currentLibraryId:n}),addLibrary:n=>e(r=>({libraries:[...r.libraries,n]})),removeLibrary:n=>e(r=>({libraries:r.libraries.filter(i=>i.id!==n),currentLibraryId:r.currentLibraryId===n?null:r.currentLibraryId})),images:[],filteredImages:[],totalImageCount:0,setImages:n=>e({images:n,filteredImages:n}),setFilteredImages:n=>e({filteredImages:n}),setTotalImageCount:n=>e({totalImageCount:n}),folders:[],selectedFolder:null,setFolders:n=>e({folders:n}),setSelectedFolder:n=>e({selectedFolder:n}),searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null},setSearchKeywords:n=>e({searchKeywords:n}),setFilters:n=>e(r=>({filters:{...r.filters,...n}})),resetFilters:()=>e({searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null}}),selectedImage:null,setSelectedImage:n=>e({selectedImage:n}),selectedImages:[],setSelectedImages:n=>e({selectedImages:n}),toggleImageSelection:n=>e(r=>r.selectedImages.some(s=>s.path===n.path)?{selectedImages:r.selectedImages.filter(s=>s.path!==n.path)}:{selectedImages:[...r.selectedImages,n]}),clearSelection:()=>e({selectedImages:[],selectedImage:null}),scanProgress:null,scanStartTime:null,setScanProgress:n=>e(r=>n&&!r.scanStartTime&&n.current>0?{scanProgress:n,scanStartTime:Date.now()}:n?{scanProgress:n}:{scanProgress:null,scanStartTime:null}),isResizingPanels:!1,setIsResizingPanels:n=>e({isResizingPanels:n}),resizingSide:null,setResizingSide:n=>e({resizingSide:n}),thumbnailHeight:200,setThumbnailHeight:n=>e({thumbnailHeight:n}),mobileView:"main",setMobileView:n=>e({mobileView:n}),getCurrentLibrary:()=>{const n=t();return n.libraries.find(r=>r.id===n.currentLibraryId)}}));function Op(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xy}=Object.prototype,{getPrototypeOf:Yu}=Object,{iterator:ea,toStringTag:Ap}=Symbol,ta=(e=>t=>{const n=Xy.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Qt=e=>(e=e.toLowerCase(),t=>ta(t)===e),na=e=>t=>typeof t===e,{isArray:vi}=Array,hi=na("undefined");function ps(e){return e!==null&&!hi(e)&&e.constructor!==null&&!hi(e.constructor)&&wt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Pp=Qt("ArrayBuffer");function Yy(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Pp(e.buffer),t}const Zy=na("string"),wt=na("function"),zp=na("number"),ms=e=>e!==null&&typeof e=="object",Qy=e=>e===!0||e===!1,so=e=>{if(ta(e)!=="object")return!1;const t=Yu(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ap in e)&&!(ea in e)},Gy=e=>{if(!ms(e)||ps(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Jy=Qt("Date"),ev=Qt("File"),tv=Qt("Blob"),nv=Qt("FileList"),rv=e=>ms(e)&&wt(e.pipe),iv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||wt(e.append)&&((t=ta(e))==="formdata"||t==="object"&&wt(e.toString)&&e.toString()==="[object FormData]"))},sv=Qt("URLSearchParams"),[ov,av,lv,uv]=["ReadableStream","Request","Response","Headers"].map(Qt),cv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function gs(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),vi(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const wr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,jp=e=>!hi(e)&&e!==wr;function Ml(){const{caseless:e,skipUndefined:t}=jp(this)&&this||{},n={},r=(i,s)=>{const o=e&&Lp(n,s)||s;so(n[o])&&so(i)?n[o]=Ml(n[o],i):so(i)?n[o]=Ml({},i):vi(i)?n[o]=i.slice():(!t||!hi(i))&&(n[o]=i)};for(let i=0,s=arguments.length;i(gs(t,(i,s)=>{n&&wt(i)?e[s]=Op(i,n):e[s]=i},{allOwnKeys:r}),e),dv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),hv=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},pv=(e,t,n,r)=>{let i,s,o;const a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&Yu(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},mv=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},gv=e=>{if(!e)return null;if(vi(e))return e;let t=e.length;if(!zp(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},yv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Yu(Uint8Array)),vv=(e,t)=>{const r=(e&&e[ea]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},wv=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},xv=Qt("HTMLFormElement"),_v=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),xf=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),kv=Qt("RegExp"),Ip=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};gs(n,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(r[s]=o||i)}),Object.defineProperties(e,r)},Sv=e=>{Ip(e,(t,n)=>{if(wt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(wt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},bv=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return vi(e)?r(e):r(String(e).split(t)),n},Ev=()=>{},Cv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Nv(e){return!!(e&&wt(e.append)&&e[Ap]==="FormData"&&e[ea])}const Rv=e=>{const t=new Array(10),n=(r,i)=>{if(ms(r)){if(t.indexOf(r)>=0)return;if(ps(r))return r;if(!("toJSON"in r)){t[i]=r;const s=vi(r)?[]:{};return gs(r,(o,a)=>{const l=n(o,i+1);!hi(l)&&(s[a]=l)}),t[i]=void 0,s}}return r};return n(e,0)},Tv=Qt("AsyncFunction"),Ov=e=>e&&(ms(e)||wt(e))&&wt(e.then)&&wt(e.catch),Fp=((e,t)=>e?setImmediate:t?((n,r)=>(wr.addEventListener("message",({source:i,data:s})=>{i===wr&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),wr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",wt(wr.postMessage)),Av=typeof queueMicrotask<"u"?queueMicrotask.bind(wr):typeof process<"u"&&process.nextTick||Fp,Pv=e=>e!=null&&wt(e[ea]),$={isArray:vi,isArrayBuffer:Pp,isBuffer:ps,isFormData:iv,isArrayBufferView:Yy,isString:Zy,isNumber:zp,isBoolean:Qy,isObject:ms,isPlainObject:so,isEmptyObject:Gy,isReadableStream:ov,isRequest:av,isResponse:lv,isHeaders:uv,isUndefined:hi,isDate:Jy,isFile:ev,isBlob:tv,isRegExp:kv,isFunction:wt,isStream:rv,isURLSearchParams:sv,isTypedArray:yv,isFileList:nv,forEach:gs,merge:Ml,extend:fv,trim:cv,stripBOM:dv,inherits:hv,toFlatObject:pv,kindOf:ta,kindOfTest:Qt,endsWith:mv,toArray:gv,forEachEntry:vv,matchAll:wv,isHTMLForm:xv,hasOwnProperty:xf,hasOwnProp:xf,reduceDescriptors:Ip,freezeMethods:Sv,toObjectSet:bv,toCamelCase:_v,noop:Ev,toFiniteNumber:Cv,findKey:Lp,global:wr,isContextDefined:jp,isSpecCompliantForm:Nv,toJSONObject:Rv,isAsyncFn:Tv,isThenable:Ov,setImmediate:Fp,asap:Av,isIterable:Pv};function me(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}$.inherits(me,Error,{toJSON:function(){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:$.toJSONObject(this.config),code:this.code,status:this.status}}});const Bp=me.prototype,Dp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Dp[e]={value:e}});Object.defineProperties(me,Dp);Object.defineProperty(Bp,"isAxiosError",{value:!0});me.from=(e,t,n,r,i,s)=>{const o=Object.create(Bp);$.toFlatObject(e,o,function(h){return h!==Error.prototype},u=>u!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return me.call(o,a,l,n,r,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",s&&Object.assign(o,s),o};const zv=null;function Ul(e){return $.isPlainObject(e)||$.isArray(e)}function Mp(e){return $.endsWith(e,"[]")?e.slice(0,-2):e}function _f(e,t,n){return e?e.concat(t).map(function(i,s){return i=Mp(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function Lv(e){return $.isArray(e)&&!e.some(Ul)}const jv=$.toFlatObject($,{},null,function(t){return/^is[A-Z]/.test(t)});function ra(e,t,n){if(!$.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=$.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,_){return!$.isUndefined(_[d])});const r=n.metaTokens,i=n.visitor||h,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&$.isSpecCompliantForm(t);if(!$.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if($.isDate(g))return g.toISOString();if($.isBoolean(g))return g.toString();if(!l&&$.isBlob(g))throw new me("Blob is not supported. Use a Buffer instead.");return $.isArrayBuffer(g)||$.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,d,_){let c=g;if(g&&!_&&typeof g=="object"){if($.endsWith(d,"{}"))d=r?d:d.slice(0,-2),g=JSON.stringify(g);else if($.isArray(g)&&Lv(g)||($.isFileList(g)||$.endsWith(d,"[]"))&&(c=$.toArray(g)))return d=Mp(d),c.forEach(function(x,k){!($.isUndefined(x)||x===null)&&t.append(o===!0?_f([d],k,s):o===null?d:d+"[]",u(x))}),!1}return Ul(g)?!0:(t.append(_f(_,d,s),u(g)),!1)}const y=[],w=Object.assign(jv,{defaultVisitor:h,convertValue:u,isVisitable:Ul});function p(g,d){if(!$.isUndefined(g)){if(y.indexOf(g)!==-1)throw Error("Circular reference detected in "+d.join("."));y.push(g),$.forEach(g,function(c,f){(!($.isUndefined(c)||c===null)&&i.call(t,c,$.isString(f)?f.trim():f,d,w))===!0&&p(c,d?d.concat(f):[f])}),y.pop()}}if(!$.isObject(e))throw new TypeError("data must be an object");return p(e),t}function kf(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Zu(e,t){this._pairs=[],e&&ra(e,this,t)}const Up=Zu.prototype;Up.append=function(t,n){this._pairs.push([t,n])};Up.toString=function(t){const n=t?function(r){return t.call(this,r,kf)}:kf;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Iv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $p(e,t,n){if(!t)return e;const r=n&&n.encode||Iv;$.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(t,n):s=$.isURLSearchParams(t)?t.toString():new Zu(t,n).toString(r),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class Sf{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){$.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Wp={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fv=typeof URLSearchParams<"u"?URLSearchParams:Zu,Bv=typeof FormData<"u"?FormData:null,Dv=typeof Blob<"u"?Blob:null,Mv={isBrowser:!0,classes:{URLSearchParams:Fv,FormData:Bv,Blob:Dv},protocols:["http","https","file","blob","url","data"]},Qu=typeof window<"u"&&typeof document<"u",$l=typeof navigator=="object"&&navigator||void 0,Uv=Qu&&(!$l||["ReactNative","NativeScript","NS"].indexOf($l.product)<0),$v=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Wv=Qu&&window.location.href||"http://localhost",Hv=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Qu,hasStandardBrowserEnv:Uv,hasStandardBrowserWebWorkerEnv:$v,navigator:$l,origin:Wv},Symbol.toStringTag,{value:"Module"})),it={...Hv,...Mv};function Vv(e,t){return ra(e,new it.classes.URLSearchParams,{visitor:function(n,r,i,s){return it.isNode&&$.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function qv(e){return $.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Kv(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r=n.length;return o=!o&&$.isArray(i)?i.length:o,l?($.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!$.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],s)&&$.isArray(i[o])&&(i[o]=Kv(i[o])),!a)}if($.isFormData(e)&&$.isFunction(e.entries)){const n={};return $.forEachEntry(e,(r,i)=>{t(qv(r),i,n,0)}),n}return null}function Xv(e,t,n){if($.isString(e))try{return(t||JSON.parse)(e),$.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ys={transitional:Wp,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=$.isObject(t);if(s&&$.isHTMLForm(t)&&(t=new FormData(t)),$.isFormData(t))return i?JSON.stringify(Hp(t)):t;if($.isArrayBuffer(t)||$.isBuffer(t)||$.isStream(t)||$.isFile(t)||$.isBlob(t)||$.isReadableStream(t))return t;if($.isArrayBufferView(t))return t.buffer;if($.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Vv(t,this.formSerializer).toString();if((a=$.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return ra(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),Xv(t)):t}],transformResponse:[function(t){const n=this.transitional||ys.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if($.isResponse(t)||$.isReadableStream(t))return t;if(t&&$.isString(t)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?me.from(a,me.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:it.classes.FormData,Blob:it.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$.forEach(["delete","get","head","post","put","patch"],e=>{ys.headers[e]={}});const Yv=$.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"]),Zv=e=>{const t={};let n,r,i;return e&&e.split(` +`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&Yv[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},bf=Symbol("internals");function Ai(e){return e&&String(e).trim().toLowerCase()}function oo(e){return e===!1||e==null?e:$.isArray(e)?e.map(oo):String(e)}function Qv(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Gv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ia(e,t,n,r,i){if($.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!$.isString(t)){if($.isString(r))return t.indexOf(r)!==-1;if($.isRegExp(r))return r.test(t)}}function Jv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function e1(e,t){const n=$.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,o){return this[r].call(this,t,i,s,o)},configurable:!0})})}let xt=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(a,l,u){const h=Ai(l);if(!h)throw new Error("header name must be a non-empty string");const y=$.findKey(i,h);(!y||i[y]===void 0||u===!0||u===void 0&&i[y]!==!1)&&(i[y||l]=oo(a))}const o=(a,l)=>$.forEach(a,(u,h)=>s(u,h,l));if($.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if($.isString(t)&&(t=t.trim())&&!Gv(t))o(Zv(t),n);else if($.isObject(t)&&$.isIterable(t)){let a={},l,u;for(const h of t){if(!$.isArray(h))throw TypeError("Object iterator must return a key-value pair");a[u=h[0]]=(l=a[u])?$.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}o(a,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=Ai(t),t){const r=$.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return Qv(i);if($.isFunction(n))return n.call(this,i,r);if($.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ai(t),t){const r=$.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Ia(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(o){if(o=Ai(o),o){const a=$.findKey(r,o);a&&(!n||Ia(r,r[a],a,n))&&(delete r[a],i=!0)}}return $.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||Ia(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return $.forEach(this,(i,s)=>{const o=$.findKey(r,s);if(o){n[o]=oo(i),delete n[s];return}const a=t?Jv(s):String(s).trim();a!==s&&delete n[s],n[a]=oo(i),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return $.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&$.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[bf]=this[bf]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=Ai(o);r[a]||(e1(i,o),r[a]=!0)}return $.isArray(t)?t.forEach(s):s(t),this}};xt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);$.reduceDescriptors(xt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});$.freezeMethods(xt);function Fa(e,t){const n=this||ys,r=t||n,i=xt.from(r.headers);let s=r.data;return $.forEach(e,function(a){s=a.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Vp(e){return!!(e&&e.__CANCEL__)}function wi(e,t,n){me.call(this,e??"canceled",me.ERR_CANCELED,t,n),this.name="CanceledError"}$.inherits(wi,me,{__CANCEL__:!0});function qp(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new me("Request failed with status code "+n.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function t1(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function n1(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),h=r[s];o||(o=u),n[i]=l,r[i]=u;let y=s,w=0;for(;y!==i;)w+=n[y++],y=y%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o{n=h,i=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const h=Date.now(),y=h-n;y>=r?o(u,h):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-y)))},()=>i&&o(i)]}const zo=(e,t,n=3)=>{let r=0;const i=n1(50,250);return r1(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,u=i(l),h=o<=a;r=o;const y={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&h?(a-o)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(y)},n)},Ef=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Cf=e=>(...t)=>$.asap(()=>e(...t)),i1=it.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,it.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,s1=it.hasStandardBrowserEnv?{write(e,t,n,r,i,s,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];$.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),$.isString(r)&&a.push(`path=${r}`),$.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),$.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function o1(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function a1(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Kp(e,t,n){let r=!o1(t);return e&&(r||n==!1)?a1(e,t):t}const Nf=e=>e instanceof xt?{...e}:e;function Rr(e,t){t=t||{};const n={};function r(u,h,y,w){return $.isPlainObject(u)&&$.isPlainObject(h)?$.merge.call({caseless:w},u,h):$.isPlainObject(h)?$.merge({},h):$.isArray(h)?h.slice():h}function i(u,h,y,w){if($.isUndefined(h)){if(!$.isUndefined(u))return r(void 0,u,y,w)}else return r(u,h,y,w)}function s(u,h){if(!$.isUndefined(h))return r(void 0,h)}function o(u,h){if($.isUndefined(h)){if(!$.isUndefined(u))return r(void 0,u)}else return r(void 0,h)}function a(u,h,y){if(y in t)return r(u,h);if(y in e)return r(void 0,u)}const l={url:s,method:s,data:s,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,responseEncoding:o,validateStatus:a,headers:(u,h,y)=>i(Nf(u),Nf(h),y,!0)};return $.forEach(Object.keys({...e,...t}),function(h){const y=l[h]||i,w=y(e[h],t[h],h);$.isUndefined(w)&&y!==a||(n[h]=w)}),n}const Xp=e=>{const t=Rr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=xt.from(o),t.url=$p(Kp(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),$.isFormData(n)){if(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if($.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([h,y])=>{u.includes(h.toLowerCase())&&o.set(h,y)})}}if(it.hasStandardBrowserEnv&&(r&&$.isFunction(r)&&(r=r(t)),r||r!==!1&&i1(t.url))){const l=i&&s&&s1.read(s);l&&o.set(i,l)}return t},l1=typeof XMLHttpRequest<"u",u1=l1&&function(e){return new Promise(function(n,r){const i=Xp(e);let s=i.data;const o=xt.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=i,h,y,w,p,g;function d(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let _=new XMLHttpRequest;_.open(i.method.toUpperCase(),i.url,!0),_.timeout=i.timeout;function c(){if(!_)return;const x=xt.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),R={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:x,config:e,request:_};qp(function(N){n(N),d()},function(N){r(N),d()},R),_=null}"onloadend"in _?_.onloadend=c:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(c)},_.onabort=function(){_&&(r(new me("Request aborted",me.ECONNABORTED,e,_)),_=null)},_.onerror=function(k){const R=k&&k.message?k.message:"Network Error",E=new me(R,me.ERR_NETWORK,e,_);E.event=k||null,r(E),_=null},_.ontimeout=function(){let k=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const R=i.transitional||Wp;i.timeoutErrorMessage&&(k=i.timeoutErrorMessage),r(new me(k,R.clarifyTimeoutError?me.ETIMEDOUT:me.ECONNABORTED,e,_)),_=null},s===void 0&&o.setContentType(null),"setRequestHeader"in _&&$.forEach(o.toJSON(),function(k,R){_.setRequestHeader(R,k)}),$.isUndefined(i.withCredentials)||(_.withCredentials=!!i.withCredentials),a&&a!=="json"&&(_.responseType=i.responseType),u&&([w,g]=zo(u,!0),_.addEventListener("progress",w)),l&&_.upload&&([y,p]=zo(l),_.upload.addEventListener("progress",y),_.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(h=x=>{_&&(r(!x||x.type?new wi(null,e,_):x),_.abort(),_=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const f=t1(i.url);if(f&&it.protocols.indexOf(f)===-1){r(new me("Unsupported protocol "+f+":",me.ERR_BAD_REQUEST,e));return}_.send(s||null)})},c1=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,a();const h=u instanceof Error?u:this.reason;r.abort(h instanceof me?h:new wi(h instanceof Error?h.message:h))}};let o=t&&setTimeout(()=>{o=null,s(new me(`timeout ${t} of ms exceeded`,me.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>$.asap(a),l}},f1=function*(e,t){let n=e.byteLength;if(n{const i=d1(e,t);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:h}=await i.next();if(u){a(),l.close();return}let y=h.byteLength;if(n){let w=s+=y;n(w)}l.enqueue(new Uint8Array(h))}catch(u){throw a(u),u}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},Tf=64*1024,{isFunction:Ds}=$,p1=(({Request:e,Response:t})=>({Request:e,Response:t}))($.global),{ReadableStream:Of,TextEncoder:Af}=$.global,Pf=(e,...t)=>{try{return!!e(...t)}catch{return!1}},m1=e=>{e=$.merge.call({skipUndefined:!0},p1,e);const{fetch:t,Request:n,Response:r}=e,i=t?Ds(t):typeof fetch=="function",s=Ds(n),o=Ds(r);if(!i)return!1;const a=i&&Ds(Of),l=i&&(typeof Af=="function"?(g=>d=>g.encode(d))(new Af):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=s&&a&&Pf(()=>{let g=!1;const d=new n(it.origin,{body:new Of,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!d}),h=o&&a&&Pf(()=>$.isReadableStream(new r("").body)),y={stream:h&&(g=>g.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!y[g]&&(y[g]=(d,_)=>{let c=d&&d[g];if(c)return c.call(d);throw new me(`Response type '${g}' is not supported`,me.ERR_NOT_SUPPORT,_)})});const w=async g=>{if(g==null)return 0;if($.isBlob(g))return g.size;if($.isSpecCompliantForm(g))return(await new n(it.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if($.isArrayBufferView(g)||$.isArrayBuffer(g))return g.byteLength;if($.isURLSearchParams(g)&&(g=g+""),$.isString(g))return(await l(g)).byteLength},p=async(g,d)=>{const _=$.toFiniteNumber(g.getContentLength());return _??w(d)};return async g=>{let{url:d,method:_,data:c,signal:f,cancelToken:x,timeout:k,onDownloadProgress:R,onUploadProgress:E,responseType:N,headers:L,withCredentials:P="same-origin",fetchOptions:I}=Xp(g),re=t||fetch;N=N?(N+"").toLowerCase():"text";let T=c1([f,x&&x.toAbortSignal()],k),D=null;const v=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let B;try{if(E&&u&&_!=="get"&&_!=="head"&&(B=await p(L,c))!==0){let O=new n(d,{method:"POST",body:c,duplex:"half"}),A;if($.isFormData(c)&&(A=O.headers.get("content-type"))&&L.setContentType(A),O.body){const[J,q]=Ef(B,zo(Cf(E)));c=Rf(O.body,Tf,J,q)}}$.isString(P)||(P=P?"include":"omit");const se=s&&"credentials"in n.prototype,X={...I,signal:T,method:_.toUpperCase(),headers:L.normalize().toJSON(),body:c,duplex:"half",credentials:se?P:void 0};D=s&&new n(d,X);let H=await(s?re(D,I):re(d,X));const z=h&&(N==="stream"||N==="response");if(h&&(R||z&&v)){const O={};["status","statusText","headers"].forEach(V=>{O[V]=H[V]});const A=$.toFiniteNumber(H.headers.get("content-length")),[J,q]=R&&Ef(A,zo(Cf(R),!0))||[];H=new r(Rf(H.body,Tf,J,()=>{q&&q(),v&&v()}),O)}N=N||"text";let j=await y[$.findKey(y,N)||"text"](H,g);return!z&&v&&v(),await new Promise((O,A)=>{qp(O,A,{data:j,headers:xt.from(H.headers),status:H.status,statusText:H.statusText,config:g,request:D})})}catch(se){throw v&&v(),se&&se.name==="TypeError"&&/Load failed|fetch/i.test(se.message)?Object.assign(new me("Network Error",me.ERR_NETWORK,g,D),{cause:se.cause||se}):me.from(se,se&&se.code,g,D)}}},g1=new Map,Yp=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let o=s.length,a=o,l,u,h=g1;for(;a--;)l=s[a],u=h.get(l),u===void 0&&h.set(l,u=a?new Map:m1(t)),h=u;return u};Yp();const Gu={http:zv,xhr:u1,fetch:{get:Yp}};$.forEach(Gu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const zf=e=>`- ${e}`,y1=e=>$.isFunction(e)||e===null||e===!1;function v1(e,t){e=$.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let o=0;o`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since : +`+o.map(zf).join(` +`):" "+zf(o[0]):"as no adapter specified";throw new me("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const Zp={getAdapter:v1,adapters:Gu};function Ba(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new wi(null,e)}function Lf(e){return Ba(e),e.headers=xt.from(e.headers),e.data=Fa.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zp.getAdapter(e.adapter||ys.adapter,e)(e).then(function(r){return Ba(e),r.data=Fa.call(e,e.transformResponse,r),r.headers=xt.from(r.headers),r},function(r){return Vp(r)||(Ba(e),r&&r.response&&(r.response.data=Fa.call(e,e.transformResponse,r.response),r.response.headers=xt.from(r.response.headers))),Promise.reject(r)})}const Qp="1.13.2",ia={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ia[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const jf={};ia.transitional=function(t,n,r){function i(s,o){return"[Axios v"+Qp+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(t===!1)throw new me(i(o," has been removed"+(n?" in "+n:"")),me.ERR_DEPRECATED);return n&&!jf[o]&&(jf[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,a):!0}};ia.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function w1(e,t,n){if(typeof e!="object")throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const a=e[s],l=a===void 0||o(a,s,e);if(l!==!0)throw new me("option "+s+" must be "+l,me.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new me("Unknown option "+s,me.ERR_BAD_OPTION)}}const ao={assertOptions:w1,validators:ia},on=ao.validators;let kr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Sf,response:new Sf}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Rr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&ao.assertOptions(r,{silentJSONParsing:on.transitional(on.boolean),forcedJSONParsing:on.transitional(on.boolean),clarifyTimeoutError:on.transitional(on.boolean)},!1),i!=null&&($.isFunction(i)?n.paramsSerializer={serialize:i}:ao.assertOptions(i,{encode:on.function,serialize:on.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ao.assertOptions(n,{baseUrl:on.spelling("baseURL"),withXsrfToken:on.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&$.merge(s.common,s[n.method]);s&&$.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=xt.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(n)===!1||(l=l&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});let h,y=0,w;if(!l){const g=[Lf.bind(this),void 0];for(g.unshift(...a),g.push(...u),w=g.length,h=Promise.resolve(n);y{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new wi(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Gp(function(i){t=i}),cancel:t}}};function _1(e){return function(n){return e.apply(null,n)}}function k1(e){return $.isObject(e)&&e.isAxiosError===!0}const Wl={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(Wl).forEach(([e,t])=>{Wl[t]=e});function Jp(e){const t=new kr(e),n=Op(kr.prototype.request,t);return $.extend(n,kr.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Jp(Rr(e,i))},n}const be=Jp(ys);be.Axios=kr;be.CanceledError=wi;be.CancelToken=x1;be.isCancel=Vp;be.VERSION=Qp;be.toFormData=ra;be.AxiosError=me;be.Cancel=be.CanceledError;be.all=function(t){return Promise.all(t)};be.spread=_1;be.isAxiosError=k1;be.mergeConfig=Rr;be.AxiosHeaders=xt;be.formToJSON=e=>Hp($.isHTMLForm(e)?new FormData(e):e);be.getAdapter=Zp.getAdapter;be.HttpStatusCode=Wl;be.default=be;const{Axios:ow,AxiosError:aw,CanceledError:lw,isCancel:uw,CancelToken:cw,VERSION:fw,all:dw,Cancel:hw,isAxiosError:pw,spread:mw,toFormData:gw,AxiosHeaders:yw,HttpStatusCode:vw,formToJSON:ww,getAdapter:xw,mergeConfig:_w}=be,Qe="/api",Cn={getAll:()=>be.get(`${Qe}/library`),add:(e,t)=>be.post(`${Qe}/library`,{name:e,path:t}),update:(e,t)=>be.put(`${Qe}/library/${e}`,t),delete:e=>be.delete(`${Qe}/library/${e}`),setCurrent:e=>be.post(`${Qe}/library/${e}/set-current`),updatePreferences:e=>be.put(`${Qe}/library/preferences`,e),updateTheme:e=>be.put(`${Qe}/library/theme`,{theme:e})},ct={search:(e,t={})=>{const n=new URLSearchParams({libraryId:e,...t});return be.get(`${Qe}/image?${n}`)},getFolders:e=>be.get(`${Qe}/image/folders?libraryId=${e}`),getThumbnailUrl:(e,t,n)=>`${Qe}/image/thumbnail/${e}/${t}/${n}`,getOriginalUrl:(e,t)=>`${Qe}/image/original/${e}/${t}`},Hl={fullScan:(e,t=!1)=>be.post(`${Qe}/scan/full`,{libraryId:e,wait:t}),sync:(e,t=!1)=>be.post(`${Qe}/scan/sync`,{libraryId:e,wait:t})},If={start:e=>be.post(`${Qe}/watch/start/${e}`),stop:e=>be.post(`${Qe}/watch/stop/${e}`),status:e=>be.get(`${Qe}/watch/status/${e}`),list:()=>be.get(`${Qe}/watch/list`)};/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var S1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Ye=(e,t)=>{const n=ne.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,...u},h)=>ne.createElement("svg",{ref:h,...S1,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${b1(e)}`,a].join(" "),...u},[...t.map(([y,w])=>ne.createElement(y,w)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E1=Ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C1=Ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ff=Ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N1=Ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R1=Ye("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T1=Ye("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O1=Ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A1=Ye("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bf=Ye("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P1=Ye("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Df=Ye("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mf=Ye("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uf=Ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vl=Ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $f=Ye("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wf=Ye("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z1=Ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.300.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L1=Ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Hf(){const{libraries:e,currentLibraryId:t,folders:n,selectedFolder:r,totalImageCount:i,setCurrentLibrary:s,setSelectedFolder:o,addLibrary:a,removeLibrary:l}=Te(),[u,h]=ne.useState(!1),[y,w]=ne.useState(""),[p,g]=ne.useState(""),[d,_]=ne.useState(""),[c,f]=ne.useState(new Set),[x,k]=ne.useState(!1),[R,E]=ne.useState(!1),N=async()=>{if(!y.trim()){alert("请输入素材库名称");return}if(!p.trim()){alert("请输入文件夹路径");return}k(!0),Te.getState().setScanProgress({current:0,total:0,percent:0,status:"preparing"});try{const z=await Cn.add(y.trim(),p.trim()),j=z.data.id,O=z.data.hasExistingIndex;a({id:j,name:y.trim(),path:p.trim()}),w(""),g(""),h(!1),await Cn.setCurrent(j),s(j),o(null),Te.getState().setImages([]),Te.getState().setFolders([]),O?(console.log("检测到已有索引,执行增量同步..."),Hl.sync(j,!1)):(console.log("首次添加,执行全量扫描..."),Hl.fullScan(j,!1))}catch(z){console.error("Error adding library:",z),alert("添加素材库失败: "+z.message)}finally{k(!1)}},L=async z=>{if(z!==t){E(!0);try{await Cn.setCurrent(z),s(z),o(null)}catch(j){console.error("Error setting current library:",j),alert("切换素材库失败: "+j.message)}finally{E(!1)}}},P=async()=>{if(!t)return;const z=e.find(O=>O.id===t);if(!(!z||!confirm(`确定要删除素材库"${z.name}"吗? + +路径: ${z.path} + +⚠️ 注意: +• 将删除索引数据并释放数据库连接 +• 不会删除原始图片文件 +• .flypic 文件夹将保留,您可以手动删除`)))try{await Cn.delete(t),l(t),Te.getState().setImages([]),Te.getState().setFolders([]),Te.getState().setSelectedImage(null),Te.getState().setSelectedFolder(null);const O=e.filter(A=>A.id!==t);if(O.length>0){const A=O[0];await Cn.setCurrent(A.id),s(A.id)}console.log(`✅ 素材库已删除: ${z.name}`),console.log(`数据库连接已释放,可手动删除: ${z.path}\\.flypic`)}catch(O){console.error("Error deleting library:",O),alert("删除素材库失败: "+O.message)}},I=z=>{const j=new Set(c);j.has(z)?j.delete(z):j.add(z),f(j)},re=z=>{const j=[],O=A=>{A.forEach(J=>{J.children&&J.children.length>0&&(j.push(J.path),O(J.children))})};return O(z),j},T=()=>{const z=re(B.length>0?B:n);f(new Set(z))},D=()=>{f(new Set)},v=()=>{const z=re(B.length>0?B:n);return z.length>0&&z.every(j=>c.has(j))},B=ne.useMemo(()=>{if(!d)return n;const z=d.trim().toLowerCase().split(/\s+/).filter(J=>J.length>0);if(z.length===0)return n;const j=[],O=J=>J.reduce((q,V)=>{const ce=V.name.toLowerCase(),Y=V.path.toLowerCase(),Z=z.every(de=>ce.includes(de)),oe=z.every(de=>Y.includes(de));let ue=[];return V.children&&V.children.length>0&&(ue=O(V.children)),(Z||oe||ue.length>0)&&(q.push({...V,children:ue}),ue.length>0&&j.push(V.path)),q},[]),A=O(n);return j.length>0&&setTimeout(()=>{f(J=>{const q=new Set(J);return j.forEach(V=>q.add(V)),q})},0),A},[n,d]),se=(z,j)=>{z.stopPropagation(),I(j)},X=z=>{const j=z.children&&z.children.length>0;r!==z.path?o(z.path):j&&I(z.path)},H=(z,j=0)=>z.map(O=>{const A=c.has(O.path),J=O.children&&O.children.length>0,q=r===O.path;return C.jsxs("div",{children:[C.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${q?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${j*16+12}px`},onClick:()=>X(O),children:[J?C.jsx("div",{className:"flex items-center justify-center w-5 h-5 mr-1 cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 rounded",onClick:V=>se(V,O.path),children:A?C.jsx(Ff,{className:"w-4 h-4 text-gray-500"}):C.jsx(N1,{className:"w-4 h-4 text-gray-500"})}):C.jsx("div",{className:"w-5 mr-1"}),C.jsx(Df,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),C.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1",children:O.name}),C.jsx("span",{className:"text-xs text-gray-400 ml-2 flex-shrink-0",children:O.image_count})]}),J&&A&&H(O.children,j+1)]},O.path)});return C.jsxs("div",{className:"w-full h-full border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col",children:[C.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[C.jsx("div",{className:"flex items-center justify-between mb-3",children:C.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"素材库"})}),C.jsxs("div",{className:"flex gap-2",children:[C.jsxs("div",{className:"relative flex-1",children:[C.jsxs("select",{value:t||"",onChange:z=>{const j=z.target.value;j==="__add__"?h(!0):j&&L(j)},disabled:R,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 appearance-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{paddingRight:"2rem"},children:[e.length===0&&C.jsx("option",{value:"",children:"暂无素材库"}),e.map(z=>C.jsx("option",{value:z.id,children:z.name},z.id)),C.jsx("option",{value:"__add__",style:{borderTop:"1px solid #ccc"},children:"+ 添加新素材库"})]}),C.jsx(Ff,{className:"absolute right-2 top-2.5 w-4 h-4 text-gray-400 pointer-events-none"})]}),t&&e.length>0&&C.jsx("button",{onClick:P,className:"px-3 py-2 border border-red-300 dark:border-red-600 rounded-lg hover:bg-red-50 dark:hover:bg-red-900 text-red-600 dark:text-red-400 transition-colors",title:"删除当前素材库",children:C.jsx(z1,{className:"w-4 h-4"})})]}),u&&C.jsxs("div",{className:"mt-3 p-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700",children:[C.jsxs("div",{className:"flex items-center justify-between mb-2",children:[C.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"添加素材库"}),C.jsx("button",{onClick:()=>h(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600",children:C.jsx(L1,{className:"w-4 h-4 text-gray-500"})})]}),C.jsxs("div",{className:"space-y-2",children:[C.jsx("input",{type:"text",placeholder:"素材库名称",value:y,onChange:z=>w(z.target.value),onKeyDown:z=>z.key==="Enter"&&N(),autoFocus:!0,className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"}),C.jsx("input",{type:"text",placeholder:"文件夹路径(例如:C:\\Users\\Pictures)",value:p,onChange:z=>g(z.target.value),onKeyDown:z=>z.key==="Enter"&&N(),className:"w-full px-2 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"}),C.jsxs("div",{className:"flex gap-2",children:[C.jsx("button",{onClick:()=>h(!1),className:"flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded text-sm hover:bg-gray-100 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-300",children:"取消"}),C.jsx("button",{onClick:N,disabled:x,className:"flex-1 px-3 py-1.5 bg-blue-500 text-white rounded text-sm hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed",children:x?"添加中...":"添加"})]})]})]})]}),C.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[C.jsx("div",{className:"mb-3 space-y-2",children:C.jsxs("div",{className:"flex gap-2",children:[C.jsxs("div",{className:"relative flex-1",children:[C.jsx(Vl,{className:"absolute left-2 top-2 w-4 h-4 text-gray-400"}),C.jsx("input",{type:"text",placeholder:"搜索文件夹(支持多关键词)...",value:d,onChange:z=>_(z.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100"})]}),C.jsx("button",{onClick:v()?D:T,className:"px-2 py-1.5 border border-gray-300 dark:border-gray-600 rounded hover:bg-gray-100 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-400 transition-colors",title:v()?"折叠全部":"展开全部",children:v()?C.jsx(T1,{className:"w-4 h-4"}):C.jsx(R1,{className:"w-4 h-4"})})]})}),C.jsxs("div",{className:"space-y-1",children:[C.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${r===null?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,onClick:()=>o(null),children:[C.jsx("div",{className:"w-5 mr-1"}),C.jsx(Df,{className:"w-4 h-4 mr-2 text-blue-500 flex-shrink-0"}),C.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 font-medium flex-1",children:"全部图片"}),C.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:i})]}),(B.length>0||n.length>0)&&C.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 my-2"}),B.length>0?H(B):d?C.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500 text-sm",children:"未找到匹配的文件夹"}):n.length===0?C.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500 text-sm",children:"暂无文件夹"}):null]})]})]})}function Ke(){return Ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?ne.useEffect:ne.useLayoutEffect;function Dr(e,t,n){var r=ne.useRef(t);r.current=t,ne.useEffect(function(){function i(s){r.current(s)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var I1=["container"];function F1(e){var t=e.container,n=t===void 0?document.body:t,r=sa(e,I1);return fp.createPortal(ve.createElement("div",Ke({},r)),n)}function B1(e){return ve.createElement("svg",Ke({width:"44",height:"44",viewBox:"0 0 768 768"},e),ve.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function D1(e){return ve.createElement("svg",Ke({width:"44",height:"44",viewBox:"0 0 768 768"},e),ve.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function M1(e){return ve.createElement("svg",Ke({width:"44",height:"44",viewBox:"0 0 768 768"},e),ve.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function U1(){return ne.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function qf(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var i=e.touches[1],s=i.clientX,o=i.clientY;return[(n+s)/2,(r+o)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(o-r,2))]}return[n,r,0]}var Hn=function(e,t,n,r){var i,s=n*t,o=(s-r)/2,a=e;return s<=r?(i=1,a=0):e>0&&o-e<=0?(i=2,a=o):e<0&&o+e<=0&&(i=3,a=-o),[i,a]};function Da(e,t,n,r,i,s,o,a,l,u){o===void 0&&(o=innerWidth/2),a===void 0&&(a=innerHeight/2),l===void 0&&(l=0),u===void 0&&(u=0);var h=Hn(e,s,n,innerWidth)[0],y=Hn(t,s,r,innerHeight),w=innerWidth/2,p=innerHeight/2;return{x:o-s/i*(o-(w+e))-w+(r/n>=3&&n*s===innerWidth?0:h?l/2:l),y:a-s/i*(a-(p+t))-p+(y[0]?u/2:u),lastCX:o,lastCY:a}}function Xl(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function Ma(e,t,n){var r=Xl(n,innerWidth,innerHeight),i=r[0],s=r[1],o=0,a=i,l=s,u=e/t*s,h=t/e*i;return e=s?a=u:e>=i&&ti/s?l=h:t/e>=3&&!r[2]?o=((l=h)-s)/2:a=u,{width:a,height:l,x:0,y:o,pause:!0}}function Us(e,t){var n=t.leading,r=n!==void 0&&n,i=t.maxWait,s=t.wait,o=s===void 0?i||0:s,a=ne.useRef(e);a.current=e;var l=ne.useRef(0),u=ne.useRef(),h=function(){return u.current&&clearTimeout(u.current)},y=ne.useCallback(function(){var w=[].slice.call(arguments),p=Date.now();function g(){l.current=p,h(),a.current.apply(null,w)}var d=l.current,_=p-d;if(d===0&&(r&&g(),l.current=p),i!==void 0){if(_>i)return void g()}else _=1&&s&&s())};h()}function h(){l=requestAnimationFrame(u)}}var W1={T:0,L:0,W:0,H:0,FIT:void 0},em=function(){var e=ne.useRef(!1);return ne.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},H1=["className"];function V1(e){var t=e.className,n=t===void 0?"":t,r=sa(e,H1);return ve.createElement("div",Ke({className:"PhotoView__Spinner "+n},r),ve.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},ve.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),ve.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var q1=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function K1(e){var t=e.src,n=e.loaded,r=e.broken,i=e.className,s=e.onPhotoLoad,o=e.loadingElement,a=e.brokenElement,l=sa(e,q1),u=em();return t&&!r?ve.createElement(ve.Fragment,null,ve.createElement("img",Ke({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(h){var y=h.target;u.current&&s({loaded:!0,naturalWidth:y.naturalWidth,naturalHeight:y.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},l)),!n&&(o?ve.createElement("span",{className:"PhotoView__icon"},o):ve.createElement(V1,{className:"PhotoView__icon"}))):a?ve.createElement("span",{className:"PhotoView__icon"},typeof a=="function"?a({src:t}):a):null}var X1={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function Y1(e){var t=e.item,n=t.src,r=t.render,i=t.width,s=i===void 0?0:i,o=t.height,a=o===void 0?0:o,l=t.originRef,u=e.visible,h=e.speed,y=e.easing,w=e.wrapClassName,p=e.className,g=e.style,d=e.loadingElement,_=e.brokenElement,c=e.onPhotoTap,f=e.onMaskTap,x=e.onReachMove,k=e.onReachUp,R=e.onPhotoResize,E=e.isActive,N=e.expose,L=Lo(X1),P=L[0],I=L[1],re=ne.useRef(0),T=em(),D=P.naturalWidth,v=D===void 0?s:D,B=P.naturalHeight,se=B===void 0?a:B,X=P.width,H=X===void 0?s:X,z=P.height,j=z===void 0?a:z,O=P.loaded,A=O===void 0?!n:O,J=P.broken,q=P.x,V=P.y,ce=P.touched,Y=P.stopRaf,Z=P.maskTouched,oe=P.rotate,ue=P.scale,de=P.CX,ge=P.CY,we=P.lastX,m=P.lastY,W=P.lastCX,U=P.lastCY,b=P.lastScale,S=P.touchTime,F=P.touchLength,K=P.pause,Q=P.reach,M=ii({onScale:function(G){return ee(Ms(G))},onRotate:function(G){oe!==G&&(N({rotate:G}),I(Ke({rotate:G},Ma(v,se,G))))}});function ee(G,he,Ce){ue!==G&&(N({scale:G}),I(Ke({scale:G},Da(q,V,H,j,ue,G,he,Ce),G<=1&&{x:0,y:0})))}var ae=Us(function(G,he,Ce){if(Ce===void 0&&(Ce=0),(ce||Z)&&E){var pn=Xl(oe,H,j),mn=pn[0],Ot=pn[1];if(Ce===0&&re.current===0){var _t=Math.abs(G-de)<=20,kt=Math.abs(he-ge)<=20;if(_t&&kt)return void I({lastCX:G,lastCY:he});re.current=_t?he>ge?3:2:1}var tn,ur=G-W,In=he-U;if(Ce===0){var cr=Hn(ur+we,ue,mn,innerWidth)[0],Pr=Hn(In+m,ue,Ot,innerHeight);tn=function(Fn,yn,vn,nn){return yn&&Fn===1||nn==="x"?"x":vn&&Fn>1||nn==="y"?"y":void 0}(re.current,cr,Pr[0],Q),tn!==void 0&&x(tn,G,he,ue)}if(tn==="x"||Z)return void I({reach:"x"});var gn=Ms(ue+(Ce-F)/100/2*ue,v/H,.2);N({scale:gn}),I(Ke({touchLength:Ce,reach:tn,scale:gn},Da(q,V,H,j,ue,gn,G,he,ur,In)))}},{maxWait:8});function ie(G){return!Y&&!ce&&(T.current&&I(Ke({},G,{pause:u})),T.current)}var fe,xe,pe,Ve,Gt,ot,Jt,ke,hn=(Gt=function(G){return ie({x:G})},ot=function(G){return ie({y:G})},Jt=function(G){return T.current&&(N({scale:G}),I({scale:G})),!ce&&T.current},ke=ii({X:function(G){return Gt(G)},Y:function(G){return ot(G)},S:function(G){return Jt(G)}}),function(G,he,Ce,pn,mn,Ot,_t,kt,tn,ur,In){var cr=Xl(ur,mn,Ot),Pr=cr[0],gn=cr[1],Fn=Hn(G,kt,Pr,innerWidth),yn=Fn[0],vn=Fn[1],nn=Hn(he,kt,gn,innerHeight),zr=nn[0],vs=nn[1],Lr=Date.now()-In;if(Lr>=200||kt!==_t||Math.abs(tn-_t)>1){var Bn=Da(G,he,mn,Ot,_t,kt),wn=Bn.x,fr=Bn.y,At=yn?vn:wn!==G?wn:null,jr=zr?vs:fr!==he?fr:null;return At!==null&&mr(G,At,ke.X),jr!==null&&mr(he,jr,ke.Y),void(kt!==_t&&mr(_t,kt,ke.S))}var dr=(G-Ce)/Lr,Dn=(he-pn)/Lr,Mn=Math.sqrt(Math.pow(dr,2)+Math.pow(Dn,2)),xn=!1,_n=!1;(function(Ut,at){var lt,$t=Ut,kn=0,Pt=0,Ir=function(xi){lt||(lt=xi);var _i=xi-lt,Ju=Math.sign(Ut),ec=-.001*Ju,tc=Math.sign(-$t)*Math.pow($t,2)*2e-4,nm=$t*_i+(ec+tc)*Math.pow(_i,2)/2;kn+=nm,lt=xi,Ju*($t+=(ec+tc)*_i)<=0?zt():at(kn)?rn():zt()};function rn(){Pt=requestAnimationFrame(Ir)}function zt(){cancelAnimationFrame(Pt)}rn()})(Mn,function(Ut){var at=G+Ut*(dr/Mn),lt=he+Ut*(Dn/Mn),$t=Hn(at,_t,Pr,innerWidth),kn=$t[0],Pt=$t[1],Ir=Hn(lt,_t,gn,innerHeight),rn=Ir[0],zt=Ir[1];if(kn&&!xn&&(xn=!0,yn?mr(at,Pt,ke.X):Kf(Pt,at+(at-Pt),ke.X)),rn&&!_n&&(_n=!0,zr?mr(lt,zt,ke.Y):Kf(zt,lt+(lt-zt),ke.Y)),xn&&_n)return!1;var xi=xn||ke.X(Pt),_i=_n||ke.Y(zt);return xi&&_i})}),en=(fe=c,xe=function(G,he){Q||ee(ue!==1?1:Math.max(2,v/H),G,he)},pe=ne.useRef(0),Ve=Us(function(){pe.current=0,fe.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var G=[].slice.call(arguments);pe.current+=1,Ve.apply(void 0,G),pe.current>=2&&(Ve.cancel(),pe.current=0,xe.apply(void 0,G))});function et(G,he){if(re.current=0,(ce||Z)&&E){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Ce=Ms(ue,v/H);if(hn(q,V,we,m,H,j,ue,Ce,b,oe,S),k(G,he),de===G&&ge===he){if(ce)return void en(G,he);Z&&f(G,he)}}}function jn(G,he,Ce){Ce===void 0&&(Ce=0),I({touched:!0,CX:G,CY:he,lastCX:G,lastCY:he,lastX:q,lastY:V,lastScale:ue,touchLength:Ce,touchTime:Date.now()})}function Ar(G){I({maskTouched:!0,CX:G.clientX,CY:G.clientY,lastX:q,lastY:V})}Dr(Sn?void 0:"mousemove",function(G){G.preventDefault(),ae(G.clientX,G.clientY)}),Dr(Sn?void 0:"mouseup",function(G){et(G.clientX,G.clientY)}),Dr(Sn?"touchmove":void 0,function(G){G.preventDefault();var he=qf(G);ae.apply(void 0,he)},{passive:!1}),Dr(Sn?"touchend":void 0,function(G){var he=G.changedTouches[0];et(he.clientX,he.clientY)},{passive:!1}),Dr("resize",Us(function(){A&&!ce&&(I(Ma(v,se,oe)),R())},{maxWait:8})),Kl(function(){E&&N(Ke({scale:ue,rotate:oe},M))},[E]);var Tt=function(G,he,Ce,pn,mn,Ot,_t,kt,tn,ur){var In=function(wn,fr,At,jr,dr){var Dn=ne.useRef(!1),Mn=Lo({lead:!0,scale:At}),xn=Mn[0],_n=xn.lead,Ut=xn.scale,at=Mn[1],lt=Us(function($t){try{return dr(!0),at({lead:!1,scale:$t}),Promise.resolve()}catch(kn){return Promise.reject(kn)}},{wait:jr});return Kl(function(){Dn.current?(dr(!1),at({lead:!0}),lt(At)):Dn.current=!0},[At]),_n?[wn*Ut,fr*Ut,At/Ut]:[wn*At,fr*At,1]}(Ot,_t,kt,tn,ur),cr=In[0],Pr=In[1],gn=In[2],Fn=function(wn,fr,At,jr,dr){var Dn=ne.useState(W1),Mn=Dn[0],xn=Dn[1],_n=ne.useState(0),Ut=_n[0],at=_n[1],lt=ne.useRef(),$t=ii({OK:function(){return wn&&at(4)}});function kn(Pt){dr(!1),at(Pt)}return ne.useEffect(function(){if(lt.current||(lt.current=Date.now()),At){if(function(Pt,Ir){var rn=Pt&&Pt.current;if(rn&&rn.nodeType===1){var zt=rn.getBoundingClientRect();Ir({T:zt.top,L:zt.left,W:zt.width,H:zt.height,FIT:rn.tagName==="IMG"?getComputedStyle(rn).objectFit:void 0})}}(fr,xn),wn)return Date.now()-lt.current<250?(at(1),requestAnimationFrame(function(){at(2),requestAnimationFrame(function(){return kn(3)})}),void setTimeout($t.OK,jr)):void at(4);kn(5)}},[wn,At]),[Ut,Mn]}(G,he,Ce,tn,ur),yn=Fn[0],vn=Fn[1],nn=vn.W,zr=vn.FIT,vs=innerWidth/2,Lr=innerHeight/2,Bn=yn<3||yn>4;return[Bn?nn?vn.L:vs:pn+(vs-Ot*kt/2),Bn?nn?vn.T:Lr:mn+(Lr-_t*kt/2),cr,Bn&&zr?cr*(vn.H/nn):Pr,yn===0?gn:Bn?nn/(Ot*kt)||.01:gn,Bn?zr?1:0:1,yn,zr]}(u,l,A,q,V,H,j,ue,h,function(G){return I({pause:G})}),ye=Tt[4],Re=Tt[6],Ae="transform "+h+"ms "+y,Pe={className:p,onMouseDown:Sn?void 0:function(G){G.stopPropagation(),G.button===0&&jn(G.clientX,G.clientY,0)},onTouchStart:Sn?function(G){G.stopPropagation(),jn.apply(void 0,qf(G))}:void 0,onWheel:function(G){if(!Q){var he=Ms(ue-G.deltaY/100/2,v/H);I({stopRaf:!0}),ee(he,G.clientX,G.clientY)}},style:{width:Tt[2]+"px",height:Tt[3]+"px",opacity:Tt[5],objectFit:Re===4?void 0:Tt[7],transform:oe?"rotate("+oe+"deg)":void 0,transition:Re>2?Ae+", opacity "+h+"ms ease, height "+(Re<4?h/2:Re>4?h:0)+"ms "+y:void 0}};return ve.createElement("div",{className:"PhotoView__PhotoWrap"+(w?" "+w:""),style:g,onMouseDown:!Sn&&E?Ar:void 0,onTouchStart:Sn&&E?function(G){return Ar(G.touches[0])}:void 0},ve.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+ye+", 0, 0, "+ye+", "+Tt[0]+", "+Tt[1]+")",transition:ce||K?void 0:Ae,willChange:E?"transform":void 0}},n?ve.createElement(K1,Ke({src:n,loaded:A,broken:J},Pe,{onPhotoLoad:function(G){I(Ke({},G,G.loaded&&Ma(G.naturalWidth||0,G.naturalHeight||0,oe)))},loadingElement:d,brokenElement:_})):r&&r({attrs:Pe,scale:ye,rotate:oe})))}var Xf={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function Z1(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,i=e.easing,s=e.photoClosable,o=e.maskClosable,a=o===void 0||o,l=e.maskOpacity,u=l===void 0?1:l,h=e.pullClosable,y=h===void 0||h,w=e.bannerVisible,p=w===void 0||w,g=e.overlayRender,d=e.toolbarRender,_=e.className,c=e.maskClassName,f=e.photoClassName,x=e.photoWrapClassName,k=e.loadingElement,R=e.brokenElement,E=e.images,N=e.index,L=N===void 0?0:N,P=e.onIndexChange,I=e.visible,re=e.onClose,T=e.afterClose,D=e.portalContainer,v=Lo(Xf),B=v[0],se=v[1],X=ne.useState(0),H=X[0],z=X[1],j=B.x,O=B.touched,A=B.pause,J=B.lastCX,q=B.lastCY,V=B.bg,ce=V===void 0?u:V,Y=B.lastBg,Z=B.overlay,oe=B.minimal,ue=B.scale,de=B.rotate,ge=B.onScale,we=B.onRotate,m=e.hasOwnProperty("index"),W=m?L:H,U=m?P:z,b=ne.useRef(W),S=E.length,F=E[W],K=typeof n=="boolean"?n:S>n,Q=function(ye,Re){var Ae=ne.useReducer(function(Ce){return!Ce},!1)[1],Pe=ne.useRef(0),G=function(Ce){var pn=ne.useRef(Ce);function mn(Ot){pn.current=Ot}return ne.useMemo(function(){(function(Ot){ye?(Ot(ye),Pe.current=1):Pe.current=2})(mn)},[Ce]),[pn.current,mn]}(ye),he=G[1];return[G[0],Pe.current,function(){Ae(),Pe.current===2&&(he(!1),Re&&Re()),Pe.current=0}]}(I,T),M=Q[0],ee=Q[1],ae=Q[2];Kl(function(){if(M)return se({pause:!0,x:W*-(innerWidth+Br)}),void(b.current=W);se(Xf)},[M]);var ie=ii({close:function(ye){we&&we(0),se({overlay:!0,lastBg:ce}),re(ye)},changeIndex:function(ye,Re){Re===void 0&&(Re=!1);var Ae=K?b.current+(ye-W):ye,Pe=S-1,G=ql(Ae,0,Pe),he=K?Ae:G,Ce=innerWidth+Br;se({touched:!1,lastCX:void 0,lastCY:void 0,x:-Ce*he,pause:Re}),b.current=he,U&&U(K?ye<0?Pe:ye>Pe?0:ye:G)}}),fe=ie.close,xe=ie.changeIndex;function pe(ye){return ye?fe():se({overlay:!Z})}function Ve(){se({x:-(innerWidth+Br)*W,lastCX:void 0,lastCY:void 0,pause:!0}),b.current=W}function Gt(ye,Re,Ae,Pe){ye==="x"?function(G){if(J!==void 0){var he=G-J,Ce=he;!K&&(W===0&&he>0||W===S-1&&he<0)&&(Ce=he/2),se({touched:!0,lastCX:J,x:-(innerWidth+Br)*b.current+Ce,pause:!1})}else se({touched:!0,lastCX:G,x:j,pause:!1})}(Re):ye==="y"&&function(G,he){if(q!==void 0){var Ce=u===null?null:ql(u,.01,u-Math.abs(G-q)/100/4);se({touched:!0,lastCY:q,bg:he===1?Ce:u,minimal:he===1})}else se({touched:!0,lastCY:G,bg:ce,minimal:!0})}(Ae,Pe)}function ot(ye,Re){var Ae=ye-(J??ye),Pe=Re-(q??Re),G=!1;if(Ae<-40)xe(W+1);else if(Ae>40)xe(W-1);else{var he=-(innerWidth+Br)*b.current;Math.abs(Pe)>100&&oe&&y&&(G=!0,fe()),se({touched:!1,x:he,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!G||Z})}}Dr("keydown",function(ye){if(I)switch(ye.key){case"ArrowLeft":xe(W-1,!0);break;case"ArrowRight":xe(W+1,!0);break;case"Escape":fe()}});var Jt=function(ye,Re,Ae){return ne.useMemo(function(){var Pe=ye.length;return Ae?ye.concat(ye).concat(ye).slice(Pe+Re-1,Pe+Re+2):ye.slice(Math.max(Re-1,0),Math.min(Re+2,Pe+1))},[ye,Re,Ae])}(E,W,K);if(!M)return null;var ke=Z&&!ee,hn=I?ce:Y,en=ge&&we&&{images:E,index:W,visible:I,onClose:fe,onIndexChange:xe,overlayVisible:ke,overlay:F&&F.overlay,scale:ue,rotate:de,onScale:ge,onRotate:we},et=r?r(ee):400,jn=i?i(ee):Vf,Ar=r?r(3):600,Tt=i?i(3):Vf;return ve.createElement(F1,{className:"PhotoView-Portal"+(ke?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(_?" "+_:""),role:"dialog",onClick:function(ye){return ye.stopPropagation()},container:D},I&&ve.createElement(U1,null),ve.createElement("div",{className:"PhotoView-Slider__Backdrop"+(c?" "+c:"")+(ee===1?" PhotoView-Slider__fadeIn":ee===2?" PhotoView-Slider__fadeOut":""),style:{background:hn?"rgba(0, 0, 0, "+hn+")":void 0,transitionTimingFunction:jn,transitionDuration:(O?0:et)+"ms",animationDuration:et+"ms"},onAnimationEnd:ae}),p&&ve.createElement("div",{className:"PhotoView-Slider__BannerWrap"},ve.createElement("div",{className:"PhotoView-Slider__Counter"},W+1," / ",S),ve.createElement("div",{className:"PhotoView-Slider__BannerRight"},d&&en&&d(en),ve.createElement(B1,{className:"PhotoView-Slider__toolbarIcon",onClick:fe}))),Jt.map(function(ye,Re){var Ae=K||W!==0?b.current-1+Re:W+Re;return ve.createElement(Y1,{key:K?ye.key+"/"+ye.src+"/"+Ae:ye.key,item:ye,speed:et,easing:jn,visible:I,onReachMove:Gt,onReachUp:ot,onPhotoTap:function(){return pe(s)},onMaskTap:function(){return pe(a)},wrapClassName:x,className:f,style:{left:(innerWidth+Br)*Ae+"px",transform:"translate3d("+j+"px, 0px, 0)",transition:O||A?void 0:"transform "+Ar+"ms "+Tt},loadingElement:k,brokenElement:R,onPhotoResize:Ve,isActive:b.current===Ae,expose:se})}),!Sn&&p&&ve.createElement(ve.Fragment,null,(K||W!==0)&&ve.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return xe(W-1,!0)}},ve.createElement(D1,null)),(K||W+1-1){var c=u.slice();return c.splice(_,1,d),void a({images:c})}a(function(f){return{images:f.images.concat(d)}})},remove:function(d){a(function(_){var c=_.images.filter(function(f){return f.key!==d});return{images:c,index:Math.min(c.length-1,y)}})},show:function(d){var _=u.findIndex(function(c){return c.key===d});a({visible:!0,index:_}),r&&r(!0,_,o)}}),p=ii({close:function(){a({visible:!1}),r&&r(!1,y,o)},changeIndex:function(d){a({index:d}),n&&n(d,o)}}),g=ne.useMemo(function(){return Ke({},o,w)},[o,w]);return ve.createElement(j1.Provider,{value:g},t,ve.createElement(Z1,Ke({images:u,visible:h,index:y,onIndexChange:p.changeIndex,onClose:p.close},i)))}function ew(){const{filteredImages:e,currentLibraryId:t,thumbnailHeight:n,selectedImage:r,setSelectedImage:i,selectedImages:s,setSelectedImages:o,toggleImageSelection:a,clearSelection:l,isResizingPanels:u}=Te(),h=ne.useRef(null),[y,w]=ne.useState(0),[p,g]=ne.useState(-1),[d,_]=ne.useState(null);ne.useEffect(()=>{let E=null,N=0;const L=10,P={current:0};let I=null;const re=v=>(Math.abs(v-P.current)<12||(P.current=v,I&&clearTimeout(I),I=setTimeout(()=>{w(v)},50)),!0),T=()=>{if(h.current){const v=h.current.offsetWidth-32;if(v>0)return re(v)}return!1},D=()=>{T()?h.current&&(E=new ResizeObserver(()=>{Te.getState().isResizingPanels||T()}),E.observe(h.current)):N{E&&E.disconnect(),I&&clearTimeout(I)}},[]),ne.useEffect(()=>{if(u||!h.current)return;const E=h.current.offsetWidth-32;E>0&&w(E)},[u]);const c=ne.useMemo(()=>{if(!e.length||!y)return[];const E=16,N=n,L=[];let P=[],I=0;return e.forEach((re,T)=>{const D=re.width/re.height,v=N*D;P.push({...re,originalWidth:v,aspectRatio:D}),I+=v;const B=(P.length-1)*E,se=I+B,X=T===e.length-1;let H=!1;if(X)H=!0;else if(se>=y*.95)H=!0;else{const z=e[T+1];if(z){const j=z.width/z.height,O=N*j;I+O+P.length*E>y*1.2&&(H=!0)}}if(H){const z=(P.length-1)*E;let O=(y-z)/I;X&&P.length<3&&(O=Math.min(O,1.2));const A=N*O;P=P.map(J=>({...J,calculatedWidth:J.originalWidth*O,calculatedHeight:A})),L.push(P),P=[],I=0}}),L},[e,n,y]),f=E=>{if(!t||!E.thumbnail_path)return"";const N=E.thumbnail_path.replace(/\\/g,"/").split("/").pop();return ct.getThumbnailUrl(t,"200",N)},x=E=>t?ct.getOriginalUrl(t,E.path):"",k=ne.useMemo(()=>e.map(E=>({src:x(E),key:E.id})),[e,t]),R=(E,N,L)=>{if(N.ctrlKey||N.metaKey)N.preventDefault(),a(E),_(L);else if(N.shiftKey&&d!==null){N.preventDefault();const P=Math.min(d,L),I=Math.max(d,L),T=c.flat().slice(P,I+1);o(T)}else l(),i(E),_(L)};return e.length?(c.flat(),C.jsx("div",{ref:h,className:"h-full overflow-y-auto p-4",children:C.jsx(J1,{images:k,visible:p>=0,onClose:()=>g(-1),index:p,onIndexChange:g,children:C.jsx("div",{className:"space-y-8",children:c.map((E,N)=>C.jsx("div",{className:"flex gap-4",children:E.map((L,P)=>{const I=c.slice(0,N).flat().length+P,re=(r==null?void 0:r.id)===L.id,T=s.some(v=>v.id===L.id),D=re||T;return C.jsxs("div",{className:"flex-shrink-0",style:{width:`${L.calculatedWidth}px`},children:[C.jsxs("div",{className:"relative group cursor-pointer overflow-hidden rounded-lg transition-all hover:shadow-lg",style:{height:`${L.calculatedHeight}px`,backgroundColor:"#2a2a2a",border:D?"3px solid #3b82f6":"3px solid transparent"},onClick:v=>R(L,v,I),onDoubleClick:()=>g(I),children:[C.jsx("img",{src:f(L),alt:L.filename,className:"w-full h-full object-cover",loading:"lazy",onError:v=>{console.error("Image load error:",L.filename,f(L)),v.target.style.display="none"}}),C.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-all pointer-events-none"})]}),C.jsx("div",{className:"mt-1 px-1",children:C.jsx("p",{className:"text-xs truncate text-center transition-colors",style:{color:D?"#3b82f6":"#909090",fontWeight:D?"600":"400"},children:L.filename})})]},L.id)})},N))})})})):C.jsx("div",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400",children:C.jsxs("div",{className:"text-center",children:[C.jsx("p",{className:"text-lg mb-2",children:"暂无图片"}),C.jsx("p",{className:"text-sm",children:"请添加素材库或调整搜索条件"})]})})}function Yf(){const{currentLibraryId:e,searchKeywords:t,filters:n,selectedFolder:r,setImages:i,setTotalImageCount:s,scanProgress:o,scanStartTime:a}=Te(),l=ne.useRef(0),u=()=>{if(!o||!a||o.current===0)return null;const p=Date.now()-a,g=o.current/o.total;if(g===0)return null;const d=p/g-p,_=Math.ceil(d/1e3);if(_<60)return`剩余约 ${_} 秒`;if(_<3600){const x=Math.floor(_/60),k=_%60;return k>0?`剩余约 ${x} 分 ${k} 秒`:`剩余约 ${x} 分钟`}const c=Math.floor(_/3600),f=Math.floor(_%3600/60);return f>0?`剩余约 ${c} 小时 ${f} 分钟`:`剩余约 ${c} 小时`};ne.useEffect(()=>{e&&(y(),w(),!r&&!t&&Object.values(n).every(p=>!p||Array.isArray(p)&&p.length===0)&&h())},[e,t,n,r]);const h=async()=>{if(e)try{const p=await ct.search(e,{});s(p.data.images.length)}catch(p){console.error("Error loading total count:",p)}},y=async()=>{if(!e)return;const p=++l.current;try{const g={keywords:t,...n};r&&(g.folder=r);const d=await ct.search(e,g);p===l.current&&i(d.data.images)}catch(g){p===l.current&&console.error("Error loading images:",g)}},w=async()=>{if(e)try{const p=await ct.getFolders(e);Te.getState().setFolders(p.data.folders)}catch(p){console.error("Error loading folders:",p)}};return C.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-gray-900",children:[o&&C.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900 border-b border-blue-200 dark:border-blue-700",children:[C.jsxs("div",{className:"flex items-center justify-between mb-2",children:[C.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:o.status==="preparing"?"正在准备扫描...":"正在扫描素材库..."}),C.jsxs("div",{className:"text-sm text-blue-600 dark:text-blue-400",children:[o.percent,"%"]})]}),C.jsx("div",{className:"w-full bg-blue-200 dark:bg-blue-800 rounded-full h-2 mb-2",children:C.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${o.status==="preparing"?"bg-blue-400 animate-pulse":"bg-blue-500"}`,style:{width:`${o.percent}%`}})}),C.jsxs("div",{className:"flex items-center justify-between text-xs text-blue-600 dark:text-blue-400",children:[C.jsx("span",{children:o.status==="preparing"?"正在初始化...":`已处理 ${o.current} / ${o.total} 张图片`}),C.jsx("span",{children:u()||"扫描完成后将自动显示"})]})]}),C.jsx("div",{className:"flex-1 overflow-hidden",children:C.jsx(ew,{})})]})}function $s(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var tm={exports:{}};/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,s){function o(u,h){if(!i[u]){if(!r[u]){var y=typeof $s=="function"&&$s;if(!h&&y)return y(u,!0);if(a)return a(u,!0);var w=new Error("Cannot find module '"+u+"'");throw w.code="MODULE_NOT_FOUND",w}var p=i[u]={exports:{}};r[u][0].call(p.exports,function(g){var d=r[u][1][g];return o(d||g)},p,p.exports,n,r,i,s)}return i[u].exports}for(var a=typeof $s=="function"&&$s,l=0;l>2,p=(3&u)<<4|h>>4,g=1>6:64,d=2>4,h=(15&w)<<4|(p=a.indexOf(l.charAt(d++)))>>2,y=(3&p)<<6|(g=a.indexOf(l.charAt(d++))),f[_++]=u,p!==64&&(f[_++]=h),g!==64&&(f[_++]=y);return f}},{"./support":30,"./utils":32}],2:[function(n,r,i){var s=n("./external"),o=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(h,y,w,p,g){this.compressedSize=h,this.uncompressedSize=y,this.crc32=w,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var h=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),y=this;return h.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(h,y,w){return h.pipe(new a).pipe(new l("uncompressedSize")).pipe(y.compressWorker(w)).pipe(new l("compressedSize")).withStreamInfo("compression",y)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var s=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var s=n("./utils"),o=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,h,y,w){var p=o,g=w+y;u^=-1;for(var d=w;d>>8^p[255&(u^h[d])];return-1^u}(0|l,a,a.length,0):function(u,h,y,w){var p=o,g=w+y;u^=-1;for(var d=w;d>>8^p[255&(u^h.charCodeAt(d))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=s?"uint8array":"array";function h(y,w){l.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=w,this.meta={}}i.magic="\b\0",a.inherits(h,l),h.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,y.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(w){y.push({data:w,meta:y.meta})}},i.compressWorker=function(y){return new h("Deflate",y)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function s(p,g){var d,_="";for(d=0;d>>=8;return _}function o(p,g,d,_,c,f){var x,k,R=p.file,E=p.compression,N=f!==u.utf8encode,L=a.transformTo("string",f(R.name)),P=a.transformTo("string",u.utf8encode(R.name)),I=R.comment,re=a.transformTo("string",f(I)),T=a.transformTo("string",u.utf8encode(I)),D=P.length!==R.name.length,v=T.length!==I.length,B="",se="",X="",H=R.dir,z=R.date,j={crc32:0,compressedSize:0,uncompressedSize:0};g&&!d||(j.crc32=p.crc32,j.compressedSize=p.compressedSize,j.uncompressedSize=p.uncompressedSize);var O=0;g&&(O|=8),N||!D&&!v||(O|=2048);var A=0,J=0;H&&(A|=16),c==="UNIX"?(J=798,A|=function(V,ce){var Y=V;return V||(Y=ce?16893:33204),(65535&Y)<<16}(R.unixPermissions,H)):(J=20,A|=function(V){return 63&(V||0)}(R.dosPermissions)),x=z.getUTCHours(),x<<=6,x|=z.getUTCMinutes(),x<<=5,x|=z.getUTCSeconds()/2,k=z.getUTCFullYear()-1980,k<<=4,k|=z.getUTCMonth()+1,k<<=5,k|=z.getUTCDate(),D&&(se=s(1,1)+s(h(L),4)+P,B+="up"+s(se.length,2)+se),v&&(X=s(1,1)+s(h(re),4)+T,B+="uc"+s(X.length,2)+X);var q="";return q+=` +\0`,q+=s(O,2),q+=E.magic,q+=s(x,2),q+=s(k,2),q+=s(j.crc32,4),q+=s(j.compressedSize,4),q+=s(j.uncompressedSize,4),q+=s(L.length,2),q+=s(B.length,2),{fileRecord:y.LOCAL_FILE_HEADER+q+L+B,dirRecord:y.CENTRAL_FILE_HEADER+s(J,2)+q+s(re.length,2)+"\0\0\0\0"+s(A,4)+s(_,4)+L+B+re}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),h=n("../crc32"),y=n("../signature");function w(p,g,d,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=d,this.encodeFileName=_,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(w,l),w.prototype.push=function(p){var g=p.meta.percent||0,d=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:d?(g+100*(d-_-1))/d:100}}))},w.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var d=o(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},w.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,d=o(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),g)this.push({data:function(_){return y.DATA_DESCRIPTOR+s(_.crc32,4)+s(_.compressedSize,4)+s(_.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},w.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=o},{"../utils":32}],19:[function(n,r,i){var s=n("./Uint8ArrayReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var s=n("./DataReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var s=n("./ArrayReader");function o(a){s.call(this,a)}n("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var s=n("../utils"),o=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),h=n("./Uint8ArrayReader");r.exports=function(y){var w=s.getTypeOf(y);return s.checkSupport(w),w!=="string"||o.uint8array?w==="nodebuffer"?new u(y):o.uint8array?new h(s.transformTo("uint8array",y)):new a(s.transformTo("array",y)):new l(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var s=n("./GenericWorker"),o=n("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var s=n("./GenericWorker"),o=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var s=n("../utils"),o=n("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var s=n("../utils"),o=n("./GenericWorker");function a(l){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(h){u.dataIsReady=!0,u.data=h,u.max=h&&h.length||0,u.type=s.getTypeOf(h),u.isPaused||u._tickAndRepeat()},function(h){u.error(h)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(n,r,i){var s=n("../utils"),o=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),h=n("../external"),y=null;if(u.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function w(g,d){return new h.Promise(function(_,c){var f=[],x=g._internalType,k=g._outputType,R=g._mimeType;g.on("data",function(E,N){f.push(E),d&&d(N)}).on("error",function(E){f=[],c(E)}).on("end",function(){try{var E=function(N,L,P){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",L),P);case"base64":return l.encode(L);default:return s.transformTo(N,L)}}(k,function(N,L){var P,I=0,re=null,T=0;for(P=0;P"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var s=n("./utils"),o=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),h=0;h<256;h++)u[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;u[254]=u[254]=1;function y(){l.call(this,"utf-8 decode"),this.leftOver=null}function w(){l.call(this,"utf-8 encode")}i.utf8encode=function(p){return o.nodebuffer?a.newBufferFrom(p,"utf-8"):function(g){var d,_,c,f,x,k=g.length,R=0;for(f=0;f>>6:(_<65536?d[x++]=224|_>>>12:(d[x++]=240|_>>>18,d[x++]=128|_>>>12&63),d[x++]=128|_>>>6&63),d[x++]=128|63&_);return d}(p)},i.utf8decode=function(p){return o.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):function(g){var d,_,c,f,x=g.length,k=new Array(2*x);for(d=_=0;d>10&1023,k[_++]=56320|1023&c)}return k.length!==_&&(k.subarray?k=k.subarray(0,_):k.length=_),s.applyFromCharCode(k)}(p=s.transformTo(o.uint8array?"uint8array":"array",p))},s.inherits(y,l),y.prototype.processChunk=function(p){var g=s.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var d=g;(g=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),g.set(d,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var _=function(f,x){var k;for((x=x||f.length)>f.length&&(x=f.length),k=x-1;0<=k&&(192&f[k])==128;)k--;return k<0||k===0?x:k+u[f[k]]>x?k:x}(g),c=g;_!==g.length&&(o.uint8array?(c=g.subarray(0,_),this.leftOver=g.subarray(_,g.length)):(c=g.slice(0,_),this.leftOver=g.slice(_,g.length))),this.push({data:i.utf8decode(c),meta:p.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=y,s.inherits(w,l),w.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=w},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var s=n("./support"),o=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(d){return d}function h(d,_){for(var c=0;c>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,d,_,c=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4>>6:(p<65536?w[_++]=224|p>>>12:(w[_++]=240|p>>>18,w[_++]=128|p>>>12&63),w[_++]=128|p>>>6&63),w[_++]=128|63&p);return w},i.buf2binstring=function(y){return h(y,y.length)},i.binstring2buf=function(y){for(var w=new s.Buf8(y.length),p=0,g=w.length;p>10&1023,f[g++]=56320|1023&d)}return h(f,g)},i.utf8border=function(y,w){var p;for((w=w||y.length)>y.length&&(w=y.length),p=w-1;0<=p&&(192&y[p])==128;)p--;return p<0||p===0?w:p+l[y[p]]>w?p:w}},{"./common":41}],43:[function(n,r,i){r.exports=function(s,o,a,l){for(var u=65535&s|0,h=s>>>16&65535|0,y=0;a!==0;){for(a-=y=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,u){var h=s,y=u+l;o^=-1;for(var w=u;w>>8^h[255&(o^a[w])];return-1^o}},{}],46:[function(n,r,i){var s,o=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),h=n("./messages"),y=0,w=4,p=0,g=-2,d=-1,_=4,c=2,f=8,x=9,k=286,R=30,E=19,N=2*k+1,L=15,P=3,I=258,re=I+P+1,T=42,D=113,v=1,B=2,se=3,X=4;function H(m,W){return m.msg=h[W],W}function z(m){return(m<<1)-(4m.avail_out&&(U=m.avail_out),U!==0&&(o.arraySet(m.output,W.pending_buf,W.pending_out,U,m.next_out),m.next_out+=U,W.pending_out+=U,m.total_out+=U,m.avail_out-=U,W.pending-=U,W.pending===0&&(W.pending_out=0))}function A(m,W){a._tr_flush_block(m,0<=m.block_start?m.block_start:-1,m.strstart-m.block_start,W),m.block_start=m.strstart,O(m.strm)}function J(m,W){m.pending_buf[m.pending++]=W}function q(m,W){m.pending_buf[m.pending++]=W>>>8&255,m.pending_buf[m.pending++]=255&W}function V(m,W){var U,b,S=m.max_chain_length,F=m.strstart,K=m.prev_length,Q=m.nice_match,M=m.strstart>m.w_size-re?m.strstart-(m.w_size-re):0,ee=m.window,ae=m.w_mask,ie=m.prev,fe=m.strstart+I,xe=ee[F+K-1],pe=ee[F+K];m.prev_length>=m.good_match&&(S>>=2),Q>m.lookahead&&(Q=m.lookahead);do if(ee[(U=W)+K]===pe&&ee[U+K-1]===xe&&ee[U]===ee[F]&&ee[++U]===ee[F+1]){F+=2,U++;do;while(ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&ee[++F]===ee[++U]&&FM&&--S!=0);return K<=m.lookahead?K:m.lookahead}function ce(m){var W,U,b,S,F,K,Q,M,ee,ae,ie=m.w_size;do{if(S=m.window_size-m.lookahead-m.strstart,m.strstart>=ie+(ie-re)){for(o.arraySet(m.window,m.window,ie,ie,0),m.match_start-=ie,m.strstart-=ie,m.block_start-=ie,W=U=m.hash_size;b=m.head[--W],m.head[W]=ie<=b?b-ie:0,--U;);for(W=U=ie;b=m.prev[--W],m.prev[W]=ie<=b?b-ie:0,--U;);S+=ie}if(m.strm.avail_in===0)break;if(K=m.strm,Q=m.window,M=m.strstart+m.lookahead,ee=S,ae=void 0,ae=K.avail_in,ee=P)for(F=m.strstart-m.insert,m.ins_h=m.window[F],m.ins_h=(m.ins_h<=P&&(m.ins_h=(m.ins_h<=P)if(b=a._tr_tally(m,m.strstart-m.match_start,m.match_length-P),m.lookahead-=m.match_length,m.match_length<=m.max_lazy_match&&m.lookahead>=P){for(m.match_length--;m.strstart++,m.ins_h=(m.ins_h<=P&&(m.ins_h=(m.ins_h<=P&&m.match_length<=m.prev_length){for(S=m.strstart+m.lookahead-P,b=a._tr_tally(m,m.strstart-1-m.prev_match,m.prev_length-P),m.lookahead-=m.prev_length-1,m.prev_length-=2;++m.strstart<=S&&(m.ins_h=(m.ins_h<m.pending_buf_size-5&&(U=m.pending_buf_size-5);;){if(m.lookahead<=1){if(ce(m),m.lookahead===0&&W===y)return v;if(m.lookahead===0)break}m.strstart+=m.lookahead,m.lookahead=0;var b=m.block_start+U;if((m.strstart===0||m.strstart>=b)&&(m.lookahead=m.strstart-b,m.strstart=b,A(m,!1),m.strm.avail_out===0)||m.strstart-m.block_start>=m.w_size-re&&(A(m,!1),m.strm.avail_out===0))return v}return m.insert=0,W===w?(A(m,!0),m.strm.avail_out===0?se:X):(m.strstart>m.block_start&&(A(m,!1),m.strm.avail_out),v)}),new oe(4,4,8,4,Y),new oe(4,5,16,8,Y),new oe(4,6,32,32,Y),new oe(4,4,16,16,Z),new oe(8,16,32,32,Z),new oe(8,16,128,128,Z),new oe(8,32,128,256,Z),new oe(32,128,258,1024,Z),new oe(32,258,258,4096,Z)],i.deflateInit=function(m,W){return we(m,W,f,15,8,0)},i.deflateInit2=we,i.deflateReset=ge,i.deflateResetKeep=de,i.deflateSetHeader=function(m,W){return m&&m.state?m.state.wrap!==2?g:(m.state.gzhead=W,p):g},i.deflate=function(m,W){var U,b,S,F;if(!m||!m.state||5>8&255),J(b,b.gzhead.time>>16&255),J(b,b.gzhead.time>>24&255),J(b,b.level===9?2:2<=b.strategy||b.level<2?4:0),J(b,255&b.gzhead.os),b.gzhead.extra&&b.gzhead.extra.length&&(J(b,255&b.gzhead.extra.length),J(b,b.gzhead.extra.length>>8&255)),b.gzhead.hcrc&&(m.adler=u(m.adler,b.pending_buf,b.pending,0)),b.gzindex=0,b.status=69):(J(b,0),J(b,0),J(b,0),J(b,0),J(b,0),J(b,b.level===9?2:2<=b.strategy||b.level<2?4:0),J(b,3),b.status=D);else{var K=f+(b.w_bits-8<<4)<<8;K|=(2<=b.strategy||b.level<2?0:b.level<6?1:b.level===6?2:3)<<6,b.strstart!==0&&(K|=32),K+=31-K%31,b.status=D,q(b,K),b.strstart!==0&&(q(b,m.adler>>>16),q(b,65535&m.adler)),m.adler=1}if(b.status===69)if(b.gzhead.extra){for(S=b.pending;b.gzindex<(65535&b.gzhead.extra.length)&&(b.pending!==b.pending_buf_size||(b.gzhead.hcrc&&b.pending>S&&(m.adler=u(m.adler,b.pending_buf,b.pending-S,S)),O(m),S=b.pending,b.pending!==b.pending_buf_size));)J(b,255&b.gzhead.extra[b.gzindex]),b.gzindex++;b.gzhead.hcrc&&b.pending>S&&(m.adler=u(m.adler,b.pending_buf,b.pending-S,S)),b.gzindex===b.gzhead.extra.length&&(b.gzindex=0,b.status=73)}else b.status=73;if(b.status===73)if(b.gzhead.name){S=b.pending;do{if(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>S&&(m.adler=u(m.adler,b.pending_buf,b.pending-S,S)),O(m),S=b.pending,b.pending===b.pending_buf_size)){F=1;break}F=b.gzindexS&&(m.adler=u(m.adler,b.pending_buf,b.pending-S,S)),F===0&&(b.gzindex=0,b.status=91)}else b.status=91;if(b.status===91)if(b.gzhead.comment){S=b.pending;do{if(b.pending===b.pending_buf_size&&(b.gzhead.hcrc&&b.pending>S&&(m.adler=u(m.adler,b.pending_buf,b.pending-S,S)),O(m),S=b.pending,b.pending===b.pending_buf_size)){F=1;break}F=b.gzindexS&&(m.adler=u(m.adler,b.pending_buf,b.pending-S,S)),F===0&&(b.status=103)}else b.status=103;if(b.status===103&&(b.gzhead.hcrc?(b.pending+2>b.pending_buf_size&&O(m),b.pending+2<=b.pending_buf_size&&(J(b,255&m.adler),J(b,m.adler>>8&255),m.adler=0,b.status=D)):b.status=D),b.pending!==0){if(O(m),m.avail_out===0)return b.last_flush=-1,p}else if(m.avail_in===0&&z(W)<=z(U)&&W!==w)return H(m,-5);if(b.status===666&&m.avail_in!==0)return H(m,-5);if(m.avail_in!==0||b.lookahead!==0||W!==y&&b.status!==666){var Q=b.strategy===2?function(M,ee){for(var ae;;){if(M.lookahead===0&&(ce(M),M.lookahead===0)){if(ee===y)return v;break}if(M.match_length=0,ae=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,ae&&(A(M,!1),M.strm.avail_out===0))return v}return M.insert=0,ee===w?(A(M,!0),M.strm.avail_out===0?se:X):M.last_lit&&(A(M,!1),M.strm.avail_out===0)?v:B}(b,W):b.strategy===3?function(M,ee){for(var ae,ie,fe,xe,pe=M.window;;){if(M.lookahead<=I){if(ce(M),M.lookahead<=I&&ee===y)return v;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=P&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=P?(ae=a._tr_tally(M,1,M.match_length-P),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(ae=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),ae&&(A(M,!1),M.strm.avail_out===0))return v}return M.insert=0,ee===w?(A(M,!0),M.strm.avail_out===0?se:X):M.last_lit&&(A(M,!1),M.strm.avail_out===0)?v:B}(b,W):s[b.level].func(b,W);if(Q!==se&&Q!==X||(b.status=666),Q===v||Q===se)return m.avail_out===0&&(b.last_flush=-1),p;if(Q===B&&(W===1?a._tr_align(b):W!==5&&(a._tr_stored_block(b,0,0,!1),W===3&&(j(b.head),b.lookahead===0&&(b.strstart=0,b.block_start=0,b.insert=0))),O(m),m.avail_out===0))return b.last_flush=-1,p}return W!==w?p:b.wrap<=0?1:(b.wrap===2?(J(b,255&m.adler),J(b,m.adler>>8&255),J(b,m.adler>>16&255),J(b,m.adler>>24&255),J(b,255&m.total_in),J(b,m.total_in>>8&255),J(b,m.total_in>>16&255),J(b,m.total_in>>24&255)):(q(b,m.adler>>>16),q(b,65535&m.adler)),O(m),0=U.w_size&&(F===0&&(j(U.head),U.strstart=0,U.block_start=0,U.insert=0),ee=new o.Buf8(U.w_size),o.arraySet(ee,W,ae-U.w_size,U.w_size,0),W=ee,ae=U.w_size),K=m.avail_in,Q=m.next_in,M=m.input,m.avail_in=ae,m.next_in=0,m.input=W,ce(U);U.lookahead>=P;){for(b=U.strstart,S=U.lookahead-(P-1);U.ins_h=(U.ins_h<>>=P=L>>>24,x-=P,(P=L>>>16&255)===0)B[h++]=65535&L;else{if(!(16&P)){if(!(64&P)){L=k[(65535&L)+(f&(1<>>=P,x-=P),x<15&&(f+=v[l++]<>>=P=L>>>24,x-=P,!(16&(P=L>>>16&255))){if(!(64&P)){L=R[(65535&L)+(f&(1<>>=P,x-=P,(P=h-y)>3,f&=(1<<(x-=I<<3))-1,s.next_in=l,s.next_out=h,s.avail_in=l>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function f(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(T){var D;return T&&T.state?(D=T.state,T.total_in=T.total_out=D.total=0,T.msg="",D.wrap&&(T.adler=1&D.wrap),D.mode=g,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new s.Buf32(d),D.distcode=D.distdyn=new s.Buf32(_),D.sane=1,D.back=-1,w):p}function k(T){var D;return T&&T.state?((D=T.state).wsize=0,D.whave=0,D.wnext=0,x(T)):p}function R(T,D){var v,B;return T&&T.state?(B=T.state,D<0?(v=0,D=-D):(v=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15=X.wsize?(s.arraySet(X.window,D,v-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize):(B<(se=X.wsize-X.wnext)&&(se=B),s.arraySet(X.window,D,v-B,se,X.wnext),(B-=se)?(s.arraySet(X.window,D,v-B,B,0),X.wnext=B,X.whave=X.wsize):(X.wnext+=se,X.wnext===X.wsize&&(X.wnext=0),X.whave>>8&255,v.check=a(v.check,F,2,0),A=O=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&O)<<8)+(O>>8))%31){T.msg="incorrect header check",v.mode=30;break}if((15&O)!=8){T.msg="unknown compression method",v.mode=30;break}if(A-=4,m=8+(15&(O>>>=4)),v.wbits===0)v.wbits=m;else if(m>v.wbits){T.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(F[0]=255&O,F[1]=O>>>8&255,v.check=a(v.check,F,2,0)),A=O=0,v.mode=3;case 3:for(;A<32;){if(z===0)break e;z--,O+=B[X++]<>>8&255,F[2]=O>>>16&255,F[3]=O>>>24&255,v.check=a(v.check,F,4,0)),A=O=0,v.mode=4;case 4:for(;A<16;){if(z===0)break e;z--,O+=B[X++]<>8),512&v.flags&&(F[0]=255&O,F[1]=O>>>8&255,v.check=a(v.check,F,2,0)),A=O=0,v.mode=5;case 5:if(1024&v.flags){for(;A<16;){if(z===0)break e;z--,O+=B[X++]<>>8&255,v.check=a(v.check,F,2,0)),A=O=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(z<(V=v.length)&&(V=z),V&&(v.head&&(m=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,B,X,V,m)),512&v.flags&&(v.check=a(v.check,B,V,X)),z-=V,X+=V,v.length-=V),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(z===0)break e;for(V=0;m=B[X+V++],v.head&&m&&v.length<65536&&(v.head.name+=String.fromCharCode(m)),m&&V>9&1,v.head.done=!0),T.adler=v.check=0,v.mode=12;break;case 10:for(;A<32;){if(z===0)break e;z--,O+=B[X++]<>>=7&A,A-=7&A,v.mode=27;break}for(;A<3;){if(z===0)break e;z--,O+=B[X++]<>>=1)){case 0:v.mode=14;break;case 1:if(I(v),v.mode=20,D!==6)break;O>>>=2,A-=2;break e;case 2:v.mode=17;break;case 3:T.msg="invalid block type",v.mode=30}O>>>=2,A-=2;break;case 14:for(O>>>=7&A,A-=7&A;A<32;){if(z===0)break e;z--,O+=B[X++]<>>16^65535)){T.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&O,A=O=0,v.mode=15,D===6)break e;case 15:v.mode=16;case 16:if(V=v.length){if(z>>=5,A-=5,v.ndist=1+(31&O),O>>>=5,A-=5,v.ncode=4+(15&O),O>>>=4,A-=4,286>>=3,A-=3}for(;v.have<19;)v.lens[K[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,U={bits:v.lenbits},W=u(0,v.lens,0,19,v.lencode,0,v.work,U),v.lenbits=U.bits,W){T.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,ue=65535&S,!((Z=S>>>24)<=A);){if(z===0)break e;z--,O+=B[X++]<>>=Z,A-=Z,v.lens[v.have++]=ue;else{if(ue===16){for(b=Z+2;A>>=Z,A-=Z,v.have===0){T.msg="invalid bit length repeat",v.mode=30;break}m=v.lens[v.have-1],V=3+(3&O),O>>>=2,A-=2}else if(ue===17){for(b=Z+3;A>>=Z)),O>>>=3,A-=3}else{for(b=Z+7;A>>=Z)),O>>>=7,A-=7}if(v.have+V>v.nlen+v.ndist){T.msg="invalid bit length repeat",v.mode=30;break}for(;V--;)v.lens[v.have++]=m}}if(v.mode===30)break;if(v.lens[256]===0){T.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,U={bits:v.lenbits},W=u(h,v.lens,0,v.nlen,v.lencode,0,v.work,U),v.lenbits=U.bits,W){T.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,U={bits:v.distbits},W=u(y,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,U),v.distbits=U.bits,W){T.msg="invalid distances set",v.mode=30;break}if(v.mode=20,D===6)break e;case 20:v.mode=21;case 21:if(6<=z&&258<=j){T.next_out=H,T.avail_out=j,T.next_in=X,T.avail_in=z,v.hold=O,v.bits=A,l(T,q),H=T.next_out,se=T.output,j=T.avail_out,X=T.next_in,B=T.input,z=T.avail_in,O=v.hold,A=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;oe=(S=v.lencode[O&(1<>>16&255,ue=65535&S,!((Z=S>>>24)<=A);){if(z===0)break e;z--,O+=B[X++]<>de)])>>>16&255,ue=65535&S,!(de+(Z=S>>>24)<=A);){if(z===0)break e;z--,O+=B[X++]<>>=de,A-=de,v.back+=de}if(O>>>=Z,A-=Z,v.back+=Z,v.length=ue,oe===0){v.mode=26;break}if(32&oe){v.back=-1,v.mode=12;break}if(64&oe){T.msg="invalid literal/length code",v.mode=30;break}v.extra=15&oe,v.mode=22;case 22:if(v.extra){for(b=v.extra;A>>=v.extra,A-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;oe=(S=v.distcode[O&(1<>>16&255,ue=65535&S,!((Z=S>>>24)<=A);){if(z===0)break e;z--,O+=B[X++]<>de)])>>>16&255,ue=65535&S,!(de+(Z=S>>>24)<=A);){if(z===0)break e;z--,O+=B[X++]<>>=de,A-=de,v.back+=de}if(O>>>=Z,A-=Z,v.back+=Z,64&oe){T.msg="invalid distance code",v.mode=30;break}v.offset=ue,v.extra=15&oe,v.mode=24;case 24:if(v.extra){for(b=v.extra;A>>=v.extra,A-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){T.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(j===0)break e;if(V=q-j,v.offset>V){if((V=v.offset-V)>v.whave&&v.sane){T.msg="invalid distance too far back",v.mode=30;break}ce=V>v.wnext?(V-=v.wnext,v.wsize-V):v.wnext-V,V>v.length&&(V=v.length),Y=v.window}else Y=se,ce=H-v.offset,V=v.length;for(jN?(P=ce[Y+_[D]],A[J+_[D]]):(P=96,0),f=1<>H)+(x-=f)]=L<<24|P<<16|I|0,x!==0;);for(f=1<>=1;if(f!==0?(O&=f-1,O+=f):O=0,D++,--q[T]==0){if(T===B)break;T=y[w+_[D]]}if(se>>7)]}function J(S,F){S.pending_buf[S.pending++]=255&F,S.pending_buf[S.pending++]=F>>>8&255}function q(S,F,K){S.bi_valid>c-K?(S.bi_buf|=F<>c-S.bi_valid,S.bi_valid+=K-c):(S.bi_buf|=F<>>=1,K<<=1,0<--F;);return K>>>1}function Y(S,F,K){var Q,M,ee=new Array(_+1),ae=0;for(Q=1;Q<=_;Q++)ee[Q]=ae=ae+K[Q-1]<<1;for(M=0;M<=F;M++){var ie=S[2*M+1];ie!==0&&(S[2*M]=ce(ee[ie]++,ie))}}function Z(S){var F;for(F=0;F>1;1<=K;K--)de(S,ee,K);for(M=fe;K=S.heap[1],S.heap[1]=S.heap[S.heap_len--],de(S,ee,1),Q=S.heap[1],S.heap[--S.heap_max]=K,S.heap[--S.heap_max]=Q,ee[2*M]=ee[2*K]+ee[2*Q],S.depth[M]=(S.depth[K]>=S.depth[Q]?S.depth[K]:S.depth[Q])+1,ee[2*K+1]=ee[2*Q+1]=M,S.heap[1]=M++,de(S,ee,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(pe,Ve){var Gt,ot,Jt,ke,hn,en,et=Ve.dyn_tree,jn=Ve.max_code,Ar=Ve.stat_desc.static_tree,Tt=Ve.stat_desc.has_stree,ye=Ve.stat_desc.extra_bits,Re=Ve.stat_desc.extra_base,Ae=Ve.stat_desc.max_length,Pe=0;for(ke=0;ke<=_;ke++)pe.bl_count[ke]=0;for(et[2*pe.heap[pe.heap_max]+1]=0,Gt=pe.heap_max+1;Gt>=7;M>>=1)if(1&xe&&ie.dyn_ltree[2*fe]!==0)return o;if(ie.dyn_ltree[18]!==0||ie.dyn_ltree[20]!==0||ie.dyn_ltree[26]!==0)return a;for(fe=32;fe>>3,(ee=S.static_len+3+7>>>3)<=M&&(M=ee)):M=ee=K+5,K+4<=M&&F!==-1?b(S,F,K,Q):S.strategy===4||ee===M?(q(S,2+(Q?1:0),3),ge(S,re,T)):(q(S,4+(Q?1:0),3),function(ie,fe,xe,pe){var Ve;for(q(ie,fe-257,5),q(ie,xe-1,5),q(ie,pe-4,4),Ve=0;Ve>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&F,S.pending_buf[S.l_buf+S.last_lit]=255&K,S.last_lit++,F===0?S.dyn_ltree[2*K]++:(S.matches++,F--,S.dyn_ltree[2*(v[K]+y+1)]++,S.dyn_dtree[2*A(F)]++),S.last_lit===S.lit_bufsize-1},i._tr_align=function(S){q(S,2,3),V(S,x,re),function(F){F.bi_valid===16?(J(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,u,h,y,w=1,p={},g=!1,d=o.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(o);_=_&&_.setTimeout?_:o,l={}.toString.call(o.process)==="[object process]"?function(k){process.nextTick(function(){f(k)})}:function(){if(o.postMessage&&!o.importScripts){var k=!0,R=o.onmessage;return o.onmessage=function(){k=!1},o.postMessage("","*"),o.onmessage=R,k}}()?(y="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",x,!1):o.attachEvent("onmessage",x),function(k){o.postMessage(y+k,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(k){f(k.data)},function(k){h.port2.postMessage(k)}):d&&"onreadystatechange"in d.createElement("script")?(u=d.documentElement,function(k){var R=d.createElement("script");R.onreadystatechange=function(){f(k),R.onreadystatechange=null,u.removeChild(R),R=null},u.appendChild(R)}):function(k){setTimeout(f,0,k)},_.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var R=new Array(arguments.length-1),E=0;E"u"?s===void 0?this:s:self)}).call(this,typeof ws<"u"?ws:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(tm);var tw=tm.exports;const Zf=Yl(tw);function Qf(){const{selectedImage:e,selectedImages:t,currentLibraryId:n,selectedFolder:r,images:i,setMobileView:s,isResizingPanels:o,resizingSide:a}=Te(),[l,u]=ne.useState(!1),[h,y]=ne.useState(""),[w,p]=ne.useState(!1),[g,d]=ne.useState(!1),[_,c]=ne.useState(!1),[f,x]=ne.useState(!1),[k,R]=ne.useState(0),[E,N]=ne.useState(!1),[L,P]=ne.useState(0),I=t.length>0,re=I?t[0]:e;if(ne.useEffect(()=>{const j=()=>{u(window.innerWidth<768)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]),ne.useEffect(()=>{if(!e||!n){y("");return}const j=T();if(y(j),p(!0),o){p(!1);return}const O=D(),A=new Image;return A.onload=()=>{y(O),p(!1)},A.onerror=()=>{console.error("Failed to load original image"),p(!1)},A.src=O,()=>{A.onload=null,A.onerror=null}},[e,n,o,a]),!e&&t.length===0)return C.jsx("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex items-center justify-center",children:C.jsx("p",{className:"text-gray-400 dark:text-gray-500 text-sm",children:"选择图片查看详情"})});const T=()=>{if(!n||!e.thumbnail_path)return"";const j=e.thumbnail_path.replace(/\\/g,"/").split("/").pop();return ct.getThumbnailUrl(n,"200",j)},D=()=>!n||!e.path?"":ct.getOriginalUrl(n,e.path),v=async()=>{try{const j=ct.getOriginalUrl(n,e.path),A=await(await fetch(j)).blob(),J=new Image,q=new Promise((Y,Z)=>{J.onload=Y,J.onerror=Z});J.src=URL.createObjectURL(A),await q;const V=document.createElement("canvas");V.width=J.width,V.height=J.height,V.getContext("2d").drawImage(J,0,0),V.toBlob(async Y=>{try{const Z=new ClipboardItem({"image/png":Y,"text/html":new Blob([`${e.filename}`],{type:"text/html"}),"text/plain":new Blob([j],{type:"text/plain"})});await navigator.clipboard.write([Z]),c(!0),setTimeout(()=>c(!1),2e3)}catch(Z){console.error("写入剪贴板失败:",Z);try{await navigator.clipboard.write([new ClipboardItem({"image/png":Y})]),c(!0),setTimeout(()=>c(!1),2e3)}catch(oe){console.error("备用方案也失败:",oe),alert("复制失败,请重试")}}},"image/png"),URL.revokeObjectURL(J.src)}catch(j){console.error("复制图片失败:",j),alert("复制图片失败,请重试")}},B=async()=>{try{const j=I?t:[e];if(j.length===1){await v();return}const A=(await Promise.all(j.map(async q=>{const V=ct.getOriginalUrl(n,q.path),Y=await(await fetch(V)).blob();return new Promise(Z=>{const oe=new FileReader;oe.onloadend=()=>{Z({dataUrl:oe.result,filename:q.filename})},oe.readAsDataURL(Y)})}))).map(({dataUrl:q,filename:V})=>`${V}`).join(` +`),J=j.map(q=>q.filename).join(` +`);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([A],{type:"text/html"}),"text/plain":new Blob([J],{type:"text/plain"})})]),c(!0),setTimeout(()=>c(!1),2e3)}catch(q){console.error("写入剪贴板失败:",q),alert(`复制失败。 + +提示:浏览器限制,多张图片会以 HTML 格式复制。 +可粘贴到 Word、富文本编辑器等。 + +如需单独使用,请使用"导出"功能。`)}}catch(j){console.error("复制图片失败:",j),alert("复制图片失败,请重试")}},se=async()=>{x(!0);try{const j=I?t:[e];if(j.length===1){const O=ct.getOriginalUrl(n,j[0].path),A=document.createElement("a");A.href=O,A.download=j[0].filename,A.target="_blank",document.body.appendChild(A),A.click(),document.body.removeChild(A)}else{const O=new Zf,A=O.folder("images");R(0);for(let V=0;V{if(!r){alert("请先选择一个文件夹");return}N(!0),P(0);try{const j=i.filter(ce=>ce.folder&&ce.folder.startsWith(r));if(j.length===0){alert("当前文件夹没有图片");return}const O=new Zf,A=r.split("/").pop()||"images",J=O.folder(A);for(let ce=0;cej<1024?j+" B":j<1024*1024?(j/1024).toFixed(2)+" KB":(j/(1024*1024)).toFixed(2)+" MB",z=j=>new Date(j).toLocaleString("zh-CN");return C.jsxs("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col h-full",children:[l&&C.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:C.jsxs("button",{onClick:()=>s("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[C.jsx(E1,{className:"w-5 h-5"}),C.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),C.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:C.jsxs("div",{className:"w-full aspect-square bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden relative",children:[C.jsx("img",{src:h,alt:re.filename,decoding:"async",className:`w-full h-full object-contain transition-opacity duration-300 ${w?"opacity-75":"opacity-100"}`}),w&&C.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded",children:"加载原图中..."})]})}),C.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:C.jsxs("div",{children:[C.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"基本信息"}),C.jsxs("div",{className:"space-y-2 text-sm",children:[C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件名:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100 break-all",children:e.filename})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"尺寸:"}),C.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[e.width," × ",e.height]})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"大小:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:H(e.size)})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"格式:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100 uppercase",children:e.format})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"创建时间:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:z(e.created_at)})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"修改时间:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:z(e.modified_at)})]}),C.jsxs("div",{children:[C.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"路径:"}),C.jsx("p",{className:"text-gray-900 dark:text-gray-100 text-xs break-all",children:e.path})]})]})]})}),C.jsxs("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 space-y-2 flex-shrink-0",children:[C.jsx("button",{onClick:B,className:`w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all ${_?"bg-green-500 text-white":"bg-blue-500 text-white hover:bg-blue-600"}`,children:_?C.jsxs(C.Fragment,{children:[C.jsx(C1,{className:"w-4 h-4"}),C.jsxs("span",{children:["已复制",I?` ${t.length} 张`:""]})]}):C.jsxs(C.Fragment,{children:[C.jsx(O1,{className:"w-4 h-4"}),C.jsxs("span",{children:["复制图片",I?` (${t.length})`:""]})]})}),!l&&C.jsxs(C.Fragment,{children:[C.jsxs("button",{onClick:se,disabled:f,className:"w-full flex flex-col items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(A1,{className:"w-4 h-4"}),C.jsx("span",{children:f?`打包中... ${k}%`:`导出图片${I?` (${t.length})`:""}`})]}),f&&I&&C.jsx("div",{className:"w-full bg-gray-300 dark:bg-gray-600 rounded-full h-1.5 mt-1",children:C.jsx("div",{className:"bg-blue-500 h-1.5 rounded-full transition-all duration-300",style:{width:`${k}%`}})})]}),r&&C.jsxs("button",{onClick:X,disabled:E,className:"w-full flex flex-col items-center justify-center gap-2 px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(P1,{className:"w-4 h-4"}),C.jsx("span",{children:E?`打包文件夹... ${L}%`:"导出当前文件夹"})]}),E&&C.jsx("div",{className:"w-full bg-purple-300 rounded-full h-1.5 mt-1",children:C.jsx("div",{className:"bg-white h-1.5 rounded-full transition-all duration-300",style:{width:`${L}%`}})})]})]})]})]})}function Gf(){const{theme:e,toggleTheme:t,searchKeywords:n,thumbnailHeight:r,images:i,filteredImages:s,selectedFolder:o,currentLibraryId:a,setSearchKeywords:l,setThumbnailHeight:u,setFilteredImages:h,mobileView:y}=Te(),[w,p]=ne.useState(!1),[g,d]=ne.useState([]),[_,c]=ne.useState([]),[f,x]=ne.useState(""),[k,R]=ne.useState(!1),[E,N]=ne.useState(!1),[L,P]=ne.useState(!1);ne.useEffect(()=>{const Y=()=>{N(window.innerWidth<768)};return Y(),window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},[]),ne.useEffect(()=>{d([]),c([]),x("")},[o]),ne.useEffect(()=>{if(a)return If.start(a).then(()=>{console.log("✅ 文件监控已启动(实时检测文件变化)")}).catch(Y=>{console.error("启动文件监控失败:",Y),console.error("提示:在飞牛 fnOS 上,请确保在应用设置中授予了文件夹访问权限")}),()=>{If.stop(a).catch(Y=>console.error("Stop watch error:",Y))}},[a]);const I=Y=>{l(Y)},re=Y=>{if(Y.length===0)return[];const Z=[...Y].sort((U,b)=>U-b),oe=Z[0],ue=Z[Z.length-1];if(ue-oe<10)return[T(oe,ue)];const de=5,ge=[],we=Math.log10(oe||1),W=(Math.log10(ue)-we)/de;for(let U=0;UK>=b&&KU)},T=(Y,Z,oe=!1)=>{const ue=de=>{const ge=we=>we<10?Math.round(we):we<100?Math.round(we/5)*5:we<1e3?Math.round(we/10)*10:Math.round(we/50)*50;return de<1?`${ge(de*1024)}B`:de<1024?`${ge(de)}KB`:de<1048576?`${ge(de/1024)}MB`:`${ge(de/1048576)}GB`};return oe?`> ${ue(Y)}`:`${ue(Y)} - ${ue(Z)}`},D=Y=>{const Z=Y.match(/^(\d+(?:\.\d+)?)(B|KB|MB|GB)$/);if(!Z)return 0;const oe=parseFloat(Z[1]);switch(Z[2]){case"B":return oe/1024;case"KB":return oe;case"MB":return oe*1024;case"GB":return oe*1024*1024;default:return 0}},v=(Y,Z)=>{if(Z.startsWith(">")){const oe=Z.substring(1).trim(),ue=D(oe);return Y>=ue}else if(Z.includes(" - ")){const[oe,ue]=Z.split(" - ").map(we=>we.trim()),de=D(oe),ge=D(ue);return Y>=de&&Y{if(i.length===0)return{formats:[],sizes:[],hasHorizontal:!1,hasVertical:!1};const Y=new Set,Z=[];let oe=!1,ue=!1;i.forEach(ge=>{ge.format&&Y.add(ge.format.toLowerCase()),Z.push(ge.size/1024),ge.width>ge.height&&(oe=!0),ge.height>ge.width&&(ue=!0)});const de=re(Z);return{formats:Array.from(Y).sort(),sizes:de,hasHorizontal:oe,hasVertical:ue}},[i]),se=ne.useMemo(()=>{if(g.length===0&&_.length===0&&!f)return i;const Y=new Set(g),Z=new Set(_);return i.filter(oe=>{var ue;if(Y.size>0&&!Y.has((ue=oe.format)==null?void 0:ue.toLowerCase()))return!1;if(Z.size>0){const de=oe.size/1024;let ge=!1;for(const we of Z)if(v(de,we)){ge=!0;break}if(!ge)return!1}if(f==="horizontal"){if(oe.width<=oe.height)return!1}else if(f==="vertical"&&oe.height<=oe.width)return!1;return!0})},[i,g,_,f]);ne.useEffect(()=>{h(se)},[se,h]);const X=Y=>{d(Z=>Z.includes(Y)?Z.filter(oe=>oe!==Y):[...Z,Y])},H=Y=>{c(Z=>Z.includes(Y)?Z.filter(oe=>oe!==Y):[...Z,Y])},z=Y=>{x(Z=>Z===Y?"":Y)},j=()=>{d([]),c([]),x("")},O=async()=>{t();try{await Cn.updateTheme(e==="light"?"dark":"light")}catch(Y){console.error("Error saving theme:",Y)}},A=async Y=>{u(Y);try{await Cn.updatePreferences({thumbnailHeight:Y})}catch(Z){console.error("Error saving preferences:",Z)}},J=async()=>{if(!(!a||k)){R(!0);try{await Hl.sync(a)}catch(Y){console.error("Error refreshing:",Y),alert("刷新失败: "+Y.message)}finally{R(!1)}}},q=B.formats,V=B.sizes.map(Y=>({label:Y})),ce=[{value:"horizontal",label:"横图"},{value:"vertical",label:"竖图"}].filter(Y=>Y.value==="horizontal"&&B.hasHorizontal||Y.value==="vertical"&&B.hasVertical);if(E){const Y=y!=="sidebar";return C.jsxs("header",{className:"border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[C.jsxs("div",{className:"h-14 flex items-center justify-between px-4",children:[C.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"FlyPic"}),C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("button",{onClick:J,disabled:!a||k,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",children:C.jsx(Uf,{className:`w-5 h-5 text-gray-700 dark:text-gray-300 ${k?"animate-spin":""}`})}),C.jsx("button",{onClick:()=>P(!L),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:C.jsx($f,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})}),C.jsx("button",{onClick:O,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:e==="light"?C.jsx(Mf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}):C.jsx(Wf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})})]})]}),Y&&C.jsx("div",{className:"px-4 pb-3",children:C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsxs("div",{className:"flex-1 relative",children:[C.jsx(Vl,{className:"absolute left-3 top-2.5 w-5 h-5 text-gray-400"}),C.jsx("input",{type:"text",placeholder:"搜索图片...",value:n,onChange:Z=>I(Z.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm"})]}),C.jsx("button",{onClick:()=>p(!w),className:`p-2 border rounded-lg ${g.length>0||_.length>0||f?"border-blue-500 bg-blue-50 dark:bg-blue-500/20":"border-gray-300 dark:border-gray-600"}`,children:C.jsx(Bf,{className:`w-5 h-5 ${g.length>0||_.length>0||f?"text-blue-600 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`})})]})}),L&&C.jsx("div",{className:"px-4 pb-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:C.jsxs("div",{className:"flex flex-col gap-3",children:[C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"缩略图大小"}),C.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[r,"px"]})]}),C.jsx("input",{type:"range",min:"150",max:"300",value:r,onChange:Z=>A(parseInt(Z.target.value)),className:"w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #3b82f6 0%, #3b82f6 ${(r-150)/150*100}%, #e5e7eb ${(r-150)/150*100}%, #e5e7eb 100%)`}})]})}),Y&&w&&C.jsxs("div",{className:"px-4 pb-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[C.jsxs("div",{className:"flex items-center justify-between mb-3",children:[C.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"筛选条件"}),C.jsx("button",{onClick:j,className:"text-xs text-blue-500",children:"清除全部"})]}),C.jsxs("div",{className:"mb-3",children:[C.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"格式"}),C.jsx("div",{className:"flex flex-wrap gap-2",children:q.map(Z=>C.jsx("button",{onClick:()=>X(Z),className:`px-3 py-1 text-xs rounded-full ${g.includes(Z)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:Z.toUpperCase()},Z))})]}),C.jsxs("div",{className:"mb-3",children:[C.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"尺寸"}),C.jsx("div",{className:"flex flex-wrap gap-2",children:V.map(Z=>C.jsx("button",{onClick:()=>H(Z.label),className:`px-3 py-1 text-xs rounded-full ${_.includes(Z.label)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:Z.label},Z.label))})]}),C.jsxs("div",{children:[C.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"方向"}),C.jsx("div",{className:"flex flex-wrap gap-2",children:ce.map(Z=>C.jsx("button",{onClick:()=>z(Z.value),className:`px-3 py-1 text-xs rounded-full ${f===Z.value?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:Z.label},Z.value))})]})]})]})}return C.jsxs("header",{className:"border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[C.jsxs("div",{className:"h-14 flex items-center justify-between px-6",children:[C.jsxs("div",{className:"flex-shrink-0",children:[C.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"FlyPic"}),C.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"轻量快速的图片素材库管理"})]}),C.jsxs("div",{className:"flex-1 max-w-2xl mx-6 flex items-center gap-3",children:[C.jsxs("div",{className:"flex-1 relative",children:[C.jsx(Vl,{className:"absolute left-3 top-2.5 w-5 h-5 text-gray-400"}),C.jsx("input",{type:"text",placeholder:"搜索图片... (多个关键词用空格分隔,即时搜索)",value:n,onChange:Y=>I(Y.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),C.jsxs("button",{onClick:()=>p(!w),className:`relative p-2 border rounded-lg transition-colors ${g.length>0||_.length>0||f?"border-blue-500 dark:border-blue-400 bg-blue-50 dark:bg-blue-500/20 hover:bg-blue-100 dark:hover:bg-blue-500/30":"border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:g.length>0||_.length>0||f?"筛选(已启用)":"筛选",children:[C.jsx(Bf,{className:`w-5 h-5 ${g.length>0||_.length>0||f?"text-blue-600 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`}),(g.length>0||_.length>0||f)&&C.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full",style:{backgroundColor:"#3b82f6"}})]})]}),C.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[C.jsx($f,{className:"w-4 h-4 text-gray-500"}),C.jsx("input",{type:"range",min:"150",max:"300",value:r,onChange:Y=>A(parseInt(Y.target.value)),className:"w-32"}),C.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 w-12",children:[r,"px"]}),C.jsx("button",{onClick:J,disabled:!a||k,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed ml-2",title:"手动刷新素材库(文件监控已自动启用)",children:C.jsx(Uf,{className:`w-5 h-5 text-gray-700 dark:text-gray-300 ${k?"animate-spin":""}`})}),C.jsx("button",{onClick:O,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:e==="light"?"切换到暗色模式":"切换到亮色模式",children:e==="light"?C.jsx(Mf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}):C.jsx(Wf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})})]})]}),w&&C.jsx("div",{className:"px-6 pb-3",children:C.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[C.jsxs("div",{className:"flex items-center justify-between mb-3",children:[C.jsx("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"筛选条件(实时生效)"}),C.jsx("button",{onClick:j,className:"text-xs text-blue-500 hover:text-blue-600 dark:hover:text-blue-400",children:"清除全部"})]}),C.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[C.jsxs("div",{children:[C.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"格式"}),C.jsx("div",{className:"flex flex-col gap-1.5",children:B.formats.length>0?B.formats.map(Y=>C.jsx("button",{onClick:()=>X(Y),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${g.includes(Y)?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500"}`,children:Y.toUpperCase()},Y)):C.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无格式数据"})})]}),C.jsxs("div",{children:[C.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"文件大小"}),C.jsx("div",{className:"flex flex-col gap-1.5",children:B.sizes.length>0?B.sizes.map(Y=>C.jsx("button",{onClick:()=>H(Y),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${_.includes(Y)?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500"}`,children:Y},Y)):C.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无大小数据"})})]}),C.jsxs("div",{children:[C.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"图片方向"}),C.jsxs("div",{className:"flex flex-col gap-1.5",children:[B.hasHorizontal&&C.jsx("button",{onClick:()=>z("horizontal"),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${f==="horizontal"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500"}`,children:"横图"}),B.hasVertical&&C.jsx("button",{onClick:()=>z("vertical"),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${f==="vertical"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500"}`,children:"竖图"}),!B.hasHorizontal&&!B.hasVertical&&C.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无方向数据"})]})]})]})]})})]})}function nw(){const{theme:e,setLibraries:t,setCurrentLibrary:n,setScanProgress:r,mobileView:i,setMobileView:s,selectedImage:o}=Te(),[a,l]=ne.useState(256),[u,h]=ne.useState(320),[y,w]=ne.useState(!1),[p,g]=ne.useState(!1),[d,_]=ne.useState(!1),c=ne.useRef(null);ne.useEffect(()=>{e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]),ne.useEffect(()=>{const E=()=>{const N=window.innerWidth<768;_(N)};return E(),window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]),ne.useEffect(()=>{d&&o&&s("detail")},[o,d,s]),ne.useEffect(()=>{f();const E=io("http://localhost:5002");return E.on("scanProgress",N=>{r(N)}),E.on("scanComplete",({libraryId:N,results:L})=>{console.log("📊 Scan complete:",L);const P=Te.getState().currentLibraryId;N===P?(console.log("🔄 Reloading folders and images..."),Promise.all([k(N),x(N)]).then(()=>{console.log("✅ Folders and images reloaded"),ct.search(N,{}).then(I=>{Te.getState().setTotalImageCount(I.data.images.length),console.log(`✅ Total count updated: ${I.data.images.length}`)})}).finally(()=>{r(null)})):r(null)}),E.on("scanError",({libraryId:N,error:L})=>{r(null),console.error("Scan error:",L)}),()=>{E.disconnect()}},[]);const f=async()=>{try{const E=await Cn.getAll();if(t(E.data.libraries),n(E.data.currentLibraryId),E.data.theme&&Te.getState().setTheme(E.data.theme),E.data.preferences){const{thumbnailHeight:N,leftPanelWidth:L,rightPanelWidth:P}=E.data.preferences;N&&Te.getState().setThumbnailHeight(N),L&&l(L),P&&h(P)}E.data.currentLibraryId&&(x(E.data.currentLibraryId),k(E.data.currentLibraryId))}catch(E){console.error("Error loading libraries:",E)}},x=async E=>{try{const N={},L=Te.getState().selectedFolder;L&&(N.folder=L);const P=await ct.search(E,N);Te.getState().setImages(P.data.images)}catch(N){console.error("Error loading images:",N)}},k=async E=>{try{const N=await ct.getFolders(E);Te.getState().setFolders(N.data.folders)}catch(N){console.error("Error loading folders:",N)}},R=async(E,N)=>{try{await Cn.updatePreferences({leftPanelWidth:E,rightPanelWidth:N})}catch(L){console.error("Error saving panel widths:",L)}};return ne.useEffect(()=>{if(!y&&!p)return;const E=document.getElementById("left-panel"),N=document.getElementById("right-panel");let L=a,P=u;const I=c.current.getBoundingClientRect(),re=I.left,T=I.right;let D=null,v=null,B=null;const se=()=>{E&&v!=null&&(E.style.width=`${v}px`,L=v),N&&B!=null&&(N.style.width=`${B}px`,P=B),D=null,v=null,B=null},X=z=>{let j=!1;if(y&&E){const O=z.clientX-re;O>=200&&O<=400&&(v=O,j=!0)}if(p&&N){const O=T-z.clientX;O>=280&&O<=500&&(B=O,j=!0)}j&&D==null&&(D=requestAnimationFrame(se))},H=()=>{D&&(cancelAnimationFrame(D),se()),l(L),h(P),R(L,P),w(!1),g(!1),Te.getState().setIsResizingPanels(!1),Te.getState().setResizingSide(null)};return document.addEventListener("mousemove",X,{passive:!0}),document.addEventListener("mouseup",H),document.body.style.userSelect="none",document.body.style.cursor="col-resize",E&&(E.style.transition="none"),N&&(N.style.transition="none"),()=>{D&&(cancelAnimationFrame(D),D=null),document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",H),document.body.style.userSelect="",document.body.style.cursor="",E&&(E.style.transition=""),N&&(N.style.transition="")}},[y,p]),d?C.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[C.jsx(Gf,{}),C.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[C.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${i==="sidebar"?"translate-x-0":"-translate-x-full"}`,children:C.jsx(Hf,{})}),C.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${i==="main"?"translate-x-0":i==="sidebar"?"translate-x-full":"-translate-x-full"}`,children:C.jsx(Yf,{})}),C.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${i==="detail"?"translate-x-0":"translate-x-full"}`,children:C.jsx(Qf,{})})]}),C.jsxs("div",{className:"flex border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[C.jsxs("button",{onClick:()=>s("sidebar"),className:`flex-1 flex flex-col items-center py-2 ${i==="sidebar"?"text-blue-500":"text-gray-500"}`,children:[C.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),C.jsx("span",{className:"text-xs mt-1",children:"文件夹"})]}),C.jsxs("button",{onClick:()=>s("main"),className:`flex-1 flex flex-col items-center py-2 ${i==="main"?"text-blue-500":"text-gray-500"}`,children:[C.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),C.jsx("span",{className:"text-xs mt-1",children:"图片"})]}),C.jsxs("button",{onClick:()=>s("detail"),disabled:!o,className:`flex-1 flex flex-col items-center py-2 ${i==="detail"?"text-blue-500":"text-gray-500"} disabled:opacity-30`,children:[C.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:C.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),C.jsx("span",{className:"text-xs mt-1",children:"详情"})]})]})]}):C.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[C.jsx(Gf,{}),C.jsxs("div",{ref:c,className:"flex flex-1 overflow-hidden",children:[C.jsx("div",{id:"left-panel",style:{width:`${a}px`},className:"flex-shrink-0 h-full",children:C.jsx(Hf,{})}),C.jsx("div",{className:`group relative w-1 h-full cursor-col-resize flex-shrink-0 transition-colors ${y?"bg-blue-500":"bg-gray-200 dark:bg-gray-700 hover:bg-blue-400"}`,onMouseDown:E=>{E.preventDefault(),Te.getState().setIsResizingPanels(!0),Te.getState().setResizingSide("left"),w(!0)},children:C.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 w-5"})}),C.jsx("div",{className:"flex-1 min-w-0 h-full",children:C.jsx(Yf,{})}),C.jsx("div",{className:`group relative w-1 h-full cursor-col-resize flex-shrink-0 transition-colors ${p?"bg-blue-500":"bg-gray-200 dark:bg-gray-700 hover:bg-blue-400"}`,onMouseDown:E=>{E.preventDefault(),Te.getState().setIsResizingPanels(!0),Te.getState().setResizingSide("right"),g(!0)},children:C.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 w-5"})}),C.jsx("div",{id:"right-panel",style:{width:`${u}px`},className:"flex-shrink-0 h-full",children:C.jsx(Qf,{})})]})]})}Ua.createRoot(document.getElementById("root")).render(C.jsx(ve.StrictMode,{children:C.jsx(nw,{})})); diff --git a/flypic/app/server/public/assets/index-DYf0hRmn.css b/flypic/app/server/public/assets/index-DYf0hRmn.css new file mode 100644 index 0000000..acdcdea --- /dev/null +++ b/flypic/app/server/public/assets/index-DYf0hRmn.css @@ -0,0 +1 @@ +.PhotoView-Portal{direction:ltr;height:100%;left:0;overflow:hidden;position:fixed;top:0;touch-action:none;width:100%;z-index:2000}@keyframes PhotoView__rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes PhotoView__delayIn{0%,50%{opacity:0}to{opacity:1}}.PhotoView__Spinner{animation:PhotoView__delayIn .4s linear both}.PhotoView__Spinner svg{animation:PhotoView__rotate .6s linear infinite}.PhotoView__Photo{cursor:grab;max-width:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.PhotoView__Photo:active{cursor:grabbing}.PhotoView__icon{display:inline-block;left:0;position:absolute;top:0;transform:translate(-50%,-50%)}.PhotoView__PhotoBox,.PhotoView__PhotoWrap{bottom:0;direction:ltr;left:0;position:absolute;right:0;top:0;touch-action:none;width:100%}.PhotoView__PhotoWrap{overflow:hidden;z-index:10}.PhotoView__PhotoBox{transform-origin:left top}@keyframes PhotoView__fade{0%{opacity:0}to{opacity:1}}.PhotoView-Slider__clean .PhotoView-Slider__ArrowLeft,.PhotoView-Slider__clean .PhotoView-Slider__ArrowRight,.PhotoView-Slider__clean .PhotoView-Slider__BannerWrap,.PhotoView-Slider__clean .PhotoView-Slider__Overlay,.PhotoView-Slider__willClose .PhotoView-Slider__BannerWrap:hover{opacity:0}.PhotoView-Slider__Backdrop{background:#000;height:100%;left:0;position:absolute;top:0;transition-property:background-color;width:100%;z-index:-1}.PhotoView-Slider__fadeIn{animation:PhotoView__fade linear both;opacity:0}.PhotoView-Slider__fadeOut{animation:PhotoView__fade linear reverse both;opacity:0}.PhotoView-Slider__BannerWrap{align-items:center;background-color:#00000080;color:#fff;display:flex;height:44px;justify-content:space-between;left:0;position:absolute;top:0;transition:opacity .2s ease-out;width:100%;z-index:20}.PhotoView-Slider__BannerWrap:hover{opacity:1}.PhotoView-Slider__Counter{font-size:14px;opacity:.75;padding:0 10px}.PhotoView-Slider__BannerRight{align-items:center;display:flex;height:100%}.PhotoView-Slider__toolbarIcon{fill:#fff;box-sizing:border-box;cursor:pointer;opacity:.75;padding:10px;transition:opacity .2s linear}.PhotoView-Slider__toolbarIcon:hover{opacity:1}.PhotoView-Slider__ArrowLeft,.PhotoView-Slider__ArrowRight{align-items:center;bottom:0;cursor:pointer;display:flex;height:100px;justify-content:center;margin:auto;opacity:.75;position:absolute;top:0;transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;z-index:20}.PhotoView-Slider__ArrowLeft:hover,.PhotoView-Slider__ArrowRight:hover{opacity:1}.PhotoView-Slider__ArrowLeft svg,.PhotoView-Slider__ArrowRight svg{fill:#fff;background:#0000004d;box-sizing:content-box;height:24px;padding:10px;width:24px}.PhotoView-Slider__ArrowLeft{left:0}.PhotoView-Slider__ArrowRight{right:0}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.-bottom-0\.5{bottom:-.125rem}.-left-2{left:-.5rem}.-right-0\.5{right:-.125rem}.-right-2{right:-.5rem}.left-2{left:.5rem}.left-3{left:.75rem}.right-2{right:.5rem}.top-2{top:.5rem}.top-2\.5{top:.625rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.ml-2{margin-left:.5rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.block{display:block}.flex{display:flex}.grid{display:grid}.aspect-square{aspect-ratio:1 / 1}.h-1\.5{height:.375rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.min-h-0{min-height:0px}.w-1{width:.25rem}.w-12{width:3rem}.w-3{width:.75rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-80{width:20rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-2xl{max-width:42rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-purple-300{--tw-bg-opacity: 1;background-color:rgb(216 180 254 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-opacity-0{--tw-bg-opacity: 0}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-3{padding-top:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.opacity-100{opacity:1}.opacity-75{opacity:.75}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}*{margin:0;padding:0;box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#root{width:100vw;height:100vh;overflow:hidden}.dark{--tw-bg-opacity: 1}.dark .bg-gray-900{background-color:#0a0a0a!important}.dark .bg-gray-800{background-color:#252525!important}.dark .bg-gray-700{background-color:#2a2a2a!important}.dark .bg-gray-600,.dark .bg-gray-500{background-color:#3a3a3a!important}.dark .bg-gray-400{background-color:#4a4a4a!important}.dark .bg-gray-300{background-color:#2a2a2a!important}.dark .bg-gray-200:not(img):not(.image-container){background-color:#2a2a2a!important}.dark .bg-gray-100,.dark .bg-gray-50,.dark .bg-white{background-color:#1a1a1a!important}.dark .border-gray-700{border-color:#333!important}.dark .border-gray-600{border-color:#444!important}.dark .border-gray-300{border-color:#333!important}.dark .border-gray-200,.dark .border-gray-100{border-color:#2a2a2a!important}.dark .text-gray-900{color:#f5f5f5!important}.dark .text-gray-700{color:#e0e0e0!important}.dark .text-gray-600{color:#b0b0b0!important}.dark .text-gray-500{color:#909090!important}.dark .text-gray-400{color:#707070!important}.dark .text-gray-300{color:#d0d0d0!important}.dark .text-white{color:#fff!important}.dark .text-gray-800{color:#e0e0e0!important}.dark .text-gray-200{color:#d0d0d0!important}.dark .text-gray-100{color:#e0e0e0!important}.dark .bg-opacity-0{--tw-bg-opacity: 0 !important}.dark .bg-opacity-10{--tw-bg-opacity: .1 !important}.dark .bg-opacity-20{--tw-bg-opacity: .2 !important}.dark .bg-opacity-30{--tw-bg-opacity: .3 !important}.dark .bg-opacity-50{--tw-bg-opacity: .5 !important}.dark .hover\:bg-gray-100:hover{background-color:#2a2a2a!important}.dark .hover\:bg-gray-700:hover{background-color:#333!important}.dark .hover\:bg-gray-600:hover{background-color:#3a3a3a!important}.dark .hover\:bg-gray-200:hover,.dark .hover\:bg-gray-50:hover{background-color:#2a2a2a!important}.dark .bg-black:not(.bg-opacity-0):not(.bg-opacity-10):not(.bg-opacity-20):not(.bg-opacity-30){background-color:#0a0a0a!important}.dark .text-black{color:#fff!important}.dark .border-black{border-color:#2a2a2a!important}.dark .bg-blue-50,.dark .bg-blue-100{background-color:#2a2a2a!important}.dark .bg-blue-200{background-color:#3a3a3a!important}.dark .bg-blue-600{background-color:#3a3a3a!important}.dark .bg-blue-800{background-color:#2a2a2a!important}.dark .bg-blue-900{background-color:#1a1a1a!important}.dark .text-blue-300{color:#d0d0d0!important}.dark .text-blue-400{color:#e0e0e0!important}.dark .text-blue-500,.dark .text-blue-600{color:#f0f0f0!important}.dark .text-blue-700{color:#e0e0e0!important}.dark .border-blue-200{border-color:#2a2a2a!important}.dark .border-blue-500{border-color:#4a4a4a!important}.dark .border-blue-700{border-color:#333!important}.dark .hover\:bg-blue-600:hover{background-color:#4a4a4a!important}.dark .hover\:bg-blue-50:hover{background-color:#333!important}.dark .bg-green-50{background-color:#2a2a2a!important}.dark .text-green-600{color:#e0e0e0!important}.dark .bg-red-50{background-color:#2a2a2a!important}.dark .text-red-600{color:#f0a0a0!important}.dark .bg-yellow-50{background-color:#2a2a2a!important}.dark .text-yellow-600{color:#e0e0a0!important}.dark img{background-color:transparent!important}.dark input,.dark select,.dark textarea{background-color:#1a1a1a!important;border-color:#333!important;color:#e0e0e0!important}.dark input:focus,.dark select:focus,.dark textarea:focus{border-color:#4a4a4a!important;outline:none!important;--tw-ring-color: #4a4a4a !important}.dark input::-moz-placeholder{color:#707070!important}.dark input::placeholder{color:#707070!important}.dark button{color:#e0e0e0!important}.dark .bg-blue-500{background-color:#4a4a4a!important}.dark .hover\:bg-blue-600:hover{background-color:#5a5a5a!important}.dark .shadow-lg{box-shadow:0 10px 15px -3px #00000080,0 4px 6px -2px #0000004d!important}.dark .shadow-xl{box-shadow:0 20px 25px -5px #00000080,0 10px 10px -5px #0000004d!important}.dark .hover\:shadow-lg:hover{box-shadow:0 10px 15px -3px #00000080,0 4px 6px -2px #0000004d!important}.dark .ring-blue-500{--tw-ring-color: #4a4a4a !important}.dark .focus\:ring-blue-500:focus{--tw-ring-color: #4a4a4a !important}.dark .focus\:ring-2:focus{--tw-ring-offset-shadow: 0 0 0 0px #000 !important;--tw-ring-shadow: 0 0 0 2px #4a4a4a !important}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#0003;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#0000004d}.dark ::-webkit-scrollbar-track{background:#ffffff0d}.dark ::-webkit-scrollbar-thumb{background:#fff3;border-radius:4px}.dark ::-webkit-scrollbar-thumb:hover{background:#ffffff4d}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-400:hover{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:bg-opacity-20{--tw-bg-opacity: .2}.dark\:border-blue-400:is(.dark *){--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.dark\:border-blue-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:border-red-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-500\/30:hover:is(.dark *){background-color:#3b82f64d}.dark\:hover\:bg-gray-500:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-600:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-blue-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))} diff --git a/flypic/app/server/public/index.html b/flypic/app/server/public/index.html new file mode 100644 index 0000000..72ab21b --- /dev/null +++ b/flypic/app/server/public/index.html @@ -0,0 +1,14 @@ + + + + + + + FlyPic - 图片素材库管理 + + + + +
+ + diff --git a/flypic/app/server/routes/image.js b/flypic/app/server/routes/image.js new file mode 100644 index 0000000..4ce645e --- /dev/null +++ b/flypic/app/server/routes/image.js @@ -0,0 +1,154 @@ +const express = require('express'); +const router = express.Router(); +const path = require('path'); +const fs = require('fs'); +const { exec } = require('child_process'); +const dbPool = require('../database/dbPool'); +const { getLibrary } = require('../utils/config'); + +// Get images with search and filters +router.get('/', (req, res) => { + try { + const { libraryId, keywords, folder, formats, minSize, maxSize, startDate, endDate } = req.query; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // 使用连接池获取数据库连接 + const db = dbPool.acquire(library.path); + + try { + const filters = {}; + if (folder) filters.folder = folder; + if (formats) filters.formats = formats.split(','); + if (minSize) filters.minSize = parseInt(minSize); + if (maxSize) filters.maxSize = parseInt(maxSize); + if (startDate) filters.startDate = parseInt(startDate); + if (endDate) filters.endDate = parseInt(endDate); + + const images = db.searchImages(keywords || '', filters); + + res.json({ images }); + } finally { + // 释放连接 + dbPool.release(library.path); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get folders +router.get('/folders', (req, res) => { + try { + const { libraryId } = req.query; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // 使用连接池 + const db = dbPool.acquire(library.path); + + try { + const folders = db.getFolderTree(); + res.json({ folders }); + } finally { + dbPool.release(library.path); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Serve thumbnail +router.get('/thumbnail/:libraryId/:size/:filename', (req, res) => { + try { + const { libraryId, filename } = req.params; + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // 直接从 thumbnails 目录获取 + const thumbnailPath = path.join(library.path, '.flypic', 'thumbnails', filename); + + if (!fs.existsSync(thumbnailPath)) { + return res.status(404).json({ error: 'Thumbnail not found' }); + } + + res.sendFile(thumbnailPath); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Serve original image +router.get('/original/:libraryId/*', (req, res) => { + try { + const { libraryId } = req.params; + const imagePath = req.params[0]; + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const fullPath = path.join(library.path, imagePath); + + if (!fs.existsSync(fullPath)) { + return res.status(404).json({ error: 'Image not found' }); + } + + res.sendFile(fullPath); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Open folder in file explorer +router.post('/:libraryId/open-folder', (req, res) => { + try { + const { path: imagePath } = req.body; + + if (!imagePath) { + return res.status(400).json({ error: 'Path is required' }); + } + + // 获取文件所在文件夹 + const folderPath = path.dirname(imagePath); + + // Windows: 使用 explorer + // Linux: 使用 xdg-open + // macOS: 使用 open + const command = process.platform === 'win32' + ? `explorer "${folderPath}"` + : process.platform === 'darwin' + ? `open "${folderPath}"` + : `xdg-open "${folderPath}"`; + + exec(command, (error) => { + if (error) { + console.error('打开文件夹失败:', error); + return res.status(500).json({ error: '打开文件夹失败' }); + } + res.json({ success: true }); + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/flypic/app/server/routes/library.js b/flypic/app/server/routes/library.js new file mode 100644 index 0000000..8da7ddf --- /dev/null +++ b/flypic/app/server/routes/library.js @@ -0,0 +1,183 @@ +const express = require('express'); +const router = express.Router(); +const fs = require('fs'); +const path = require('path'); +const { + loadConfig, + addLibrary, + removeLibrary, + updateLibrary, + setCurrentLibrary, + updatePreferences, + updateTheme +} = require('../utils/config'); + +// Get all libraries and config +router.get('/', (req, res) => { + try { + const config = loadConfig(); + res.json({ + libraries: config.libraries, + currentLibraryId: config.currentLibraryId, + theme: config.theme, + preferences: config.preferences + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Add new library +router.post('/', (req, res) => { + try { + const { name, path } = req.body; + + if (!name || !path) { + return res.status(400).json({ error: 'Name and path are required' }); + } + + if (!fs.existsSync(path)) { + return res.status(400).json({ error: 'Path does not exist' }); + } + + const id = addLibrary(name, path); + + // Check if .flypic directory exists + const flypicDir = require('path').join(path, '.flypic'); + const hasExistingIndex = fs.existsSync(flypicDir); + + res.json({ + id, + message: 'Library added successfully', + hasExistingIndex + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Update preferences (must be before /:id route) +router.put('/preferences', (req, res) => { + try { + const preferences = updatePreferences(req.body); + res.json({ preferences }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Update theme (must be before /:id route) +router.put('/theme', (req, res) => { + try { + const { theme } = req.body; + updateTheme(theme); + res.json({ theme }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Update library +router.put('/:id', (req, res) => { + try { + const { id } = req.params; + const updates = req.body; + + const success = updateLibrary(id, updates); + if (success) { + res.json({ message: 'Library updated successfully' }); + } else { + res.status(404).json({ error: 'Library not found' }); + } + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Delete library +router.delete('/:id', async (req, res) => { + try { + const { id } = req.params; + + // 获取素材库信息 + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === id); + + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + // 关闭该素材库的数据库连接,释放文件锁 + const dbPool = require('../database/dbPool'); + console.log(`[Delete] Closing database connection for: ${library.path}`); + dbPool.close(library.path); + + // 等待一下,确保连接完全关闭 + await new Promise(resolve => setTimeout(resolve, 500)); + + // 删除索引 + removeLibrary(id); + + console.log(`✅ Library removed and database connection released: ${library.name}`); + + res.json({ + message: 'Library removed successfully', + path: library.path + }); + } catch (error) { + console.error('Error in delete library:', error); + res.status(500).json({ error: error.message }); + } +}); + +// Set current library +router.post('/:id/set-current', (req, res) => { + try { + const { id } = req.params; + const config = loadConfig(); + const dbPool = require('../database/dbPool'); + + // 获取旧的当前素材库 + const oldLibraryId = config.currentLibraryId; + if (oldLibraryId && oldLibraryId !== id) { + const oldLibrary = config.libraries.find(lib => lib.id === oldLibraryId); + if (oldLibrary) { + // 关闭旧素材库的数据库连接 + console.log(`[Switch] Closing old library connection: ${oldLibrary.name}`); + dbPool.close(oldLibrary.path); + } + } + + // 设置新的当前素材库 + setCurrentLibrary(id); + + const newLibrary = config.libraries.find(lib => lib.id === id); + console.log(`[Switch] Switched to library: ${newLibrary?.name}`); + + res.json({ message: 'Current library set successfully' }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Close database connection for a library +router.post('/:id/close-db', (req, res) => { + try { + const { id } = req.params; + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === id); + + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const dbPool = require('../database/dbPool'); + dbPool.close(library.path); + + res.json({ message: 'Database connection closed successfully' }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/flypic/app/server/routes/scan.js b/flypic/app/server/routes/scan.js new file mode 100644 index 0000000..8bbaec9 --- /dev/null +++ b/flypic/app/server/routes/scan.js @@ -0,0 +1,121 @@ +const express = require('express'); +const router = express.Router(); +const LibraryDatabase = require('../database/db'); +const { getLibrary, updateLibrary } = require('../utils/config'); +const { scanLibrary, syncLibrary } = require('../utils/scanner'); + +// Start full scan +router.post('/full', async (req, res) => { + try { + const { libraryId, wait } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const io = req.app.get('io'); + const dbPool = require('../database/dbPool'); + const db = dbPool.acquire(library.path); + + // 如果需要等待扫描完成 + if (wait) { + try { + const results = await scanLibrary(library.path, db, (progress) => { + io.emit('scanProgress', { + libraryId, + ...progress + }); + }); + + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + + res.json({ message: 'Scan completed', results }); + } catch (error) { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + throw error; + } + } else { + // Start scan in background + res.json({ message: 'Scan started' }); + + scanLibrary(library.path, db, (progress) => { + io.emit('scanProgress', { + libraryId, + ...progress + }); + }).then(results => { + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + }).catch(error => { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + }); + } + + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Start incremental sync +router.post('/sync', async (req, res) => { + try { + const { libraryId, wait } = req.body; + + if (!libraryId) { + return res.status(400).json({ error: 'Library ID is required' }); + } + + const library = getLibrary(libraryId); + if (!library) { + return res.status(404).json({ error: 'Library not found' }); + } + + const io = req.app.get('io'); + const dbPool = require('../database/dbPool'); + const db = dbPool.acquire(library.path); + + // 如果需要等待同步完成 + if (wait) { + try { + const results = await syncLibrary(library.path, db); + + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + + res.json({ message: 'Sync completed', results }); + } catch (error) { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + throw error; + } + } else { + // Start sync in background + res.json({ message: 'Sync started' }); + + syncLibrary(library.path, db).then(results => { + dbPool.release(library.path); + updateLibrary(libraryId, { lastScan: Date.now() }); + io.emit('scanComplete', { libraryId, results }); + }).catch(error => { + dbPool.release(library.path); + io.emit('scanError', { libraryId, error: error.message }); + }); + } + + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/flypic/app/server/routes/watch.js b/flypic/app/server/routes/watch.js new file mode 100644 index 0000000..31e12eb --- /dev/null +++ b/flypic/app/server/routes/watch.js @@ -0,0 +1,73 @@ +const express = require('express'); +const router = express.Router(); + +// Start watching a library +router.post('/start/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + const fileWatcher = req.app.get('fileWatcher'); + const io = req.app.get('io'); + + fileWatcher.watch(libraryId, io); + + res.json({ + message: 'File watching started', + libraryId, + isWatching: true + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Stop watching a library +router.post('/stop/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + const fileWatcher = req.app.get('fileWatcher'); + + fileWatcher.unwatch(libraryId); + + res.json({ + message: 'File watching stopped', + libraryId, + isWatching: false + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get watch status +router.get('/status/:libraryId', (req, res) => { + try { + const { libraryId } = req.params; + const fileWatcher = req.app.get('fileWatcher'); + + const isWatching = fileWatcher.isWatching(libraryId); + + res.json({ + libraryId, + isWatching + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +// Get all watched libraries +router.get('/list', (req, res) => { + try { + const fileWatcher = req.app.get('fileWatcher'); + const watchedLibraries = fileWatcher.getWatchedLibraries(); + + res.json({ + watchedLibraries, + count: watchedLibraries.length + }); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); + +module.exports = router; diff --git a/flypic/app/server/server.js b/flypic/app/server/server.js new file mode 100644 index 0000000..0208c15 --- /dev/null +++ b/flypic/app/server/server.js @@ -0,0 +1,93 @@ +const express = require('express'); +const cors = require('cors'); +const path = require('path'); +const http = require('http'); +const { Server } = require('socket.io'); +const fileWatcher = require('./utils/fileWatcher'); + +const app = express(); +const server = http.createServer(app); +const io = new Server(server, { + cors: { + origin: process.env.FRONTEND_DIST ? false : 'http://localhost:5173', + methods: ['GET', 'POST'] + } +}); + +const PORT = process.env.TRIM_SERVICE_PORT || process.env.PORT || 3000; + +// Auto-detect frontend dist path +let FRONTEND_DIST = process.env.FRONTEND_DIST; +if (!FRONTEND_DIST) { + // Try common locations + const possiblePaths = [ + path.join(__dirname, 'public'), // 飞牛 fnOS 打包后的位置 + path.join(__dirname, '../frontend/dist'), // 开发环境 + path.join(__dirname, '../public'), + path.join(__dirname, '../../frontend/dist') + ]; + + for (const p of possiblePaths) { + if (require('fs').existsSync(p)) { + FRONTEND_DIST = p; + console.log('✅ Found frontend at:', p); + break; + } + } + + if (!FRONTEND_DIST) { + console.log('⚠️ Frontend not found, tried:', possiblePaths); + } +} + +// Middleware +app.use(cors()); +app.use(express.json()); + +// API Routes +const libraryRouter = require('./routes/library'); +const imageRouter = require('./routes/image'); +const scanRouter = require('./routes/scan'); +const watchRouter = require('./routes/watch'); + +app.use('/api/library', libraryRouter); +app.use('/api/image', imageRouter); +app.use('/api/scan', scanRouter); +app.use('/api/watch', watchRouter); + +// Serve static files (production) +if (FRONTEND_DIST) { + console.log('📁 Serving frontend from:', FRONTEND_DIST); + app.use(express.static(FRONTEND_DIST)); + app.get('*', (req, res) => { + if (!req.path.startsWith('/api')) { + res.sendFile(path.join(FRONTEND_DIST, 'index.html')); + } + }); +} + +// Socket.IO for real-time updates +io.on('connection', (socket) => { + console.log('Client connected:', socket.id); + + socket.on('disconnect', () => { + console.log('Client disconnected:', socket.id); + }); +}); + +// Make io accessible to routes +app.set('io', io); + +// Make fileWatcher accessible to routes +app.set('fileWatcher', fileWatcher); + +server.listen(PORT, () => { + console.log(`🚀 FlyPic server running on http://localhost:${PORT}`); +}); + +// Cleanup on exit +process.on('SIGINT', () => { + console.log('\nShutting down...'); + fileWatcher.unwatchAll(); + process.exit(0); +}); diff --git a/flypic/app/server/utils/config.js b/flypic/app/server/utils/config.js new file mode 100644 index 0000000..892a6f2 --- /dev/null +++ b/flypic/app/server/utils/config.js @@ -0,0 +1,205 @@ +const fs = require('fs'); +const path = require('path'); +const os = require('os'); + +/** + * Get config directory based on environment + */ +function getConfigDir() { + // Check if running on fnOS + if (process.env.TRIM_PKGVAR) { + return process.env.TRIM_PKGVAR; + } + + // Windows + if (process.platform === 'win32') { + return path.join(process.env.APPDATA || os.homedir(), 'FlyPic'); + } + + // Linux/Mac + return path.join(os.homedir(), '.flypic'); +} + +/** + * Get config file path + */ +function getConfigPath() { + const configDir = getConfigDir(); + if (!fs.existsSync(configDir)) { + fs.mkdirSync(configDir, { recursive: true }); + } + return path.join(configDir, 'config.json'); +} + +/** + * Load configuration + */ +function loadConfig() { + const configPath = getConfigPath(); + + if (!fs.existsSync(configPath)) { + const defaultConfig = { + libraries: [], + theme: 'light', + currentLibraryId: null, + // UI preferences + preferences: { + thumbnailHeight: 200, + rowGap: 32, + columnGap: 16, + leftPanelWidth: 256, // 左侧边栏宽度 + rightPanelWidth: 320 // 右侧边栏宽度 + } + }; + saveConfig(defaultConfig); + return defaultConfig; + } + + try { + const data = fs.readFileSync(configPath, 'utf8'); + const config = JSON.parse(data); + + // Ensure preferences exist (for backward compatibility) + if (!config.preferences) { + config.preferences = { + thumbnailHeight: 200, + rowGap: 32, + columnGap: 16 + }; + } + + return config; + } catch (error) { + console.error('Error loading config:', error); + return { + libraries: [], + theme: 'light', + currentLibraryId: null, + preferences: { + thumbnailHeight: 200, + rowGap: 32, + columnGap: 16 + } + }; + } +} + +/** + * Save configuration + */ +function saveConfig(config) { + const configPath = getConfigPath(); + try { + fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8'); + return true; + } catch (error) { + console.error('Error saving config:', error); + return false; + } +} + +/** + * Add library to config + */ +function addLibrary(name, libraryPath) { + const config = loadConfig(); + const id = Date.now().toString(); + + config.libraries.push({ + id, + name, + path: libraryPath, + lastScan: null, + createdAt: Date.now() + }); + + if (!config.currentLibraryId) { + config.currentLibraryId = id; + } + + saveConfig(config); + return id; +} + +/** + * Remove library from config + */ +function removeLibrary(libraryId) { + const config = loadConfig(); + config.libraries = config.libraries.filter(lib => lib.id !== libraryId); + + if (config.currentLibraryId === libraryId) { + config.currentLibraryId = config.libraries.length > 0 ? config.libraries[0].id : null; + } + + saveConfig(config); + return true; +} + +/** + * Update library + */ +function updateLibrary(libraryId, updates) { + const config = loadConfig(); + const library = config.libraries.find(lib => lib.id === libraryId); + + if (library) { + Object.assign(library, updates); + saveConfig(config); + return true; + } + + return false; +} + +/** + * Get library by ID + */ +function getLibrary(libraryId) { + const config = loadConfig(); + return config.libraries.find(lib => lib.id === libraryId); +} + +/** + * Set current library + */ +function setCurrentLibrary(libraryId) { + const config = loadConfig(); + config.currentLibraryId = libraryId; + saveConfig(config); + return true; +} + +/** + * Update preferences + */ +function updatePreferences(preferences) { + const config = loadConfig(); + config.preferences = { ...config.preferences, ...preferences }; + saveConfig(config); + return config.preferences; +} + +/** + * Update theme + */ +function updateTheme(theme) { + const config = loadConfig(); + config.theme = theme; + saveConfig(config); + return true; +} + +module.exports = { + getConfigDir, + getConfigPath, + loadConfig, + saveConfig, + addLibrary, + removeLibrary, + updateLibrary, + getLibrary, + setCurrentLibrary, + updatePreferences, + updateTheme +}; diff --git a/flypic/app/server/utils/fileWatcher.js b/flypic/app/server/utils/fileWatcher.js new file mode 100644 index 0000000..d8a550e --- /dev/null +++ b/flypic/app/server/utils/fileWatcher.js @@ -0,0 +1,230 @@ +const chokidar = require('chokidar'); +const path = require('path'); +const { getLibrary } = require('./config'); +const { syncLibrary, applyChangesFromEvents } = require('./scanner'); +const dbPool = require('../database/dbPool'); + +class FileWatcher { + constructor() { + this.watchers = new Map(); // libraryId -> watcher + this.debounceTimers = new Map(); // libraryId -> { timer, forceRebuildFolders } + this.changeBuffers = new Map(); // libraryId -> { filesAdded, filesChanged, filesRemoved, dirsAdded, dirsRemoved } + } + + // 获取或创建变更缓冲区 + _getBuffer(libraryId) { + if (!this.changeBuffers.has(libraryId)) { + this.changeBuffers.set(libraryId, { + filesAdded: new Set(), + filesChanged: new Set(), + filesRemoved: new Set(), + dirsAdded: new Set(), + dirsRemoved: new Set() + }); + } + return this.changeBuffers.get(libraryId); + } + + // 缓冲区事件数量 + _bufferCount(buf) { + return ( + buf.filesAdded.size + + buf.filesChanged.size + + buf.filesRemoved.size + + buf.dirsAdded.size + + buf.dirsRemoved.size + ); + } + + // 启动监控 + watch(libraryId, io) { + // 如果已经在监控,先停止 + if (this.watchers.has(libraryId)) { + this.unwatch(libraryId); + } + + const library = getLibrary(libraryId); + if (!library) { + console.error(`Library ${libraryId} not found`); + return; + } + + // 检查路径是否存在和可访问 + const fs = require('fs'); + try { + fs.accessSync(library.path, fs.constants.R_OK); + } catch (error) { + console.error(`Cannot access library path: ${library.path}`, error.message); + console.error('提示:在飞牛 fnOS 上,请确保在应用设置中授予了文件夹访问权限'); + return; + } + + console.log(`Starting file watcher for library: ${library.name} (${library.path})`); + + // 支持的图片格式 + const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff']; + const pattern = `**/*.{${imageExtensions.join(',')}}`; + + // 创建监控器(监控文件和文件夹) + const watcher = chokidar.watch([pattern, '**/'], { + cwd: library.path, + ignored: [ + '**/node_modules/**', + '**/.git/**', + '**/.flypic/**', // 忽略自己的缓存目录 + '**/.*' // 忽略隐藏文件 + ], + persistent: true, + ignoreInitial: true, // 忽略初始扫描 + awaitWriteFinish: { + stabilityThreshold: 1200, // 文件稳定 1.2 秒后触发,提升响应 + pollInterval: 100 + } + }); + + // 防抖处理:多个文件变化合并为一次同步(自适应时长) + const debouncedSync = (forceRebuildFolders = false) => { + const buf = this._getBuffer(libraryId); + const changeCount = this._bufferCount(buf); + + // 清除之前的定时器 + if (this.debounceTimers.has(libraryId)) { + const oldTimer = this.debounceTimers.get(libraryId); + clearTimeout(oldTimer.timer); + // 聚合 forceRebuildFolders 标记 + forceRebuildFolders = forceRebuildFolders || oldTimer.forceRebuildFolders; + } + + // 自适应防抖时间:少量变化更快响应 + let debounceMs = 5000; + if (changeCount <= 1) debounceMs = 1200; + else if (changeCount <= 10) debounceMs = 2000; + else if (changeCount <= 50) debounceMs = 3500; + else if (changeCount <= 200) debounceMs = 5000; + else debounceMs = 8000; // 超大批量进一步聚合 + + const timer = setTimeout(async () => { + const snapshot = this._getBuffer(libraryId); + // 清空缓冲区(开始新一轮累计) + this.changeBuffers.set(libraryId, { + filesAdded: new Set(), + filesChanged: new Set(), + filesRemoved: new Set(), + dirsAdded: new Set(), + dirsRemoved: new Set() + }); + + // 从连接池获取数据库连接 + const db = dbPool.acquire(library.path); + + try { + const total = this._bufferCount(snapshot); + let results; + + if (forceRebuildFolders || total > 200) { + // 大量变化或目录级变化:走增量全量路径(更稳) + results = await syncLibrary(library.path, db, true); + } else { + // 小批量变化:基于事件的快速同步 + results = await applyChangesFromEvents(library.path, db, { + filesAdded: Array.from(snapshot.filesAdded), + filesChanged: Array.from(snapshot.filesChanged), + filesRemoved: Array.from(snapshot.filesRemoved), + dirsAdded: Array.from(snapshot.dirsAdded), + dirsRemoved: Array.from(snapshot.dirsRemoved) + }); + } + + // 通过 Socket.IO 通知前端 + io.emit('scanComplete', { libraryId, results }); + console.log(`Sync complete for ${library.name}:`, results); + } catch (error) { + console.error(`Sync error for ${library.name}:`, error); + io.emit('scanError', { libraryId, error: error.message }); + } finally { + // 释放数据库连接(不关闭,复用) + dbPool.release(library.path); + } + + this.debounceTimers.delete(libraryId); + }, debounceMs); + + this.debounceTimers.set(libraryId, { timer, forceRebuildFolders }); + }; + + // 监听文件和文件夹变化(写入缓冲,统一合并处理) + watcher + .on('add', (filePath) => { + this._getBuffer(libraryId).filesAdded.add(filePath); + debouncedSync(); + }) + .on('unlink', (filePath) => { + this._getBuffer(libraryId).filesRemoved.add(filePath); + debouncedSync(); + }) + .on('change', (filePath) => { + this._getBuffer(libraryId).filesChanged.add(filePath); + debouncedSync(); + }) + .on('addDir', (dirPath) => { + this._getBuffer(libraryId).dirsAdded.add(dirPath); + debouncedSync(true); // 强制重建文件夹结构 + }) + .on('unlinkDir', (dirPath) => { + this._getBuffer(libraryId).dirsRemoved.add(dirPath); + debouncedSync(true); // 强制重建文件夹结构 + }) + .on('error', (error) => { + console.error(`Watcher error for ${library.name}:`, error); + }) + .on('ready', () => { + console.log(`File watcher ready for: ${library.name}`); + }); + + this.watchers.set(libraryId, watcher); + } + + // 停止监控 + unwatch(libraryId) { + const watcher = this.watchers.get(libraryId); + if (watcher) { + watcher.close(); + this.watchers.delete(libraryId); + console.log(`Stopped file watcher for library: ${libraryId}`); + } + + // 清除防抖定时器 + if (this.debounceTimers.has(libraryId)) { + const timerObj = this.debounceTimers.get(libraryId); + clearTimeout(timerObj.timer); + this.debounceTimers.delete(libraryId); + } + + // 清空缓冲区 + if (this.changeBuffers.has(libraryId)) { + this.changeBuffers.delete(libraryId); + } + } + + // 停止所有监控 + unwatchAll() { + for (const libraryId of this.watchers.keys()) { + this.unwatch(libraryId); + } + } + + // 获取监控状态 + isWatching(libraryId) { + return this.watchers.has(libraryId); + } + + // 获取所有正在监控的库 + getWatchedLibraries() { + return Array.from(this.watchers.keys()); + } +} + +// 单例模式 +const fileWatcher = new FileWatcher(); + +module.exports = fileWatcher; diff --git a/flypic/app/server/utils/scanner.js b/flypic/app/server/utils/scanner.js new file mode 100644 index 0000000..c738d5f --- /dev/null +++ b/flypic/app/server/utils/scanner.js @@ -0,0 +1,445 @@ +const fs = require('fs'); +const path = require('path'); +const { glob } = require('glob'); +const { + isImageFile, + calculateFileHash, + getImageMetadata, + generateImageThumbnails +} = require('./thumbnail'); + +/** + * Get all image files in a directory + */ +async function getAllImageFiles(libraryPath) { + // 仅匹配常见图片扩展,避免遍历所有非图片文件,显著降低 IO + const exts = '{jpg,jpeg,png,webp,gif,bmp,tiff}'; + const pattern = path.join(libraryPath, '**', `*.${exts}`).replace(/\\/g, '/'); + const files = await glob(pattern, { + nodir: true, + nocase: true, // 大小写不敏感(Windows/macOS) + ignore: ['**/.flypic/**', '**/node_modules/**'] + }); + return files; +} + +/** + * Ensure a folder and its parents exist in DB + */ +function ensureFolderChain(db, folderPath) { + if (!folderPath || folderPath === '.' || folderPath === '') return; + let current = folderPath; + const visited = new Set(); + while (current && current !== '.' && !visited.has(current)) { + visited.add(current); + const parent = path.dirname(current); + const name = path.basename(current); + const existing = db.getFolderByPath(current); + if (!existing) { + db.insertFolder({ + path: current, + parent_path: parent === '.' ? '' : parent, + name, + image_count: 0 + }); + } + if (parent === current) break; + current = parent; + } +} + +/** + * Apply changes from file system events quickly without full rescan + * events = { + * filesAdded: [relPath], + * filesChanged: [relPath], + * filesRemoved: [relPath], + * dirsAdded: [relDir], + * dirsRemoved: [relDir] + * } + */ +async function applyChangesFromEvents(libraryPath, db, events) { + try { + // Normalize helper to OS-specific separators to match DB records + const norm = (p) => path.normalize(p); + + const affectedFolders = new Set(); + const results = { added: 0, modified: 0, deleted: 0, foldersAdded: 0, foldersRemoved: 0 }; + + // Handle directory additions (ensure chain exists) + for (const dir of (events.dirsAdded || [])) { + const d = norm(dir); + ensureFolderChain(db, d); + results.foldersAdded++; + // update parents too + let cur = d; + while (cur && cur !== '.') { + affectedFolders.add(cur); + const parent = path.dirname(cur); + if (parent === cur) break; + cur = parent; + } + } + + // Handle file additions + for (const file of (events.filesAdded || [])) { + try { + const rel = norm(file); + const full = path.join(libraryPath, rel); + + // 检查文件是否存在 + if (!fs.existsSync(full)) { + console.warn(`File not found, skipping: ${full}`); + continue; + } + + const folder = path.dirname(rel); + ensureFolderChain(db, folder); + await processImage(full, libraryPath, db); + affectedFolders.add(folder); + // parents + let cur = folder; + while (cur && cur !== '.') { + affectedFolders.add(cur); + const parent = path.dirname(cur); + if (parent === cur) break; + cur = parent; + } + results.added++; + } catch (error) { + console.error(`Error processing added file ${file}:`, error.message); + } + } + + // Handle file changes + for (const file of (events.filesChanged || [])) { + try { + const rel = norm(file); + const full = path.join(libraryPath, rel); + + // 检查文件是否存在 + if (!fs.existsSync(full)) { + console.warn(`File not found, skipping: ${full}`); + continue; + } + + await processImage(full, libraryPath, db); + const folder = path.dirname(rel); + affectedFolders.add(folder); + results.modified++; + } catch (error) { + console.error(`Error processing changed file ${file}:`, error.message); + } + } + + // Handle file removals + for (const file of (events.filesRemoved || [])) { + try { + const rel = norm(file); + db.deleteImage(rel); + const folder = path.dirname(rel); + affectedFolders.add(folder); + // parents + let cur = folder; + while (cur && cur !== '.') { + affectedFolders.add(cur); + const parent = path.dirname(cur); + if (parent === cur) break; + cur = parent; + } + results.deleted++; + } catch (error) { + console.error(`Error deleting file ${file}:`, error.message); + } + } + + // Handle directory removals (bulk delete) + for (const dir of (events.dirsRemoved || [])) { + try { + const d = norm(dir); + // delete images and folders under this dir + db.deleteImagesByFolderPrefix(d); + db.deleteFoldersByPrefix(d); + const parent = path.dirname(d); + if (parent && parent !== '.') affectedFolders.add(parent); + results.foldersRemoved++; + } catch (error) { + console.error(`Error deleting directory ${dir}:`, error.message); + } + } + + // Update counts for all affected folders + affectedFolders.forEach((folderPath) => { + if (folderPath && folderPath !== '.') { + try { + db.updateFolderImageCount(folderPath); + } catch (error) { + console.error(`Error updating folder count ${folderPath}:`, error.message); + } + } + }); + + return results; + } catch (error) { + console.error('Error in applyChangesFromEvents:', error); + throw error; + } +} + +/** + * Get folder structure + */ +async function getFolderStructure(libraryPath) { + const folders = []; + + function scanDir(dirPath, parentPath = '') { + const items = fs.readdirSync(dirPath, { withFileTypes: true }); + + for (const item of items) { + if (item.isDirectory() && !item.name.startsWith('.')) { + const fullPath = path.join(dirPath, item.name); + const relativePath = path.relative(libraryPath, fullPath); + + folders.push({ + path: relativePath, + parent_path: parentPath, + name: item.name, + image_count: 0 + }); + + scanDir(fullPath, relativePath); + } + } + } + + scanDir(libraryPath); + return folders; +} + +/** + * Process a single image file + */ +async function processImage(imagePath, libraryPath, db) { + try { + const relativePath = path.relative(libraryPath, imagePath); + const filename = path.basename(imagePath); + const folder = path.dirname(relativePath); + + // Check if image already exists in database + const existing = db.getImageByPath(relativePath); + const currentHash = calculateFileHash(imagePath); + + // Skip if file hasn't changed + if (existing && existing.file_hash === currentHash) { + return { status: 'skipped', path: relativePath }; + } + + // Get image metadata + const metadata = await getImageMetadata(imagePath); + if (!metadata) { + return { status: 'error', path: relativePath, error: 'Failed to read metadata' }; + } + + // Generate thumbnails + const thumbnails = await generateImageThumbnails(imagePath, libraryPath); + + // Insert/update in database + db.insertImage({ + path: relativePath, + filename: filename, + folder: folder, + size: metadata.size, + width: metadata.width, + height: metadata.height, + format: metadata.format, + created_at: Math.floor(metadata.created_at), + modified_at: Math.floor(metadata.modified_at), + file_hash: currentHash, + thumbnail_path: thumbnails.thumbnail_path, + thumbnail_size: thumbnails.thumbnail_size + }); + + return { status: 'processed', path: relativePath }; + } catch (error) { + console.error('Error processing image:', imagePath, error); + return { status: 'error', path: imagePath, error: error.message }; + } +} + +/** + * Scan library and update database + */ +async function scanLibrary(libraryPath, db, onProgress) { + try { + // Get all image files + const files = await getAllImageFiles(libraryPath); + const total = files.length; + + console.log(`Found ${total} images in library`); + + // Get folder structure + const folders = await getFolderStructure(libraryPath); + folders.forEach(folder => db.insertFolder(folder)); + + // Process images in batches + const batchSize = 50; + const results = { + processed: 0, + skipped: 0, + errors: 0 + }; + + for (let i = 0; i < files.length; i += batchSize) { + const batch = files.slice(i, i + batchSize); + + await Promise.all( + batch.map(file => processImage(file, libraryPath, db)) + ).then(batchResults => { + batchResults.forEach(result => { + if (result.status === 'processed') results.processed++; + else if (result.status === 'skipped') results.skipped++; + else if (result.status === 'error') results.errors++; + }); + }); + + // Report progress + if (onProgress) { + onProgress({ + total, + current: Math.min(i + batchSize, total), + percent: Math.round((Math.min(i + batchSize, total) / total) * 100), + currentFile: batch[batch.length - 1] + }); + } + } + + // Update folder image counts + folders.forEach(folder => { + db.updateFolderImageCount(folder.path); + }); + + console.log('Scan complete:', results); + return results; + } catch (error) { + console.error('Error scanning library:', error); + throw error; + } +} + +/** + * Sync library (incremental scan) + */ +async function syncLibrary(libraryPath, db, forceRebuildFolders = false) { + try { + // Get all current files + const currentFiles = await getAllImageFiles(libraryPath); + const currentPaths = new Set( + currentFiles.map(file => path.relative(libraryPath, file)) + ); + + // Get database files + const dbImages = db.getAllImages(); + const dbPaths = new Set(dbImages.map(img => img.path)); + + // Find new, modified, and deleted files + const toAdd = [...currentPaths].filter(p => !dbPaths.has(p)); + const toCheck = [...currentPaths].filter(p => dbPaths.has(p)); + const toDelete = [...dbPaths].filter(p => !currentPaths.has(p)); + + console.log(`Sync: ${toAdd.length} new, ${toCheck.length} to check, ${toDelete.length} deleted`); + + // Process new files + for (const relativePath of toAdd) { + const fullPath = path.join(libraryPath, relativePath); + await processImage(fullPath, libraryPath, db); + } + + // Check modified files + for (const relativePath of toCheck) { + const fullPath = path.join(libraryPath, relativePath); + const existing = db.getImageByPath(relativePath); + const currentHash = calculateFileHash(fullPath); + + if (existing.file_hash !== currentHash) { + await processImage(fullPath, libraryPath, db); + } + } + + // Delete removed files + for (const relativePath of toDelete) { + db.deleteImage(relativePath); + // TODO: Clean up thumbnail files + } + + // Rebuild folder structure if there are changes or forced + if (toAdd.length > 0 || toDelete.length > 0 || forceRebuildFolders) { + console.log('Rebuilding folder structure...'); + + // Get current folder structure from file system + const currentFolders = await getFolderStructure(libraryPath); + + // Get existing folders from database + const dbFolders = db.getAllFolders(); + const dbFolderPaths = new Set(dbFolders.map(f => f.path)); + + // Find new and deleted folders + const currentFolderPaths = new Set(currentFolders.map(f => f.path)); + const foldersToAdd = currentFolders.filter(f => !dbFolderPaths.has(f.path)); + const foldersToDelete = dbFolders.filter(f => !currentFolderPaths.has(f.path)); + + // Add new folders + foldersToAdd.forEach(folder => { + db.insertFolder(folder); + }); + + // Delete removed folders + foldersToDelete.forEach(folder => { + db.deleteFolder(folder.path); + }); + + console.log(`Folders: +${foldersToAdd.length}, -${foldersToDelete.length}`); + + // Update folder image counts + console.log('Updating folder image counts...'); + const affectedFolders = new Set(); + + // Collect all affected folders (including parent folders) + [...toAdd, ...toDelete].forEach(relativePath => { + let folderPath = path.dirname(relativePath); + + // Add current folder and all parent folders + while (folderPath && folderPath !== '.') { + affectedFolders.add(folderPath); + const parent = path.dirname(folderPath); + if (parent === folderPath) break; // Reached root + folderPath = parent; + } + }); + + // Update counts for all affected folders + affectedFolders.forEach(folderPath => { + db.updateFolderImageCount(folderPath); + }); + + console.log(`Updated ${affectedFolders.size} folder counts`); + } + + return { + added: toAdd.length, + modified: toCheck.length, + deleted: toDelete.length + }; + } catch (error) { + console.error('Error syncing library:', error); + throw error; + } +} + +module.exports = { + getAllImageFiles, + getFolderStructure, + processImage, + scanLibrary, + syncLibrary, + applyChangesFromEvents +}; diff --git a/flypic/app/server/utils/thumbnail.js b/flypic/app/server/utils/thumbnail.js new file mode 100644 index 0000000..020506a --- /dev/null +++ b/flypic/app/server/utils/thumbnail.js @@ -0,0 +1,180 @@ +const sharp = require('sharp'); +const path = require('path'); +const fs = require('fs'); +const crypto = require('crypto'); + +const SUPPORTED_FORMATS = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif']; + +/** + * Check if file is a supported image + */ +function isImageFile(filename) { + const ext = path.extname(filename).toLowerCase().slice(1); + return SUPPORTED_FORMATS.includes(ext); +} + +/** + * Calculate file hash for change detection + */ +function calculateFileHash(filePath) { + const fileBuffer = fs.readFileSync(filePath); + const hashSum = crypto.createHash('md5'); + hashSum.update(fileBuffer); + return hashSum.digest('hex'); +} + +/** + * Get thumbnail configuration based on original image size + */ +function getThumbnailConfig(originalWidth, originalHeight, targetHeight = 200) { + const targetWidth = Math.round((originalWidth / originalHeight) * targetHeight); + + // 优化质量配置:提高质量,减少模糊 + // WebP 格式建议质量范围:80-95 + let quality = 90; + const originalSize = originalWidth * originalHeight; + + if (originalSize > 10000000) { // >10MP + quality = 85; // 提高到 85(之前 70) + } else if (originalSize > 5000000) { // 5-10MP + quality = 88; // 提高到 88(之前 75) + } else if (originalSize > 2000000) { // 2-5MP + quality = 90; // 提高到 90(之前 80) + } + + return { + width: targetWidth, + height: targetHeight, + quality: quality, + format: 'webp' + }; +} + +/** + * Generate thumbnail for an image with dynamic quality adjustment + */ +async function generateThumbnail(inputPath, outputPath, targetHeight = 200) { + try { + // Get image metadata + const metadata = await sharp(inputPath).metadata(); + const config = getThumbnailConfig(metadata.width, metadata.height, targetHeight); + + const TARGET_MIN_SIZE = 50 * 1024; // 50KB (提高下限) + const TARGET_MAX_SIZE = 150 * 1024; // 150KB (提高上限) + const MAX_ATTEMPTS = 3; + + let quality = config.quality; + let attempt = 0; + let finalSize = 0; + + // 动态调整质量,直到文件大小在目标范围内 + while (attempt < MAX_ATTEMPTS) { + // Generate thumbnail with current quality + await sharp(inputPath) + .resize(config.width, config.height, { + fit: 'cover', + position: 'center', + kernel: 'lanczos3' // 使用高质量的缩放算法 + }) + .webp({ + quality: quality, + effort: 6, // 提高压缩质量(0-6,6最好但最慢) + smartSubsample: true // 智能色度子采样 + }) + .toFile(outputPath); + + // Check file size + const stats = fs.statSync(outputPath); + finalSize = stats.size; + + // 如果在目标范围内,完成 + if (finalSize >= TARGET_MIN_SIZE && finalSize <= TARGET_MAX_SIZE) { + console.log(`✅ Thumbnail generated: ${finalSize} bytes (quality: ${quality})`); + break; + } + + // 如果太大,降低质量 + if (finalSize > TARGET_MAX_SIZE) { + const ratio = TARGET_MAX_SIZE / finalSize; + quality = Math.max(70, Math.round(quality * ratio * 0.9)); // 最低质量提高到 70 + console.log(`⬇️ File too large (${finalSize} bytes), reducing quality to ${quality}`); + } + // 如果太小,提高质量 + else if (finalSize < TARGET_MIN_SIZE) { + const ratio = TARGET_MIN_SIZE / finalSize; + quality = Math.min(98, Math.round(quality * ratio * 1.1)); // 最高质量提高到 98 + console.log(`⬆️ File too small (${finalSize} bytes), increasing quality to ${quality}`); + } + + attempt++; + + // 最后一次尝试,接受结果 + if (attempt >= MAX_ATTEMPTS) { + console.log(`⚠️ Max attempts reached, final size: ${finalSize} bytes (quality: ${quality})`); + break; + } + } + + return { + width: config.width, + height: config.height, + size: finalSize, + quality: quality, + path: outputPath + }; + } catch (error) { + console.error('Error generating thumbnail:', error); + throw error; + } +} + +/** + * Get image metadata + */ +async function getImageMetadata(imagePath) { + try { + const metadata = await sharp(imagePath).metadata(); + const stats = fs.statSync(imagePath); + + return { + width: metadata.width, + height: metadata.height, + format: metadata.format, + size: stats.size, + created_at: stats.birthtimeMs, + modified_at: stats.mtimeMs + }; + } catch (error) { + console.error('Error getting image metadata:', error); + return null; + } +} + +/** + * Generate thumbnail for an image + * 优化:直接存储在 thumbnails/ 目录,不再使用子文件夹 + */ +async function generateImageThumbnails(imagePath, libraryPath) { + const flypicDir = path.join(libraryPath, '.flypic'); + const relativePath = path.relative(libraryPath, imagePath); + const hash = crypto.createHash('md5').update(relativePath).digest('hex'); + + // 直接存储在 thumbnails 目录,不使用 200 子文件夹 + const thumbPath = path.join(flypicDir, 'thumbnails', `${hash}.webp`); + const thumb = await generateThumbnail(imagePath, thumbPath, 200); + + return { + thumbnail_path: path.relative(flypicDir, thumbPath), + thumbnail_size: thumb.size + }; +} + +module.exports = { + isImageFile, + calculateFileHash, + getThumbnailConfig, + generateThumbnail, + getImageMetadata, + generateImageThumbnails, + SUPPORTED_FORMATS +}; diff --git a/flypic/app/ui/config b/flypic/app/ui/config new file mode 100644 index 0000000..db9cd77 --- /dev/null +++ b/flypic/app/ui/config @@ -0,0 +1,11 @@ +{ + ".url": { + "flypic.Application": { + "title": "FlyPic", + "icon": "images/icon_{0}.png", + "type": "url", + "protocol": "http", + "port": "5002" + } + } +} \ No newline at end of file diff --git a/flypic/app/ui/images/icon-256.png b/flypic/app/ui/images/icon-256.png new file mode 100644 index 0000000..079d8e9 Binary files /dev/null and b/flypic/app/ui/images/icon-256.png differ diff --git a/flypic/app/ui/images/icon-64.png b/flypic/app/ui/images/icon-64.png new file mode 100644 index 0000000..d403d35 Binary files /dev/null and b/flypic/app/ui/images/icon-64.png differ diff --git a/flypic/cmd/config_callback b/flypic/cmd/config_callback new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/config_callback @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/cmd/config_init b/flypic/cmd/config_init new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/config_init @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/cmd/install_callback b/flypic/cmd/install_callback new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/install_callback @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/cmd/install_init b/flypic/cmd/install_init new file mode 100644 index 0000000..4bb82ef --- /dev/null +++ b/flypic/cmd/install_init @@ -0,0 +1,18 @@ +#!/bin/bash +LOG="${TRIM_TEMP_LOGFILE:-/tmp/flypic_install.log}" +exec >> "$LOG" 2>&1 +set -x + +echo "=== FlyPic 安装初始化开始 ===" +echo "时间: $(date)" +echo "应用名称: ${TRIM_APPNAME}" +echo "应用版本: ${TRIM_APPVER}" +echo "用户名: ${TRIM_USERNAME}" +echo "用户组: ${TRIM_GROUPNAME}" +echo "数据共享路径: ${TRIM_DATA_SHARE_PATHS}" +echo "应用目录: ${TRIM_APPDEST}" +echo "数据目录: ${TRIM_PKGVAR}" +echo "临时目录: ${TRIM_PKGTMP}" +echo "=== 安装初始化完成 ===" + +exit 0 diff --git a/flypic/cmd/main b/flypic/cmd/main new file mode 100644 index 0000000..1d2cf43 --- /dev/null +++ b/flypic/cmd/main @@ -0,0 +1,109 @@ +#!/bin/bash +set -e + +LOG_FILE="${TRIM_PKGVAR}/info.log" +PID_FILE="${TRIM_PKGVAR}/app.pid" + +export PATH=/var/apps/nodejs_v22/target/bin:$PATH + +# 数据目录 +DATA_DIR="${TRIM_DATA_SHARE_PATHS%%:*}" +# 启动命令 +CMD="DATA_DIR=${DATA_DIR} PORT=5002 node ${TRIM_APPDEST}/server/server.js" + +log_msg() { + local msg="$(date '+%Y-%m-%d %H:%M:%S') - $1" + echo "$msg" | tee -a "${LOG_FILE}" >&2 + # 同时输出到系统日志(如果存在) + if [ -n "${TRIM_TEMP_LOGFILE}" ]; then + echo "$msg" >> "${TRIM_TEMP_LOGFILE}" 2>&1 || true + fi +} + +start_process() { + if status; then + return 0 + fi + + log_msg "Starting FlyPic..." + bash -c "${CMD}" >> ${LOG_FILE} 2>&1 & + printf "%s" "$!" > ${PID_FILE} + return 0 +} + +stop_process() { + log_msg "Stopping FlyPic..." + + if [ -r "${PID_FILE}" ]; then + pid=$(head -n 1 "${PID_FILE}" | tr -d '[:space:]') + + log_msg "pid=${pid}" + if ! check_process "${pid}"; then + rm -f "${PID_FILE}" + log_msg "remove pid file" + return + fi + + log_msg "send TERM signal to PID:${pid}..." + kill -TERM ${pid} >> ${LOG_FILE} 2>&1 + + local count=0 + while check_process "${pid}" && [ $count -lt 10 ]; do + sleep 1 + count=$((count + 1)) + log_msg "waiting process terminal... (${count}s/10s)" + done + + if check_process "${pid}"; then + log_msg "send KILL signal to PID:${pid}..." + kill -KILL "${pid}" + sleep 1 + rm -f "${PID_FILE}" + else + log_msg "process killed..." + fi + fi + + return 0 +} + +check_process() { + local pid=$1 + if kill -0 "${pid}" 2>/dev/null; then + return 0 + else + return 1 + fi +} + +status() { + if [ -f "${PID_FILE}" ]; then + pid=$(head -n 1 "${PID_FILE}" | tr -d '[:space:]') + if check_process "${pid}"; then + return 0 + else + rm -f "${PID_FILE}" + fi + fi + + return 1 +} + +case $1 in +start) + start_process + ;; +stop) + stop_process + ;; +status) + if status; then + exit 0 + else + exit 3 + fi + ;; +*) + exit 1 + ;; +esac diff --git a/flypic/cmd/uninstall_callback b/flypic/cmd/uninstall_callback new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/uninstall_callback @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/cmd/uninstall_init b/flypic/cmd/uninstall_init new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/uninstall_init @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/cmd/upgrade_callback b/flypic/cmd/upgrade_callback new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/upgrade_callback @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/cmd/upgrade_init b/flypic/cmd/upgrade_init new file mode 100644 index 0000000..06bd986 --- /dev/null +++ b/flypic/cmd/upgrade_init @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/flypic/config/privilege b/flypic/config/privilege new file mode 100644 index 0000000..1cdec9e --- /dev/null +++ b/flypic/config/privilege @@ -0,0 +1,7 @@ +{ + "defaults": { + "run-as": "package" + }, + "username": "flypic", + "groupname": "flypic" +} diff --git a/flypic/config/resource b/flypic/config/resource new file mode 100644 index 0000000..d4a2636 --- /dev/null +++ b/flypic/config/resource @@ -0,0 +1,14 @@ +{ + "data-share": { + "shares": [ + { + "name": "flypic", + "permission": { + "rw": [ + "flypic" + ] + } + } + ] + } +} diff --git a/flypic/manifest b/flypic/manifest new file mode 100644 index 0000000..bd75e53 --- /dev/null +++ b/flypic/manifest @@ -0,0 +1,12 @@ +appname=flypic +version=0.1.0 +desc=轻量、快速、稳定的图片检索浏览应用 +arch=x86_64 +display_name=FlyPic +maintainer=ZangXincz +distributor=ZangXincz +desktop_uidir=ui +desktop_applaunchname=flypic.Application +source=thirdparty +service_port=5002 +install_dep_apps=nodejs_v22 diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..c92eeef --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + + FlyPic - 图片素材库管理 + + +
+ + + diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..7d06b4e --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,32 @@ +{ + "name": "flypic-frontend", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "axios": "^1.6.2", + "jszip": "^3.10.1", + "lucide-react": "^0.300.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-photo-view": "^1.2.3", + "react-virtualized-auto-sizer": "^1.0.20", + "react-window": "^1.8.10", + "socket.io-client": "^4.6.0", + "zustand": "^4.4.7" + }, + "devDependencies": { + "@types/react": "^18.2.43", + "@types/react-dom": "^18.2.17", + "@vitejs/plugin-react": "^4.2.1", + "autoprefixer": "^10.4.16", + "postcss": "^8.4.32", + "tailwindcss": "^3.4.0", + "vite": "^5.0.8" + } +} diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/frontend/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx new file mode 100644 index 0000000..80c46c6 --- /dev/null +++ b/frontend/src/App.jsx @@ -0,0 +1,473 @@ +import { useEffect, useState, useRef } from 'react'; +import { io } from 'socket.io-client'; +import useStore from './store/useStore'; +import { libraryAPI, imageAPI, scanAPI } from './services/api'; +import Sidebar from './components/Sidebar'; +import MainContent from './components/MainContent'; +import RightPanel from './components/RightPanel'; +import Header from './components/Header'; + +function App() { + const { + theme, + setLibraries, + setCurrentLibrary, + setScanProgress, + mobileView, + setMobileView, + selectedImage + } = useStore(); + const [leftWidth, setLeftWidth] = useState(256); // 默认 256px (w-64) + const [rightWidth, setRightWidth] = useState(320); // 默认 320px (w-80) + const [isDraggingLeft, setIsDraggingLeft] = useState(false); + const [isDraggingRight, setIsDraggingRight] = useState(false); + const [isMobile, setIsMobile] = useState(false); + const containerRef = useRef(null); + + useEffect(() => { + // Apply theme + if (theme === 'dark') { + document.documentElement.classList.add('dark'); + } else { + document.documentElement.classList.remove('dark'); + } + }, [theme]); + + // 检测屏幕尺寸 + useEffect(() => { + const checkMobile = () => { + const mobile = window.innerWidth < 768; // < 768px 为移动端 + setIsMobile(mobile); + }; + + checkMobile(); + window.addEventListener('resize', checkMobile); + return () => window.removeEventListener('resize', checkMobile); + }, []); + + // 选中图片时自动切换到详情视图(移动端) + useEffect(() => { + if (isMobile && selectedImage) { + setMobileView('detail'); + } + }, [selectedImage, isMobile, setMobileView]); + + useEffect(() => { + // Setup Socket.IO - 开发模式连接后端端口,生产模式使用同源 + const socketUrl = import.meta.env.DEV + ? 'http://localhost:3000' // 开发模式:后端端口 + : window.location.origin; // 生产模式:同源 + + console.log('🔌 Connecting to Socket.IO:', socketUrl); + const socket = io(socketUrl, { + transports: ['websocket', 'polling'], // 优先使用 websocket + reconnection: true, + reconnectionDelay: 1000, + reconnectionAttempts: 5 + }); + + socket.on('connect', () => { + console.log('✅ Socket.IO connected:', socket.id); + }); + + socket.on('disconnect', () => { + console.log('❌ Socket.IO disconnected'); + }); + + socket.on('connect_error', (error) => { + console.error('❌ Socket.IO connection error:', error); + }); + + socket.on('scanProgress', (progress) => { + // 只显示当前素材库的进度 + const currentLibId = useStore.getState().currentLibraryId; + if (progress.libraryId === currentLibId) { + setScanProgress(progress); + } + }); + + socket.on('scanComplete', ({ libraryId, results }) => { + console.log('📊 Scan complete:', { libraryId, results }); + + // Only reload if this is the current library + const currentLibId = useStore.getState().currentLibraryId; + console.log('🔍 Current library:', currentLibId, 'Scan library:', libraryId, 'Match:', libraryId === currentLibId); + + if (libraryId === currentLibId) { + console.log('🔄 Reloading folders and images...'); + + // 获取当前的筛选条件 + const state = useStore.getState(); + const params = { + keywords: state.searchKeywords, + ...state.filters + }; + + // 只有选中了文件夹才添加 folder 参数 + if (state.selectedFolder) { + params.folder = state.selectedFolder; + } + + // 并行加载文件夹和图片 + Promise.all([ + imageAPI.getFolders(libraryId), + // 如果没有选中文件夹且没有搜索条件,不加载图片(保持在 Dashboard) + (state.selectedFolder || state.searchKeywords || state.filters.formats.length > 0) + ? imageAPI.search(libraryId, params) + : Promise.resolve({ data: { images: [] } }), + // 扫描完成后总是重新获取总数 + imageAPI.getCount(libraryId) + ]).then(([foldersRes, imagesRes, countRes]) => { + useStore.getState().setFolders(foldersRes.data.folders); + useStore.getState().setImages(imagesRes.data.images); + // 更新图片总数 + useStore.getState().setTotalImageCount(countRes.data.count); + + console.log(`✅ Data reloaded, total: ${countRes.data.count}`); + }).catch(err => { + console.error('❌ Error reloading data:', err); + }).finally(() => { + // 最后清除进度 + setScanProgress(null); + console.log('✅ Scan progress cleared'); + }); + } else { + console.log('⚠️ Library mismatch, skipping reload'); + // 不是当前素材库,直接清除进度 + setScanProgress(null); + } + }); + + socket.on('scanError', ({ libraryId, error }) => { + setScanProgress(null); + console.error('Scan error:', error); + }); + + socket.on('scanPaused', ({ libraryId, results }) => { + console.log('⏸️ Scan paused:', { libraryId, results }); + // 保持进度显示,但标记为可以继续 + }); + + // Socket 监听已就绪后,再加载库并可能触发同步 + loadLibraries(); + + return () => { + socket.disconnect(); + }; + }, []); + + const loadLibraries = async () => { + try { + const response = await libraryAPI.getAll(); + const { libraries, currentLibraryId: libId, theme: configTheme, preferences } = response.data; + + // 立即更新基础状态 + setLibraries(libraries); + setCurrentLibrary(libId); + + // 加载主题和偏好设置 + if (configTheme) { + useStore.getState().setTheme(configTheme); + } + if (preferences) { + const { thumbnailHeight, leftPanelWidth, rightPanelWidth } = preferences; + if (thumbnailHeight) useStore.getState().setThumbnailHeight(thumbnailHeight); + if (leftPanelWidth) setLeftWidth(leftPanelWidth); + if (rightPanelWidth) setRightWidth(rightPanelWidth); + } + + if (libId) { + // 并行加载图片和文件夹(加快初始加载速度) + // 优化:启动时不加载全部图片,只加载文件夹 + const [foldersRes] = await Promise.all([ + imageAPI.getFolders(libId) + ]); + + useStore.getState().setFolders(foldersRes.data.folders); + + // 获取总数 + try { + const countRes = await imageAPI.getCount(libId); + useStore.getState().setTotalImageCount(countRes.data.count); + } catch (e) { + console.error('Failed to get image count:', e); + } + + console.log('📂 数据加载完成,文件监控器将自动检测变化'); + + // 后台检查扫描状态(不阻塞主流程) + scanAPI.getStatus(libId).then(scanStatus => { + const { status, progress, pendingCount } = scanStatus.data; + if (status === 'scanning' || status === 'paused') { + console.log(`🔄 恢复扫描状态: ${status}, 进度: ${progress?.percent || 0}%`); + setScanProgress({ + ...progress, + canStop: true, + isPaused: status === 'paused', + pendingCount: pendingCount + }); + } + }).catch(() => { }); // 忽略状态检查错误 + } + } catch (error) { + console.error('Error loading libraries:', error); + } + }; + + const loadImages = async (libraryId) => { + try { + const params = {}; + + // Get current selected folder + const selectedFolder = useStore.getState().selectedFolder; + if (selectedFolder) { + params.folder = selectedFolder; + } + + const response = await imageAPI.search(libraryId, params); + useStore.getState().setImages(response.data.images); + } catch (error) { + console.error('Error loading images:', error); + } + }; + + const loadFolders = async (libraryId) => { + try { + const response = await imageAPI.getFolders(libraryId); + useStore.getState().setFolders(response.data.folders); + } catch (error) { + console.error('Error loading folders:', error); + } + }; + + // 保存面板宽度 + const savePanelWidths = async (left, right) => { + try { + await libraryAPI.updatePreferences({ + leftPanelWidth: left, + rightPanelWidth: right + }); + } catch (error) { + console.error('Error saving panel widths:', error); + } + }; + + // 处理鼠标拖动(极致性能优化 + RAF 批处理) + useEffect(() => { + if (!isDraggingLeft && !isDraggingRight) return; + + const leftPanel = document.getElementById('left-panel'); + const rightPanel = document.getElementById('right-panel'); + let currentLeftWidth = leftWidth; + let currentRightWidth = rightWidth; + + // 缓存容器位置,避免重复计算 + const containerRect = containerRef.current.getBoundingClientRect(); + const containerLeft = containerRect.left; + const containerRight = containerRect.right; + + // RAF 批处理,避免一帧多次样式写入 + let rafId = null; + let pendingLeft = null; + let pendingRight = null; + + const flushStyle = () => { + if (leftPanel && pendingLeft != null) { + leftPanel.style.width = `${pendingLeft}px`; + currentLeftWidth = pendingLeft; + } + if (rightPanel && pendingRight != null) { + rightPanel.style.width = `${pendingRight}px`; + currentRightWidth = pendingRight; + } + rafId = null; + pendingLeft = null; + pendingRight = null; + }; + + const handleMouseMove = (e) => { + let needSchedule = false; + + if (isDraggingLeft && leftPanel) { + const newWidth = e.clientX - containerLeft; + if (newWidth >= 200 && newWidth <= 400) { + pendingLeft = newWidth; + needSchedule = true; + } + } + + if (isDraggingRight && rightPanel) { + const newWidth = containerRight - e.clientX; + if (newWidth >= 280 && newWidth <= 500) { + pendingRight = newWidth; + needSchedule = true; + } + } + + if (needSchedule && rafId == null) { + rafId = requestAnimationFrame(flushStyle); + } + }; + + const handleMouseUp = () => { + if (rafId) { + cancelAnimationFrame(rafId); + flushStyle(); + } + // 更新 state 并保存 + setLeftWidth(currentLeftWidth); + setRightWidth(currentRightWidth); + savePanelWidths(currentLeftWidth, currentRightWidth); + + setIsDraggingLeft(false); + setIsDraggingRight(false); + // 拖动结束,恢复 + useStore.getState().setIsResizingPanels(false); + useStore.getState().setResizingSide(null); + }; + + // 使用 passive: false 确保可以阻止默认行为 + document.addEventListener('mousemove', handleMouseMove, { passive: true }); + document.addEventListener('mouseup', handleMouseUp); + document.body.style.userSelect = 'none'; + document.body.style.cursor = 'col-resize'; + // 禁用过渡动画 + if (leftPanel) leftPanel.style.transition = 'none'; + if (rightPanel) rightPanel.style.transition = 'none'; + + return () => { + if (rafId) { + cancelAnimationFrame(rafId); + rafId = null; + } + document.removeEventListener('mousemove', handleMouseMove); + document.removeEventListener('mouseup', handleMouseUp); + document.body.style.userSelect = ''; + document.body.style.cursor = ''; + // 恢复过渡动画 + if (leftPanel) leftPanel.style.transition = ''; + if (rightPanel) rightPanel.style.transition = ''; + }; + }, [isDraggingLeft, isDraggingRight]); + + // 移动端布局 + if (isMobile) { + return ( +
+
+
+ {/* 侧边栏视图 */} +
+ +
+ + {/* 主内容视图 */} +
+ +
+ + {/* 详情视图 */} +
+ +
+
+ + {/* 底部导航 */} +
+ + + +
+
+ ); + } + + // 桌面端布局 + return ( +
+
+
+ {/* 左侧边栏 */} +
+ +
+ + {/* 左侧拖动条 */} +
{ + e.preventDefault(); + // 标记正在拖动,供其他组件抑制重算 + useStore.getState().setIsResizingPanels(true); + useStore.getState().setResizingSide('left'); + setIsDraggingLeft(true); + }} + > + {/* 扩大点击区域 */} +
+
+ + {/* 中间主内容区 */} +
+ +
+ + {/* 右侧拖动条 */} +
{ + e.preventDefault(); + // 标记正在拖动,供其他组件抑制重算 + useStore.getState().setIsResizingPanels(true); + useStore.getState().setResizingSide('right'); + setIsDraggingRight(true); + }} + > + {/* 扩大点击区域 */} +
+
+ + {/* 右侧边栏 */} +
+ +
+
+
+ ); +} + +export default App; diff --git a/frontend/src/components/Dashboard.jsx b/frontend/src/components/Dashboard.jsx new file mode 100644 index 0000000..1fdefe0 --- /dev/null +++ b/frontend/src/components/Dashboard.jsx @@ -0,0 +1,127 @@ +import React from 'react'; +import useStore from '../store/useStore'; +import { Folder, Image as ImageIcon, Search } from 'lucide-react'; + +function Dashboard() { + const { + totalImageCount, + folders, + currentLibraryId, + getCurrentLibrary + } = useStore(); + + const currentLibrary = getCurrentLibrary(); + + // Calculate stats + const folderCount = folders.length; + + // Group folders by parent to find top-level folders + const topLevelFolders = folders.filter(f => !f.parent_path || f.parent_path === '.' || f.parent_path === ''); + + return ( +
+
+
+

+ {currentLibrary?.name || '素材库'} +

+

+ {currentLibrary?.path} +

+
+ + {/* Stats Cards */} +
+
+
+
+ +
+
+
+ {totalImageCount.toLocaleString()} +
+
总图片数
+
+
+
+ +
+
+
+ +
+
+
+ {folderCount.toLocaleString()} +
+
文件夹
+
+
+
+ +
+
+
+ +
+
+
+ 快速开始 +
+
+ 使用左侧目录树浏览或顶部搜索栏查找图片 +
+
+
+
+
+ + {/* Top Level Folders Preview */} + {topLevelFolders.length > 0 && ( +
+

+ 根目录文件夹 +

+
+ {topLevelFolders.map(folder => ( +
useStore.getState().setSelectedFolder(folder.path)} + > +
+ +
+
+ {folder.name} +
+
+
+
+ {folder.image_count || 0} 张图片 +
+
+ ))} +
+
+ )} + + {/* Empty State */} + {topLevelFolders.length === 0 && ( +
+ +

+ 暂无文件夹 +

+

+ 您的素材库似乎是空的。请将图片添加到素材库目录中,系统会自动扫描。 +

+
+ )} +
+
+ ); +} + +export default Dashboard; diff --git a/frontend/src/components/FileViewer.jsx b/frontend/src/components/FileViewer.jsx new file mode 100644 index 0000000..d5109c0 --- /dev/null +++ b/frontend/src/components/FileViewer.jsx @@ -0,0 +1,124 @@ +import { X, ExternalLink } from 'lucide-react'; +import { imageAPI } from '../services/api'; + +/** + * 文件查看器 - 支持视频播放和文档查看 + * 不依赖额外库,使用浏览器原生能力 + */ +function FileViewer({ file, libraryId, onClose }) { + if (!file) return null; + + const fileType = file.file_type || 'image'; + const originalUrl = imageAPI.getOriginalUrl(libraryId, file.path); + + // 在系统默认应用中打开 + const openInSystem = async () => { + try { + await imageAPI.openInExplorer(libraryId, file.path); + } catch (error) { + console.error('Failed to open file:', error); + } + }; + + return ( +
+ {/* 顶部工具栏 */} +
+
+ {file.filename} +
+
+ + +
+
+ + {/* 内容区域 */} +
+ {fileType === 'video' && ( + + )} + + {fileType === 'audio' && ( +
+
🎵
+ +

{file.filename}

+
+ )} + + {fileType === 'document' && ( +
+ {file.format === 'pdf' ? ( +