diff --git a/.gitignore b/.gitignore index a51bd51..1d578f7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,6 @@ Knowledge base/ # 构建输出 dist/ -flypic/ flypic.zip # 测试数据 diff --git a/backend/package.json b/backend/package.json index 5a99446..76a9ff5 100644 --- a/backend/package.json +++ b/backend/package.json @@ -8,12 +8,14 @@ "start": "node --expose-gc server.js" }, "dependencies": { + "bcrypt": "^5.1.1", "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", + "jsonwebtoken": "^9.0.2", "multer": "^2.0.0-rc.4", "p-limit": "^7.2.0", "sharp": "^0.33.0", diff --git a/flypic/app/server/database/db.js b/flypic/app/server/database/db.js index 5ed1457..f347071 100644 --- a/flypic/app/server/database/db.js +++ b/flypic/app/server/database/db.js @@ -67,6 +67,27 @@ class LibraryDatabase { // 列已存在,忽略错误 } + // 添加 rating 列(如果不存在) + try { + this.db.exec(`ALTER TABLE images ADD COLUMN rating INTEGER DEFAULT 0`); + } catch (e) { + // 列已存在,忽略错误 + } + + // 添加 favorite 列(如果不存在) + try { + this.db.exec(`ALTER TABLE images ADD COLUMN favorite INTEGER DEFAULT 0`); + } catch (e) { + // 列已存在,忽略错误 + } + + // 添加 tags 列(如果不存在) + try { + this.db.exec(`ALTER TABLE images ADD COLUMN tags TEXT DEFAULT ''`); + } catch (e) { + // 列已存在,忽略错误 + } + // Folders table this.db.exec(` CREATE TABLE IF NOT EXISTS folders ( @@ -89,6 +110,9 @@ class LibraryDatabase { 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); + -- 评分和收藏索引:优化筛选查询 + CREATE INDEX IF NOT EXISTS idx_rating ON images(rating DESC); + CREATE INDEX IF NOT EXISTS idx_favorite ON images(favorite DESC); `); // Metadata table for tracking database modifications @@ -171,6 +195,12 @@ class LibraryDatabase { return stmt.get(imagePath); } + getImagesByFolderPrefix(folderPath) { + // 获取文件夹内所有图片记录(包括子文件夹) + const stmt = this.db.prepare('SELECT * FROM images WHERE folder = ? OR folder LIKE ?'); + return stmt.all(folderPath, `${folderPath}/%`); + } + getAllImages() { // ⚠️ 警告:此方法会加载所有图片到内存,仅用于调试! // 生产环境请使用 searchImages() 或流式查询 diff --git a/flypic/app/server/package-lock.json b/flypic/app/server/package-lock.json index efce4da..3f70354 100644 --- a/flypic/app/server/package-lock.json +++ b/flypic/app/server/package-lock.json @@ -8,15 +8,19 @@ "name": "flypic-backend", "version": "1.0.0", "dependencies": { + "bcrypt": "^5.1.1", "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", + "jsonwebtoken": "^9.0.2", + "multer": "^2.0.0-rc.4", "p-limit": "^7.2.0", "sharp": "^0.33.0", - "socket.io": "^4.6.0" + "socket.io": "^4.6.0", + "trash": "^8.1.1" }, "devDependencies": { "cross-env": "^7.0.3", @@ -411,6 +415,26 @@ "node": ">=12" } }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmmirror.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "license": "BSD-3-Clause", + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -421,12 +445,45 @@ "node": ">=14" } }, + "node_modules/@sindresorhus/chunkify": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/@sindresorhus/chunkify/-/chunkify-0.2.0.tgz", + "integrity": "sha512-mOAiwqu+bIIkNFDCXFJxZEmF9p9WHfSBbpLLmgysYnNkEs7aA0/AvU9+6zLHFqI7JnqdqwAuWu8CbGwGIszRdw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@sindresorhus/df": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/@sindresorhus/df/-/df-3.1.1.tgz", + "integrity": "sha512-SME/vtXaJcnQ/HpeV6P82Egy+jThn11IKfwW8+/XVoRD0rmPHVTeKMtww1oWdVnMykzVPjmrDN9S8NBndPEHCQ==", + "license": "MIT", + "dependencies": { + "execa": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, "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/@stroncium/procfs": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/@stroncium/procfs/-/procfs-1.2.1.tgz", + "integrity": "sha512-X1Iui3FUNZP18EUvysTHxt+Avu2nlVzyf90YM8OYgP6SGzTzzX/0JgObfO1AQQDzuZtNNz29bVh8h5R97JrjxA==", + "license": "CC0-1.0", + "engines": { + "node": ">=8" + } + }, "node_modules/@types/cors": { "version": "2.8.19", "resolved": "https://registry.npmmirror.com/@types/cors/-/cors-2.8.19.tgz", @@ -445,6 +502,12 @@ "undici-types": "~7.16.0" } }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "license": "ISC" + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmmirror.com/accepts/-/accepts-1.3.8.tgz", @@ -458,6 +521,57 @@ "node": ">= 0.6" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/agent-base/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/aggregate-error": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/aggregate-error/-/aggregate-error-4.0.1.tgz", + "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", + "license": "MIT", + "dependencies": { + "clean-stack": "^4.0.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ansi-regex": { "version": "6.2.2", "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-6.2.2.tgz", @@ -495,12 +609,59 @@ "node": ">= 8" } }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/aproba": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/aproba/-/aproba-2.1.0.tgz", + "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==", + "license": "ISC" + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } + }, "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/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "license": "MIT", + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", @@ -536,6 +697,20 @@ "node": "^4.5.0 || >= 5.9" } }, + "node_modules/bcrypt": { + "version": "5.1.1", + "resolved": "https://registry.npmmirror.com/bcrypt/-/bcrypt-5.1.1.tgz", + "integrity": "sha512-AGBHOG5hPYZ5Xl9KXzU5iKq9516yEmvCKDg3ecP5kX2aB6UqTeXZxk2ELnDgDm6BQSMlLt9rDB4LoSMx0rYwww==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.11", + "node-addon-api": "^5.0.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/better-sqlite3": { "version": "9.6.0", "resolved": "https://registry.npmmirror.com/better-sqlite3/-/better-sqlite3-9.6.0.tgz", @@ -648,6 +823,29 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz", @@ -711,10 +909,28 @@ } }, "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" + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/clean-stack": { + "version": "4.2.0", + "resolved": "https://registry.npmmirror.com/clean-stack/-/clean-stack-4.2.0.tgz", + "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/color": { "version": "4.2.3", @@ -757,13 +973,42 @@ "simple-swizzle": "^0.2.2" } }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmmirror.com/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, "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/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "license": "ISC" + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz", @@ -886,6 +1131,12 @@ "node": ">=4.0.0" } }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "license": "MIT" + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", @@ -914,6 +1165,18 @@ "node": ">=8" } }, + "node_modules/dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmmirror.com/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "license": "MIT", + "dependencies": { + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -934,6 +1197,15 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "license": "MIT" }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmmirror.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz", @@ -1052,6 +1324,18 @@ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "license": "MIT" }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz", @@ -1061,6 +1345,32 @@ "node": ">= 0.6" } }, + "node_modules/execa": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/execa/-/execa-2.1.0.tgz", + "integrity": "sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^3.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": "^8.12.0 || >=9.7.0" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, "node_modules/expand-template": { "version": "2.0.3", "resolved": "https://registry.npmmirror.com/expand-template/-/expand-template-2.0.3.tgz", @@ -1192,6 +1502,36 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "license": "MIT" }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", @@ -1215,6 +1555,74 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/gauge/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/gauge/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/gauge/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, + "node_modules/gauge/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/gauge/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/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -1252,6 +1660,21 @@ "node": ">= 0.4" } }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmmirror.com/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmmirror.com/github-from-package/-/github-from-package-0.0.0.tgz", @@ -1290,6 +1713,66 @@ "node": ">= 6" } }, + "node_modules/globby": { + "version": "7.1.1", + "resolved": "https://registry.npmmirror.com/globby/-/globby-7.1.1.tgz", + "integrity": "sha512-yANWAN2DUcBtuus5Cpd+SKROzXHs2iVXFZt/Ykrfz6SAXqacLX25NZpltE+39ceMexYF4TtEadjuSTw8+3wX4g==", + "license": "MIT", + "dependencies": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/globby/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==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/globby/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globby/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", @@ -1324,6 +1807,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "license": "ISC" + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz", @@ -1356,6 +1845,42 @@ "url": "https://opencollective.com/express" } }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/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/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -1388,6 +1913,12 @@ ], "license": "BSD-3-Clause" }, + "node_modules/ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmmirror.com/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "license": "MIT" + }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -1395,6 +1926,29 @@ "dev": true, "license": "ISC" }, + "node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", @@ -1473,6 +2027,30 @@ "node": ">=0.12.0" } }, + "node_modules/is-path-inside": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/is-path-inside/-/is-path-inside-4.0.0.tgz", + "integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", @@ -1494,12 +2072,127 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmmirror.com/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", + "license": "MIT", + "dependencies": { + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/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/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmmirror.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmmirror.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, "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/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -1527,6 +2220,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" + }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmmirror.com/methods/-/methods-1.1.2.tgz", @@ -1569,6 +2268,15 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-3.1.0.tgz", @@ -1614,18 +2322,120 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, "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/mount-point": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/mount-point/-/mount-point-3.0.0.tgz", + "integrity": "sha512-jAhfD7ZCG+dbESZjcY1SdFVFqSJkh/yGbdsifHcPkvuLRO5ugK0Ssmd9jdATu29BTd4JiN+vkpMzVvsUgP3SZA==", + "license": "MIT", + "dependencies": { + "@sindresorhus/df": "^1.0.1", + "pify": "^2.3.0", + "pinkie-promise": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mount-point/node_modules/@sindresorhus/df": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/@sindresorhus/df/-/df-1.0.1.tgz", + "integrity": "sha512-1Hyp7NQnD/u4DSxR2DGW78TF9k7R0wZ8ev0BpMAIzA6yTQSHqNb5wTuvtcPYf4FWbVse2rW7RgDsyL8ua2vXHw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mount-point/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/move-file": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/move-file/-/move-file-3.1.0.tgz", + "integrity": "sha512-4aE3U7CCBWgrQlQDMq8da4woBWDGHioJFiOZ8Ie6Yq2uwYQ9V2kGhTz4x3u6Wc+OU17nw0yc3rJ/lQ4jIiPe3A==", + "license": "MIT", + "dependencies": { + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "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/multer": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/multer/-/multer-2.0.2.tgz", + "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "concat-stream": "^2.0.0", + "mkdirp": "^0.5.6", + "object-assign": "^4.1.1", + "type-is": "^1.6.18", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">= 10.16.0" + } + }, "node_modules/napi-build-utils": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/napi-build-utils/-/napi-build-utils-2.0.0.tgz", @@ -1653,6 +2463,32 @@ "node": ">=10" } }, + "node_modules/node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/nodemon": { "version": "3.1.11", "resolved": "https://registry.npmmirror.com/nodemon/-/nodemon-3.1.11.tgz", @@ -1731,6 +2567,21 @@ "dev": true, "license": "MIT" }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", @@ -1740,6 +2591,31 @@ "node": ">=0.10.0" } }, + "node_modules/npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz", @@ -1782,6 +2658,39 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/p-limit": { "version": "7.2.0", "resolved": "https://registry.npmmirror.com/p-limit/-/p-limit-7.2.0.tgz", @@ -1797,6 +2706,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-map": { + "version": "5.5.0", + "resolved": "https://registry.npmmirror.com/p-map/-/p-map-5.5.0.tgz", + "integrity": "sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==", + "license": "MIT", + "dependencies": { + "aggregate-error": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "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", @@ -1812,6 +2736,24 @@ "node": ">= 0.8" } }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", @@ -1843,6 +2785,18 @@ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "license": "MIT" }, + "node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz", @@ -1855,6 +2809,36 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/prebuild-install": { "version": "7.1.3", "resolved": "https://registry.npmmirror.com/prebuild-install/-/prebuild-install-7.1.3.tgz", @@ -1991,6 +2975,65 @@ "node": ">=8.10.0" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/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==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2163,6 +3206,12 @@ "node": ">= 0.8" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "license": "ISC" + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -2380,6 +3429,15 @@ "node": ">=10" } }, + "node_modules/slash": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/slash/-/slash-1.0.0.tgz", + "integrity": "sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/socket.io": { "version": "4.8.1", "resolved": "https://registry.npmmirror.com/socket.io/-/socket.io-4.8.1.tgz", @@ -2499,6 +3557,14 @@ "node": ">= 0.8" } }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz", @@ -2604,6 +3670,15 @@ "node": ">=8" } }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -2626,6 +3701,23 @@ "node": ">=4" } }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmmirror.com/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/tar-fs": { "version": "2.1.4", "resolved": "https://registry.npmmirror.com/tar-fs/-/tar-fs-2.1.4.tgz", @@ -2638,6 +3730,12 @@ "tar-stream": "^2.1.4" } }, + "node_modules/tar-fs/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/tar-stream": { "version": "2.2.0", "resolved": "https://registry.npmmirror.com/tar-stream/-/tar-stream-2.2.0.tgz", @@ -2654,6 +3752,27 @@ "node": ">=6" } }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2685,6 +3804,34 @@ "nodetouch": "bin/nodetouch.js" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmmirror.com/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/trash": { + "version": "8.1.1", + "resolved": "https://registry.npmmirror.com/trash/-/trash-8.1.1.tgz", + "integrity": "sha512-r15NUF+BJpDBKLTyOXaB+PhF8qh53TAOTpu/wCt6bqpu488jamsiOV7VdC//yPwAnyGIv1EJgetEnjLNer5XVw==", + "license": "MIT", + "dependencies": { + "@sindresorhus/chunkify": "^0.2.0", + "@stroncium/procfs": "^1.2.1", + "globby": "^7.1.1", + "is-path-inside": "^4.0.0", + "move-file": "^3.0.0", + "p-map": "^5.1.0", + "uuid": "^8.3.2", + "xdg-trashdir": "^3.1.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", @@ -2717,6 +3864,12 @@ "node": ">= 0.6" } }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmmirror.com/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, "node_modules/undefsafe": { "version": "2.0.5", "resolved": "https://registry.npmmirror.com/undefsafe/-/undefsafe-2.0.5.tgz", @@ -2739,6 +3892,18 @@ "node": ">= 0.8" } }, + "node_modules/user-home": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha512-KMWqdlOcjCYdtIJpicDSFBQ8nFwS2i9sslAd6f4+CBGcU4gist2REnr2fxj2YocvJFxSF3ZOHLYLVZnUxv4BZQ==", + "license": "MIT", + "dependencies": { + "os-homedir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2754,6 +3919,15 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz", @@ -2763,6 +3937,22 @@ "node": ">= 0.8" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", @@ -2778,6 +3968,56 @@ "node": ">= 8" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmmirror.com/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wide-align/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/wide-align/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/wide-align/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/wide-align/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/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -2896,6 +4136,45 @@ } } }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/xdg-trashdir": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/xdg-trashdir/-/xdg-trashdir-3.1.0.tgz", + "integrity": "sha512-N1XQngeqMBoj9wM4ZFadVV2MymImeiFfYD+fJrNlcVcOHsJFFQe7n3b+aBoTPwARuq2HQxukfzVpQmAk1gN4sQ==", + "license": "MIT", + "dependencies": { + "@sindresorhus/df": "^3.1.1", + "mount-point": "^3.0.0", + "user-home": "^2.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, "node_modules/yocto-queue": { "version": "1.2.2", "resolved": "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-1.2.2.tgz", diff --git a/flypic/app/server/package.json b/flypic/app/server/package.json index 602765a..76a9ff5 100644 --- a/flypic/app/server/package.json +++ b/flypic/app/server/package.json @@ -8,15 +8,19 @@ "start": "node --expose-gc server.js" }, "dependencies": { + "bcrypt": "^5.1.1", "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", + "jsonwebtoken": "^9.0.2", + "multer": "^2.0.0-rc.4", "p-limit": "^7.2.0", "sharp": "^0.33.0", - "socket.io": "^4.6.0" + "socket.io": "^4.6.0", + "trash": "^8.1.1" }, "devDependencies": { "cross-env": "^7.0.3", diff --git a/flypic/app/server/public/ICON_256.PNG b/flypic/app/server/public/ICON_256.PNG new file mode 100644 index 0000000..079d8e9 Binary files /dev/null and b/flypic/app/server/public/ICON_256.PNG differ diff --git a/flypic/app/server/public/assets/index-BOz4q9XG.js b/flypic/app/server/public/assets/index-BOz4q9XG.js new file mode 100644 index 0000000..33ca329 --- /dev/null +++ b/flypic/app/server/public/assets/index-BOz4q9XG.js @@ -0,0 +1,292 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Pi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Su(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Df={exports:{}},Qo={},Mf={exports:{}},Ke={};/** + * @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 _i=Symbol.for("react.element"),e0=Symbol.for("react.portal"),t0=Symbol.for("react.fragment"),n0=Symbol.for("react.strict_mode"),r0=Symbol.for("react.profiler"),s0=Symbol.for("react.provider"),i0=Symbol.for("react.context"),o0=Symbol.for("react.forward_ref"),a0=Symbol.for("react.suspense"),l0=Symbol.for("react.memo"),u0=Symbol.for("react.lazy"),Ic=Symbol.iterator;function c0(e){return e===null||typeof e!="object"?null:(e=Ic&&e[Ic]||e["@@iterator"],typeof e=="function"?e:null)}var Bf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Uf=Object.assign,$f={};function Cs(e,t,n){this.props=e,this.context=t,this.refs=$f,this.updater=n||Bf}Cs.prototype.isReactComponent={};Cs.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")};Cs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Wf(){}Wf.prototype=Cs.prototype;function Cu(e,t,n){this.props=e,this.context=t,this.refs=$f,this.updater=n||Bf}var Eu=Cu.prototype=new Wf;Eu.constructor=Cu;Uf(Eu,Cs.prototype);Eu.isPureReactComponent=!0;var Ac=Array.isArray,Hf=Object.prototype.hasOwnProperty,Nu={current:null},Vf={key:!0,ref:!0,__self:!0,__source:!0};function qf(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Hf.call(t,r)&&!Vf.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1>>1,A=B[P];if(0>>1;Ps(oe,te))_es(ae,oe)?(B[P]=ae,B[_e]=te,P=_e):(B[P]=oe,B[J]=te,P=J);else if(_es(ae,te))B[P]=ae,B[_e]=te,P=_e;else break e}}return M}function s(B,M){var te=B.sortIndex-M.sortIndex;return te!==0?te:B.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],d=[],p=1,v=null,x=3,y=!1,g=!1,c=!1,w=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(B){for(var M=n(d);M!==null;){if(M.callback===null)r(d);else if(M.startTime<=B)r(d),M.sortIndex=M.expirationTime,t(l,M);else break;M=n(d)}}function _(B){if(c=!1,b(B),!g)if(n(l)!==null)g=!0,re(S);else{var M=n(d);M!==null&&Y(_,M.startTime-B)}}function S(B,M){g=!1,c&&(c=!1,f(L),L=-1),y=!0;var te=x;try{for(b(M),v=n(l);v!==null&&(!(v.expirationTime>M)||B&&!le());){var P=v.callback;if(typeof P=="function"){v.callback=null,x=v.priorityLevel;var A=P(v.expirationTime<=M);M=e.unstable_now(),typeof A=="function"?v.callback=A:v===n(l)&&r(l),b(M)}else r(l);v=n(l)}if(v!==null)var ie=!0;else{var J=n(d);J!==null&&Y(_,J.startTime-M),ie=!1}return ie}finally{v=null,x=te,y=!1}}var T=!1,j=null,L=-1,O=5,D=-1;function le(){return!(e.unstable_now()-DB||125P?(B.sortIndex=te,t(d,B),n(l)===null&&B===n(d)&&(c?(f(L),L=-1):c=!0,Y(_,te-P))):(B.sortIndex=A,t(l,B),g||y||(g=!0,re(S))),B},e.unstable_shouldYield=le,e.unstable_wrapCallback=function(B){var M=x;return function(){var te=x;x=M;try{return B.apply(this,arguments)}finally{x=te}}}})(Gf);Yf.exports=Gf;var b0=Yf.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 k0=F,an=b0;function me(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"),cl=Object.prototype.hasOwnProperty,_0=/^[: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]*$/,Lc={},zc={};function S0(e){return cl.call(zc,e)?!0:cl.call(Lc,e)?!1:_0.test(e)?zc[e]=!0:(Lc[e]=!0,!1)}function C0(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 E0(e,t,n,r){if(t===null||typeof t>"u"||C0(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 qt(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var It={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){It[e]=new qt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];It[t]=new qt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){It[e]=new qt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){It[e]=new qt(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){It[e]=new qt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){It[e]=new qt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){It[e]=new qt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){It[e]=new qt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){It[e]=new qt(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ru=/[\-:]([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(Ru,Tu);It[t]=new qt(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(Ru,Tu);It[t]=new qt(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(Ru,Tu);It[t]=new qt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){It[e]=new qt(e,1,!1,e.toLowerCase(),null,!1,!1)});It.xlinkHref=new qt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){It[e]=new qt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ou(e,t,n,r){var s=It.hasOwnProperty(t)?It[t]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var l=` +`+s[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Ca=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Hs(e):""}function N0(e){switch(e.tag){case 5:return Hs(e.type);case 16:return Hs("Lazy");case 13:return Hs("Suspense");case 19:return Hs("SuspenseList");case 0:case 2:case 15:return e=Ea(e.type,!1),e;case 11:return e=Ea(e.type.render,!1),e;case 1:return e=Ea(e.type,!0),e;default:return""}}function pl(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 Gr:return"Fragment";case Yr:return"Portal";case dl:return"Profiler";case Iu:return"StrictMode";case fl:return"Suspense";case hl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case eh:return(e.displayName||"Context")+".Consumer";case Jf:return(e._context.displayName||"Context")+".Provider";case Au:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pu:return t=e.displayName||null,t!==null?t:pl(e.type)||"Memo";case sr:t=e._payload,e=e._init;try{return pl(e(t))}catch{}}return null}function j0(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 pl(t);case 8:return t===Iu?"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 kr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function R0(e){var t=nh(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 s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.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 Fi(e){e._valueTracker||(e._valueTracker=R0(e))}function rh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=nh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Eo(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 ml(e,t){var n=t.checked;return mt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Dc(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=kr(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 sh(e,t){t=t.checked,t!=null&&Ou(e,"checked",t,!1)}function gl(e,t){sh(e,t);var n=kr(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")?yl(e,t.type,n):t.hasOwnProperty("defaultValue")&&yl(e,t.type,kr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Mc(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 yl(e,t,n){(t!=="number"||Eo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Vs=Array.isArray;function us(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Di.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ii(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Xs={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},T0=["Webkit","ms","Moz","O"];Object.keys(Xs).forEach(function(e){T0.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Xs[t]=Xs[e]})});function lh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Xs.hasOwnProperty(e)&&Xs[e]?(""+t).trim():t+"px"}function uh(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=lh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var O0=mt({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 wl(e,t){if(t){if(O0[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(me(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(me(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(me(61))}if(t.style!=null&&typeof t.style!="object")throw Error(me(62))}}function bl(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 kl=null;function Lu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _l=null,cs=null,ds=null;function $c(e){if(e=Ei(e)){if(typeof _l!="function")throw Error(me(280));var t=e.stateNode;t&&(t=ra(t),_l(e.stateNode,e.type,t))}}function ch(e){cs?ds?ds.push(e):ds=[e]:cs=e}function dh(){if(cs){var e=cs,t=ds;if(ds=cs=null,$c(e),t)for(e=0;e>>=0,e===0?32:31-($0(e)/W0|0)|0}var Mi=64,Bi=4194304;function qs(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 To(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=qs(a):(i&=o,i!==0&&(r=qs(i)))}else o=n&~s,o!==0?r=qs(o):i!==0&&(r=qs(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&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 Si(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tn(t),e[t]=n}function K0(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=Gs),Gc=" ",Qc=!1;function Oh(e,t){switch(e){case"keyup":return bg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ih(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qr=!1;function _g(e,t){switch(e){case"compositionend":return Ih(t);case"keypress":return t.which!==32?null:(Qc=!0,Gc);case"textInput":return e=t.data,e===Gc&&Qc?null:e;default:return null}}function Sg(e,t){if(Qr)return e==="compositionend"||!Wu&&Oh(e,t)?(e=Rh(),lo=Bu=cr=null,Qr=!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=nd(n)}}function zh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fh(){for(var e=window,t=Eo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Eo(e.document)}return t}function Hu(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 Ag(e){var t=Fh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&zh(n.ownerDocument.documentElement,n)){if(r!==null&&Hu(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 s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=rd(n,i);var o=rd(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>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,Jr=null,Rl=null,Js=null,Tl=!1;function sd(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tl||Jr==null||Jr!==Eo(r)||(r=Jr,"selectionStart"in r&&Hu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Js&&di(Js,r)||(Js=r,r=Ao(Rl,"onSelect"),0ns||(e.current=zl[ns],zl[ns]=null,ns--)}function it(e,t){ns++,zl[ns]=e.current,e.current=t}var _r={},Dt=Cr(_r),Yt=Cr(!1),Fr=_r;function ys(e,t){var n=e.type.contextTypes;if(!n)return _r;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Gt(e){return e=e.childContextTypes,e!=null}function Lo(){ut(Yt),ut(Dt)}function dd(e,t,n){if(Dt.current!==_r)throw Error(me(168));it(Dt,t),it(Yt,n)}function qh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(me(108,j0(e)||"Unknown",s));return mt({},n,r)}function zo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_r,Fr=Dt.current,it(Dt,e),it(Yt,Yt.current),!0}function fd(e,t,n){var r=e.stateNode;if(!r)throw Error(me(169));n?(e=qh(e,t,Fr),r.__reactInternalMemoizedMergedChildContext=e,ut(Yt),ut(Dt),it(Dt,e)):ut(Yt),it(Yt,n)}var Kn=null,sa=!1,Ba=!1;function Kh(e){Kn===null?Kn=[e]:Kn.push(e)}function Vg(e){sa=!0,Kh(e)}function Er(){if(!Ba&&Kn!==null){Ba=!0;var e=0,t=rt;try{var n=Kn;for(rt=1;e>=o,s-=o,Zn=1<<32-Tn(t)+s|n<L?(O=j,j=null):O=j.sibling;var D=x(f,j,b[L],_);if(D===null){j===null&&(j=O);break}e&&j&&D.alternate===null&&t(f,j),h=i(D,h,L),T===null?S=D:T.sibling=D,T=D,j=O}if(L===b.length)return n(f,j),dt&&Nr(f,L),S;if(j===null){for(;LL?(O=j,j=null):O=j.sibling;var le=x(f,j,D.value,_);if(le===null){j===null&&(j=O);break}e&&j&&le.alternate===null&&t(f,j),h=i(le,h,L),T===null?S=le:T.sibling=le,T=le,j=O}if(D.done)return n(f,j),dt&&Nr(f,L),S;if(j===null){for(;!D.done;L++,D=b.next())D=v(f,D.value,_),D!==null&&(h=i(D,h,L),T===null?S=D:T.sibling=D,T=D);return dt&&Nr(f,L),S}for(j=r(f,j);!D.done;L++,D=b.next())D=y(j,f,L,D.value,_),D!==null&&(e&&D.alternate!==null&&j.delete(D.key===null?L:D.key),h=i(D,h,L),T===null?S=D:T.sibling=D,T=D);return e&&j.forEach(function(R){return t(f,R)}),dt&&Nr(f,L),S}function w(f,h,b,_){if(typeof b=="object"&&b!==null&&b.type===Gr&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case zi:e:{for(var S=b.key,T=h;T!==null;){if(T.key===S){if(S=b.type,S===Gr){if(T.tag===7){n(f,T.sibling),h=s(T,b.props.children),h.return=f,f=h;break e}}else if(T.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===sr&&md(S)===T.type){n(f,T.sibling),h=s(T,b.props),h.ref=Ms(f,T,b),h.return=f,f=h;break e}n(f,T);break}else t(f,T);T=T.sibling}b.type===Gr?(h=Lr(b.props.children,f.mode,_,b.key),h.return=f,f=h):(_=yo(b.type,b.key,b.props,null,f.mode,_),_.ref=Ms(f,h,b),_.return=f,f=_)}return o(f);case Yr:e:{for(T=b.key;h!==null;){if(h.key===T)if(h.tag===4&&h.stateNode.containerInfo===b.containerInfo&&h.stateNode.implementation===b.implementation){n(f,h.sibling),h=s(h,b.children||[]),h.return=f,f=h;break e}else{n(f,h);break}else t(f,h);h=h.sibling}h=Za(b,f.mode,_),h.return=f,f=h}return o(f);case sr:return T=b._init,w(f,h,T(b._payload),_)}if(Vs(b))return g(f,h,b,_);if(Ps(b))return c(f,h,b,_);Ki(f,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,h!==null&&h.tag===6?(n(f,h.sibling),h=s(h,b),h.return=f,f=h):(n(f,h),h=Ka(b,f.mode,_),h.return=f,f=h),o(f)):n(f,h)}return w}var xs=Gh(!0),Qh=Gh(!1),Mo=Cr(null),Bo=null,is=null,Zu=null;function Xu(){Zu=is=Bo=null}function Yu(e){var t=Mo.current;ut(Mo),e._currentValue=t}function Ml(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 hs(e,t){Bo=e,Zu=is=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xt=!0),e.firstContext=null)}function wn(e){var t=e._currentValue;if(Zu!==e)if(e={context:e,memoizedValue:t,next:null},is===null){if(Bo===null)throw Error(me(308));is=e,Bo.dependencies={lanes:0,firstContext:e}}else is=is.next=e;return t}var Or=null;function Gu(e){Or===null?Or=[e]:Or.push(e)}function Jh(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Gu(t)):(n.next=s.next,s.next=n),t.interleaved=n,er(e,r)}function er(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 ir=!1;function Qu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ep(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 Gn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function gr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Qe&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,er(e,n)}return s=r.interleaved,s===null?(t.next=t,Gu(r)):(t.next=s.next,s.next=t),r.interleaved=t,er(e,n)}function co(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,Fu(e,n)}}function gd(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=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};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,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 Uo(e,t,n,r){var s=e.updateQueue;ir=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,d=l.next;l.next=null,o===null?i=d:o.next=d,o=l;var p=e.alternate;p!==null&&(p=p.updateQueue,a=p.lastBaseUpdate,a!==o&&(a===null?p.firstBaseUpdate=d:a.next=d,p.lastBaseUpdate=l))}if(i!==null){var v=s.baseState;o=0,p=d=l=null,a=i;do{var x=a.lane,y=a.eventTime;if((r&x)===x){p!==null&&(p=p.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,c=a;switch(x=t,y=n,c.tag){case 1:if(g=c.payload,typeof g=="function"){v=g.call(y,v,x);break e}v=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=c.payload,x=typeof g=="function"?g.call(y,v,x):g,x==null)break e;v=mt({},v,x);break e;case 2:ir=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,x=s.effects,x===null?s.effects=[a]:x.push(a))}else y={eventTime:y,lane:x,tag:a.tag,payload:a.payload,callback:a.callback,next:null},p===null?(d=p=y,l=v):p=p.next=y,o|=x;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;x=a,a=x.next,x.next=null,s.lastBaseUpdate=x,s.shared.pending=null}}while(!0);if(p===null&&(l=v),s.baseState=l,s.firstBaseUpdate=d,s.lastBaseUpdate=p,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Br|=o,e.lanes=o,e.memoizedState=v}}function yd(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=$a.transition;$a.transition={};try{e(!1),t()}finally{rt=n,$a.transition=r}}function yp(){return bn().memoizedState}function Xg(e,t,n){var r=vr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vp(e))xp(t,n);else if(n=Jh(e,t,n,r),n!==null){var s=Ht();On(n,e,r,s),wp(n,t,r)}}function Yg(e,t,n){var r=vr(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vp(e))xp(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,In(a,o)){var l=t.interleaved;l===null?(s.next=s,Gu(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=Jh(e,t,s,r),n!==null&&(s=Ht(),On(n,e,r,s),wp(n,t,r))}}function vp(e){var t=e.alternate;return e===pt||t!==null&&t===pt}function xp(e,t){ei=Wo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wp(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fu(e,n)}}var Ho={readContext:wn,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useInsertionEffect:At,useLayoutEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useMutableSource:At,useSyncExternalStore:At,useId:At,unstable_isNewReconciler:!1},Gg={readContext:wn,useCallback:function(e,t){return Fn().memoizedState=[e,t===void 0?null:t],e},useContext:wn,useEffect:xd,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ho(4194308,4,fp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ho(4194308,4,e,t)},useInsertionEffect:function(e,t){return ho(4,2,e,t)},useMemo:function(e,t){var n=Fn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fn();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=Xg.bind(null,pt,e),[r.memoizedState,e]},useRef:function(e){var t=Fn();return e={current:e},t.memoizedState=e},useState:vd,useDebugValue:oc,useDeferredValue:function(e){return Fn().memoizedState=e},useTransition:function(){var e=vd(!1),t=e[0];return e=Zg.bind(null,e[1]),Fn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=pt,s=Fn();if(dt){if(n===void 0)throw Error(me(407));n=n()}else{if(n=t(),jt===null)throw Error(me(349));Mr&30||sp(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,xd(op.bind(null,r,i,e),[e]),r.flags|=2048,xi(9,ip.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Fn(),t=jt.identifierPrefix;if(dt){var n=Xn,r=Zn;n=(r&~(1<<32-Tn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=yi++,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[Mn]=t,e[pi]=r,Tp(e,t,!1,!1),t.stateNode=e;e:{switch(o=bl(n,r),n){case"dialog":lt("cancel",e),lt("close",e),s=r;break;case"iframe":case"object":case"embed":lt("load",e),s=r;break;case"video":case"audio":for(s=0;sks&&(t.flags|=128,r=!0,Bs(i,!1),t.lanes=4194304)}else{if(!r)if(e=$o(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!dt)return Pt(t),null}else 2*vt()-i.renderingStartTime>ks&&n!==1073741824&&(t.flags|=128,r=!0,Bs(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=vt(),t.sibling=null,n=ht.current,it(ht,r?n&1|2:n&1),t):(Pt(t),null);case 22:case 23:return fc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?rn&1073741824&&(Pt(t),t.subtreeFlags&6&&(t.flags|=8192)):Pt(t),null;case 24:return null;case 25:return null}throw Error(me(156,t.tag))}function iy(e,t){switch(qu(t),t.tag){case 1:return Gt(t.type)&&Lo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ws(),ut(Yt),ut(Dt),tc(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ec(t),null;case 13:if(ut(ht),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(me(340));vs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ut(ht),null;case 4:return ws(),null;case 10:return Yu(t.type._context),null;case 22:case 23:return fc(),null;case 24:return null;default:return null}}var Xi=!1,zt=!1,oy=typeof WeakSet=="function"?WeakSet:Set,Re=null;function os(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yt(e,t,r)}else n.current=null}function Zl(e,t,n){try{n()}catch(r){yt(e,t,r)}}var Td=!1;function ay(e,t){if(Ol=Oo,e=Fh(),Hu(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 s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,d=0,p=0,v=e,x=null;t:for(;;){for(var y;v!==n||s!==0&&v.nodeType!==3||(a=o+s),v!==i||r!==0&&v.nodeType!==3||(l=o+r),v.nodeType===3&&(o+=v.nodeValue.length),(y=v.firstChild)!==null;)x=v,v=y;for(;;){if(v===e)break t;if(x===n&&++d===s&&(a=o),x===i&&++p===r&&(l=o),(y=v.nextSibling)!==null)break;v=x,x=v.parentNode}v=y}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Il={focusedElem:e,selectionRange:n},Oo=!1,Re=t;Re!==null;)if(t=Re,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Re=e;else for(;Re!==null;){t=Re;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 c=g.memoizedProps,w=g.memoizedState,f=t.stateNode,h=f.getSnapshotBeforeUpdate(t.elementType===t.type?c:Cn(t.type,c),w);f.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(me(163))}}catch(_){yt(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Re=e;break}Re=t.return}return g=Td,Td=!1,g}function ti(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Zl(t,n,i)}s=s.next}while(s!==r)}}function aa(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 Xl(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 Ap(e){var t=e.alternate;t!==null&&(e.alternate=null,Ap(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mn],delete t[pi],delete t[Ll],delete t[Wg],delete t[Hg])),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 Pp(e){return e.tag===5||e.tag===3||e.tag===4}function Od(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Pp(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 Yl(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=Po));else if(r!==4&&(e=e.child,e!==null))for(Yl(e,t,n),e=e.sibling;e!==null;)Yl(e,t,n),e=e.sibling}function Gl(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(Gl(e,t,n),e=e.sibling;e!==null;)Gl(e,t,n),e=e.sibling}var Tt=null,En=!1;function rr(e,t,n){for(n=n.child;n!==null;)Lp(e,t,n),n=n.sibling}function Lp(e,t,n){if(Bn&&typeof Bn.onCommitFiberUnmount=="function")try{Bn.onCommitFiberUnmount(Jo,n)}catch{}switch(n.tag){case 5:zt||os(n,t);case 6:var r=Tt,s=En;Tt=null,rr(e,t,n),Tt=r,En=s,Tt!==null&&(En?(e=Tt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tt.removeChild(n.stateNode));break;case 18:Tt!==null&&(En?(e=Tt,n=n.stateNode,e.nodeType===8?Ma(e.parentNode,n):e.nodeType===1&&Ma(e,n),ui(e)):Ma(Tt,n.stateNode));break;case 4:r=Tt,s=En,Tt=n.stateNode.containerInfo,En=!0,rr(e,t,n),Tt=r,En=s;break;case 0:case 11:case 14:case 15:if(!zt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Zl(n,t,o),s=s.next}while(s!==r)}rr(e,t,n);break;case 1:if(!zt&&(os(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){yt(n,t,a)}rr(e,t,n);break;case 21:rr(e,t,n);break;case 22:n.mode&1?(zt=(r=zt)||n.memoizedState!==null,rr(e,t,n),zt=r):rr(e,t,n);break;default:rr(e,t,n)}}function Id(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new oy),t.forEach(function(r){var s=gy.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Sn(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=vt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*uy(r/1960))-r,10e?16:e,dr===null)var r=!1;else{if(e=dr,dr=null,Ko=0,Qe&6)throw Error(me(331));var s=Qe;for(Qe|=4,Re=e.current;Re!==null;){var i=Re,o=i.child;if(Re.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lvt()-cc?Pr(e,0):uc|=n),Qt(e,t)}function Wp(e,t){t===0&&(e.mode&1?(t=Bi,Bi<<=1,!(Bi&130023424)&&(Bi=4194304)):t=1);var n=Ht();e=er(e,t),e!==null&&(Si(e,t,n),Qt(e,n))}function my(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wp(e,n)}function gy(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(me(314))}r!==null&&r.delete(t),Wp(e,n)}var Hp;Hp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yt.current)Xt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xt=!1,ry(e,t,n);Xt=!!(e.flags&131072)}else Xt=!1,dt&&t.flags&1048576&&Zh(t,Do,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;po(e,t),e=t.pendingProps;var s=ys(t,Dt.current);hs(t,n),s=rc(null,t,r,e,s,n);var i=sc();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Gt(r)?(i=!0,zo(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Qu(t),s.updater=oa,t.stateNode=s,s._reactInternals=t,Ul(t,r,e,n),t=Hl(null,t,r,!0,i,n)):(t.tag=0,dt&&i&&Vu(t),$t(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(po(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=vy(r),e=Cn(r,e),s){case 0:t=Wl(null,t,r,e,n);break e;case 1:t=Nd(null,t,r,e,n);break e;case 11:t=Cd(null,t,r,e,n);break e;case 14:t=Ed(null,t,r,Cn(r.type,e),n);break e}throw Error(me(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cn(r,s),Wl(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cn(r,s),Nd(e,t,r,s,n);case 3:e:{if(Np(t),e===null)throw Error(me(387));r=t.pendingProps,i=t.memoizedState,s=i.element,ep(e,t),Uo(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=bs(Error(me(423)),t),t=jd(e,t,r,n,s);break e}else if(r!==s){s=bs(Error(me(424)),t),t=jd(e,t,r,n,s);break e}else for(sn=mr(t.stateNode.containerInfo.firstChild),on=t,dt=!0,jn=null,n=Qh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vs(),r===s){t=tr(e,t,n);break e}$t(e,t,r,n)}t=t.child}return t;case 5:return tp(t),e===null&&Dl(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,Al(r,s)?o=null:i!==null&&Al(r,i)&&(t.flags|=32),Ep(e,t),$t(e,t,o,n),t.child;case 6:return e===null&&Dl(t),null;case 13:return jp(e,t,n);case 4:return Ju(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=xs(t,null,r,n):$t(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cn(r,s),Cd(e,t,r,s,n);case 7:return $t(e,t,t.pendingProps,n),t.child;case 8:return $t(e,t,t.pendingProps.children,n),t.child;case 12:return $t(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,it(Mo,r._currentValue),r._currentValue=o,i!==null)if(In(i.value,o)){if(i.children===s.children&&!Yt.current){t=tr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Gn(-1,n&-n),l.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var p=d.pending;p===null?l.next=l:(l.next=p.next,p.next=l),d.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ml(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(me(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Ml(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}$t(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,hs(t,n),s=wn(s),r=r(s),t.flags|=1,$t(e,t,r,n),t.child;case 14:return r=t.type,s=Cn(r,t.pendingProps),s=Cn(r.type,s),Ed(e,t,r,s,n);case 15:return Sp(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cn(r,s),po(e,t),t.tag=1,Gt(r)?(e=!0,zo(t)):e=!1,hs(t,n),bp(t,r,s),Ul(t,r,s,n),Hl(null,t,r,!0,e,n);case 19:return Rp(e,t,n);case 22:return Cp(e,t,n)}throw Error(me(156,t.tag))};function Vp(e,t){return vh(e,t)}function yy(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 vn(e,t,n,r){return new yy(e,t,n,r)}function pc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function vy(e){if(typeof e=="function")return pc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Au)return 11;if(e===Pu)return 14}return 2}function xr(e,t){var n=e.alternate;return n===null?(n=vn(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 yo(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")pc(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Gr:return Lr(n.children,s,i,t);case Iu:o=8,s|=8;break;case dl:return e=vn(12,n,t,s|2),e.elementType=dl,e.lanes=i,e;case fl:return e=vn(13,n,t,s),e.elementType=fl,e.lanes=i,e;case hl:return e=vn(19,n,t,s),e.elementType=hl,e.lanes=i,e;case th:return ua(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Jf:o=10;break e;case eh:o=9;break e;case Au:o=11;break e;case Pu:o=14;break e;case sr:o=16,r=null;break e}throw Error(me(130,e==null?e:typeof e,""))}return t=vn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Lr(e,t,n,r){return e=vn(7,e,r,t),e.lanes=n,e}function ua(e,t,n,r){return e=vn(22,e,r,t),e.elementType=th,e.lanes=n,e.stateNode={isHidden:!1},e}function Ka(e,t,n){return e=vn(6,e,null,t),e.lanes=n,e}function Za(e,t,n){return t=vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function xy(e,t,n,r,s){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=ja(0),this.expirationTimes=ja(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ja(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function mc(e,t,n,r,s,i,o,a,l){return e=new xy(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=vn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qu(i),e}function wy(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Xp)}catch(e){console.error(e)}}Xp(),Xf.exports=ln;var Yp=Xf.exports,Bd=Yp;ul.createRoot=Bd.createRoot,ul.hydrateRoot=Bd.hydrateRoot;const Wn=Object.create(null);Wn.open="0";Wn.close="1";Wn.ping="2";Wn.pong="3";Wn.message="4";Wn.upgrade="5";Wn.noop="6";const vo=Object.create(null);Object.keys(Wn).forEach(e=>{vo[Wn[e]]=e});const nu={type:"error",data:"parser error"},Gp=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Qp=typeof ArrayBuffer=="function",Jp=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,xc=({type:e,data:t},n,r)=>Gp&&t instanceof Blob?n?r(t):Ud(t,r):Qp&&(t instanceof ArrayBuffer||Jp(t))?n?r(t):Ud(new Blob([t]),r):r(Wn[e]+(t||"")),Ud=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function $d(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Xa;function Cy(e,t){if(Gp&&e.data instanceof Blob)return e.data.arrayBuffer().then($d).then(t);if(Qp&&(e.data instanceof ArrayBuffer||Jp(e.data)))return t($d(e.data));xc(e,!1,n=>{Xa||(Xa=new TextEncoder),t(Xa.encode(n))})}const Wd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zs=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,s=0,i,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r>4,p[s++]=(o&15)<<4|a>>2,p[s++]=(a&3)<<6|l&63;return d},Ny=typeof ArrayBuffer=="function",wc=(e,t)=>{if(typeof e!="string")return{type:"message",data:em(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:jy(e.substring(1),t)}:vo[n]?e.length>1?{type:vo[n],data:e.substring(1)}:{type:vo[n]}:nu},jy=(e,t)=>{if(Ny){const n=Ey(e);return em(n,t)}else return{base64:!0,data:e}},em=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},tm="",Ry=(e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((i,o)=>{xc(i,!1,a=>{r[o]=a,++s===n&&t(r.join(tm))})})},Ty=(e,t)=>{const n=e.split(tm),r=[];for(let s=0;s{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let Ya;function Qi(e){return e.reduce((t,n)=>t+n.length,0)}function Ji(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;sMath.pow(2,21)-1){a.enqueue(nu);break}s=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(Qi(n)e){a.enqueue(nu);break}}}})}const nm=4;function kt(e){if(e)return Ay(e)}function Ay(e){for(var t in kt.prototype)e[t]=kt.prototype[t];return e}kt.prototype.on=kt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};kt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.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,s=0;sPromise.resolve().then(t):(t,n)=>n(t,0),gn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Py="arraybuffer";function rm(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Ly=gn.setTimeout,zy=gn.clearTimeout;function ma(e,t){t.useNativeTimers?(e.setTimeoutFn=Ly.bind(gn),e.clearTimeoutFn=zy.bind(gn)):(e.setTimeoutFn=gn.setTimeout.bind(gn),e.clearTimeoutFn=gn.clearTimeout.bind(gn))}const Fy=1.33;function Dy(e){return typeof e=="string"?My(e):Math.ceil((e.byteLength||e.size)*Fy)}function My(e){let t=0,n=0;for(let r=0,s=e.length;r=57344?n+=3:(r++,n+=4);return n}function sm(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function By(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Uy(e){let t={},n=e.split("&");for(let r=0,s=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)};Ty(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,Ry(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]=sm()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let im=!1;try{im=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Hy=im;function Vy(){}class qy extends Wy{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",(s,i)=>{this.onError("xhr post error",s,i)})}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 $n extends kt{constructor(t,n,r){super(),this.createRequest=t,ma(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=rm(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 s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}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 s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.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(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=$n.requestsCount++,$n.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=Vy,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete $n.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()}}$n.requestsCount=0;$n.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Hd);else if(typeof addEventListener=="function"){const e="onpagehide"in gn?"pagehide":"unload";addEventListener(e,Hd,!1)}}function Hd(){for(let e in $n.requests)$n.requests.hasOwnProperty(e)&&$n.requests[e].abort()}const Ky=function(){const e=om({xdomain:!1});return e&&e.responseType!==null}();class Zy extends qy{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Ky&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new $n(om,this.uri(),t)}}function om(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Hy))return new XMLHttpRequest}catch{}if(!t)try{return new gn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const am=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Xy extends bc{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=am?{}:rm(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(s){return this.emitReserved("error",s)}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,i)}catch{}s&&pa(()=>{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]=sm()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Ga=gn.WebSocket||gn.MozWebSocket;class Yy extends Xy{createSocket(t,n,r){return am?new Ga(t,n,r):n?new Ga(t,n):new Ga(t)}doWrite(t,n){this.ws.send(n)}}class Gy extends bc{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=Iy(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),s=Oy();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const i=()=>{r.read().then(({done:a,value:l})=>{a||(this.onPacket(l),i())}).catch(a=>{})};i();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{s&&pa(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Qy={websocket:Yy,webtransport:Gy,polling:Zy},Jy=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ev=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ru(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 s=Jy.exec(e||""),i={},o=14;for(;o--;)i[ev[o]]=s[o]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=tv(i,i.path),i.queryKey=nv(i,i.query),i}function tv(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 nv(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(n[s]=i)}),n}const su=typeof addEventListener=="function"&&typeof removeEventListener=="function",xo=[];su&&addEventListener("offline",()=>{xo.forEach(e=>e())},!1);class wr extends kt{constructor(t,n){if(super(),this.binaryType=Py,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=ru(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=ru(n.host).host);ma(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 s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=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=Uy(this.opts.query)),su&&(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"})},xo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=nm,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&&wr.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",wr.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,pa(()=>{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,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),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(wr.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(),su&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=xo.indexOf(this._offlineEventListener);r!==-1&&xo.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}wr.protocol=nm;class rv extends wr{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",v=>{if(!r)if(v.type==="pong"&&v.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;wr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function i(){r||(r=!0,p(),n.close(),n=null)}const o=v=>{const x=new Error("probe error: "+v);x.transport=n.name,i(),this.emitReserved("upgradeError",x)};function a(){o("transport closed")}function l(){o("socket closed")}function d(v){n&&v.name!==n.name&&i()}const p=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",a),this.off("close",l),this.off("upgrading",d)};n.once("open",s),n.once("error",o),n.once("close",a),this.once("close",l),this.once("upgrading",d),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;rQy[s]).filter(s=>!!s)),super(t,r)}};function iv(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=ru(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 i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const ov=typeof ArrayBuffer=="function",av=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,lm=Object.prototype.toString,lv=typeof Blob=="function"||typeof Blob<"u"&&lm.call(Blob)==="[object BlobConstructor]",uv=typeof File=="function"||typeof File<"u"&&lm.call(File)==="[object FileConstructor]";function kc(e){return ov&&(e instanceof ArrayBuffer||av(e))||lv&&e instanceof Blob||uv&&e instanceof File}function wo(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(i),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,s)=>{const i=(o,a)=>o?s(o):r(a);i.withError=!0,n.push(i),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((s,...i)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...i)),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:Xe.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 Xe.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 Xe.EVENT:case Xe.BINARY_EVENT:this.onevent(t);break;case Xe.ACK:case Xe.BINARY_ACK:this.onack(t);break;case Xe.DISCONNECT:this.ondisconnect();break;case Xe.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(...s){r||(r=!0,n.packet({type:Xe.ACK,id:t,data:s}))}}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:Xe.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}js.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};js.prototype.reset=function(){this.attempts=0};js.prototype.setMin=function(e){this.ms=e};js.prototype.setMax=function(e){this.max=e};js.prototype.setJitter=function(e){this.jitter=e};class au extends kt{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,ma(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 js({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const s=n.parser||gv;this.encoder=new s.Encoder,this.decoder=new s.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 sv(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Nn(n,"open",function(){r.onopen(),t&&t()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=Nn(n,"error",i);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(s),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(Nn(t,"ping",this.onping.bind(this)),Nn(t,"data",this.ondata.bind(this)),Nn(t,"error",this.onerror.bind(this)),Nn(t,"close",this.onclose.bind(this)),Nn(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){pa(()=>{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 um(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(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):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 $s={};function bo(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=iv(e,t.path||"/socket.io"),r=n.source,s=n.id,i=n.path,o=$s[s]&&i in $s[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return a?l=new au(r,t):($s[s]||($s[s]=new au(r,t)),l=$s[s]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(bo,{Manager:au,Socket:um,io:bo,connect:bo});const vv={},qd=e=>{let t;const n=new Set,r=(p,v)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const y=t;t=v??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(g=>g(t,y))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(vv?"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()}},d=t=e(r,s,l);return l},xv=e=>e?qd(e):qd;var cm={exports:{}},dm={},fm={exports:{}},hm={};/** + * @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 _s=F;function wv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bv=typeof Object.is=="function"?Object.is:wv,kv=_s.useState,_v=_s.useEffect,Sv=_s.useLayoutEffect,Cv=_s.useDebugValue;function Ev(e,t){var n=t(),r=kv({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Sv(function(){s.value=n,s.getSnapshot=t,Qa(s)&&i({inst:s})},[e,n,t]),_v(function(){return Qa(s)&&i({inst:s}),e(function(){Qa(s)&&i({inst:s})})},[e]),Cv(n),n}function Qa(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!bv(e,n)}catch{return!0}}function Nv(e,t){return t()}var jv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Nv:Ev;hm.useSyncExternalStore=_s.useSyncExternalStore!==void 0?_s.useSyncExternalStore:jv;fm.exports=hm;var Rv=fm.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 ga=F,Tv=Rv;function Ov(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Iv=typeof Object.is=="function"?Object.is:Ov,Av=Tv.useSyncExternalStore,Pv=ga.useRef,Lv=ga.useEffect,zv=ga.useMemo,Fv=ga.useDebugValue;dm.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=Pv(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=zv(function(){function l(y){if(!d){if(d=!0,p=y,y=r(y),s!==void 0&&o.hasValue){var g=o.value;if(s(g,y))return v=g}return v=y}if(g=v,Iv(p,y))return g;var c=r(y);return s!==void 0&&s(g,c)?(p=y,g):(p=y,v=c)}var d=!1,p,v,x=n===void 0?null:n;return[function(){return l(t())},x===null?void 0:function(){return l(x())}]},[t,n,r,s]);var a=Av(e,i[0],i[1]);return Lv(function(){o.hasValue=!0,o.value=a},[a]),Fv(a),a};cm.exports=dm;var Dv=cm.exports;const Mv=Su(Dv),pm={},{useDebugValue:Bv}=Ve,{useSyncExternalStoreWithSelector:Uv}=Mv;let Kd=!1;const $v=e=>e;function Wv(e,t=$v,n){(pm?"production":void 0)!=="production"&&n&&!Kd&&(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"),Kd=!0);const r=Uv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Bv(r),r}const Zd=e=>{(pm?"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"?xv(e):e,n=(r,s)=>Wv(t,r,s);return Object.assign(n,t),n},Rs=e=>e?Zd(e):Zd,Wt=Rs(e=>({theme:"light",mobileView:"main",thumbnailHeight:200,isResizingPanels:!1,resizingSide:null,setTheme:t=>e({theme:t}),toggleTheme:()=>e(t=>({theme:t.theme==="light"?"dark":"light"})),setMobileView:t=>e({mobileView:t}),setThumbnailHeight:t=>e({thumbnailHeight:t}),setIsResizingPanels:t=>e({isResizingPanels:t}),setResizingSide:t=>e({resizingSide:t})})),Rn=Rs((e,t)=>({libraries:[],currentLibraryId:null,showAddLibraryForm:!1,expandLibrarySelector:!1,setLibraries:n=>e({libraries:n}),setCurrentLibrary:n=>e({currentLibraryId:n}),setShowAddLibraryForm:n=>e({showAddLibraryForm:n}),triggerExpandLibrarySelector:()=>e({expandLibrarySelector:!0}),resetExpandLibrarySelector:()=>e({expandLibrarySelector:!1}),addLibrary:n=>e(r=>({libraries:[...r.libraries,n]})),removeLibrary:n=>e(r=>({libraries:r.libraries.filter(s=>s.id!==n),currentLibraryId:r.currentLibraryId===n?null:r.currentLibraryId})),updateLibrary:(n,r)=>e(s=>({libraries:s.libraries.map(i=>i.id===n?{...i,...r}:i)})),getCurrentLibrary:()=>{const{libraries:n,currentLibraryId:r}=t();return n.find(s=>s.id===r)}})),Ee=Rs((e,t)=>({images:[],selectedImage:null,selectedImages:[],totalImageCount:0,totalSize:0,folders:[],selectedFolder:null,selectedFolderItem:null,searchKeywords:"",filters:{formats:[],sizes:[],orientations:[],ratings:[]},originalImages:[],imageLoadingState:{isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1},renamingImage:null,setImages:n=>e({images:n}),setOriginalImages:n=>e({originalImages:n}),appendImages:n=>e(r=>({images:[...r.images,...n],originalImages:[...r.originalImages,...n]})),clearImages:()=>e({images:[],originalImages:[]}),setSelectedImage:n=>e({selectedImage:n}),setSelectedImages:n=>e({selectedImages:n}),toggleImageSelection:n=>e(r=>({selectedImages:r.selectedImages.some(i=>i.path===n.path)?r.selectedImages.filter(i=>i.path!==n.path):[...r.selectedImages,n]})),clearSelection:()=>e({selectedImages:[],selectedImage:null,selectedFolderItem:null}),setFolders:n=>e({folders:n}),setSelectedFolder:n=>e({selectedFolder:n}),setSelectedFolderItem:n=>e({selectedFolderItem:n}),setSearchKeywords:n=>e({searchKeywords:n}),setFilters:n=>e(r=>({filters:{...r.filters,...n}})),resetFilters:()=>e({searchKeywords:"",filters:{formats:[],sizes:[],orientations:[],ratings:[]}}),setTotalImageCount:n=>e({totalImageCount:n}),setTotalSize:n=>e({totalSize:n}),setImageLoadingState:n=>e(r=>({imageLoadingState:{...r.imageLoadingState,...n}})),setRenamingImage:n=>e({renamingImage:n}),updateImage:(n,r)=>e(s=>{var i;return{images:s.images.map(o=>o.path===n?{...o,...r}:o),selectedImage:((i=s.selectedImage)==null?void 0:i.path)===n?{...s.selectedImage,...r}:s.selectedImage}})})),or=Rs((e,t)=>({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}),clearScanProgress:()=>e({scanProgress:null,scanStartTime:null}),getEstimatedTimeLeft:()=>{const{scanProgress:n,scanStartTime:r}=t();if(!n||!r||n.current===0)return null;const s=Date.now()-r,i=n.current/s,o=n.total-n.current;return Math.ceil(o/i/1e3)},isScanning:()=>{const{scanProgress:n}=t();return n&&n.status!=="preparing"}})),Hv="/api";class Ja extends Error{constructor(t,n,r){super(t),this.name="APIError",this.status=n,this.data=r}}function Sc(){return localStorage.getItem("flypic_token")}function mm(e){e?localStorage.setItem("flypic_token",e):localStorage.removeItem("flypic_token")}async function ji(e,t={}){var i;const n=Sc(),r={"Content-Type":"application/json",...t.headers};n&&(r.Authorization=`Bearer ${n}`);const s={headers:r,...t};try{const o=await fetch(`${Hv}${e}`,s),a=await o.json();if(!o.ok)throw o.status===401&&(e.includes("/auth/status")||(mm(null),window.dispatchEvent(new Event("auth:unauthorized")))),new Ja(((i=a.error)==null?void 0:i.message)||a.error||"Request failed",o.status,a);return a.data!==void 0?a.data:a}catch(o){throw o instanceof Ja?o:new Ja(o.message||"Network error",0,null)}}function Vv(e,t={}){return ji(e,{method:"GET",...t})}function qv(e,t,n={}){return ji(e,{method:"POST",body:JSON.stringify(t),...n})}function Kv(e,t,n={}){return ji(e,{method:"PUT",body:JSON.stringify(t),...n})}function Zv(e,t,n={}){return ji(e,{method:"PATCH",body:JSON.stringify(t),...n})}function Xv(e,t={}){return ji(e,{method:"DELETE",...t})}const tt={get:Vv,post:qv,put:Kv,patch:Zv,delete:Xv};async function Yv(){return tt.get("/library")}async function Gv(e,t){return tt.post("/library",{name:e,path:t})}async function Qv(e,t){return tt.put(`/library/${e}`,t)}async function gm(e,t=!0){return tt.delete(`/library/${e}?autoSelectNext=${t}`)}const Jv=gm;async function ex(e){return tt.post(`/library/${e}/set-current`)}async function tx(e){return tt.put("/library/preferences",e)}async function nx(e){return tt.put("/library/theme",{theme:e})}async function rx(e){return tt.get(`/library/${e}/validate`)}const sx=Object.freeze(Object.defineProperty({__proto__:null,add:Gv,deleteLibrary:Jv,getAll:Yv,remove:gm,setCurrent:ex,update:Qv,updatePreferences:tx,updateTheme:nx,validate:rx},Symbol.toStringTag,{value:"Module"}));async function ix(e,t={},n={}){const r=new URLSearchParams({libraryId:e,...t});return tt.get(`/image?${r}`,n)}async function ox(e){return tt.get(`/image/count?libraryId=${e}`)}async function ax(e){return tt.get(`/image/stats?libraryId=${e}`)}async function lx(e){return tt.get(`/image/folders?libraryId=${e}`)}async function ux(e){return tt.get(`/image/cache-meta?libraryId=${e}`)}function cx(e,t){return`/api/image/thumbnail/${e}/${t}`}function dx(e,t){return`/api/image/original/${e}/${t}`}async function fx(e,t){return tt.post(`/image/${e}/open-file`,{path:t})}async function hx(e,t,n){return tt.put("/image/rating",{libraryId:e,paths:Array.isArray(t)?t:[t],rating:n})}const px=Object.freeze(Object.defineProperty({__proto__:null,getCacheMeta:ux,getCount:ox,getFolders:lx,getOriginalUrl:dx,getStats:ax,getThumbnailUrl:cx,openInExplorer:fx,search:ix,updateRating:hx},Symbol.toStringTag,{value:"Module"}));async function mx(e,t=!1){return tt.post("/scan/full",{libraryId:e,wait:t})}async function gx(e,t=!1){return tt.post("/scan/sync",{libraryId:e,wait:t})}async function yx(e){return tt.get(`/scan/status/${e}`)}async function vx(e){return tt.post("/scan/fix-folders",{libraryId:e})}const xx=Object.freeze(Object.defineProperty({__proto__:null,fixFolders:vx,fullScan:mx,getStatus:yx,sync:gx},Symbol.toStringTag,{value:"Module"}));function ym(e,t){return function(){return e.apply(t,arguments)}}const{toString:wx}=Object.prototype,{getPrototypeOf:Cc}=Object,{iterator:ya,toStringTag:vm}=Symbol,va=(e=>t=>{const n=wx.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),An=e=>(e=e.toLowerCase(),t=>va(t)===e),xa=e=>t=>typeof t===e,{isArray:Ts}=Array,Ss=xa("undefined");function Ri(e){return e!==null&&!Ss(e)&&e.constructor!==null&&!Ss(e.constructor)&&Jt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const xm=An("ArrayBuffer");function bx(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&xm(e.buffer),t}const kx=xa("string"),Jt=xa("function"),wm=xa("number"),Ti=e=>e!==null&&typeof e=="object",_x=e=>e===!0||e===!1,ko=e=>{if(va(e)!=="object")return!1;const t=Cc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(vm in e)&&!(ya in e)},Sx=e=>{if(!Ti(e)||Ri(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Cx=An("Date"),Ex=An("File"),Nx=An("Blob"),jx=An("FileList"),Rx=e=>Ti(e)&&Jt(e.pipe),Tx=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Jt(e.append)&&((t=va(e))==="formdata"||t==="object"&&Jt(e.toString)&&e.toString()==="[object FormData]"))},Ox=An("URLSearchParams"),[Ix,Ax,Px,Lx]=["ReadableStream","Request","Response","Headers"].map(An),zx=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Oi(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Ts(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,km=e=>!Ss(e)&&e!==Ar;function lu(){const{caseless:e,skipUndefined:t}=km(this)&&this||{},n={},r=(s,i)=>{const o=e&&bm(n,i)||i;ko(n[o])&&ko(s)?n[o]=lu(n[o],s):ko(s)?n[o]=lu({},s):Ts(s)?n[o]=s.slice():(!t||!Ss(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s(Oi(t,(s,i)=>{n&&Jt(s)?e[i]=ym(s,n):e[i]=s},{allOwnKeys:r}),e),Dx=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Mx=(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)},Bx=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&Cc(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ux=(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},$x=e=>{if(!e)return null;if(Ts(e))return e;let t=e.length;if(!wm(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Wx=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Cc(Uint8Array)),Hx=(e,t)=>{const r=(e&&e[ya]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Vx=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},qx=An("HTMLFormElement"),Kx=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Xd=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zx=An("RegExp"),_m=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Oi(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Xx=e=>{_m(e,(t,n)=>{if(Jt(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Jt(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+"'")})}})},Yx=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Ts(e)?r(e):r(String(e).split(t)),n},Gx=()=>{},Qx=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Jx(e){return!!(e&&Jt(e.append)&&e[vm]==="FormData"&&e[ya])}const e1=e=>{const t=new Array(10),n=(r,s)=>{if(Ti(r)){if(t.indexOf(r)>=0)return;if(Ri(r))return r;if(!("toJSON"in r)){t[s]=r;const i=Ts(r)?[]:{};return Oi(r,(o,a)=>{const l=n(o,s+1);!Ss(l)&&(i[a]=l)}),t[s]=void 0,i}}return r};return n(e,0)},t1=An("AsyncFunction"),n1=e=>e&&(Ti(e)||Jt(e))&&Jt(e.then)&&Jt(e.catch),Sm=((e,t)=>e?setImmediate:t?((n,r)=>(Ar.addEventListener("message",({source:s,data:i})=>{s===Ar&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Ar.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Jt(Ar.postMessage)),r1=typeof queueMicrotask<"u"?queueMicrotask.bind(Ar):typeof process<"u"&&process.nextTick||Sm,s1=e=>e!=null&&Jt(e[ya]),Q={isArray:Ts,isArrayBuffer:xm,isBuffer:Ri,isFormData:Tx,isArrayBufferView:bx,isString:kx,isNumber:wm,isBoolean:_x,isObject:Ti,isPlainObject:ko,isEmptyObject:Sx,isReadableStream:Ix,isRequest:Ax,isResponse:Px,isHeaders:Lx,isUndefined:Ss,isDate:Cx,isFile:Ex,isBlob:Nx,isRegExp:Zx,isFunction:Jt,isStream:Rx,isURLSearchParams:Ox,isTypedArray:Wx,isFileList:jx,forEach:Oi,merge:lu,extend:Fx,trim:zx,stripBOM:Dx,inherits:Mx,toFlatObject:Bx,kindOf:va,kindOfTest:An,endsWith:Ux,toArray:$x,forEachEntry:Hx,matchAll:Vx,isHTMLForm:qx,hasOwnProperty:Xd,hasOwnProp:Xd,reduceDescriptors:_m,freezeMethods:Xx,toObjectSet:Yx,toCamelCase:Kx,noop:Gx,toFiniteNumber:Qx,findKey:bm,global:Ar,isContextDefined:km,isSpecCompliantForm:Jx,toJSONObject:e1,isAsyncFn:t1,isThenable:n1,setImmediate:Sm,asap:r1,isIterable:s1};function We(e,t,n,r,s){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),s&&(this.response=s,this.status=s.status?s.status:null)}Q.inherits(We,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:Q.toJSONObject(this.config),code:this.code,status:this.status}}});const Cm=We.prototype,Em={};["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=>{Em[e]={value:e}});Object.defineProperties(We,Em);Object.defineProperty(Cm,"isAxiosError",{value:!0});We.from=(e,t,n,r,s,i)=>{const o=Object.create(Cm);Q.toFlatObject(e,o,function(p){return p!==Error.prototype},d=>d!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return We.call(o,a,l,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const i1=null;function uu(e){return Q.isPlainObject(e)||Q.isArray(e)}function Nm(e){return Q.endsWith(e,"[]")?e.slice(0,-2):e}function Yd(e,t,n){return e?e.concat(t).map(function(s,i){return s=Nm(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function o1(e){return Q.isArray(e)&&!e.some(uu)}const a1=Q.toFlatObject(Q,{},null,function(t){return/^is[A-Z]/.test(t)});function wa(e,t,n){if(!Q.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Q.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(c,w){return!Q.isUndefined(w[c])});const r=n.metaTokens,s=n.visitor||p,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&Q.isSpecCompliantForm(t);if(!Q.isFunction(s))throw new TypeError("visitor must be a function");function d(g){if(g===null)return"";if(Q.isDate(g))return g.toISOString();if(Q.isBoolean(g))return g.toString();if(!l&&Q.isBlob(g))throw new We("Blob is not supported. Use a Buffer instead.");return Q.isArrayBuffer(g)||Q.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function p(g,c,w){let f=g;if(g&&!w&&typeof g=="object"){if(Q.endsWith(c,"{}"))c=r?c:c.slice(0,-2),g=JSON.stringify(g);else if(Q.isArray(g)&&o1(g)||(Q.isFileList(g)||Q.endsWith(c,"[]"))&&(f=Q.toArray(g)))return c=Nm(c),f.forEach(function(b,_){!(Q.isUndefined(b)||b===null)&&t.append(o===!0?Yd([c],_,i):o===null?c:c+"[]",d(b))}),!1}return uu(g)?!0:(t.append(Yd(w,c,i),d(g)),!1)}const v=[],x=Object.assign(a1,{defaultVisitor:p,convertValue:d,isVisitable:uu});function y(g,c){if(!Q.isUndefined(g)){if(v.indexOf(g)!==-1)throw Error("Circular reference detected in "+c.join("."));v.push(g),Q.forEach(g,function(f,h){(!(Q.isUndefined(f)||f===null)&&s.call(t,f,Q.isString(h)?h.trim():h,c,x))===!0&&y(f,c?c.concat(h):[h])}),v.pop()}}if(!Q.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Gd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ec(e,t){this._pairs=[],e&&wa(e,this,t)}const jm=Ec.prototype;jm.append=function(t,n){this._pairs.push([t,n])};jm.toString=function(t){const n=t?function(r){return t.call(this,r,Gd)}:Gd;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function l1(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Rm(e,t,n){if(!t)return e;const r=n&&n.encode||l1;Q.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=Q.isURLSearchParams(t)?t.toString():new Ec(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Qd{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){Q.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Tm={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},u1=typeof URLSearchParams<"u"?URLSearchParams:Ec,c1=typeof FormData<"u"?FormData:null,d1=typeof Blob<"u"?Blob:null,f1={isBrowser:!0,classes:{URLSearchParams:u1,FormData:c1,Blob:d1},protocols:["http","https","file","blob","url","data"]},Nc=typeof window<"u"&&typeof document<"u",cu=typeof navigator=="object"&&navigator||void 0,h1=Nc&&(!cu||["ReactNative","NativeScript","NS"].indexOf(cu.product)<0),p1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",m1=Nc&&window.location.href||"http://localhost",g1=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Nc,hasStandardBrowserEnv:h1,hasStandardBrowserWebWorkerEnv:p1,navigator:cu,origin:m1},Symbol.toStringTag,{value:"Module"})),Ft={...g1,...f1};function y1(e,t){return wa(e,new Ft.classes.URLSearchParams,{visitor:function(n,r,s,i){return Ft.isNode&&Q.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function v1(e){return Q.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function x1(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&Q.isArray(s)?s.length:o,l?(Q.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!Q.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&Q.isArray(s[o])&&(s[o]=x1(s[o])),!a)}if(Q.isFormData(e)&&Q.isFunction(e.entries)){const n={};return Q.forEachEntry(e,(r,s)=>{t(v1(r),s,n,0)}),n}return null}function w1(e,t,n){if(Q.isString(e))try{return(t||JSON.parse)(e),Q.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Ii={transitional:Tm,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=Q.isObject(t);if(i&&Q.isHTMLForm(t)&&(t=new FormData(t)),Q.isFormData(t))return s?JSON.stringify(Om(t)):t;if(Q.isArrayBuffer(t)||Q.isBuffer(t)||Q.isStream(t)||Q.isFile(t)||Q.isBlob(t)||Q.isReadableStream(t))return t;if(Q.isArrayBufferView(t))return t.buffer;if(Q.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return y1(t,this.formSerializer).toString();if((a=Q.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return wa(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),w1(t)):t}],transformResponse:[function(t){const n=this.transitional||Ii.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(Q.isResponse(t)||Q.isReadableStream(t))return t;if(t&&Q.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?We.from(a,We.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:Ft.classes.FormData,Blob:Ft.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Q.forEach(["delete","get","head","post","put","patch"],e=>{Ii.headers[e]={}});const b1=Q.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"]),k1=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&b1[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Jd=Symbol("internals");function Ws(e){return e&&String(e).trim().toLowerCase()}function _o(e){return e===!1||e==null?e:Q.isArray(e)?e.map(_o):String(e)}function _1(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 S1=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function el(e,t,n,r,s){if(Q.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!Q.isString(t)){if(Q.isString(r))return t.indexOf(r)!==-1;if(Q.isRegExp(r))return r.test(t)}}function C1(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function E1(e,t){const n=Q.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let en=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const p=Ws(l);if(!p)throw new Error("header name must be a non-empty string");const v=Q.findKey(s,p);(!v||s[v]===void 0||d===!0||d===void 0&&s[v]!==!1)&&(s[v||l]=_o(a))}const o=(a,l)=>Q.forEach(a,(d,p)=>i(d,p,l));if(Q.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(Q.isString(t)&&(t=t.trim())&&!S1(t))o(k1(t),n);else if(Q.isObject(t)&&Q.isIterable(t)){let a={},l,d;for(const p of t){if(!Q.isArray(p))throw TypeError("Object iterator must return a key-value pair");a[d=p[0]]=(l=a[d])?Q.isArray(l)?[...l,p[1]]:[l,p[1]]:p[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Ws(t),t){const r=Q.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return _1(s);if(Q.isFunction(n))return n.call(this,s,r);if(Q.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ws(t),t){const r=Q.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||el(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Ws(o),o){const a=Q.findKey(r,o);a&&(!n||el(r,r[a],a,n))&&(delete r[a],s=!0)}}return Q.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||el(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return Q.forEach(this,(s,i)=>{const o=Q.findKey(r,i);if(o){n[o]=_o(s),delete n[i];return}const a=t?C1(i):String(i).trim();a!==i&&delete n[i],n[a]=_o(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Q.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&Q.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(s=>r.set(s)),r}static accessor(t){const r=(this[Jd]=this[Jd]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Ws(o);r[a]||(E1(s,o),r[a]=!0)}return Q.isArray(t)?t.forEach(i):i(t),this}};en.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Q.reduceDescriptors(en.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Q.freezeMethods(en);function tl(e,t){const n=this||Ii,r=t||n,s=en.from(r.headers);let i=r.data;return Q.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Im(e){return!!(e&&e.__CANCEL__)}function Os(e,t,n){We.call(this,e??"canceled",We.ERR_CANCELED,t,n),this.name="CanceledError"}Q.inherits(Os,We,{__CANCEL__:!0});function Am(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new We("Request failed with status code "+n.status,[We.ERR_BAD_REQUEST,We.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function N1(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function j1(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),p=r[i];o||(o=d),n[s]=l,r[s]=d;let v=i,x=0;for(;v!==s;)x+=n[v++],v=v%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o{n=p,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const p=Date.now(),v=p-n;v>=r?o(d,p):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-v)))},()=>s&&o(s)]}const Yo=(e,t,n=3)=>{let r=0;const s=j1(50,250);return R1(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,d=s(l),p=o<=a;r=o;const v={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:d||void 0,estimated:d&&a&&p?(a-o)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(v)},n)},ef=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},tf=e=>(...t)=>Q.asap(()=>e(...t)),T1=Ft.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ft.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ft.origin),Ft.navigator&&/(msie|trident)/i.test(Ft.navigator.userAgent)):()=>!0,O1=Ft.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];Q.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Q.isString(r)&&a.push(`path=${r}`),Q.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),Q.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 I1(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function A1(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Pm(e,t,n){let r=!I1(t);return e&&(r||n==!1)?A1(e,t):t}const nf=e=>e instanceof en?{...e}:e;function $r(e,t){t=t||{};const n={};function r(d,p,v,x){return Q.isPlainObject(d)&&Q.isPlainObject(p)?Q.merge.call({caseless:x},d,p):Q.isPlainObject(p)?Q.merge({},p):Q.isArray(p)?p.slice():p}function s(d,p,v,x){if(Q.isUndefined(p)){if(!Q.isUndefined(d))return r(void 0,d,v,x)}else return r(d,p,v,x)}function i(d,p){if(!Q.isUndefined(p))return r(void 0,p)}function o(d,p){if(Q.isUndefined(p)){if(!Q.isUndefined(d))return r(void 0,d)}else return r(void 0,p)}function a(d,p,v){if(v in t)return r(d,p);if(v in e)return r(void 0,d)}const l={url:i,method:i,data:i,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:(d,p,v)=>s(nf(d),nf(p),v,!0)};return Q.forEach(Object.keys({...e,...t}),function(p){const v=l[p]||s,x=v(e[p],t[p],p);Q.isUndefined(x)&&v!==a||(n[p]=x)}),n}const Lm=e=>{const t=$r({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=en.from(o),t.url=Rm(Pm(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Q.isFormData(n)){if(Ft.hasStandardBrowserEnv||Ft.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Q.isFunction(n.getHeaders)){const l=n.getHeaders(),d=["content-type","content-length"];Object.entries(l).forEach(([p,v])=>{d.includes(p.toLowerCase())&&o.set(p,v)})}}if(Ft.hasStandardBrowserEnv&&(r&&Q.isFunction(r)&&(r=r(t)),r||r!==!1&&T1(t.url))){const l=s&&i&&O1.read(i);l&&o.set(s,l)}return t},P1=typeof XMLHttpRequest<"u",L1=P1&&function(e){return new Promise(function(n,r){const s=Lm(e);let i=s.data;const o=en.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,p,v,x,y,g;function c(){y&&y(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(p),s.signal&&s.signal.removeEventListener("abort",p)}let w=new XMLHttpRequest;w.open(s.method.toUpperCase(),s.url,!0),w.timeout=s.timeout;function f(){if(!w)return;const b=en.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:b,config:e,request:w};Am(function(j){n(j),c()},function(j){r(j),c()},S),w=null}"onloadend"in w?w.onloadend=f:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(f)},w.onabort=function(){w&&(r(new We("Request aborted",We.ECONNABORTED,e,w)),w=null)},w.onerror=function(_){const S=_&&_.message?_.message:"Network Error",T=new We(S,We.ERR_NETWORK,e,w);T.event=_||null,r(T),w=null},w.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||Tm;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new We(_,S.clarifyTimeoutError?We.ETIMEDOUT:We.ECONNABORTED,e,w)),w=null},i===void 0&&o.setContentType(null),"setRequestHeader"in w&&Q.forEach(o.toJSON(),function(_,S){w.setRequestHeader(S,_)}),Q.isUndefined(s.withCredentials)||(w.withCredentials=!!s.withCredentials),a&&a!=="json"&&(w.responseType=s.responseType),d&&([x,g]=Yo(d,!0),w.addEventListener("progress",x)),l&&w.upload&&([v,y]=Yo(l),w.upload.addEventListener("progress",v),w.upload.addEventListener("loadend",y)),(s.cancelToken||s.signal)&&(p=b=>{w&&(r(!b||b.type?new Os(null,e,w):b),w.abort(),w=null)},s.cancelToken&&s.cancelToken.subscribe(p),s.signal&&(s.signal.aborted?p():s.signal.addEventListener("abort",p)));const h=N1(s.url);if(h&&Ft.protocols.indexOf(h)===-1){r(new We("Unsupported protocol "+h+":",We.ERR_BAD_REQUEST,e));return}w.send(i||null)})},z1=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,a();const p=d instanceof Error?d:this.reason;r.abort(p instanceof We?p:new Os(p instanceof Error?p.message:p))}};let o=t&&setTimeout(()=>{o=null,i(new We(`timeout ${t} of ms exceeded`,We.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>Q.asap(a),l}},F1=function*(e,t){let n=e.byteLength;if(n{const s=D1(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:p}=await s.next();if(d){a(),l.close();return}let v=p.byteLength;if(n){let x=i+=v;n(x)}l.enqueue(new Uint8Array(p))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},sf=64*1024,{isFunction:eo}=Q,B1=(({Request:e,Response:t})=>({Request:e,Response:t}))(Q.global),{ReadableStream:of,TextEncoder:af}=Q.global,lf=(e,...t)=>{try{return!!e(...t)}catch{return!1}},U1=e=>{e=Q.merge.call({skipUndefined:!0},B1,e);const{fetch:t,Request:n,Response:r}=e,s=t?eo(t):typeof fetch=="function",i=eo(n),o=eo(r);if(!s)return!1;const a=s&&eo(of),l=s&&(typeof af=="function"?(g=>c=>g.encode(c))(new af):async g=>new Uint8Array(await new n(g).arrayBuffer())),d=i&&a&&lf(()=>{let g=!1;const c=new n(Ft.origin,{body:new of,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!c}),p=o&&a&&lf(()=>Q.isReadableStream(new r("").body)),v={stream:p&&(g=>g.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!v[g]&&(v[g]=(c,w)=>{let f=c&&c[g];if(f)return f.call(c);throw new We(`Response type '${g}' is not supported`,We.ERR_NOT_SUPPORT,w)})});const x=async g=>{if(g==null)return 0;if(Q.isBlob(g))return g.size;if(Q.isSpecCompliantForm(g))return(await new n(Ft.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(Q.isArrayBufferView(g)||Q.isArrayBuffer(g))return g.byteLength;if(Q.isURLSearchParams(g)&&(g=g+""),Q.isString(g))return(await l(g)).byteLength},y=async(g,c)=>{const w=Q.toFiniteNumber(g.getContentLength());return w??x(c)};return async g=>{let{url:c,method:w,data:f,signal:h,cancelToken:b,timeout:_,onDownloadProgress:S,onUploadProgress:T,responseType:j,headers:L,withCredentials:O="same-origin",fetchOptions:D}=Lm(g),le=t||fetch;j=j?(j+"").toLowerCase():"text";let R=z1([h,b&&b.toAbortSignal()],_),Z=null;const k=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let U;try{if(T&&d&&w!=="get"&&w!=="head"&&(U=await y(L,f))!==0){let P=new n(c,{method:"POST",body:f,duplex:"half"}),A;if(Q.isFormData(f)&&(A=P.headers.get("content-type"))&&L.setContentType(A),P.body){const[ie,J]=ef(U,Yo(tf(T)));f=rf(P.body,sf,ie,J)}}Q.isString(O)||(O=O?"include":"omit");const re=i&&"credentials"in n.prototype,Y={...D,signal:R,method:w.toUpperCase(),headers:L.normalize().toJSON(),body:f,duplex:"half",credentials:re?O:void 0};Z=i&&new n(c,Y);let B=await(i?le(Z,D):le(c,Y));const M=p&&(j==="stream"||j==="response");if(p&&(S||M&&k)){const P={};["status","statusText","headers"].forEach(oe=>{P[oe]=B[oe]});const A=Q.toFiniteNumber(B.headers.get("content-length")),[ie,J]=S&&ef(A,Yo(tf(S),!0))||[];B=new r(rf(B.body,sf,ie,()=>{J&&J(),k&&k()}),P)}j=j||"text";let te=await v[Q.findKey(v,j)||"text"](B,g);return!M&&k&&k(),await new Promise((P,A)=>{Am(P,A,{data:te,headers:en.from(B.headers),status:B.status,statusText:B.statusText,config:g,request:Z})})}catch(re){throw k&&k(),re&&re.name==="TypeError"&&/Load failed|fetch/i.test(re.message)?Object.assign(new We("Network Error",We.ERR_NETWORK,g,Z),{cause:re.cause||re}):We.from(re,re&&re.code,g,Z)}}},$1=new Map,zm=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,d,p=$1;for(;a--;)l=i[a],d=p.get(l),d===void 0&&p.set(l,d=a?new Map:U1(t)),p=d;return d};zm();const jc={http:i1,xhr:L1,fetch:{get:zm}};Q.forEach(jc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const uf=e=>`- ${e}`,W1=e=>Q.isFunction(e)||e===null||e===!1;function H1(e,t){e=Q.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since : +`+o.map(uf).join(` +`):" "+uf(o[0]):"as no adapter specified";throw new We("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Fm={getAdapter:H1,adapters:jc};function nl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Os(null,e)}function cf(e){return nl(e),e.headers=en.from(e.headers),e.data=tl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Fm.getAdapter(e.adapter||Ii.adapter,e)(e).then(function(r){return nl(e),r.data=tl.call(e,e.transformResponse,r),r.headers=en.from(r.headers),r},function(r){return Im(r)||(nl(e),r&&r.response&&(r.response.data=tl.call(e,e.transformResponse,r.response),r.response.headers=en.from(r.response.headers))),Promise.reject(r)})}const Dm="1.13.2",ba={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ba[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const df={};ba.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Dm+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new We(s(o," has been removed"+(n?" in "+n:"")),We.ERR_DEPRECATED);return n&&!df[o]&&(df[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};ba.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function V1(e,t,n){if(typeof e!="object")throw new We("options must be an object",We.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new We("option "+i+" must be "+l,We.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new We("Unknown option "+i,We.ERR_BAD_OPTION)}}const So={assertOptions:V1,validators:ba},zn=So.validators;let zr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Qd,response:new Qd}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$r(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&So.assertOptions(r,{silentJSONParsing:zn.transitional(zn.boolean),forcedJSONParsing:zn.transitional(zn.boolean),clarifyTimeoutError:zn.transitional(zn.boolean)},!1),s!=null&&(Q.isFunction(s)?n.paramsSerializer={serialize:s}:So.assertOptions(s,{encode:zn.function,serialize:zn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),So.assertOptions(n,{baseUrl:zn.spelling("baseURL"),withXsrfToken:zn.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&Q.merge(i.common,i[n.method]);i&&Q.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=en.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(c){typeof c.runWhen=="function"&&c.runWhen(n)===!1||(l=l&&c.synchronous,a.unshift(c.fulfilled,c.rejected))});const d=[];this.interceptors.response.forEach(function(c){d.push(c.fulfilled,c.rejected)});let p,v=0,x;if(!l){const g=[cf.bind(this),void 0];for(g.unshift(...a),g.push(...d),x=g.length,p=Promise.resolve(n);v{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Os(i,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 Mm(function(s){t=s}),cancel:t}}};function K1(e){return function(n){return e.apply(null,n)}}function Z1(e){return Q.isObject(e)&&e.isAxiosError===!0}const du={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(du).forEach(([e,t])=>{du[t]=e});function Bm(e){const t=new zr(e),n=ym(zr.prototype.request,t);return Q.extend(n,zr.prototype,t,{allOwnKeys:!0}),Q.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Bm($r(e,s))},n}const xt=Bm(Ii);xt.Axios=zr;xt.CanceledError=Os;xt.CancelToken=q1;xt.isCancel=Im;xt.VERSION=Dm;xt.toFormData=wa;xt.AxiosError=We;xt.Cancel=xt.CanceledError;xt.all=function(t){return Promise.all(t)};xt.spread=K1;xt.isAxiosError=Z1;xt.mergeConfig=$r;xt.AxiosHeaders=en;xt.formToJSON=e=>Om(Q.isHTMLForm(e)?new FormData(e):e);xt.getAdapter=Fm.getAdapter;xt.HttpStatusCode=du;xt.default=xt;const{Axios:y2,AxiosError:v2,CanceledError:x2,isCancel:w2,CancelToken:b2,VERSION:k2,all:_2,Cancel:S2,isAxiosError:C2,spread:E2,toFormData:N2,AxiosHeaders:j2,HttpStatusCode:R2,formToJSON:T2,getAdapter:O2,mergeConfig:I2}=xt,X1="/api",Kt={async delete(e,t){return tt.delete("/file/delete",{body:JSON.stringify({libraryId:e,items:t}),headers:{"Content-Type":"application/json"}})},async rename(e,t,n){return tt.patch("/file/rename",{libraryId:e,path:t,newName:n})},async move(e,t,n){return tt.post("/file/move",{libraryId:e,items:t,targetFolder:n})},async copy(e,t,n,r="rename"){return tt.post("/file/copy",{libraryId:e,items:t,targetFolder:n,conflictAction:r})},async updateMetadata(e,t,n){return tt.patch("/file/metadata",{libraryId:e,path:t,...n})},async restore(e,t){return tt.post("/file/restore",{libraryId:e,items:t})},async createFolder(e,t){return tt.post("/file/create-folder",{libraryId:e,folderPath:t})},async upload(e,t,n,r,s){const i=new FormData;i.append("libraryId",e),t&&i.append("targetFolder",t),s&&i.append("conflictAction",s);for(const d of n)i.append("files",d);const o=Sc(),a={};return o&&(a.Authorization=`Bearer ${o}`),(await xt.post(`${X1}/upload`,i,{headers:a,onUploadProgress:r})).data}},Lt=sx,De=px,br=xx;function Um(){const e=Wt(r=>r.theme),t=Wt(r=>r.setTheme);return F.useEffect(()=>{const r=document.documentElement;e==="dark"?r.classList.add("dark"):r.classList.remove("dark")},[e]),{theme:e,toggleTheme:async()=>{const r=e==="light"?"dark":"light";t(r);try{await Lt.updateTheme(r)}catch(s){console.error("保存主题失败:",s)}}}}class Y1{constructor(){this.blobUrls=new Set,this.eventListeners=new Map,this.pendingLoads=new Set}registerBlobUrl(t){t&&t.startsWith("blob:")&&this.blobUrls.add(t)}revokeBlobUrl(t){if(t&&t.startsWith("blob:"))try{URL.revokeObjectURL(t),this.blobUrls.delete(t)}catch(n){console.warn("[DOMCleanup] Failed to revoke blob URL:",n)}}revokeAllBlobUrls(){let t=0;for(const n of this.blobUrls)try{URL.revokeObjectURL(n),t++}catch(r){console.warn("[DOMCleanup] Failed to revoke blob URL:",r)}this.blobUrls.clear(),t>0&&console.log(`[DOMCleanup] Revoked ${t} blob URLs`)}clearImageSources(t){if(!t)return;const n=t.querySelectorAll("img");let r=0;n.forEach(s=>{s.src&&(s.src.startsWith("blob:")&&this.revokeBlobUrl(s.src),s.src="",r++)}),r>0&&console.log(`[DOMCleanup] Cleared ${r} image sources`)}registerEventListener(t,n,r){this.eventListeners.has(t)||this.eventListeners.set(t,[]),this.eventListeners.get(t).push({event:n,handler:r})}removeEventListeners(t){const n=this.eventListeners.get(t);n&&(n.forEach(({event:r,handler:s})=>{try{t.removeEventListener(r,s)}catch(i){console.warn("[DOMCleanup] Failed to remove event listener:",i)}}),this.eventListeners.delete(t))}removeAllEventListeners(){let t=0;for(const[n,r]of this.eventListeners.entries())r.forEach(({event:s,handler:i})=>{try{n.removeEventListener(s,i),t++}catch(o){console.warn("[DOMCleanup] Failed to remove event listener:",o)}});this.eventListeners.clear(),t>0&&console.log(`[DOMCleanup] Removed ${t} event listeners`)}registerPendingLoad(t){this.pendingLoads.add(t)}cancelPendingLoad(t){if(this.pendingLoads.has(t))try{t.abort(),this.pendingLoads.delete(t)}catch(n){console.warn("[DOMCleanup] Failed to cancel pending load:",n)}}cancelPendingLoads(){let t=0;for(const n of this.pendingLoads)try{n.abort(),t++}catch(r){console.warn("[DOMCleanup] Failed to cancel pending load:",r)}this.pendingLoads.clear(),t>0&&console.log(`[DOMCleanup] Cancelled ${t} pending loads`)}suggestGarbageCollection(){try{new Array(1e3).fill(new Array(1e3).fill(0)).length>0}catch{}window.requestIdleCallback&&window.requestIdleCallback(()=>{})}cleanup(){console.log("[DOMCleanup] Performing complete cleanup..."),this.revokeAllBlobUrls(),this.removeAllEventListeners(),this.cancelPendingLoads(),this.suggestGarbageCollection(),console.log("[DOMCleanup] Cleanup complete")}getStatus(){return{blobUrls:this.blobUrls.size,eventListeners:this.eventListeners.size,pendingLoads:this.pendingLoads.size}}}const fu=new Y1;/** + * @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 G1={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 Q1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Ye=(e,t)=>{const n=F.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...d},p)=>F.createElement("svg",{ref:p,...G1,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${Q1(e)}`,a].join(" "),...d},[...t.map(([v,x])=>F.createElement(v,x)),...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 $m=Ye("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @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("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 rl=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 hu=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 Wm=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 J1=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 ew=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 Co=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 tw=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 nw=Ye("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]);/** + * @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 rw=Ye("FileText",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["line",{x1:"16",x2:"8",y1:"13",y2:"13",key:"14keom"}],["line",{x1:"16",x2:"8",y1:"17",y2:"17",key:"17nazh"}],["line",{x1:"10",x2:"8",y1:"9",y2:"9",key:"1a5vjj"}]]);/** + * @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 sw=Ye("File",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}]]);/** + * @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 hf=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 pf=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 iw=Ye("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + * @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("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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 Yn=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 ow=Ye("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + * @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 aw=Ye("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** + * @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 lw=Ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @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 gf=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 uw=Ye("Move",[["polyline",{points:"5 9 2 12 5 15",key:"1r5uj5"}],["polyline",{points:"9 5 12 2 15 5",key:"5v383o"}],["polyline",{points:"15 19 12 22 9 19",key:"g7qi8m"}],["polyline",{points:"19 9 22 12 19 15",key:"tpp73q"}],["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}]]);/** + * @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 cw=Ye("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** + * @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 dw=Ye("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",key:"1xcu5"}],["circle",{cx:"17.5",cy:"10.5",r:".5",key:"736e4u"}],["circle",{cx:"8.5",cy:"7.5",r:".5",key:"clrty"}],["circle",{cx:"6.5",cy:"12.5",r:".5",key:"1s4xz9"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** + * @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 fw=Ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + * @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 hw=Ye("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/** + * @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 pw=Ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @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 pu=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 mw=Ye("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @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 mu=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 yf=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 bi=Ye("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** + * @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 vf=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 Hm=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 Ai=Ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ki={LIBRARY:"library",FOLDER:"folder",IMAGES:"images"};let xf=0;const gw=()=>(xf+=1,`req_${Date.now()}_${xf}`);class yw{constructor(){this.activeRequests=new Map,this.requestContexts=new Map}createRequest(t){const n=gw(),r=new AbortController,s={id:n,type:t,createdAt:Date.now(),abortController:r,signal:r.signal,status:"pending",isActive:!0,cancel:()=>{if(s.isActive){s.isActive=!1,s.status="cancelled",r.abort(),this.requestContexts.delete(n);const i=this.activeRequests.get(t);i&&i.delete(n)}}};return this.requestContexts.set(n,s),this.activeRequests.has(t)||this.activeRequests.set(t,new Map),this.activeRequests.get(t).set(n,s),s}cancelAll(t){const n=this.activeRequests.get(t);if(n){for(const r of n.values())r.cancel();n.clear()}}cancelAllRequests(){for(const t of Object.values(ki))this.cancelAll(t)}isValid(t){const n=this.requestContexts.get(t);return n?n.isActive:!1}complete(t){const n=this.requestContexts.get(t);if(n&&n.isActive){n.status="completed",n.isActive=!1,this.requestContexts.delete(t);const r=this.activeRequests.get(n.type);r&&r.delete(t)}}error(t){const n=this.requestContexts.get(t);if(n&&n.isActive){n.status="error",n.isActive=!1,this.requestContexts.delete(t);const r=this.activeRequests.get(n.type);r&&r.delete(t)}}getActiveCount(t){const n=this.activeRequests.get(t);return n?n.size:0}hasActiveRequests(t){return this.getActiveCount(t)>0}}const yn=new yw;function gu(){yn.cancelAll(ki.IMAGES)}function vw(e){e&&setTimeout(()=>{},300)}function yu({isOpen:e,libraryName:t,libraryPath:n,status:r,onRescan:s,onOpenOther:i,onCreateNew:o}){if(!e)return null;const a=r==="missing_index",l=a?"素材库索引丢失":"打开资源库失败";return u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:u.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-lg w-full mx-4 overflow-hidden",children:u.jsxs("div",{className:"flex",children:[u.jsxs("div",{className:"flex-1 p-6",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsx($m,{className:"w-6 h-6 text-yellow-500"}),u.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:l})]}),u.jsx("div",{className:"text-gray-600 dark:text-gray-300 mb-6 space-y-2",children:a?u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["素材库 ",u.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:t})," 的索引数据已丢失。"]}),u.jsxs("p",{children:["路径: ",u.jsx("span",{className:"text-blue-500 break-all",children:n})]}),u.jsx("p",{className:"text-sm text-gray-500",children:"图片文件夹仍然存在,您可以重新扫描来重建索引。"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["在这个位置的资源库(",u.jsx("span",{className:"text-blue-500 break-all",children:n}),") 打开失败,可能是因为路径已经变化,或者资源库链接错误。"]}),u.jsxs("p",{children:["如果您更改过资源库位置,可以"," ",u.jsx("button",{onClick:i,className:"text-blue-500 hover:text-blue-600 hover:underline",children:"重新选择路径"})," ","打开"]})]})}),u.jsx("div",{className:"text-gray-500 dark:text-gray-400 mb-4",children:a?"请选择操作:":"您也可以:"}),u.jsxs("div",{className:"flex flex-wrap gap-3",children:[a&&u.jsxs("button",{onClick:s,className:"flex items-center gap-2 px-4 py-2.5 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors",children:[u.jsx(pu,{className:"w-4 h-4"}),"重新扫描"]}),u.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[u.jsx(iw,{className:"w-4 h-4"}),"打开其他资源库"]}),u.jsxs("button",{onClick:o,className:`flex items-center gap-2 px-4 py-2.5 rounded-lg transition-colors ${a?"border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700":"bg-blue-500 text-white hover:bg-blue-600"}`,children:[u.jsx(pw,{className:"w-4 h-4"}),"创建新资源库"]})]})]}),u.jsx("div",{className:"hidden md:flex items-center justify-center w-48 bg-gradient-to-br from-blue-50 to-blue-100 dark:from-gray-700 dark:to-gray-600",children:u.jsx("div",{className:"relative",children:u.jsxs("svg",{className:"w-32 h-32",viewBox:"0 0 128 128",fill:"none",children:[u.jsx("path",{d:"M64 20L20 55V108H108V55L64 20Z",className:"fill-blue-200 dark:fill-blue-900"}),u.jsx("path",{d:"M64 20L20 55V108H108V55L64 20Z",className:"stroke-blue-400 dark:stroke-blue-600",strokeWidth:"3",fill:"none"}),u.jsx("rect",{x:"52",y:"70",width:"24",height:"38",className:"fill-blue-300 dark:fill-blue-800"}),u.jsx("rect",{x:"30",y:"65",width:"16",height:"16",className:"fill-yellow-200 dark:fill-yellow-900"}),u.jsx("rect",{x:"82",y:"65",width:"16",height:"16",className:"fill-yellow-200 dark:fill-yellow-900"}),u.jsx("path",{d:"M100 30L110 48H90L100 30Z",className:"fill-yellow-400"}),u.jsx("text",{x:"100",y:"45",textAnchor:"middle",className:"fill-yellow-800 text-xs font-bold",children:"!"})]})})})]})})})}function Vm({isOpen:e,position:t,onClose:n,options:r}){const s=F.useRef(null);if(F.useEffect(()=>{if(!e)return;const d=v=>{s.current&&!s.current.contains(v.target)&&n()},p=v=>{v.key==="Escape"&&n()};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p)}},[e,n]),!e||!t)return null;const o=(()=>{const p=r.length*40+16,v=window.innerWidth,x=window.innerHeight;let y=t.x,g=t.y;return y+200>v&&(y=v-200-10),g+p>x&&(g=t.y-p,g<0&&(g=x-p-10)),y=Math.max(10,y),g=Math.max(10,g),{left:y,top:g}})(),a={left:`${o.left}px`,top:`${o.top}px`},l=d=>{d(),n()};return u.jsx("div",{ref:s,className:"fixed z-50 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 py-2 min-w-[200px]",style:a,children:r.map((d,p)=>u.jsx("div",{children:d.divider?u.jsx("div",{className:"my-2 border-t border-gray-200 dark:border-gray-700"}):u.jsxs("button",{onClick:()=>l(d.action),disabled:d.disabled,className:` + w-full flex items-center gap-3 px-4 py-2 text-left text-sm + ${d.disabled?"opacity-50 cursor-not-allowed":"hover:bg-gray-100 dark:hover:bg-gray-700"} + ${d.danger?"text-red-600 dark:text-red-400":"text-gray-700 dark:text-gray-300"} + `,children:[d.icon,u.jsx("span",{className:"flex-1",children:d.label}),d.shortcut&&u.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:d.shortcut})]})},p))})}const Dn={delete:e=>({icon:u.jsx(Hm,{size:16}),label:"移入回收站",shortcut:"Del",danger:!1,action:e}),rename:e=>({icon:u.jsx(fw,{size:16}),label:"重命名",shortcut:"F2",action:e}),move:e=>({icon:u.jsx(uw,{size:16}),label:"移动到",action:e}),copy:e=>({icon:u.jsx(Co,{size:16}),label:"复制",shortcut:"Ctrl+C",action:e}),newSiblingFolder:e=>({icon:u.jsx(mf,{size:16}),label:"新建同级文件夹",action:e}),newSubFolder:e=>({icon:u.jsx(mf,{size:16}),label:"新建子文件夹",action:e}),divider:()=>({divider:!0})};function qm({isVisible:e,message:t,onUndo:n,onClose:r,duration:s=3e3}){return F.useEffect(()=>{if(!e)return;const i=setTimeout(()=>{r()},s);return()=>clearTimeout(i)},[e,t,s,r]),e?u.jsx("div",{className:"fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 animate-slide-up",children:u.jsxs("div",{className:"bg-gray-900 dark:bg-gray-800 text-white rounded-lg shadow-2xl px-4 py-3 flex items-center gap-4 min-w-[300px]",children:[u.jsx("span",{className:"flex-1 text-sm",children:t}),u.jsxs("button",{onClick:n,className:"flex items-center gap-1 px-3 py-1 bg-blue-600 hover:bg-blue-700 rounded transition-colors text-sm font-medium",children:[u.jsx(mw,{size:14}),"撤销"]}),u.jsx("button",{onClick:r,className:"text-gray-400 hover:text-white transition-colors",children:u.jsx(Ai,{size:18})})]})}):null}function Km({folders:e,currentFolder:t,onSelect:n,onClose:r}){const[s,i]=F.useState(new Set),[o,a]=F.useState(t||null),l=F.useRef(null),d=F.useRef(null);F.useEffect(()=>{if(t&&t!==""){const c=new Set,w=t.split("/");for(let f=0;f{if(l.current&&d.current){const c=l.current,w=d.current;if(c&&w){const f=c.getBoundingClientRect(),h=w.getBoundingClientRect(),b=c.offsetTop-w.offsetTop-h.height/2+f.height/2;w.scrollTop=b,console.log(`📍 立即定位到选中文件夹: ${t}`)}}},[s,t]);const p=c=>{i(w=>{const f=new Set(w);return f.has(c)?f.delete(c):f.add(c),f})},v=c=>{const w=c.children&&c.children.length>0;o!==c.path?a(c.path):w&&p(c.path)},x=(c,w)=>{c.stopPropagation(),p(w)},y=()=>{o!==null&&n(o)},g=(c,w=0)=>c.map(f=>{const h=s.has(f.path),b=f.children&&f.children.length>0,_=o===f.path,S=t===f.path,T=S;return u.jsxs("div",{children:[u.jsxs("div",{ref:S?l:null,className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${T?"opacity-50 cursor-not-allowed bg-gray-100 dark:bg-gray-700":_?"bg-blue-500 dark:bg-blue-600":"hover:bg-blue-50 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${w*16+12}px`},onClick:()=>!T&&v(f),children:[b?u.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:j=>x(j,f.path),children:h?u.jsx(hu,{className:"w-4 h-4"}):u.jsx(Wm,{className:"w-4 h-4"})}):u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:`w-4 h-4 mr-2 flex-shrink-0 ${_?"text-white":"text-yellow-500 dark:text-yellow-400"}`}),u.jsx("span",{className:`text-sm truncate flex-1 font-medium ${_?"text-white":"text-gray-900 dark:text-gray-100"}`,children:f.name}),S&&u.jsx("span",{className:`text-xs ml-2 ${_?"text-blue-100":"text-gray-500 dark:text-gray-400"}`,children:"(当前)"})]}),b&&h&&u.jsx("div",{children:g(f.children,w+1)})]},f.path)});return u.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-[500px] max-h-[600px] flex flex-col",children:[u.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"选择目标文件夹"}),u.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:u.jsx(Ai,{className:"w-5 h-5"})})]}),u.jsxs("div",{ref:d,className:"flex-1 overflow-y-auto p-4",children:[u.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors mb-2 ${o===""?"bg-blue-500 dark:bg-blue-600":"hover:bg-blue-50 dark:hover:bg-gray-700"}`,onClick:()=>a(""),children:[u.jsx(aw,{className:`w-4 h-4 mr-2 ${o===""?"text-white":"text-blue-500 dark:text-blue-400"}`}),u.jsx("span",{className:`text-sm font-medium ${o===""?"text-white":"text-gray-900 dark:text-gray-100"}`,children:"根目录"})]}),e&&e.length>0?g(e):u.jsx("div",{className:"text-center text-gray-500 py-8",children:"暂无文件夹"})]}),u.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700",children:[u.jsx("button",{onClick:r,className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:"取消"}),u.jsx("button",{onClick:y,disabled:o===null,className:"px-4 py-2 text-sm text-white bg-blue-500 hover:bg-blue-600 rounded disabled:opacity-50 disabled:cursor-not-allowed",children:"确定"})]})]})})}const xw=async e=>{try{const t=await br.getStatus(e);return t.data||t}catch{return null}};function wf(){var nn;const{libraries:e,currentLibraryId:t,setCurrentLibrary:n,addLibrary:r,removeLibrary:s,showAddLibraryForm:i,setShowAddLibraryForm:o,expandLibrarySelector:a,resetExpandLibrarySelector:l}=Rn(),{folders:d,selectedFolder:p,totalImageCount:v,setSelectedFolder:x,setSelectedFolderItem:y}=Ee(),{isScanning:g}=or(),[c,w]=F.useState(!1),[f,h]=F.useState(""),[b,_]=F.useState(""),[S,T]=F.useState(""),[j,L]=F.useState(""),[O,D]=F.useState(new Set),[le,R]=F.useState(!1),[Z,k]=F.useState(!1),[U,re]=F.useState(null),[Y,B]=F.useState(!1),[M,te]=F.useState({isOpen:!1,position:null,folder:null}),[P,A]=F.useState({isVisible:!1,message:"",count:0}),[ie,J]=F.useState([]),[oe,_e]=F.useState(null),[ae,ce]=F.useState(!1),[be,Te]=F.useState(null),[Ce,He]=F.useState(null),[Be,m]=F.useState(""),[K,V]=F.useState(null),[N,C]=F.useState(""),z=F.useRef(null),ee=F.useRef(null),se=F.useRef(null),$=F.useRef(null),de=G=>{L(G),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{T(G)},300)};F.useEffect(()=>()=>{z.current&&clearTimeout(z.current)},[]),F.useEffect(()=>{A({isVisible:!1,message:"",count:0})},[p]),F.useEffect(()=>{i&&(w(!0),o(!1))},[i,o]),F.useEffect(()=>{a&&(B(!0),l())},[a,l]),F.useEffect(()=>{const G=ye=>{ee.current&&!ee.current.contains(ye.target)&&B(!1)};if(Y)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[Y]);const ke=F.useCallback((G,ye)=>!G||G.length===0?G:G.filter(E=>E.path!==ye).map(E=>({...E,children:E.children?ke(E.children,ye):[]})),[]),pe=F.useCallback((G,ye)=>{if(!ye||ye.length===0)return null;const E=[],I=ue=>{if(ue)for(const ve of ue)E.push(ve),ve.children&&ve.children.length>0&&I(ve.children)};I(ye);const W=G.includes("/")?G.substring(0,G.lastIndexOf("/")):null,X=E.filter(ue=>(ue.path.includes("/")?ue.path.substring(0,ue.path.lastIndexOf("/")):null)===W);if(X.length===0)return W||null;const H=X.findIndex(ue=>ue.path===G);return H===-1?W||null:H0?X[H-1].path:W||null},[]);F.useEffect(()=>{const G=async ye=>{if(!(ye.target.tagName==="INPUT"||ye.target.tagName==="TEXTAREA")){if(ye.key==="Delete"&&p){const{selectedImages:E,selectedImage:I}=Ee.getState();if(E.length>0||I)return;ye.preventDefault(),await ge(p)}if(ye.key==="F2"&&p){const{selectedImages:E,selectedImage:I}=Ee.getState();if(E.length>0||I)return;ye.preventDefault();const W=(H,ue)=>{for(const ve of H){if(ve.path===ue)return ve;if(ve.children){const xe=W(ve.children,ue);if(xe)return xe}}return null},X=W(d,p);X&&(He(X),m(X.name),te({isOpen:!1,position:null,folder:null}),setTimeout(()=>{se.current&&(se.current.focus(),se.current.select())},50))}(ye.ctrlKey||ye.metaKey)&&ye.key==="z"&&ie.length>0&&(ye.preventDefault(),await Ue())}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[p,ie,d,pe]);const ge=async G=>{if(!t)return;const ye=[{type:"folder",path:G}],E=[...ie,{items:ye,folderPath:G}];if(J(E),p===G){const I=ke(d,G),W=pe(G,I);x(W)}A({isVisible:!0,message:`已将文件夹移入临时文件夹(Ctrl+Z撤销 · ${E.length}次)`,count:1}),Promise.all([Kt.delete(t,ye),De.getFolders(t)]).then(([I,W])=>{const{setFolders:X}=Ee.getState();I.failed.length>0?(console.warn("⚠️ 删除失败:",I.failed),J(ie),A({isVisible:!1,message:"",count:0}),X(W.folders),alert("删除失败: "+I.failed[0].error)):X(W.folders)}).catch(I=>{console.error("删除文件夹失败:",I),J(ie),A({isVisible:!1,message:"",count:0}),De.getFolders(t).then(W=>{const{setFolders:X}=Ee.getState();X(W.folders)}),alert("删除失败: "+(I.message||"未知错误"))})},Ue=async()=>{if(ie.length===0)return;const G=ie[ie.length-1],ye=ie.slice(0,-1);A({isVisible:!1,message:"",count:0}),J(ye);const{folders:E,setFolders:I}=Ee.getState();if(E&&E.length>0&&!E.some(X=>X.path===G.folderPath)){const X={path:G.folderPath,count:0,name:G.folderPath.split("/").pop()||G.folderPath};I([...E,X])}x(G.folderPath),console.log(`📂 跳转到文件夹: ${G.folderPath}`),Promise.all([Kt.restore(t,G.items),De.getFolders(t)]).then(([W,X])=>{const{setFolders:H}=Ee.getState();if(W.failed.length>0){console.warn(`⚠️ 恢复失败: ${W.failed.length} 个文件`);const ue=W.failed[0].error||"未知错误";J(ie),H(X.folders),alert(`恢复失败: ${ue} + +提示:超过5分钟的文件已移入系统回收站,请手动从回收站恢复。`)}else H(X.folders)}).catch(W=>{console.error("撤销失败:",W),J(ie),De.getFolders(t).then(X=>{const{setFolders:H}=Ee.getState();H(X.folders)}),alert("撤销失败: "+(W.message||"未知错误"))})},Fe=async(G,ye)=>{if(G.preventDefault(),G.stopPropagation(),_e(null),!!t)try{const E=JSON.parse(G.dataTransfer.getData("application/json")),{items:I}=E;if(!I||I.length===0)return;const W=I.some(ve=>ve.type==="folder");if(!W){const{images:ve,setImages:xe}=Ee.getState(),Ne=new Set(I.map(Ze=>Ze.path)),Me=ve.filter(Ze=>!Ne.has(Ze.path));xe(Me)}const[X,H]=await Promise.all([Kt.move(t,I,ye.path),De.getFolders(t)]);X.failed&&X.failed.length>0?alert(`移动失败: ${X.failed[0].error}`):console.log(`✅ 已移动 ${I.length} 个${W?"文件夹":"文件"}到: ${ye.path}`);const{setFolders:ue}=Ee.getState();ue(H.folders)}catch(E){console.error("拖拽移动失败:",E)}},ot=(G,ye)=>{G.preventDefault(),G.stopPropagation(),_e(ye.path)},wt=G=>{G.preventDefault(),G.stopPropagation(),_e(null)},nt=G=>{Te(G),ce(!0),te({isOpen:!1,position:null,folder:null})},Rt=async G=>{if(!t||!be)return;ce(!1);const ye=be.split("/").pop(),E=G?`${G}/${ye}`:ye;try{const I=[{type:"folder",path:be}],[W,X]=await Promise.all([Kt.move(t,I,G),De.getFolders(t)]);W.failed&&W.failed.length>0?alert(`移动失败: ${W.failed[0].error}`):(x(E),console.log(`✅ 已移动文件夹: ${be} -> ${E}`));const{setFolders:H}=Ee.getState();H(X.folders)}catch(I){console.error("移动文件夹失败:",I),alert("移动失败: "+(I.message||"未知错误")),De.getFolders(t).then(W=>{const{setFolders:X}=Ee.getState();X(W.folders)})}finally{Te(null)}},$e=G=>{G&&(He(G),m(G.name),te({isOpen:!1,position:null,folder:null}),setTimeout(()=>{se.current&&(se.current.focus(),se.current.select())},50))},q=async()=>{if(!Ce||!Be.trim()){He(null),m("");return}const G=Ce.name,ye=Be.trim();if(ye===G){He(null),m("");return}const E=Ce.path,I=p===E;try{const X=(await Kt.rename(t,E,ye)).newPath;console.log(`✅ 文件夹重命名成功: ${G} → ${ye}, 路径: ${E} → ${X}`);const{setImages:H,setFolders:ue,setSelectedFolder:ve}=Ee.getState();H([]);const xe=await De.getFolders(t);console.log("📁 重命名后最新文件夹列表:",xe.folders),ue(xe.folders),I&&(console.log(`📂 重命名当前文件夹: ${E} → ${X}`),ve(null),setTimeout(()=>{ve(X),console.log("✅ 已切换到新文件夹, selectedFolder =",X)},50))}catch(W){console.error("文件夹重命名失败:",W),alert("重命名失败: "+(W.message||"未知错误"))}finally{He(null),m("")}},we=()=>{He(null),m("")},fe=(G,ye)=>{const E=G==="sibling"?ye.includes("/")?ye.substring(0,ye.lastIndexOf("/")):"":ye;V({type:G,parentPath:E,basePath:ye}),C("新建文件夹"),te({isOpen:!1,position:null,folder:null}),setTimeout(()=>{$.current&&($.current.focus(),$.current.select())},50)},je=async()=>{if(!K||!N.trim()){V(null),C("");return}const G=N.trim(),{parentPath:ye}=K,E=ye?`${ye}/${G}`:G;try{await Kt.createFolder(t,E),console.log(`✅ 文件夹创建成功: ${E}`);const I=await De.getFolders(t),{setFolders:W}=Ee.getState();W(I.folders),ye&&D(X=>new Set([...X,ye]))}catch(I){console.error("创建文件夹失败:",I),alert("创建文件夹失败: "+(I.message||"未知错误"))}finally{V(null),C("")}},Oe=()=>{V(null),C("")},Pe=async()=>{var G,ye;if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}if(!f.trim()){alert("请输入素材库名称");return}if(!b.trim()){alert("请输入文件夹路径");return}R(!0);try{console.log("📝 添加素材库...");const E=await Lt.add(f.trim(),b.trim()),I=E.id,W=E.hasExistingIndex;if(r({id:I,name:f.trim(),path:b.trim()}),h(""),_(""),w(!1),R(!1),console.log("🔄 切换到新素材库..."),await Lt.setCurrent(I),n(I),x(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setSelectedImage(null),Ee.getState().setTotalImageCount(0),or.getState().setScanProgress({libraryId:I,current:0,total:0,percent:0,status:"preparing"}),W){console.log("检测到已有索引,先加载现有数据...");try{const[X,H]=await Promise.all([De.getFolders(I),De.getCount(I)]);Ee.getState().setFolders(X.folders),Ee.getState().setTotalImageCount(H.count),console.log("✅ 已加载现有数据")}catch(X){console.warn("⚠️ 加载现有数据失败:",X)}}console.log("🔍 开始异步扫描..."),W?(console.log("执行增量同步,检测变化..."),br.sync(I,!1)):(console.log("首次添加,执行全量扫描..."),br.fullScan(I,!1)),console.log("✅ 扫描已启动,请等待进度显示...")}catch(E){console.error("❌ Error adding library:",E);let I=E.message||"未知错误";(ye=(G=E.response)==null?void 0:G.data)!=null&&ye.message&&(I=E.response.data.message),I.includes("无法访问")||I.includes("权限")||I.includes("数据共享")?alert(`⚠️ 文件夹权限不足 + +`+I+` + +操作步骤: +1. 应用中心找到 FlyPic 应用 +2. 点击 应用设置 +3. 将该文件夹添加到 FlyPic 应用的读写权限`):alert("添加素材库失败: "+I),or.getState().setScanProgress(null),R(!1)}},he=async G=>{if(G!==t){if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}k(!0);try{const ye=await Lt.validate(G),E=ye.data||ye;if(E.status!=="ok"){re({id:G,name:E.name,path:E.path,status:E.status}),k(!1);return}gu(),yn.cancelAllRequests(),or.getState().setScanProgress(null),Ee.getState().setSelectedImage(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setImageLoadingState({isLoading:!1,loadedCount:0,totalCount:0}),x(null),await Lt.setCurrent(G);const[I,W]=await Promise.all([De.getFolders(G),De.getCount(G)]);Ee.getState().setFolders(I.folders),Ee.getState().setTotalImageCount(W.count),n(G),xw(G).then(X=>{X&&X.status==="scanning"&&or.getState().setScanProgress(X.progress)}).catch(()=>{})}catch(ye){console.error("Error setting current library:",ye),alert("切换素材库失败: "+ye.message),Ee.getState().setImageLoadingState({isLoading:!1})}finally{k(!1)}}},Ie=async()=>{if(!t)return;if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}const G=e.find(E=>E.id===t);if(!(!G||!confirm(`确定要删除素材库"${G.name}"吗? + +路径: ${G.path} + +⚠️ 注意: +• 将删除索引数据并释放数据库连接 +• 不会删除原始图片文件 +• .flypic 文件夹将保留,您可以手动删除`)))try{await Lt.remove(t),s(t),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setSelectedImage(null),Ee.getState().setSelectedFolder(null);const E=e.filter(I=>I.id!==t);if(E.length>0){const I=E[0];await Lt.setCurrent(I.id),n(I.id)}console.log(`✅ 素材库已删除: ${G.name}`),console.log(`数据库连接已释放,可手动删除: ${G.path}\\.flypic`)}catch(E){console.error("Error deleting library:",E),alert("删除素材库失败: "+E.message)}},Le=G=>{const ye=new Set(O);ye.has(G)?ye.delete(G):ye.add(G),D(ye)},Ae=G=>{const ye=[],E=I=>{I.forEach(W=>{W.children&&W.children.length>0&&(ye.push(W.path),E(W.children))})};return E(G),ye},ne=()=>{const G=Ae(qe.length>0?qe:d);D(new Set(G))},Se=()=>{D(new Set)},ze=()=>{const G=Ae(qe.length>0?qe:d);return G.length>0&&G.every(ye=>O.has(ye))},qe=F.useMemo(()=>{if(!S)return d;const G=S.trim().toLowerCase().split(/\s+/).filter(W=>W.length>0);if(G.length===0)return d;const ye=[],E=W=>W.reduce((X,H)=>{const ue=H.name.toLowerCase(),ve=H.path.toLowerCase(),xe=G.every(Ze=>ue.includes(Ze)),Ne=G.every(Ze=>ve.includes(Ze));let Me=[];return H.children&&H.children.length>0&&(Me=E(H.children)),(xe||Ne||Me.length>0)&&(X.push({...H,children:Me}),Me.length>0&&ye.push(H.path)),X},[]),I=E(d);return ye.length>0&&setTimeout(()=>{D(W=>{const X=new Set(W);return ye.forEach(H=>X.add(H)),X})},0),I},[d,S]),Je=(G,ye)=>{G.stopPropagation(),Le(ye)},st=G=>{const ye=G.children&&G.children.length>0;if(p!==G.path){gu(),x(G.path);const{clearSelection:E,setSelectedFolderItem:I}=Ee.getState();E(),I(G)}else ye&&Le(G.path)},ct=(G,ye=0)=>G.map(E=>{const I=O.has(E.path),W=E.children&&E.children.length>0,X=p===E.path;return u.jsxs("div",{children:[u.jsxs("div",{className:`flex items-center px-3 py-2 rounded-md cursor-pointer transition-colors ${X?"bg-blue-50 dark:bg-blue-900":oe===E.path?"bg-green-100 dark:bg-green-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${ye*16+12}px`},onClick:()=>st(E),onContextMenu:H=>{H.preventDefault(),te({isOpen:!0,position:{x:H.clientX,y:H.clientY},folder:E})},draggable:!0,onDragStart:H=>{const ue=[{type:"folder",path:E.path}];H.dataTransfer.setData("application/json",JSON.stringify({items:ue})),H.dataTransfer.effectAllowed="move"},onDrop:H=>Fe(H,E),onDragOver:H=>ot(H,E),onDragLeave:wt,children:[W?u.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:H=>Je(H,E.path),children:I?u.jsx(hu,{className:"w-4 h-4 text-gray-500"}):u.jsx(Wm,{className:"w-4 h-4 text-gray-500"})}):u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),(Ce==null?void 0:Ce.path)===E.path?u.jsx("input",{ref:se,type:"text",value:Be,onChange:H=>m(H.target.value),onKeyDown:H=>{H.key==="Enter"?(H.preventDefault(),q()):H.key==="Escape"&&(H.preventDefault(),we())},onBlur:q,onClick:H=>H.stopPropagation(),className:"flex-1 text-sm text-gray-700 dark:text-gray-300 truncate bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-blue-500 underline-offset-2",style:{padding:0,margin:0}}):u.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1",children:E.name}),u.jsx("span",{className:"text-xs text-gray-400 ml-2 flex-shrink-0",children:E.imageCount})]}),K&&K.type==="child"&&K.basePath===E.path&&I&&u.jsxs("div",{className:"flex items-center py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",style:{paddingLeft:`${(ye+1)*16+12}px`},children:[u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),u.jsx("input",{ref:$,type:"text",value:N,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"?(H.preventDefault(),je()):H.key==="Escape"&&(H.preventDefault(),Oe())},onBlur:je,onClick:H=>H.stopPropagation(),className:"flex-1 text-sm text-gray-700 dark:text-gray-300 bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-green-500 underline-offset-2"})]}),W&&I&&ct(E.children,ye+1),K&&K.type==="sibling"&&K.basePath===E.path&&u.jsxs("div",{className:"flex items-center py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",style:{paddingLeft:`${ye*16+12}px`},children:[u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),u.jsx("input",{ref:$,type:"text",value:N,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"?(H.preventDefault(),je()):H.key==="Escape"&&(H.preventDefault(),Oe())},onBlur:je,onClick:H=>H.stopPropagation(),className:"flex-1 text-sm text-gray-700 dark:text-gray-300 bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-green-500 underline-offset-2"})]})]},E.path)}),gt=async()=>{if(!U)return;const G=U.id;re(null);try{or.getState().setScanProgress(null),Ee.getState().setSelectedImage(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setTotalImageCount(0),x(null),await Lt.setCurrent(G),n(G),await br.fullScan(G)}catch(ye){console.error("启动扫描失败:",ye.message),alert("启动扫描失败: "+ye.message)}},et=async()=>{if(U){try{await Lt.remove(U.id,!1),s(U.id),n(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setTotalImageCount(0),x(null)}catch(G){console.error("移除素材库失败:",G.message)}re(null),setTimeout(()=>{B(!0)},100)}},tn=async()=>{if(U){try{await Lt.remove(U.id),s(U.id)}catch(G){console.error("移除素材库失败:",G.message)}re(null),w(!0)}};return u.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:[u.jsx(yu,{isOpen:!!U,libraryName:U==null?void 0:U.name,libraryPath:U==null?void 0:U.path,status:U==null?void 0:U.status,onRescan:gt,onOpenOther:et,onCreateNew:tn}),u.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[u.jsx("div",{className:"flex items-center justify-between mb-3",children:u.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"素材库"})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs("div",{className:"relative flex-1",ref:ee,children:[u.jsxs("div",{onClick:()=>{!Z&&!g()&&B(!Y)},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 cursor-pointer flex items-center justify-between ${Z||g()?"opacity-50 cursor-not-allowed":""}`,children:[u.jsx("span",{className:"truncate",children:e.length===0?"暂无素材库":t?((nn=e.find(G=>G.id===t))==null?void 0:nn.name)||"未知素材库":"请选择素材库..."}),u.jsx(hu,{className:"w-4 h-4 text-gray-400 flex-shrink-0 ml-2"})]}),Y&&u.jsxs("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg shadow-lg z-50 max-h-64 overflow-y-auto",children:[e.map(G=>u.jsxs("div",{onClick:()=>{G.id!==t&&he(G.id),B(!1)},className:`px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 ${G.id===t?"bg-blue-50 dark:bg-blue-900":""}`,children:[u.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:G.name}),u.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",title:G.path,children:G.path})]},G.id)),u.jsx("div",{onClick:()=>{if(g()){alert("扫描进行中,请稍后再试或暂停扫描");return}w(!0),B(!1)},className:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 border-t border-gray-200 dark:border-gray-700 text-blue-600 dark:text-blue-400",children:"+ 添加新素材库"})]})]}),t&&e.length>0&&u.jsx("button",{onClick:Ie,disabled:g(),className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:g()?"扫描进行中,无法删除":"删除当前素材库",children:u.jsx(Hm,{className:"w-4 h-4"})})]}),c&&u.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:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"添加素材库"}),u.jsx("button",{onClick:()=>w(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600",children:u.jsx(Ai,{className:"w-4 h-4 text-gray-500"})})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("input",{type:"text",placeholder:"素材库名称",value:f,onChange:G=>h(G.target.value),onKeyDown:G=>G.key==="Enter"&&Pe(),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"}),u.jsx("input",{type:"text",placeholder:"文件夹路径(例如:C:\\Users\\Pictures)",value:b,onChange:G=>_(G.target.value),onKeyDown:G=>G.key==="Enter"&&Pe(),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"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>w(!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:"取消"}),u.jsx("button",{onClick:Pe,disabled:le,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:le?"添加中...":"添加"})]})]})]})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[u.jsx("div",{className:"mb-3 space-y-2",children:u.jsxs("div",{className:"flex gap-2",children:[u.jsxs("div",{className:"relative flex-1",children:[u.jsx(mu,{className:"absolute left-2 top-2 w-4 h-4 text-gray-400"}),u.jsx("input",{type:"text",placeholder:"搜索文件夹(支持多关键词)...",value:j,onChange:G=>de(G.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"})]}),u.jsx("button",{onClick:ze()?Se:ne,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:ze()?"折叠全部":"展开全部",children:ze()?u.jsx(ew,{className:"w-4 h-4"}):u.jsx(J1,{className:"w-4 h-4"})})]})}),u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${p===null?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,onClick:()=>x(null),children:[u.jsx("div",{className:"w-5 mr-1"}),u.jsx(Yn,{className:"w-4 h-4 mr-2 text-blue-500 flex-shrink-0"}),u.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 font-medium flex-1",children:"全部图片"}),u.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:v})]}),(qe.length>0||d.length>0)&&u.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 my-2"}),qe.length>0?ct(qe):S?u.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500 text-sm",children:"未找到匹配的文件夹"}):d.length===0?u.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500 text-sm",children:"暂无文件夹"}):null]})]}),u.jsx(Vm,{isOpen:M.isOpen,position:M.position,onClose:()=>te({isOpen:!1,position:null,folder:null}),options:M.folder?[Dn.newSiblingFolder(()=>fe("sibling",M.folder.path)),Dn.newSubFolder(()=>fe("child",M.folder.path)),Dn.divider(),Dn.rename(()=>$e(M.folder)),Dn.move(()=>nt(M.folder.path)),Dn.delete(async()=>{te({isOpen:!1,position:null,folder:null}),await ge(M.folder.path)})]:[]}),u.jsx(qm,{isVisible:P.isVisible,message:P.message,onUndo:Ue,onClose:()=>{A({isVisible:!1,message:"",count:0})}}),ae&&u.jsx(Km,{folders:d,currentFolder:be,onSelect:Rt,onClose:()=>{ce(!1),Te(null)}})]})}class ww{constructor(t={}){this.maxSize=t.maxSize||20,this.cache=new Map,this.accessOrder=[],this.stats={hitCount:0,missCount:0,evictionCount:0,totalSets:0,totalGets:0}}get(t){this.stats.totalGets++;const n=this.cache.get(t);return n?(this.stats.hitCount++,this._updateAccessOrder(t),n.accessCount=(n.accessCount||0)+1,n):(this.stats.missCount++,null)}set(t,n){this.stats.totalSets++,!this.cache.has(t)&&this.cache.size>=this.maxSize&&this.evictLRU();let r=null;n.blob&&(r=URL.createObjectURL(n.blob)),this.cache.set(t,{data:n,blobUrl:r,timestamp:Date.now(),accessCount:1}),this._updateAccessOrder(t)}remove(t){const n=this.cache.get(t);if(n){n.blobUrl&&URL.revokeObjectURL(n.blobUrl),this.cache.delete(t);const r=this.accessOrder.indexOf(t);r>-1&&this.accessOrder.splice(r,1)}}clear(){for(const[t,n]of this.cache.entries())n.blobUrl&&URL.revokeObjectURL(n.blobUrl);this.cache.clear(),this.accessOrder=[]}evictLRU(){if(this.accessOrder.length===0)return;const t=this.accessOrder[0];this.remove(t),this.stats.evictionCount++}size(){return this.cache.size}getStats(){const t=this.stats.totalGets>0?(this.stats.hitCount/this.stats.totalGets*100).toFixed(2):0;return{size:this.cache.size,maxSize:this.maxSize,hitCount:this.stats.hitCount,missCount:this.stats.missCount,evictionCount:this.stats.evictionCount,totalSets:this.stats.totalSets,totalGets:this.stats.totalGets,hitRate:parseFloat(t)}}_updateAccessOrder(t){const n=this.accessOrder.indexOf(t);n>-1&&this.accessOrder.splice(n,1),this.accessOrder.push(t)}has(t){return this.cache.has(t)}keys(){return Array.from(this.cache.keys())}logStats(){this.getStats()}}const bw=new ww;function Nt(){return Nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?F.useEffect:F.useLayoutEffect;function Xr(e,t,n){var r=F.useRef(t);r.current=t,F.useEffect(function(){function s(i){r.current(i)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var _w=["container"];function Sw(e){var t=e.container,n=t===void 0?document.body:t,r=ka(e,_w);return Yp.createPortal(Ve.createElement("div",Nt({},r)),n)}function Cw(e){return Ve.createElement("svg",Nt({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 Ew(e){return Ve.createElement("svg",Nt({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 Nw(e){return Ve.createElement("svg",Nt({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 jw(){return F.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function kf(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var s=e.touches[1],i=s.clientX,o=s.clientY;return[(n+i)/2,(r+o)/2,Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2))]}return[n,r,0]}var ar=function(e,t,n,r){var s,i=n*t,o=(i-r)/2,a=e;return i<=r?(s=1,a=0):e>0&&o-e<=0?(s=2,a=o):e<0&&o+e<=0&&(s=3,a=-o),[s,a]};function sl(e,t,n,r,s,i,o,a,l,d){o===void 0&&(o=innerWidth/2),a===void 0&&(a=innerHeight/2),l===void 0&&(l=0),d===void 0&&(d=0);var p=ar(e,i,n,innerWidth)[0],v=ar(t,i,r,innerHeight),x=innerWidth/2,y=innerHeight/2;return{x:o-i/s*(o-(x+e))-x+(r/n>=3&&n*i===innerWidth?0:p?l/2:l),y:a-i/s*(a-(y+t))-y+(v[0]?d/2:d),lastCX:o,lastCY:a}}function wu(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function il(e,t,n){var r=wu(n,innerWidth,innerHeight),s=r[0],i=r[1],o=0,a=s,l=i,d=e/t*i,p=t/e*s;return e=i?a=d:e>=s&&ts/i?l=p:t/e>=3&&!r[2]?o=((l=p)-i)/2:a=d,{width:a,height:l,x:0,y:o,pause:!0}}function no(e,t){var n=t.leading,r=n!==void 0&&n,s=t.maxWait,i=t.wait,o=i===void 0?s||0:i,a=F.useRef(e);a.current=e;var l=F.useRef(0),d=F.useRef(),p=function(){return d.current&&clearTimeout(d.current)},v=F.useCallback(function(){var x=[].slice.call(arguments),y=Date.now();function g(){l.current=y,p(),a.current.apply(null,x)}var c=l.current,w=y-c;if(c===0&&(r&&g(),l.current=y),s!==void 0){if(w>s)return void g()}else w=1&&i&&i())};p()}function p(){l=requestAnimationFrame(d)}}var Tw={T:0,L:0,W:0,H:0,FIT:void 0},Zm=function(){var e=F.useRef(!1);return F.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},Ow=["className"];function Iw(e){var t=e.className,n=t===void 0?"":t,r=ka(e,Ow);return Ve.createElement("div",Nt({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 Aw=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function Pw(e){var t=e.src,n=e.loaded,r=e.broken,s=e.className,i=e.onPhotoLoad,o=e.loadingElement,a=e.brokenElement,l=ka(e,Aw),d=Zm();return t&&!r?Ve.createElement(Ve.Fragment,null,Ve.createElement("img",Nt({className:"PhotoView__Photo"+(s?" "+s:""),src:t,onLoad:function(p){var v=p.target;d.current&&i({loaded:!0,naturalWidth:v.naturalWidth,naturalHeight:v.naturalHeight})},onError:function(){d.current&&i({broken:!0})},draggable:!1,alt:""},l)),!n&&(o?Ve.createElement("span",{className:"PhotoView__icon"},o):Ve.createElement(Iw,{className:"PhotoView__icon"}))):a?Ve.createElement("span",{className:"PhotoView__icon"},typeof a=="function"?a({src:t}):a):null}var Lw={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 zw(e){var t=e.item,n=t.src,r=t.render,s=t.width,i=s===void 0?0:s,o=t.height,a=o===void 0?0:o,l=t.originRef,d=e.visible,p=e.speed,v=e.easing,x=e.wrapClassName,y=e.className,g=e.style,c=e.loadingElement,w=e.brokenElement,f=e.onPhotoTap,h=e.onMaskTap,b=e.onReachMove,_=e.onReachUp,S=e.onPhotoResize,T=e.isActive,j=e.expose,L=Go(Lw),O=L[0],D=L[1],le=F.useRef(0),R=Zm(),Z=O.naturalWidth,k=Z===void 0?i:Z,U=O.naturalHeight,re=U===void 0?a:U,Y=O.width,B=Y===void 0?i:Y,M=O.height,te=M===void 0?a:M,P=O.loaded,A=P===void 0?!n:P,ie=O.broken,J=O.x,oe=O.y,_e=O.touched,ae=O.stopRaf,ce=O.maskTouched,be=O.rotate,Te=O.scale,Ce=O.CX,He=O.CY,Be=O.lastX,m=O.lastY,K=O.lastCX,V=O.lastCY,N=O.lastScale,C=O.touchTime,z=O.touchLength,ee=O.pause,se=O.reach,$=ms({onScale:function(ne){return de(to(ne))},onRotate:function(ne){be!==ne&&(j({rotate:ne}),D(Nt({rotate:ne},il(k,re,ne))))}});function de(ne,Se,ze){Te!==ne&&(j({scale:ne}),D(Nt({scale:ne},sl(J,oe,B,te,Te,ne,Se,ze),ne<=1&&{x:0,y:0})))}var ke=no(function(ne,Se,ze){if(ze===void 0&&(ze=0),(_e||ce)&&T){var qe=wu(be,B,te),Je=qe[0],st=qe[1];if(ze===0&&le.current===0){var ct=Math.abs(ne-Ce)<=20,gt=Math.abs(Se-He)<=20;if(ct&>)return void D({lastCX:ne,lastCY:Se});le.current=ct?Se>He?3:2:1}var et,tn=ne-K,nn=Se-V;if(ze===0){var G=ar(tn+Be,Te,Je,innerWidth)[0],ye=ar(nn+m,Te,st,innerHeight);et=function(I,W,X,H){return W&&I===1||H==="x"?"x":X&&I>1||H==="y"?"y":void 0}(le.current,G,ye[0],se),et!==void 0&&b(et,ne,Se,Te)}if(et==="x"||ce)return void D({reach:"x"});var E=to(Te+(ze-z)/100/2*Te,k/B,.2);j({scale:E}),D(Nt({touchLength:ze,reach:et,scale:E},sl(J,oe,B,te,Te,E,ne,Se,tn,nn)))}},{maxWait:8});function pe(ne){return!ae&&!_e&&(R.current&&D(Nt({},ne,{pause:d})),R.current)}var ge,Ue,Fe,ot,wt,nt,Rt,$e,q=(wt=function(ne){return pe({x:ne})},nt=function(ne){return pe({y:ne})},Rt=function(ne){return R.current&&(j({scale:ne}),D({scale:ne})),!_e&&R.current},$e=ms({X:function(ne){return wt(ne)},Y:function(ne){return nt(ne)},S:function(ne){return Rt(ne)}}),function(ne,Se,ze,qe,Je,st,ct,gt,et,tn,nn){var G=wu(tn,Je,st),ye=G[0],E=G[1],I=ar(ne,gt,ye,innerWidth),W=I[0],X=I[1],H=ar(Se,gt,E,innerHeight),ue=H[0],ve=H[1],xe=Date.now()-nn;if(xe>=200||gt!==ct||Math.abs(et-ct)>1){var Ne=sl(ne,Se,Je,st,ct,gt),Me=Ne.x,Ze=Ne.y,Ge=W?X:Me!==ne?Me:null,ft=ue?ve:Ze!==Se?Ze:null;return Ge!==null&&Rr(ne,Ge,$e.X),ft!==null&&Rr(Se,ft,$e.Y),void(gt!==ct&&Rr(ct,gt,$e.S))}var at=(ne-ze)/xe,_t=(Se-qe)/xe,Mt=Math.sqrt(Math.pow(at,2)+Math.pow(_t,2)),cn=!1,dn=!1;(function(kn,Bt){var Ut,_n=kn,Hn=0,fn=0,Vr=function(Is){Ut||(Ut=Is);var As=Is-Ut,Rc=Math.sign(kn),Tc=-.001*Rc,Oc=Math.sign(-_n)*Math.pow(_n,2)*2e-4,Jm=_n*As+(Tc+Oc)*Math.pow(As,2)/2;Hn+=Jm,Ut=Is,Rc*(_n+=(Tc+Oc)*As)<=0?hn():Bt(Hn)?Pn():hn()};function Pn(){fn=requestAnimationFrame(Vr)}function hn(){cancelAnimationFrame(fn)}Pn()})(Mt,function(kn){var Bt=ne+kn*(at/Mt),Ut=Se+kn*(_t/Mt),_n=ar(Bt,ct,ye,innerWidth),Hn=_n[0],fn=_n[1],Vr=ar(Ut,ct,E,innerHeight),Pn=Vr[0],hn=Vr[1];if(Hn&&!cn&&(cn=!0,W?Rr(Bt,fn,$e.X):_f(fn,Bt+(Bt-fn),$e.X)),Pn&&!dn&&(dn=!0,ue?Rr(Ut,hn,$e.Y):_f(hn,Ut+(Ut-hn),$e.Y)),cn&&dn)return!1;var Is=cn||$e.X(fn),As=dn||$e.Y(hn);return Is&&As})}),we=(ge=f,Ue=function(ne,Se){se||de(Te!==1?1:Math.max(2,k/B),ne,Se)},Fe=F.useRef(0),ot=no(function(){Fe.current=0,ge.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ne=[].slice.call(arguments);Fe.current+=1,ot.apply(void 0,ne),Fe.current>=2&&(ot.cancel(),Fe.current=0,Ue.apply(void 0,ne))});function fe(ne,Se){if(le.current=0,(_e||ce)&&T){D({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var ze=to(Te,k/B);if(q(J,oe,Be,m,B,te,Te,ze,N,be,C),_(ne,Se),Ce===ne&&He===Se){if(_e)return void we(ne,Se);ce&&h(ne,Se)}}}function je(ne,Se,ze){ze===void 0&&(ze=0),D({touched:!0,CX:ne,CY:Se,lastCX:ne,lastCY:Se,lastX:J,lastY:oe,lastScale:Te,touchLength:ze,touchTime:Date.now()})}function Oe(ne){D({maskTouched:!0,CX:ne.clientX,CY:ne.clientY,lastX:J,lastY:oe})}Xr(Vn?void 0:"mousemove",function(ne){ne.preventDefault(),ke(ne.clientX,ne.clientY)}),Xr(Vn?void 0:"mouseup",function(ne){fe(ne.clientX,ne.clientY)}),Xr(Vn?"touchmove":void 0,function(ne){ne.preventDefault();var Se=kf(ne);ke.apply(void 0,Se)},{passive:!1}),Xr(Vn?"touchend":void 0,function(ne){var Se=ne.changedTouches[0];fe(Se.clientX,Se.clientY)},{passive:!1}),Xr("resize",no(function(){A&&!_e&&(D(il(k,re,be)),S())},{maxWait:8})),xu(function(){T&&j(Nt({scale:Te,rotate:be},$))},[T]);var Pe=function(ne,Se,ze,qe,Je,st,ct,gt,et,tn){var nn=function(Me,Ze,Ge,ft,at){var _t=F.useRef(!1),Mt=Go({lead:!0,scale:Ge}),cn=Mt[0],dn=cn.lead,kn=cn.scale,Bt=Mt[1],Ut=no(function(_n){try{return at(!0),Bt({lead:!1,scale:_n}),Promise.resolve()}catch(Hn){return Promise.reject(Hn)}},{wait:ft});return xu(function(){_t.current?(at(!1),Bt({lead:!0}),Ut(Ge)):_t.current=!0},[Ge]),dn?[Me*kn,Ze*kn,Ge/kn]:[Me*Ge,Ze*Ge,1]}(st,ct,gt,et,tn),G=nn[0],ye=nn[1],E=nn[2],I=function(Me,Ze,Ge,ft,at){var _t=F.useState(Tw),Mt=_t[0],cn=_t[1],dn=F.useState(0),kn=dn[0],Bt=dn[1],Ut=F.useRef(),_n=ms({OK:function(){return Me&&Bt(4)}});function Hn(fn){at(!1),Bt(fn)}return F.useEffect(function(){if(Ut.current||(Ut.current=Date.now()),Ge){if(function(fn,Vr){var Pn=fn&&fn.current;if(Pn&&Pn.nodeType===1){var hn=Pn.getBoundingClientRect();Vr({T:hn.top,L:hn.left,W:hn.width,H:hn.height,FIT:Pn.tagName==="IMG"?getComputedStyle(Pn).objectFit:void 0})}}(Ze,cn),Me)return Date.now()-Ut.current<250?(Bt(1),requestAnimationFrame(function(){Bt(2),requestAnimationFrame(function(){return Hn(3)})}),void setTimeout(_n.OK,ft)):void Bt(4);Hn(5)}},[Me,Ge]),[kn,Mt]}(ne,Se,ze,et,tn),W=I[0],X=I[1],H=X.W,ue=X.FIT,ve=innerWidth/2,xe=innerHeight/2,Ne=W<3||W>4;return[Ne?H?X.L:ve:qe+(ve-st*gt/2),Ne?H?X.T:xe:Je+(xe-ct*gt/2),G,Ne&&ue?G*(X.H/H):ye,W===0?E:Ne?H/(st*gt)||.01:E,Ne?ue?1:0:1,W,ue]}(d,l,A,J,oe,B,te,Te,p,function(ne){return D({pause:ne})}),he=Pe[4],Ie=Pe[6],Le="transform "+p+"ms "+v,Ae={className:y,onMouseDown:Vn?void 0:function(ne){ne.stopPropagation(),ne.button===0&&je(ne.clientX,ne.clientY,0)},onTouchStart:Vn?function(ne){ne.stopPropagation(),je.apply(void 0,kf(ne))}:void 0,onWheel:function(ne){if(!se){var Se=to(Te-ne.deltaY/100/2,k/B);D({stopRaf:!0}),de(Se,ne.clientX,ne.clientY)}},style:{width:Pe[2]+"px",height:Pe[3]+"px",opacity:Pe[5],objectFit:Ie===4?void 0:Pe[7],transform:be?"rotate("+be+"deg)":void 0,transition:Ie>2?Le+", opacity "+p+"ms ease, height "+(Ie<4?p/2:Ie>4?p:0)+"ms "+v:void 0}};return Ve.createElement("div",{className:"PhotoView__PhotoWrap"+(x?" "+x:""),style:g,onMouseDown:!Vn&&T?Oe:void 0,onTouchStart:Vn&&T?function(ne){return Oe(ne.touches[0])}:void 0},Ve.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+he+", 0, 0, "+he+", "+Pe[0]+", "+Pe[1]+")",transition:_e||ee?void 0:Le,willChange:T?"transform":void 0}},n?Ve.createElement(Pw,Nt({src:n,loaded:A,broken:ie},Ae,{onPhotoLoad:function(ne){D(Nt({},ne,ne.loaded&&il(ne.naturalWidth||0,ne.naturalHeight||0,be)))},loadingElement:c,brokenElement:w})):r&&r({attrs:Ae,scale:he,rotate:be})))}var Sf={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 Fw(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,s=e.easing,i=e.photoClosable,o=e.maskClosable,a=o===void 0||o,l=e.maskOpacity,d=l===void 0?1:l,p=e.pullClosable,v=p===void 0||p,x=e.bannerVisible,y=x===void 0||x,g=e.overlayRender,c=e.toolbarRender,w=e.className,f=e.maskClassName,h=e.photoClassName,b=e.photoWrapClassName,_=e.loadingElement,S=e.brokenElement,T=e.images,j=e.index,L=j===void 0?0:j,O=e.onIndexChange,D=e.visible,le=e.onClose,R=e.afterClose,Z=e.portalContainer,k=Go(Sf),U=k[0],re=k[1],Y=F.useState(0),B=Y[0],M=Y[1],te=U.x,P=U.touched,A=U.pause,ie=U.lastCX,J=U.lastCY,oe=U.bg,_e=oe===void 0?d:oe,ae=U.lastBg,ce=U.overlay,be=U.minimal,Te=U.scale,Ce=U.rotate,He=U.onScale,Be=U.onRotate,m=e.hasOwnProperty("index"),K=m?L:B,V=m?O:M,N=F.useRef(K),C=T.length,z=T[K],ee=typeof n=="boolean"?n:C>n,se=function(he,Ie){var Le=F.useReducer(function(ze){return!ze},!1)[1],Ae=F.useRef(0),ne=function(ze){var qe=F.useRef(ze);function Je(st){qe.current=st}return F.useMemo(function(){(function(st){he?(st(he),Ae.current=1):Ae.current=2})(Je)},[ze]),[qe.current,Je]}(he),Se=ne[1];return[ne[0],Ae.current,function(){Le(),Ae.current===2&&(Se(!1),Ie&&Ie()),Ae.current=0}]}(D,R),$=se[0],de=se[1],ke=se[2];xu(function(){if($)return re({pause:!0,x:K*-(innerWidth+Kr)}),void(N.current=K);re(Sf)},[$]);var pe=ms({close:function(he){Be&&Be(0),re({overlay:!0,lastBg:_e}),le(he)},changeIndex:function(he,Ie){Ie===void 0&&(Ie=!1);var Le=ee?N.current+(he-K):he,Ae=C-1,ne=vu(Le,0,Ae),Se=ee?Le:ne,ze=innerWidth+Kr;re({touched:!1,lastCX:void 0,lastCY:void 0,x:-ze*Se,pause:Ie}),N.current=Se,V&&V(ee?he<0?Ae:he>Ae?0:he:ne)}}),ge=pe.close,Ue=pe.changeIndex;function Fe(he){return he?ge():re({overlay:!ce})}function ot(){re({x:-(innerWidth+Kr)*K,lastCX:void 0,lastCY:void 0,pause:!0}),N.current=K}function wt(he,Ie,Le,Ae){he==="x"?function(ne){if(ie!==void 0){var Se=ne-ie,ze=Se;!ee&&(K===0&&Se>0||K===C-1&&Se<0)&&(ze=Se/2),re({touched:!0,lastCX:ie,x:-(innerWidth+Kr)*N.current+ze,pause:!1})}else re({touched:!0,lastCX:ne,x:te,pause:!1})}(Ie):he==="y"&&function(ne,Se){if(J!==void 0){var ze=d===null?null:vu(d,.01,d-Math.abs(ne-J)/100/4);re({touched:!0,lastCY:J,bg:Se===1?ze:d,minimal:Se===1})}else re({touched:!0,lastCY:ne,bg:_e,minimal:!0})}(Le,Ae)}function nt(he,Ie){var Le=he-(ie??he),Ae=Ie-(J??Ie),ne=!1;if(Le<-40)Ue(K+1);else if(Le>40)Ue(K-1);else{var Se=-(innerWidth+Kr)*N.current;Math.abs(Ae)>100&&be&&v&&(ne=!0,ge()),re({touched:!1,x:Se,lastCX:void 0,lastCY:void 0,bg:d,overlay:!!ne||ce})}}Xr("keydown",function(he){if(D)switch(he.key){case"ArrowLeft":Ue(K-1,!0);break;case"ArrowRight":Ue(K+1,!0);break;case"Escape":ge()}});var Rt=function(he,Ie,Le){return F.useMemo(function(){var Ae=he.length;return Le?he.concat(he).concat(he).slice(Ae+Ie-1,Ae+Ie+2):he.slice(Math.max(Ie-1,0),Math.min(Ie+2,Ae+1))},[he,Ie,Le])}(T,K,ee);if(!$)return null;var $e=ce&&!de,q=D?_e:ae,we=He&&Be&&{images:T,index:K,visible:D,onClose:ge,onIndexChange:Ue,overlayVisible:$e,overlay:z&&z.overlay,scale:Te,rotate:Ce,onScale:He,onRotate:Be},fe=r?r(de):400,je=s?s(de):bf,Oe=r?r(3):600,Pe=s?s(3):bf;return Ve.createElement(Sw,{className:"PhotoView-Portal"+($e?"":" PhotoView-Slider__clean")+(D?"":" PhotoView-Slider__willClose")+(w?" "+w:""),role:"dialog",onClick:function(he){return he.stopPropagation()},container:Z},D&&Ve.createElement(jw,null),Ve.createElement("div",{className:"PhotoView-Slider__Backdrop"+(f?" "+f:"")+(de===1?" PhotoView-Slider__fadeIn":de===2?" PhotoView-Slider__fadeOut":""),style:{background:q?"rgba(0, 0, 0, "+q+")":void 0,transitionTimingFunction:je,transitionDuration:(P?0:fe)+"ms",animationDuration:fe+"ms"},onAnimationEnd:ke}),y&&Ve.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Ve.createElement("div",{className:"PhotoView-Slider__Counter"},K+1," / ",C),Ve.createElement("div",{className:"PhotoView-Slider__BannerRight"},c&&we&&c(we),Ve.createElement(Cw,{className:"PhotoView-Slider__toolbarIcon",onClick:ge}))),Rt.map(function(he,Ie){var Le=ee||K!==0?N.current-1+Ie:K+Ie;return Ve.createElement(zw,{key:ee?he.key+"/"+he.src+"/"+Le:he.key,item:he,speed:fe,easing:je,visible:D,onReachMove:wt,onReachUp:nt,onPhotoTap:function(){return Fe(i)},onMaskTap:function(){return Fe(a)},wrapClassName:b,className:h,style:{left:(innerWidth+Kr)*Le+"px",transform:"translate3d("+te+"px, 0px, 0)",transition:P||A?void 0:"transform "+Oe+"ms "+Pe},loadingElement:_,brokenElement:S,onPhotoResize:ot,isActive:N.current===Le,expose:re})}),!Vn&&y&&Ve.createElement(Ve.Fragment,null,(ee||K!==0)&&Ve.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return Ue(K-1,!0)}},Ve.createElement(Ew,null)),(ee||K+1-1){var f=d.slice();return f.splice(w,1,c),void a({images:f})}a(function(h){return{images:h.images.concat(c)}})},remove:function(c){a(function(w){var f=w.images.filter(function(h){return h.key!==c});return{images:f,index:Math.min(f.length-1,v)}})},show:function(c){var w=d.findIndex(function(f){return f.key===c});a({visible:!0,index:w}),r&&r(!0,w,o)}}),y=ms({close:function(){a({visible:!1}),r&&r(!1,v,o)},changeIndex:function(c){a({index:c}),n&&n(c,o)}}),g=F.useMemo(function(){return Nt({},o,x)},[o,x]);return Ve.createElement(kw.Provider,{value:g},t,Ve.createElement(Fw,Nt({images:d,visible:p,index:v,onIndexChange:y.changeIndex,onClose:y.close},s)))}function bu(){return bu=Object.assign?Object.assign.bind():function(e){for(var t=1;t=t?e.call(null):s.id=requestAnimationFrame(r)}var s={id:requestAnimationFrame(r)};return s}var al=-1;function Rf(e){if(e===void 0&&(e=!1),al===-1||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),al=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return al}var Zr=null;function Tf(e){if(e===void 0&&(e=!1),Zr===null||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),s=r.style;return s.width="100px",s.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Zr="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Zr="negative":Zr="positive-ascending"),document.body.removeChild(t),Zr}return Zr}var qw=150,Kw=function(t,n){return t};function Zw(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,s=e.getItemSize,i=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,l=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,p=e.validateProps;return t=function(v){Uw(x,v);function x(g){var c;return c=v.call(this,g)||this,c._instanceProps=l(c.props,Cf(c)),c._outerRef=void 0,c._resetIsScrollingTimeoutId=null,c.state={instance:Cf(c),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof c.props.initialScrollOffset=="number"?c.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},c._callOnItemsRendered=void 0,c._callOnItemsRendered=ol(function(w,f,h,b){return c.props.onItemsRendered({overscanStartIndex:w,overscanStopIndex:f,visibleStartIndex:h,visibleStopIndex:b})}),c._callOnScroll=void 0,c._callOnScroll=ol(function(w,f,h){return c.props.onScroll({scrollDirection:w,scrollOffset:f,scrollUpdateWasRequested:h})}),c._getItemStyle=void 0,c._getItemStyle=function(w){var f=c.props,h=f.direction,b=f.itemSize,_=f.layout,S=c._getItemStyleCache(d&&b,d&&_,d&&h),T;if(S.hasOwnProperty(w))T=S[w];else{var j=n(c.props,w,c._instanceProps),L=s(c.props,w,c._instanceProps),O=h==="horizontal"||_==="horizontal",D=h==="rtl",le=O?j:0;S[w]=T={position:"absolute",left:D?void 0:le,right:D?le:void 0,top:O?0:j,height:O?"100%":L,width:O?L:"100%"}}return T},c._getItemStyleCache=void 0,c._getItemStyleCache=ol(function(w,f,h){return{}}),c._onScrollHorizontal=function(w){var f=w.currentTarget,h=f.clientWidth,b=f.scrollLeft,_=f.scrollWidth;c.setState(function(S){if(S.scrollOffset===b)return null;var T=c.props.direction,j=b;if(T==="rtl")switch(Tf()){case"negative":j=-b;break;case"positive-descending":j=_-h-b;break}return j=Math.max(0,Math.min(j,_-h)),{isScrolling:!0,scrollDirection:S.scrollOffsetT.clientWidth?Rf():0:S=T.scrollHeight>T.clientHeight?Rf():0}this.scrollTo(i(this.props,c,w,_,this._instanceProps,S))},y.componentDidMount=function(){var c=this.props,w=c.direction,f=c.initialScrollOffset,h=c.layout;if(typeof f=="number"&&this._outerRef!=null){var b=this._outerRef;w==="horizontal"||h==="horizontal"?b.scrollLeft=f:b.scrollTop=f}this._callPropsCallbacks()},y.componentDidUpdate=function(){var c=this.props,w=c.direction,f=c.layout,h=this.state,b=h.scrollOffset,_=h.scrollUpdateWasRequested;if(_&&this._outerRef!=null){var S=this._outerRef;if(w==="horizontal"||f==="horizontal")if(w==="rtl")switch(Tf()){case"negative":S.scrollLeft=-b;break;case"positive-ascending":S.scrollLeft=b;break;default:var T=S.clientWidth,j=S.scrollWidth;S.scrollLeft=j-T-b;break}else S.scrollLeft=b;else S.scrollTop=b}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&jf(this._resetIsScrollingTimeoutId)},y.render=function(){var c=this.props,w=c.children,f=c.className,h=c.direction,b=c.height,_=c.innerRef,S=c.innerElementType,T=c.innerTagName,j=c.itemCount,L=c.itemData,O=c.itemKey,D=O===void 0?Kw:O,le=c.layout,R=c.outerElementType,Z=c.outerTagName,k=c.style,U=c.useIsScrolling,re=c.width,Y=this.state.isScrolling,B=h==="horizontal"||le==="horizontal",M=B?this._onScrollHorizontal:this._onScrollVertical,te=this._getRangeToRender(),P=te[0],A=te[1],ie=[];if(j>0)for(var J=P;J<=A;J++)ie.push(F.createElement(w,{data:L,key:D(J,L),index:J,isScrolling:U?Y:void 0,style:this._getItemStyle(J)}));var oe=r(this.props,this._instanceProps);return F.createElement(R||Z||"div",{className:f,onScroll:M,ref:this._outerRefSetter,style:bu({position:"relative",height:b,width:re,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:h},k)},F.createElement(S||T||"div",{children:ie,ref:_,style:{height:B?"100%":oe,pointerEvents:Y?"none":void 0,width:B?oe:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var c=this.props.itemCount;if(c>0){var w=this._getRangeToRender(),f=w[0],h=w[1],b=w[2],_=w[3];this._callOnItemsRendered(f,h,b,_)}}if(typeof this.props.onScroll=="function"){var S=this.state,T=S.scrollDirection,j=S.scrollOffset,L=S.scrollUpdateWasRequested;this._callOnScroll(T,j,L)}},y._getRangeToRender=function(){var c=this.props,w=c.itemCount,f=c.overscanCount,h=this.state,b=h.isScrolling,_=h.scrollDirection,S=h.scrollOffset;if(w===0)return[0,0,0,0];var T=o(this.props,S,this._instanceProps),j=a(this.props,T,S,this._instanceProps),L=!b||_==="backward"?Math.max(1,f):1,O=!b||_==="forward"?Math.max(1,f):1;return[Math.max(0,T-L),Math.max(0,Math.min(w-1,j+O)),T,j]},x}(F.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Xw=function(t,n){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,n.instance},Yw=50,ls=function(t,n,r){var s=t,i=s.itemSize,o=r.itemMetadataMap,a=r.lastMeasuredIndex;if(n>a){var l=0;if(a>=0){var d=o[a];l=d.offset+d.size}for(var p=a+1;p<=n;p++){var v=i(p);o[p]={offset:l,size:v},l+=v}r.lastMeasuredIndex=n}return o[n]},Gw=function(t,n,r){var s=n.itemMetadataMap,i=n.lastMeasuredIndex,o=i>0?s[i].offset:0;return o>=r?Xm(t,n,i,0,r):Qw(t,n,Math.max(0,i),r)},Xm=function(t,n,r,s,i){for(;s<=r;){var o=s+Math.floor((r-s)/2),a=ls(t,o,n).offset;if(a===i)return o;ai&&(r=o-1)}return s>0?s-1:0},Qw=function(t,n,r,s){for(var i=t.itemCount,o=1;r=r&&(o=r-1),o>=0){var l=s[o];a=l.offset+l.size}var d=r-o-1,p=d*i;return a+p},Jw=Zw({getItemOffset:function(t,n,r){return ls(t,n,r).offset},getItemSize:function(t,n,r){return r.itemMetadataMap[n].size},getEstimatedTotalSize:Of,getOffsetForIndexAndAlignment:function(t,n,r,s,i,o){var a=t.direction,l=t.height,d=t.layout,p=t.width,v=a==="horizontal"||d==="horizontal",x=v?p:l,y=ls(t,n,i),g=Of(t,i),c=Math.max(0,Math.min(g-x,y.offset)),w=Math.max(0,y.offset-x+y.size+o);switch(r==="smart"&&(s>=w-x&&s<=c+x?r="auto":r="center"),r){case"start":return c;case"end":return w;case"center":return Math.round(w+(c-w)/2);case"auto":default:return s>=w&&s<=c?s:s({clipboardItems:[],clipboardType:null,copyToClipboard:(n,r="copy")=>{e({clipboardItems:n,clipboardType:r}),console.log(`📋 已复制 ${n.length} 个项目到剪贴板`)},clearClipboard:()=>{e({clipboardItems:[],clipboardType:null})},getClipboard:()=>{const{clipboardItems:n,clipboardType:r}=t();return{items:n,type:r}},hasClipboard:()=>t().clipboardItems.length>0}));function e2({file:e,libraryId:t,onClose:n}){if(!e)return null;const r=e.file_type||"image",s=De.getOriginalUrl(t,e.path),i=async()=>{try{await De.openInExplorer(t,e.path)}catch(o){console.error("Failed to open file:",o)}};return u.jsxs("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-90 flex items-center justify-center",children:[u.jsxs("div",{className:"absolute top-0 left-0 right-0 h-16 bg-black bg-opacity-50 flex items-center justify-between px-4 z-10",children:[u.jsx("div",{className:"text-white text-sm truncate max-w-md",children:e.filename}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("button",{onClick:i,className:"p-2 text-white hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"在系统默认应用中打开",children:u.jsx(nw,{className:"w-5 h-5"})}),u.jsx("button",{onClick:n,className:"p-2 text-white hover:bg-white hover:bg-opacity-20 rounded transition-colors",children:u.jsx(Ai,{className:"w-6 h-6"})})]})]}),u.jsxs("div",{className:"w-full h-full flex items-center justify-center p-20",children:[r==="video"&&u.jsx("video",{src:s,controls:!0,autoPlay:!0,className:"max-w-full max-h-full rounded shadow-2xl",onError:o=>{console.error("Video load error:",o),alert("视频加载失败,请尝试在系统默认应用中打开")},children:"您的浏览器不支持视频播放"}),r==="audio"&&u.jsxs("div",{className:"flex flex-col items-center justify-center",children:[u.jsx("div",{className:"text-white text-6xl mb-8",children:"🎵"}),u.jsx("audio",{src:s,controls:!0,autoPlay:!0,className:"w-96 rounded shadow-2xl",onError:o=>{console.error("Audio load error:",o),alert("音频加载失败,请尝试在系统默认应用中打开")},children:"您的浏览器不支持音频播放"}),u.jsx("p",{className:"text-white mt-4 text-sm opacity-70",children:e.filename})]}),r==="document"&&u.jsx("div",{className:"w-full h-full bg-white rounded shadow-2xl overflow-hidden",children:e.format==="pdf"?u.jsx("iframe",{src:s,className:"w-full h-full",title:e.filename}):u.jsx("iframe",{src:s,className:"w-full h-full",title:e.filename,sandbox:"allow-same-origin"})}),(r==="design"||r==="other"||!r)&&u.jsxs("div",{className:"text-center text-white",children:[u.jsx("p",{className:"mb-4",children:"此文件类型需要在专业软件中打开"}),u.jsx("button",{onClick:i,className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 rounded-lg transition-colors",children:"在系统默认应用中打开"})]})]}),u.jsx("div",{className:"absolute inset-0 -z-10",onClick:n})]})}function t2({isVisible:e,rating:t,count:n,onClose:r,duration:s=2e3}){return F.useEffect(()=>{if(!e)return;const i=setTimeout(()=>{r()},s);return()=>clearTimeout(i)},[e,t,n,s,r]),e?u.jsx("div",{className:"fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 animate-slide-up",children:u.jsxs("div",{className:"bg-gray-900 dark:bg-gray-800 text-white rounded-lg shadow-2xl px-6 py-4 flex items-center gap-3 min-w-[200px]",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[[...Array(t)].map((i,o)=>u.jsx(bi,{size:16,className:"fill-yellow-400 text-yellow-400"},o)),[...Array(5-t)].map((i,o)=>u.jsx(bi,{size:16,className:"fill-none text-gray-600"},o+t))]}),u.jsxs("span",{className:"text-sm font-medium",children:[t===0?"已取消评分":`已评 ${t} 星`,n>1?` (${n} 张)`:""]})]})}):null}function n2({isOpen:e,conflicts:t,onResolve:n,onCancel:r}){if(!e)return null;const s=i=>{n(i)};return u.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full mx-4",children:[u.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx($m,{className:"w-5 h-5 text-yellow-500"}),u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"文件冲突"})]}),u.jsx("button",{onClick:r,className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded",children:u.jsx(Ai,{className:"w-5 h-5 text-gray-500"})})]}),u.jsxs("div",{className:"p-4",children:[u.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:t.some(i=>i.isSameLocation)?u.jsxs(u.Fragment,{children:["正在同一位置复制 ",u.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:t.length})," 个文件/文件夹"]}):u.jsxs(u.Fragment,{children:["目标位置已存在 ",u.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:t.length})," 个同名文件/文件夹"]})}),u.jsxs("div",{className:"mb-4 max-h-40 overflow-y-auto bg-gray-50 dark:bg-gray-900 rounded p-3",children:[t.slice(0,5).map((i,o)=>u.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300 mb-1",children:["• ",i.name,i.isSameLocation&&u.jsx("span",{className:"ml-2 text-xs text-blue-500 dark:text-blue-400",children:"(同位置)"})]},o)),t.length>5&&u.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["... 还有 ",t.length-5," 个文件"]})]}),u.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:"请选择如何处理:"}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("button",{onClick:()=>s("skip"),className:"w-full px-4 py-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-white rounded-lg transition-colors text-left",children:[u.jsx("div",{className:"font-medium",children:"跳过"}),u.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:t.some(i=>i.isSameLocation)?"不创建副本,保持原样":"保留现有文件,不复制冲突的文件"})]}),u.jsxs("button",{onClick:()=>s("replace"),className:"w-full px-4 py-2 bg-yellow-100 hover:bg-yellow-200 dark:bg-yellow-900 dark:hover:bg-yellow-800 text-gray-900 dark:text-white rounded-lg transition-colors text-left",children:[u.jsx("div",{className:"font-medium",children:"覆盖"}),u.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:t.some(i=>i.isSameLocation)?"无法覆盖自己,将跳过":"用新文件替换现有文件"})]}),u.jsxs("button",{onClick:()=>s("rename"),className:"w-full px-4 py-2 bg-blue-100 hover:bg-blue-200 dark:bg-blue-900 dark:hover:bg-blue-800 text-gray-900 dark:text-white rounded-lg transition-colors text-left",children:[u.jsx("div",{className:"font-medium",children:"保留两者"}),u.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:'自动重命名为 "文件名 (1).ext"'})]})]})]}),u.jsx("div",{className:"flex justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700",children:u.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:"取消"})})]})})}const r2=100,ll=e=>{const t=e.match(/^(\d+(?:\.\d+)?)(B|KB|MB|GB)$/);if(!t)return 0;const n=parseFloat(t[1]);switch(t[2]){case"B":return n/1024;case"KB":return n;case"MB":return n*1024;case"GB":return n*1024*1024;default:return 0}},s2=(e,t)=>{if(t.startsWith(">")){const n=t.substring(1).trim(),r=ll(n);return e>=r}else if(t.includes(" - ")){const[n,r]=t.split(" - ").map(o=>o.trim()),s=ll(n),i=ll(r);return e>=s&&e{const{formats:E,sizes:I,orientations:W,ratings:X}=x;return(!E||E.length===0)&&(!I||I.length===0)&&(!W||W.length===0)&&(!X||X.length===0)?t:t.filter(H=>{var ue;if(E&&E.length>0&&!E.includes((ue=H.format)==null?void 0:ue.toLowerCase()))return!1;if(I&&I.length>0){const ve=H.size/1024;let xe=!1;for(const Ne of I)if(s2(ve,Ne)){xe=!0;break}if(!xe)return!1}if(W&&W.length>0){const ve=H.width/H.height;let xe=!1;for(const Ne of W)if(Ne==="horizontal"&&ve>1.05){xe=!0;break}else if(Ne==="vertical"&&ve<.95){xe=!0;break}else if(Ne==="square"&&ve>=.95&&ve<=1.05){xe=!0;break}if(!xe)return!1}if(X&&X.length>0){const ve=H.rating||0;if(!X.includes(ve))return!1}return!0})},[t,x]),O=F.useRef(null),D=F.useRef(null),[le,R]=F.useState(0),[Z,k]=F.useState(0),[U,re]=F.useState(-1),[Y,B]=F.useState(null),[M,te]=F.useState(null),[P,A]=F.useState({isOpen:!1,position:null,image:null}),[ie,J]=F.useState({isVisible:!1,message:"",count:0}),[oe,_e]=F.useState([]),[ae,ce]=F.useState({isVisible:!1,rating:0,count:0}),[be,Te]=F.useState(!1),[Ce,He]=F.useState([]),[Be,m]=F.useState(""),K=F.useRef(null),[V,N]=F.useState({isOpen:!1,conflicts:[],pendingPaste:null,pendingUpload:null}),[C,z]=F.useState(!1),[ee,se]=F.useState({isUploading:!1,percent:0,current:0,total:0}),{copyToClipboard:$,getClipboard:de,hasClipboard:ke}=Ym();F.useEffect(()=>{J({isVisible:!1,message:"",count:0})},[d]),F.useEffect(()=>{const E=I=>{I.preventDefault(),I.stopPropagation()};return document.addEventListener("dragover",E),document.addEventListener("drop",E),()=>{document.removeEventListener("dragover",E),document.removeEventListener("drop",E)}},[]),F.useEffect(()=>{const E=async I=>{if(!(I.target.tagName==="INPUT"||I.target.tagName==="TEXTAREA")){if((I.ctrlKey||I.metaKey)&&I.key==="c"){(s.length>0||n)&&(I.preventDefault(),Le());return}if((I.ctrlKey||I.metaKey)&&I.key==="v"){ke()&&d&&(I.preventDefault(),await Ae());return}if((I.ctrlKey||I.metaKey)&&I.key==="z"){I.preventDefault(),oe.length>0&&await fe();return}if((I.key==="F2"||I.key==="Enter")&&n&&s.length===0){I.preventDefault(),gt(n);return}if(I.key==="Delete"){(s.length>0||n)&&(I.preventDefault(),await Oe());return}if(["1","2","3","4","5"].includes(I.key)){if(s.length>0||n){I.preventDefault();const W=parseInt(I.key);await je(W)}return}if(I.key==="0"){(s.length>0||n)&&(I.preventDefault(),await je(0));return}}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[s,n,t,e,oe,d,ke]);const pe=F.useCallback(async()=>{var I;if(!e||!l.hasMore||l.isLoading)return;const E=yn.createRequest(ki.IMAGES);g({isLoading:!0});try{const W={offset:t.length,limit:ro.pageSize};d&&(W.folder=d),v&&(W.keywords=v),((I=x.formats)==null?void 0:I.length)>0&&(W.formats=x.formats.join(","));const X=await De.search(e,W,{signal:E.signal});if(!yn.isValid(E.id))return;const{images:H,total:ue,hasMore:ve}=X;yn.complete(E.id),y(H),g({isLoading:!1,loadedCount:t.length+H.length,totalCount:ue,hasMore:ve||!1})}catch(W){if(W.name==="CanceledError"||W.name==="AbortError")return;console.error("Error loading more images:",W),yn.error(E.id),g({isLoading:!1})}},[e,l,t.length,d,v,x,y,g]);F.useEffect(()=>{let E=null,I=0;const W=10,X={current:0};let H=null;const ue=(Ne,Me)=>(Math.abs(Ne-X.current)<12||(X.current=Ne,H&&clearTimeout(H),H=setTimeout(()=>{R(Ne),k(Me)},50)),!0),ve=()=>{if(O.current){const Ne=O.current.offsetWidth-32,Me=O.current.offsetHeight;if(Ne>0)return ue(Ne,Me)}return!1},xe=()=>{ve()?O.current&&(E=new ResizeObserver(()=>{Wt.getState().isResizingPanels||ve()}),E.observe(O.current)):I{E&&E.disconnect(),H&&clearTimeout(H)}},[]),F.useEffect(()=>{if(j||!O.current)return;const E=O.current.offsetWidth-32,I=O.current.offsetHeight;E>0&&(R(E),k(I),D.current&&D.current.resetAfterIndex(0))},[j]);const ge=F.useMemo(()=>{if(!L.length||!le)return[];const E=16,I=T,W=[];let X=[],H=0;return L.forEach((ue,ve)=>{const xe=ue.width/ue.height,Ne=I*xe;X.push({...ue,originalWidth:Ne,aspectRatio:xe}),H+=Ne;const Me=(X.length-1)*E,Ze=H+Me,Ge=ve===L.length-1;let ft=!1;if(Ge)ft=!0;else if(Ze>=le*.95)ft=!0;else{const at=L[ve+1];if(at){const _t=at.width/at.height,Mt=I*_t;H+Mt+X.length*E>le*1.2&&(ft=!0)}}if(ft){const at=(X.length-1)*E;let Mt=(le-at)/H;Ge&&X.length<3&&(Mt=Math.min(Mt,1.2));const cn=I*Mt;X=X.map(dn=>({...dn,calculatedWidth:dn.originalWidth*Mt,calculatedHeight:cn})),W.push(X),X=[],H=0}}),W},[L,T,le]),Ue=E=>{const I=E.thumbnailPath;if(!e||!I)return"";const W=I.replace(/\\/g,"/").split("/").pop();return De.getThumbnailUrl(e,W)},Fe=E=>e?De.getOriginalUrl(e,E.path):"",ot=F.useMemo(()=>L.map(E=>({src:Fe(E),key:E.id})),[L,e]),wt=L.length>r2,nt=F.useCallback(E=>{if(!ge||!ge[E]||ge[E].length===0)return T+40;const I=ge[E][0];return((I==null?void 0:I.calculatedHeight)||T)+28+32},[ge,T]),Rt=F.useRef(0);F.useEffect(()=>{if(D.current&&wt){const E=Rt.current,I=ge.length;if(I>E&&E>0){const W=Math.max(0,E-1);D.current.resetAfterIndex(W)}else I!==E&&D.current.resetAfterIndex(0);Rt.current=I}},[ge,wt]);const $e=F.useMemo(()=>!ge||ge.length===0?[]:ge.flat(),[ge]),q=F.useCallback((E,I,W)=>{if(S(null),I.ctrlKey||I.metaKey)I.preventDefault(),o(E),B(W);else if(I.shiftKey&&Y!==null){I.preventDefault();const X=Math.min(Y,W),H=Math.max(Y,W),ue=$e.slice(X,H+1);i(ue)}else a(),r(E),B(W)},[$e,Y,o,i,a,r,S]),we=F.useCallback((E,I)=>{E.preventDefault(),A({isOpen:!0,position:{x:E.clientX,y:E.clientY},image:I})},[]),fe=async()=>{var ue;if(oe.length===0)return;const E=oe[oe.length-1],I=oe.slice(0,-1);J({isVisible:!1,message:"",count:0}),_e(I);const W=((ue=E.images[0])==null?void 0:ue.folder)||null,{folders:X,setFolders:H}=Ee.getState();if(X&&X.length>0){const ve=X.map(xe=>{const Ne=E.images.filter(Me=>{var Ze;return Me.folder===xe.path||((Ze=Me.folder)==null?void 0:Ze.startsWith(xe.path+"/"))}).length;return Ne>0?{...xe,count:(xe.count||0)+Ne}:xe});H(ve)}if(W&&W!==d)p(W),console.log(`📂 跳转到文件夹: ${W}`);else{const ve=[...t,...E.images];c(ve)}Promise.all([Kt.restore(e,E.items),De.getFolders(e)]).then(([ve,xe])=>{if(ve.failed.length>0){console.warn(`⚠️ 恢复失败: ${ve.failed.length} 个文件`);const Ne=ve.failed[0].error||"未知错误";_e(oe),W===d&&c(t),H(xe.folders),alert(`恢复失败: ${Ne} + +提示:超过5分钟的文件已移入系统回收站,请手动从回收站恢复。`)}else H(xe.folders)}).catch(ve=>{console.error("恢复失败:",ve),_e(oe),W===d&&c(t),De.getFolders(e).then(xe=>{H(xe.folders)}),alert("恢复失败: "+(ve.message||"未知错误"))})},je=async E=>{const I=s.length>0?s:n?[n]:[];if(I.length!==0)try{const W=I.map(H=>H.path);await De.updateRating(e,W,E);const X=t.map(H=>W.includes(H.path)?{...H,rating:E}:H);if(c(X),n&&W.includes(n.path)&&Ee.getState().setSelectedImage({...n,rating:E}),s.length>0){const H=s.map(ue=>W.includes(ue.path)?{...ue,rating:E}:ue);Ee.getState().setSelectedImages(H)}ce({isVisible:!0,rating:E,count:I.length}),console.log(`⭐ 已将 ${I.length} 张图片评为 ${E} 星`)}catch(W){console.error("评分失败:",W),alert("评分失败: "+(W.message||"未知错误"))}},Oe=async()=>{const E=s.length>0?s.map(xe=>({type:"file",path:xe.path})):n?[{type:"file",path:n.path}]:[];if(E.length===0)return;const I=new Set(E.map(xe=>xe.path)),W=t.filter(xe=>I.has(xe.path)),X=t.filter(xe=>!I.has(xe.path));c(X),a();const{folders:H,setFolders:ue}=Ee.getState();if(H&&H.length>0){const xe=H.map(Ne=>{const Me=W.filter(Ze=>{var Ge;return Ze.folder===Ne.path||((Ge=Ze.folder)==null?void 0:Ge.startsWith(Ne.path+"/"))}).length;return Me>0?{...Ne,count:Math.max(0,(Ne.count||0)-Me)}:Ne});ue(xe)}const ve=[...oe,{images:W,paths:Array.from(I),items:E}];_e(ve),J({isVisible:!0,message:`已将 ${E.length} 个文件移入临时文件夹(Ctrl+Z撤销 · ${ve.length}次)`,count:E.length}),Promise.all([Kt.delete(e,E),De.getFolders(e)]).then(([xe,Ne])=>{xe.failed.length>0?(console.warn(`⚠️ 删除失败: ${xe.failed.length} 个文件`,xe.failed),c(t),_e(oe),J({isVisible:!1,message:"",count:0}),ue(Ne.folders),alert("删除失败: 部分文件无法删除")):ue(Ne.folders)}).catch(xe=>{console.error("删除失败:",xe),c(t),_e(oe),J({isVisible:!1,message:"",count:0}),De.getFolders(e).then(Ne=>{ue(Ne.folders)}),alert("删除失败: "+(xe.message||"未知错误"))})},Pe=F.useCallback(()=>{const E=s.length>0?s.map(I=>({type:"file",path:I.path})):n?[{type:"file",path:n.path}]:[];E.length!==0&&(He(E),Te(!0),A({isOpen:!1,position:null,image:null}))},[s,n]),he=F.useCallback(async E=>{if(!e||Ce.length===0)return;Te(!1);const I=new Set(Ce.map(X=>X.path)),W=t.filter(X=>!I.has(X.path));c(W),a();try{const[X,H]=await Promise.all([Kt.move(e,Ce,E),De.getFolders(e)]);X.failed&&X.failed.length>0?(alert(`移动失败: ${X.failed[0].error}`),c(t)):console.log(`✅ 已移动 ${Ce.length} 个文件到: ${E||"根目录"}`),f(H.folders)}catch(X){console.error("移动失败:",X),alert("移动失败: "+(X.message||"未知错误")),c(t)}finally{He([])}},[e,Ce,t,c,a,f]),Ie=async E=>{try{if(typeof ClipboardItem>"u"||!navigator.clipboard||typeof navigator.clipboard.write!="function")return console.warn("系统剪贴板 API 不可用"),!1;if(E.length===0)return!1;if(E.length===1)try{const I=E[0],W=`/api/image/original/${e}/${I.path}`,H=await(await fetch(W)).blob(),ue=document.createElement("canvas"),ve=new Image;await new Promise((Me,Ze)=>{ve.onload=Me,ve.onerror=Ze,ve.src=URL.createObjectURL(H)}),ue.width=ve.width,ue.height=ve.height,ue.getContext("2d").drawImage(ve,0,0),URL.revokeObjectURL(ve.src);const Ne=await new Promise(Me=>{ue.toBlob(Me,"image/png")});return await navigator.clipboard.write([new ClipboardItem({"image/png":Ne})]),!0}catch(I){return console.warn("单图复制失败:",I),!1}try{const W=(await Promise.all(E.map(async H=>{const ue=`/api/image/original/${e}/${H.path}`,xe=await(await fetch(ue)).blob();return new Promise(Ne=>{const Me=new FileReader;Me.onloadend=()=>{Ne({dataUrl:Me.result,filename:H.filename})},Me.readAsDataURL(xe)})}))).map(({dataUrl:H,filename:ue})=>`${ue}`).join(""),X=E.map(H=>H.filename).join(` +`);return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([W],{type:"text/html"}),"text/plain":new Blob([X],{type:"text/plain"})})]),!0}catch(I){return console.warn("多图复制失败:",I),!1}}catch(I){return console.warn("写入系统剪贴板失败:",I),!1}},Le=F.useCallback(()=>{const E=s.length>0?s:n?[n]:[];if(E.length===0)return;const I=E.map(W=>({type:"file",path:W.path,data:W}));$(I,"copy"),console.log(`📋 已复制 ${I.length} 个文件到应用内剪贴板`),J({isVisible:!0,message:`已复制 ${I.length} 个文件`,count:I.length}),setTimeout(()=>{J({isVisible:!1,message:"",count:0})},3e3),Ie(E).then(W=>{W&&console.log("✅ 已写入系统剪贴板,可粘贴到外部应用")})},[s,n,$,e]),Ae=F.useCallback(async()=>{if(!e||!d)return;const{items:E}=de();if(!E||E.length===0)return;const I=t.filter(X=>X.folder===d),W=[];for(const X of E){const H=X.path.split("/").pop(),ue=X.path.substring(0,X.path.lastIndexOf("/"));I.some(xe=>xe.filename===H)&&W.push({path:X.path,name:H,isSameLocation:ue===d})}W.length>0?N({isOpen:!0,conflicts:W,pendingPaste:{items:E,targetFolder:d}}):await ne(E,d,"rename")},[e,d,de,t]),ne=F.useCallback(async(E,I,W)=>{if(!e)return;console.log(`📋 开始粘贴 ${E.length} 个文件到: ${I}`);const{folders:X,setFolders:H}=Ee.getState(),ue=X;if(X&&X.length>0){const ve=X.map(xe=>xe.path===I||I.startsWith(xe.path+"/")?{...xe,count:(xe.count||0)+E.length}:xe);H(ve)}J({isVisible:!0,message:`已粘贴 ${E.length} 个文件`,count:E.length}),setTimeout(()=>{J({isVisible:!1,message:"",count:0})},3e3),(async()=>{var ve,xe;try{const Ne=await Kt.copy(e,E,I,W),Me=((ve=Ne.success)==null?void 0:ve.length)||0,Ze=((xe=Ne.failed)==null?void 0:xe.length)||0;if(Ze>0&&(J({isVisible:!0,message:Me>0?`已粘贴 ${Me} 个文件,${Ze} 个失败`:`粘贴失败: ${Ne.failed[0].error}`,count:Me}),setTimeout(()=>{J({isVisible:!1,message:"",count:0})},3e3)),d===I){const ft={folder:d},at=await De.search(e,ft);c(at.images)}const Ge=await De.getFolders(e);H(Ge.folders)}catch(Ne){console.error("粘贴失败:",Ne),H(ue),J({isVisible:!1,message:"",count:0}),alert("粘贴失败: "+(Ne.message||"未知错误"))}})()},[e,d,c]),Se=F.useCallback(async E=>{var X,H,ue,ve;const{pendingPaste:I,pendingUpload:W}=V;if(N({isOpen:!1,conflicts:[],pendingPaste:null,pendingUpload:null}),I)await ne(I.items,I.targetFolder,E);else if(W){if(console.log(`处理上传冲突: ${E}`),E==="skip"){console.log("用户选择跳过上传");return}se({isUploading:!0,percent:0,current:0,total:W.files.length});try{const xe=await Kt.upload(e,W.targetFolder,W.files,Ge=>{const ft=Math.round(Ge.loaded*100/Ge.total);se(at=>({...at,percent:ft}))},E);se({isUploading:!1,percent:100,current:xe.success.length,total:W.files.length});const Ne=((X=xe.success)==null?void 0:X.length)||0,Me=((H=xe.failed)==null?void 0:H.length)||0;let Ze=`上传完成: 成功 ${Ne} 个`;if(Me>0&&(Ze+=`, 失败 ${Me} 个`),J({isVisible:!0,message:Ze,count:Ne}),setTimeout(()=>{J({isVisible:!1,message:"",count:0}),se({isUploading:!1,percent:0,current:0,total:0})},3e3),Ne>0){const Ge={folder:d||""},ft=await De.search(e,Ge);c(ft.images);const at=await De.getFolders(e);f(at.folders),setTimeout(async()=>{try{const _t=await De.search(e,Ge);c(_t.images),console.log("✅ 缩略图刷新完成")}catch(_t){console.error("刷新缩略图失败:",_t)}},2e3)}}catch(xe){console.error("上传失败:",xe),se({isUploading:!1,percent:0,current:0,total:0}),alert("上传失败: "+(((ve=(ue=xe.response)==null?void 0:ue.data)==null?void 0:ve.error)||xe.message||"未知错误"))}}},[V,ne,e,d,c,f]),ze=F.useCallback(()=>{N({isOpen:!1,conflicts:[],pendingPaste:null,pendingUpload:null})},[]),qe=F.useCallback(E=>{E.preventDefault(),E.stopPropagation();const I=E.dataTransfer.types,W=I.includes("Files"),X=I.includes("application/json");W&&!X&&z(!0)},[]),Je=F.useCallback(E=>{E.preventDefault(),E.stopPropagation();const I=E.dataTransfer.types,W=I.includes("Files"),X=I.includes("application/json");W&&!X?E.dataTransfer.dropEffect="copy":E.dataTransfer.dropEffect="none"},[]),st=F.useCallback(E=>{var W;E.preventDefault(),E.stopPropagation();const I=(W=O.current)==null?void 0:W.getBoundingClientRect();if(I){const X=E.clientX,H=E.clientY;(XI.right||HI.bottom)&&z(!1)}},[]),ct=F.useCallback(async E=>{var W,X,H,ue;if(E.preventDefault(),E.stopPropagation(),z(!1),!e){alert("请先选择素材库");return}const I=Array.from(E.dataTransfer.files);if(I.length!==0){console.log(`📤 准备上传 ${I.length} 个文件到: ${d||"根目录"}`),se({isUploading:!0,percent:0,current:0,total:I.length});try{const ve=await Kt.upload(e,d||"",I,Ge=>{const ft=Math.round(Ge.loaded*100/Ge.total);se(at=>({...at,percent:ft}))});se({isUploading:!1,percent:100,current:ve.success.length,total:I.length});const xe=ve.conflicts||[];if(xe.length>0){console.log(`⚠️ 检测到 ${xe.length} 个文件冲突`),N({isOpen:!0,conflicts:xe,pendingUpload:{files:I.filter(Ge=>{const ft=Ge.name;return xe.some(at=>at.name===ft)}),targetFolder:d||""}}),se({isUploading:!1,percent:0,current:0,total:0});return}const Ne=((W=ve.success)==null?void 0:W.length)||0,Me=((X=ve.failed)==null?void 0:X.length)||0;let Ze=`上传完成: 成功 ${Ne} 个`;if(Me>0&&(Ze+=`, 失败 ${Me} 个`),J({isVisible:!0,message:Ze,count:Ne}),setTimeout(()=>{J({isVisible:!1,message:"",count:0}),se({isUploading:!1,percent:0,current:0,total:0})},3e3),Ne>0){const Ge={folder:d||""},ft=await De.search(e,Ge);c(ft.images);const at=await De.getFolders(e);f(at.folders),setTimeout(async()=>{try{const _t=await De.search(e,Ge);c(_t.images),console.log("✅ 缩略图刷新完成")}catch(_t){console.error("刷新缩略图失败:",_t)}},2e3)}}catch(ve){console.error("上传失败:",ve),se({isUploading:!1,percent:0,current:0,total:0}),alert("上传失败: "+(((ue=(H=ve.response)==null?void 0:H.data)==null?void 0:ue.error)||ve.message||"未知错误"))}}},[e,d,c,f]),gt=F.useCallback(E=>{if(!E)return;b(E);const I=E.filename.substring(0,E.filename.lastIndexOf("."))||E.filename;m(I),setTimeout(()=>{K.current&&(K.current.focus(),K.current.select())},50)},[b]),et=F.useCallback(async()=>{if(!h||!Be.trim()){b(null),m("");return}const E=h.filename,I=E.substring(E.lastIndexOf(".")),W=Be.trim()+I;if(W===E){b(null),m("");return}try{const X=await Kt.rename(e,h.path,W),H=X.newPath,ue=X.newName;_(h.path,{path:H,filename:ue}),console.log(`✅ 重命名成功: ${E} → ${ue}`)}catch(X){console.error("重命名失败:",X),alert("重命名失败: "+(X.message||"未知错误"))}finally{b(null),m("")}},[h,Be,e,_]),tn=F.useCallback(()=>{b(null),m("")},[]),nn=F.useCallback(E=>{const I=s.length>0,W=[];return I||W.push(Dn.rename(()=>{A({isOpen:!1,position:null,image:null}),gt(E)})),W.push(Dn.copy(()=>{A({isOpen:!1,position:null,image:null}),Le()}),Dn.move(Pe),Dn.delete(async()=>{A({isOpen:!1,position:null,image:null}),await Oe()})),W},[s,n,Pe,gt,Le]),G=(E,I)=>{const W=(n==null?void 0:n.id)===E.id,X=s.some(ue=>ue.id===E.id),H=W||X;return u.jsxs("div",{className:"flex-shrink-0",style:{width:`${E.calculatedWidth}px`},children:[u.jsxs("div",{className:`relative group cursor-pointer overflow-hidden rounded-lg transition-all hover:shadow-lg ${H?"border-2 border-blue-400 dark:border-blue-500":"border border-gray-200 dark:border-gray-600"}`,style:{height:`${E.calculatedHeight}px`},onClick:ue=>q(E,ue,I),onDoubleClick:()=>{(E.fileType||"image")==="image"?re(I):te(E)},onContextMenu:ue=>we(ue,E),draggable:!0,onDragStart:ue=>{const xe=(s.length>0&&s.some(Ne=>Ne.id===E.id)?s:[E]).map(Ne=>({type:"file",path:Ne.path}));ue.dataTransfer.setData("application/json",JSON.stringify({items:xe})),ue.dataTransfer.effectAllowed="move"},children:[u.jsx("img",{src:Ue(E)||'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200"%3E%3Crect fill="%23f3f4f6" width="200" height="200"/%3E%3Ctext x="50%25" y="45%25" dominant-baseline="middle" text-anchor="middle" fill="%239ca3af" font-family="sans-serif" font-size="14"%3E需要同步%3C/text%3E%3Ctext x="50%25" y="60%25" dominant-baseline="middle" text-anchor="middle" fill="%23d1d5db" font-family="sans-serif" font-size="12"%3E点击同步按钮%3C/text%3E%3C/svg%3E',alt:E.filename,className:"w-full h-full object-cover",loading:"lazy",onError:ue=>{ue.target.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200"%3E%3Crect fill="%23fef2f2" width="200" height="200"/%3E%3Ctext x="50%25" y="45%25" dominant-baseline="middle" text-anchor="middle" fill="%23dc2626" font-family="sans-serif" font-size="14"%3E加载失败%3C/text%3E%3Ctext x="50%25" y="60%25" dominant-baseline="middle" text-anchor="middle" fill="%23f87171" font-family="sans-serif" font-size="12"%3E请重新同步%3C/text%3E%3C/svg%3E',ue.target.onerror=null}}),E.fileType&&E.fileType!=="image"&&u.jsxs("div",{className:`absolute top-2 right-2 rounded-md px-2 py-1 flex items-center gap-1 shadow-lg ${E.fileType==="video"?"bg-blue-500 bg-opacity-90":E.fileType==="audio"?"bg-pink-500 bg-opacity-90":E.fileType==="document"?"bg-green-500 bg-opacity-90":E.fileType==="design"?"bg-purple-500 bg-opacity-90":"bg-gray-500 bg-opacity-90"}`,children:[E.fileType==="video"&&u.jsx(hw,{className:"w-4 h-4 text-white fill-white"}),E.fileType==="audio"&&u.jsx(cw,{className:"w-4 h-4 text-white"}),E.fileType==="document"&&u.jsx(rw,{className:"w-4 h-4 text-white"}),E.fileType==="design"&&u.jsx(dw,{className:"w-4 h-4 text-white"}),E.fileType==="other"&&u.jsx(sw,{className:"w-4 h-4 text-white"}),u.jsx("span",{className:"text-white text-xs font-semibold uppercase",children:E.format||E.filename.split(".").pop()})]}),u.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-all pointer-events-none"})]}),u.jsx("div",{className:"mt-1 px-1 h-4 flex items-center",children:(h==null?void 0:h.id)===E.id?u.jsx("input",{ref:K,type:"text",value:Be,onChange:ue=>m(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?(ue.preventDefault(),et()):ue.key==="Escape"&&(ue.preventDefault(),tn())},onBlur:et,onClick:ue=>ue.stopPropagation(),className:"w-full text-xs text-center bg-transparent border-none outline-none focus:outline-none underline decoration-2 decoration-blue-500 underline-offset-2 truncate leading-none",style:{color:H?"#3b82f6":"#909090",fontWeight:H?"600":"400",padding:0,margin:0,height:"1rem"}}):u.jsx("p",{className:"text-xs truncate text-center transition-colors cursor-text m-0 leading-none",style:{color:H?"#3b82f6":"#909090",fontWeight:H?"600":"400",height:"1rem"},onDoubleClick:ue=>{s.length===0&&(ue.stopPropagation(),gt(E))},title:s.length===0?"双击重命名":"",children:E.filename})})]},E.id)},ye=({index:E,style:I})=>{var H;const W=ge[E];if(!W)return null;let X=0;for(let ue=0;ueG(ue,X+ve))})};return!L.length&&l.isLoading?u.jsxs("div",{ref:O,className:"h-full overflow-hidden relative",onDragEnter:qe,onDragOver:Je,onDragLeave:st,onDrop:ct,children:[C&&u.jsx("div",{className:"absolute inset-0 z-50 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none",children:u.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-8 shadow-2xl",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"text-6xl mb-4",children:"📤"}),u.jsx("p",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"拖放图片到这里"}),u.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"支持 JPG、PNG、GIF、WebP 等格式"})]})})}),ee.isUploading&&u.jsxs("div",{className:"absolute top-4 right-4 z-40 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 min-w-[300px]",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"正在上传..."}),u.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[ee.percent,"%"]})]}),u.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:u.jsx("div",{className:"bg-blue-500 h-2 rounded-full transition-all duration-300",style:{width:`${ee.percent}%`}})}),u.jsxs("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-right",children:["共 ",ee.total," 个文件"]})]})]}):L.length?!le&&L.length>0?u.jsx("div",{ref:O,className:"h-full overflow-hidden"}):u.jsxs("div",{ref:O,className:"h-full overflow-hidden relative",onDragEnter:qe,onDragOver:Je,onDragLeave:st,onDrop:ct,children:[C&&u.jsx("div",{className:"absolute inset-0 z-50 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none",children:u.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-8 shadow-2xl",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"text-6xl mb-4",children:"📤"}),u.jsx("p",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"拖放图片到这里"}),u.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"支持 JPG、PNG、GIF、WebP 等格式"})]})})}),ee.isUploading&&u.jsxs("div",{className:"absolute top-4 right-4 z-40 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 min-w-[300px]",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"正在上传..."}),u.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[ee.percent,"%"]})]}),u.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:u.jsx("div",{className:"bg-blue-500 h-2 rounded-full transition-all duration-300",style:{width:`${ee.percent}%`}})}),u.jsxs("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-right",children:["共 ",ee.total," 个文件"]})]}),u.jsx(Bw,{images:ot,visible:U>=0,onClose:()=>re(-1),index:U,onIndexChange:re,children:wt?u.jsx(Jw,{ref:D,height:Z||600,width:le+32,itemCount:ge.length,itemSize:nt,className:"p-4",overscanCount:ro.overscanCount,onScroll:({scrollOffset:E,scrollDirection:I})=>{if(I==="forward"&&l.hasMore&&!l.isLoading){const W=ge.reduce((H,ue,ve)=>H+nt(ve),0),X=E+(Z||600);W-X{if(l.hasMore&&!l.isLoading){const{scrollTop:I,scrollHeight:W,clientHeight:X}=E.target;W-I-X{var X;let W=0;for(let H=0;HG(H,W+ue))},I)})})})}),M&&u.jsx(e2,{file:M,libraryId:e,onClose:()=>te(null)}),u.jsx(Vm,{isOpen:P.isOpen,position:P.position,onClose:()=>A({isOpen:!1,position:null,image:null}),options:P.image?nn(P.image):[]}),u.jsx(qm,{isVisible:ie.isVisible,message:ie.message,onUndo:fe,onClose:()=>{J({isVisible:!1,message:"",count:0})}}),u.jsx(t2,{isVisible:ae.isVisible,rating:ae.rating,count:ae.count,onClose:()=>ce({isVisible:!1,rating:0,count:0})}),be&&u.jsx(Km,{folders:w,currentFolder:d,onSelect:he,onClose:()=>{Te(!1),He([])}}),u.jsx(n2,{isOpen:V.isOpen,conflicts:V.conflicts,onResolve:Se,onCancel:ze})]}):u.jsxs("div",{ref:O,className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400 relative",onDragEnter:qe,onDragOver:Je,onDragLeave:st,onDrop:ct,children:[C&&u.jsx("div",{className:"absolute inset-0 z-50 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 flex items-center justify-center pointer-events-none",children:u.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-8 shadow-2xl",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"text-6xl mb-4",children:"📤"}),u.jsx("p",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200 mb-2",children:"拖放图片到这里"}),u.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"支持 JPG、PNG、GIF、WebP 等格式"})]})})}),ee.isUploading&&u.jsxs("div",{className:"absolute top-4 right-4 z-40 bg-white dark:bg-gray-800 rounded-lg shadow-xl p-4 min-w-[300px]",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"正在上传..."}),u.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[ee.percent,"%"]})]}),u.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:u.jsx("div",{className:"bg-blue-500 h-2 rounded-full transition-all duration-300",style:{width:`${ee.percent}%`}})}),u.jsxs("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 text-right",children:["共 ",ee.total," 个文件"]})]}),u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-lg mb-2",children:"暂无图片"}),u.jsx("p",{className:"text-sm",children:"请添加素材库或调整搜索条件"}),u.jsx("p",{className:"text-xs mt-4 text-gray-400",children:"可以直接拖拽文件到这里上传"})]})]})}function o2(){const{currentLibraryId:e,getCurrentLibrary:t}=Rn(),{totalImageCount:n,totalSize:r,folders:s}=Ee(),i=t(),o=s.length,a=s.filter(d=>!d.parentPath||d.parentPath==="."||d.parentPath===""),l=d=>{if(d===0)return"0 B";const p=1024,v=["B","KB","MB","GB","TB"],x=Math.floor(Math.log(d)/Math.log(p));return Math.round(d/Math.pow(p,x)*100)/100+" "+v[x]};return u.jsx("div",{className:"flex-1 h-full overflow-y-auto bg-primary p-8",children:u.jsxs("div",{className:"max-w-4xl mx-auto",children:[u.jsxs("div",{className:"mb-8",children:[u.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:(i==null?void 0:i.name)||"素材库"}),(i==null?void 0:i.path)&&u.jsx("p",{className:"text-sm text-tertiary",children:i.path})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-12",children:[u.jsx("div",{className:"bg-secondary rounded-xl p-6 shadow-sm border",children:u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("div",{className:"p-3 bg-blue-100 rounded-lg text-accent",children:u.jsx(lw,{className:"w-6 h-6"})}),u.jsxs("div",{children:[u.jsx("div",{className:"text-2xl font-bold text-primary",children:n.toLocaleString()}),u.jsx("div",{className:"text-sm text-tertiary",children:"图片总数"})]})]})}),u.jsx("div",{className:"bg-secondary rounded-xl p-6 shadow-sm border",children:u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("div",{className:"p-3 bg-indigo-100 rounded-lg text-indigo-600",children:u.jsx(Yn,{className:"w-6 h-6"})}),u.jsxs("div",{children:[u.jsx("div",{className:"text-2xl font-bold text-primary",children:o.toLocaleString()}),u.jsx("div",{className:"text-sm text-tertiary",children:"文件夹数"})]})]})}),u.jsx("div",{className:"bg-secondary rounded-xl p-6 shadow-sm border",children:u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("div",{className:"p-3 bg-purple-100 rounded-lg text-purple-600",children:u.jsx(ow,{className:"w-6 h-6"})}),u.jsxs("div",{children:[u.jsx("div",{className:"text-2xl font-bold text-primary",children:l(r)}),u.jsx("div",{className:"text-sm text-tertiary",children:"总大小"})]})]})})]}),a.length>0&&u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-semibold text-primary mb-4",children:"根目录文件夹"}),u.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:a.map(d=>u.jsxs("div",{className:"bg-secondary rounded-lg p-4 shadow-sm border hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>Ee.getState().setSelectedFolder(d.path),children:[u.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[u.jsx(Yn,{className:"w-8 h-8 text-yellow-500 group-hover:text-yellow-400 transition-colors"}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsx("div",{className:"font-medium text-primary truncate",title:d.name,children:d.name})})]}),u.jsxs("div",{className:"text-xs text-tertiary",children:[d.imageCount||0," 张图片"]})]},d.path))})]}),a.length===0&&u.jsxs("div",{className:"text-center py-12 bg-secondary rounded-xl border border-dashed",children:[u.jsx(Yn,{className:"w-12 h-12 text-secondary mx-auto mb-4"}),u.jsx("h3",{className:"text-lg font-medium text-primary mb-2",children:"暂无文件夹"}),u.jsx("p",{className:"text-tertiary max-w-sm mx-auto",children:"您的素材库似乎是空的。请将图片添加到素材库目录中,系统会自动扫描。"})]})]})})}function If(){const{currentLibraryId:e}=Rn(),{searchKeywords:t,filters:n,selectedFolder:r,setImages:s,setOriginalImages:i,imageLoadingState:o,images:a}=Ee(),{scanProgress:l}=or(),d=F.useRef(null),p=F.useRef(null),v=()=>{if(!l||l.current===0)return null;if(l.estimatedTimeLeft!==void 0){const g=l.estimatedTimeLeft;return g<1?"即将完成":g<60?`剩余约 ${g} 秒`:`剩余约 ${Math.floor(g/60)} 分钟`}return null},x=F.useCallback(()=>{yn.cancelAll(ki.IMAGES),d.current=null},[]),y=F.useCallback(async(g=!0)=>{var w;if(!e)return;if(!r&&!t&&n.formats.length===0){s([]),Ee.getState().setImageLoadingState({isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1});return}g&&bw.clear(),gu(),x();const c=yn.createRequest(ki.IMAGES);d.current=c,Ee.getState().setImageLoadingState({...o,isLoading:!0});try{const f={offset:g?0:o.loadedCount,limit:100};r&&(f.folder=r),t&&(f.keywords=t),((w=n.formats)==null?void 0:w.length)>0&&(f.formats=n.formats.join(","));const h=await De.search(e,f,{signal:c.signal}),{images:b,total:_,hasMore:S}=h;if(!yn.isValid(c.id))return;yn.complete(c.id),g&&(s(b),i(b)),Ee.getState().setImageLoadingState({isLoading:!1,loadedCount:b.length,totalCount:_,hasMore:S||!1}),S&&vw(S)}catch(f){if(f.name==="CanceledError"||f.name==="AbortError")return;console.error("Error loading images:",f),yn.error(c.id)}finally{(yn.isValid(c.id)||c.status==="completed")&&(d.current=null)}},[e,t,r,s,i,x]);return F.useEffect(()=>{if(e)return p.current&&clearTimeout(p.current),x(),Ee.getState().setImageLoadingState({isLoading:!0,loadedCount:o.loadedCount,totalCount:o.totalCount,hasMore:!1}),p.current=setTimeout(()=>{y(!0)},50),()=>{p.current&&clearTimeout(p.current)}},[e,t,r,y,x]),F.useEffect(()=>{const g=localStorage.getItem("flypic_restore_folder");if(g){const{setSelectedFolder:c}=Ee.getState();c(g),localStorage.removeItem("flypic_restore_folder"),console.log("✅ 已恢复到文件夹:",g)}},[]),F.useEffect(()=>()=>{x(),p.current&&clearTimeout(p.current),fu.cancelPendingLoads(),fu.removeAllEventListeners()},[x]),u.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-gray-900",children:[l&&u.jsxs("div",{className:"p-4 border-b bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:(l==null?void 0:l.status)==="preparing"?"正在准备扫描...":"正在扫描素材库..."}),u.jsxs("span",{className:"text-sm text-blue-600 dark:text-blue-400",children:[(l==null?void 0:l.percent)||0,"%"]})]}),u.jsx("div",{className:"w-full rounded-full h-2 mb-2 bg-blue-200 dark:bg-blue-800",children:u.jsx("div",{className:"h-2 rounded-full transition-all bg-blue-500",style:{width:`${(l==null?void 0:l.percent)||0}%`}})}),u.jsxs("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:["已处理 ",(l==null?void 0:l.current)||0," / ",(l==null?void 0:l.total)||0," 张图片",v()&&` · ${v()}`]})]}),o.totalCount>0&&u.jsx("div",{className:"px-4 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:u.jsxs("div",{className:"flex items-center justify-between text-sm",children:[u.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["已加载 ",a.length," / ",o.totalCount," 张"]}),u.jsx("div",{className:"w-32 h-1.5 bg-gray-200 rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full bg-blue-500",style:{width:`${o.totalCount?a.length/o.totalCount*100:0}%`}})})]})}),u.jsx("div",{className:"flex-1 overflow-hidden",children:!r&&!t&&n.formats.length===0?u.jsx(o2,{}):u.jsx(i2,{})})]})}function so(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 Gm={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,s,i){function o(d,p){if(!s[d]){if(!r[d]){var v=typeof so=="function"&&so;if(!p&&v)return v(d,!0);if(a)return a(d,!0);var x=new Error("Cannot find module '"+d+"'");throw x.code="MODULE_NOT_FOUND",x}var y=s[d]={exports:{}};r[d][0].call(y.exports,function(g){var c=r[d][1][g];return o(c||g)},y,y.exports,n,r,s,i)}return s[d].exports}for(var a=typeof so=="function"&&so,l=0;l>2,y=(3&d)<<4|p>>4,g=1>6:64,c=2>4,p=(15&x)<<4|(y=a.indexOf(l.charAt(c++)))>>2,v=(3&y)<<6|(g=a.indexOf(l.charAt(c++))),h[w++]=d,y!==64&&(h[w++]=p),g!==64&&(h[w++]=v);return h}},{"./support":30,"./utils":32}],2:[function(n,r,s){var i=n("./external"),o=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function d(p,v,x,y,g){this.compressedSize=p,this.uncompressedSize=v,this.crc32=x,this.compression=y,this.compressedContent=g}d.prototype={getContentWorker:function(){var p=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),v=this;return p.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),p},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(p,v,x){return p.pipe(new a).pipe(new l("uncompressedSize")).pipe(v.compressWorker(x)).pipe(new l("compressedSize")).withStreamInfo("compression",v)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,s){var i=n("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},s.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,s){var i=n("./utils"),o=function(){for(var a,l=[],d=0;d<256;d++){a=d;for(var p=0;p<8;p++)a=1&a?3988292384^a>>>1:a>>>1;l[d]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(d,p,v,x){var y=o,g=x+v;d^=-1;for(var c=x;c>>8^y[255&(d^p[c])];return-1^d}(0|l,a,a.length,0):function(d,p,v,x){var y=o,g=x+v;d^=-1;for(var c=x;c>>8^y[255&(d^p.charCodeAt(c))];return-1^d}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(n,r,s){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,s){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),d=i?"uint8array":"array";function p(v,x){l.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=x,this.meta={}}s.magic="\b\0",a.inherits(p,l),p.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(d,v.data),!1)},p.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},p.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},p.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(x){v.push({data:x,meta:v.meta})}},s.compressWorker=function(v){return new p("Deflate",v)},s.uncompressWorker=function(){return new p("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,s){function i(y,g){var c,w="";for(c=0;c>>=8;return w}function o(y,g,c,w,f,h){var b,_,S=y.file,T=y.compression,j=h!==d.utf8encode,L=a.transformTo("string",h(S.name)),O=a.transformTo("string",d.utf8encode(S.name)),D=S.comment,le=a.transformTo("string",h(D)),R=a.transformTo("string",d.utf8encode(D)),Z=O.length!==S.name.length,k=R.length!==D.length,U="",re="",Y="",B=S.dir,M=S.date,te={crc32:0,compressedSize:0,uncompressedSize:0};g&&!c||(te.crc32=y.crc32,te.compressedSize=y.compressedSize,te.uncompressedSize=y.uncompressedSize);var P=0;g&&(P|=8),j||!Z&&!k||(P|=2048);var A=0,ie=0;B&&(A|=16),f==="UNIX"?(ie=798,A|=function(oe,_e){var ae=oe;return oe||(ae=_e?16893:33204),(65535&ae)<<16}(S.unixPermissions,B)):(ie=20,A|=function(oe){return 63&(oe||0)}(S.dosPermissions)),b=M.getUTCHours(),b<<=6,b|=M.getUTCMinutes(),b<<=5,b|=M.getUTCSeconds()/2,_=M.getUTCFullYear()-1980,_<<=4,_|=M.getUTCMonth()+1,_<<=5,_|=M.getUTCDate(),Z&&(re=i(1,1)+i(p(L),4)+O,U+="up"+i(re.length,2)+re),k&&(Y=i(1,1)+i(p(le),4)+R,U+="uc"+i(Y.length,2)+Y);var J="";return J+=` +\0`,J+=i(P,2),J+=T.magic,J+=i(b,2),J+=i(_,2),J+=i(te.crc32,4),J+=i(te.compressedSize,4),J+=i(te.uncompressedSize,4),J+=i(L.length,2),J+=i(U.length,2),{fileRecord:v.LOCAL_FILE_HEADER+J+L+U,dirRecord:v.CENTRAL_FILE_HEADER+i(ie,2)+J+i(le.length,2)+"\0\0\0\0"+i(A,4)+i(w,4)+L+U+le}}var a=n("../utils"),l=n("../stream/GenericWorker"),d=n("../utf8"),p=n("../crc32"),v=n("../signature");function x(y,g,c,w){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=c,this.encodeFileName=w,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(x,l),x.prototype.push=function(y){var g=y.meta.percent||0,c=this.entriesCount,w=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,l.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:c?(g+100*(c-w-1))/c:100}}))},x.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var g=this.streamFiles&&!y.file.dir;if(g){var c=o(y,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:c.fileRecord,meta:{percent:0}})}else this.accumulate=!0},x.prototype.closedSource=function(y){this.accumulate=!1;var g=this.streamFiles&&!y.file.dir,c=o(y,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(c.dirRecord),g)this.push({data:function(w){return v.DATA_DESCRIPTOR+i(w.crc32,4)+i(w.compressedSize,4)+i(w.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:c.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},x.prototype.flush=function(){for(var y=this.bytesWritten,g=0;g=this.index;l--)d=(d<<8)+this.byteAt(l);return this.index+=a,d},readString:function(a){return i.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,s){var i=n("./Uint8ArrayReader");function o(a){i.call(this,a)}n("../utils").inherits(o,i),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,s){var i=n("./DataReader");function o(a){i.call(this,a)}n("../utils").inherits(o,i),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,s){var i=n("./ArrayReader");function o(a){i.call(this,a)}n("../utils").inherits(o,i),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,s){var i=n("../utils"),o=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),d=n("./NodeBufferReader"),p=n("./Uint8ArrayReader");r.exports=function(v){var x=i.getTypeOf(v);return i.checkSupport(x),x!=="string"||o.uint8array?x==="nodebuffer"?new d(v):o.uint8array?new p(i.transformTo("uint8array",v)):new a(i.transformTo("array",v)):new l(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,s){var i=n("./GenericWorker"),o=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,i),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,s){var i=n("./GenericWorker"),o=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),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,s){var i=n("../utils"),o=n("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,o),a.prototype.processChunk=function(l){if(l){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,s){var i=n("../utils"),o=n("./GenericWorker");function a(l){o.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(p){d.dataIsReady=!0,d.data=p,d.max=p&&p.length||0,d.type=i.getTypeOf(p),d.isPaused||d._tickAndRepeat()},function(p){d.error(p)})}i.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,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,d=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,d);break;case"uint8array":l=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":l=this.data.slice(this.index,d)}return this.index=d,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,s){function i(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}i.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=i},{}],29:[function(n,r,s){var i=n("../utils"),o=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),d=n("../support"),p=n("../external"),v=null;if(d.nodestream)try{v=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function x(g,c){return new p.Promise(function(w,f){var h=[],b=g._internalType,_=g._outputType,S=g._mimeType;g.on("data",function(T,j){h.push(T),c&&c(j)}).on("error",function(T){h=[],f(T)}).on("end",function(){try{var T=function(j,L,O){switch(j){case"blob":return i.newBlob(i.transformTo("arraybuffer",L),O);case"base64":return l.encode(L);default:return i.transformTo(j,L)}}(_,function(j,L){var O,D=0,le=null,R=0;for(O=0;O"u")s.blob=!1;else{var i=new ArrayBuffer(0);try{s.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!n("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,s){for(var i=n("./utils"),o=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),d=new Array(256),p=0;p<256;p++)d[p]=252<=p?6:248<=p?5:240<=p?4:224<=p?3:192<=p?2:1;d[254]=d[254]=1;function v(){l.call(this,"utf-8 decode"),this.leftOver=null}function x(){l.call(this,"utf-8 encode")}s.utf8encode=function(y){return o.nodebuffer?a.newBufferFrom(y,"utf-8"):function(g){var c,w,f,h,b,_=g.length,S=0;for(h=0;h<_;h++)(64512&(w=g.charCodeAt(h)))==55296&&h+1<_&&(64512&(f=g.charCodeAt(h+1)))==56320&&(w=65536+(w-55296<<10)+(f-56320),h++),S+=w<128?1:w<2048?2:w<65536?3:4;for(c=o.uint8array?new Uint8Array(S):new Array(S),h=b=0;b>>6:(w<65536?c[b++]=224|w>>>12:(c[b++]=240|w>>>18,c[b++]=128|w>>>12&63),c[b++]=128|w>>>6&63),c[b++]=128|63&w);return c}(y)},s.utf8decode=function(y){return o.nodebuffer?i.transformTo("nodebuffer",y).toString("utf-8"):function(g){var c,w,f,h,b=g.length,_=new Array(2*b);for(c=w=0;c>10&1023,_[w++]=56320|1023&f)}return _.length!==w&&(_.subarray?_=_.subarray(0,w):_.length=w),i.applyFromCharCode(_)}(y=i.transformTo(o.uint8array?"uint8array":"array",y))},i.inherits(v,l),v.prototype.processChunk=function(y){var g=i.transformTo(o.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var c=g;(g=new Uint8Array(c.length+this.leftOver.length)).set(this.leftOver,0),g.set(c,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var w=function(h,b){var _;for((b=b||h.length)>h.length&&(b=h.length),_=b-1;0<=_&&(192&h[_])==128;)_--;return _<0||_===0?b:_+d[h[_]]>b?_:b}(g),f=g;w!==g.length&&(o.uint8array?(f=g.subarray(0,w),this.leftOver=g.subarray(w,g.length)):(f=g.slice(0,w),this.leftOver=g.slice(w,g.length))),this.push({data:s.utf8decode(f),meta:y.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=v,i.inherits(x,l),x.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=x},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,s){var i=n("./support"),o=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function d(c){return c}function p(c,w){for(var f=0;f>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var g,c,w,f=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?x[w++]=224|y>>>12:(x[w++]=240|y>>>18,x[w++]=128|y>>>12&63),x[w++]=128|y>>>6&63),x[w++]=128|63&y);return x},s.buf2binstring=function(v){return p(v,v.length)},s.binstring2buf=function(v){for(var x=new i.Buf8(v.length),y=0,g=x.length;y>10&1023,h[g++]=56320|1023&c)}return p(h,g)},s.utf8border=function(v,x){var y;for((x=x||v.length)>v.length&&(x=v.length),y=x-1;0<=y&&(192&v[y])==128;)y--;return y<0||y===0?x:y+l[v[y]]>x?y:x}},{"./common":41}],43:[function(n,r,s){r.exports=function(i,o,a,l){for(var d=65535&i|0,p=i>>>16&65535|0,v=0;a!==0;){for(a-=v=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,d){var p=i,v=d+l;o^=-1;for(var x=d;x>>8^p[255&(o^a[x])];return-1^o}},{}],46:[function(n,r,s){var i,o=n("../utils/common"),a=n("./trees"),l=n("./adler32"),d=n("./crc32"),p=n("./messages"),v=0,x=4,y=0,g=-2,c=-1,w=4,f=2,h=8,b=9,_=286,S=30,T=19,j=2*_+1,L=15,O=3,D=258,le=D+O+1,R=42,Z=113,k=1,U=2,re=3,Y=4;function B(m,K){return m.msg=p[K],K}function M(m){return(m<<1)-(4m.avail_out&&(V=m.avail_out),V!==0&&(o.arraySet(m.output,K.pending_buf,K.pending_out,V,m.next_out),m.next_out+=V,K.pending_out+=V,m.total_out+=V,m.avail_out-=V,K.pending-=V,K.pending===0&&(K.pending_out=0))}function A(m,K){a._tr_flush_block(m,0<=m.block_start?m.block_start:-1,m.strstart-m.block_start,K),m.block_start=m.strstart,P(m.strm)}function ie(m,K){m.pending_buf[m.pending++]=K}function J(m,K){m.pending_buf[m.pending++]=K>>>8&255,m.pending_buf[m.pending++]=255&K}function oe(m,K){var V,N,C=m.max_chain_length,z=m.strstart,ee=m.prev_length,se=m.nice_match,$=m.strstart>m.w_size-le?m.strstart-(m.w_size-le):0,de=m.window,ke=m.w_mask,pe=m.prev,ge=m.strstart+D,Ue=de[z+ee-1],Fe=de[z+ee];m.prev_length>=m.good_match&&(C>>=2),se>m.lookahead&&(se=m.lookahead);do if(de[(V=K)+ee]===Fe&&de[V+ee-1]===Ue&&de[V]===de[z]&&de[++V]===de[z+1]){z+=2,V++;do;while(de[++z]===de[++V]&&de[++z]===de[++V]&&de[++z]===de[++V]&&de[++z]===de[++V]&&de[++z]===de[++V]&&de[++z]===de[++V]&&de[++z]===de[++V]&&de[++z]===de[++V]&&z$&&--C!=0);return ee<=m.lookahead?ee:m.lookahead}function _e(m){var K,V,N,C,z,ee,se,$,de,ke,pe=m.w_size;do{if(C=m.window_size-m.lookahead-m.strstart,m.strstart>=pe+(pe-le)){for(o.arraySet(m.window,m.window,pe,pe,0),m.match_start-=pe,m.strstart-=pe,m.block_start-=pe,K=V=m.hash_size;N=m.head[--K],m.head[K]=pe<=N?N-pe:0,--V;);for(K=V=pe;N=m.prev[--K],m.prev[K]=pe<=N?N-pe:0,--V;);C+=pe}if(m.strm.avail_in===0)break;if(ee=m.strm,se=m.window,$=m.strstart+m.lookahead,de=C,ke=void 0,ke=ee.avail_in,de=O)for(z=m.strstart-m.insert,m.ins_h=m.window[z],m.ins_h=(m.ins_h<=O&&(m.ins_h=(m.ins_h<=O)if(N=a._tr_tally(m,m.strstart-m.match_start,m.match_length-O),m.lookahead-=m.match_length,m.match_length<=m.max_lazy_match&&m.lookahead>=O){for(m.match_length--;m.strstart++,m.ins_h=(m.ins_h<=O&&(m.ins_h=(m.ins_h<=O&&m.match_length<=m.prev_length){for(C=m.strstart+m.lookahead-O,N=a._tr_tally(m,m.strstart-1-m.prev_match,m.prev_length-O),m.lookahead-=m.prev_length-1,m.prev_length-=2;++m.strstart<=C&&(m.ins_h=(m.ins_h<m.pending_buf_size-5&&(V=m.pending_buf_size-5);;){if(m.lookahead<=1){if(_e(m),m.lookahead===0&&K===v)return k;if(m.lookahead===0)break}m.strstart+=m.lookahead,m.lookahead=0;var N=m.block_start+V;if((m.strstart===0||m.strstart>=N)&&(m.lookahead=m.strstart-N,m.strstart=N,A(m,!1),m.strm.avail_out===0)||m.strstart-m.block_start>=m.w_size-le&&(A(m,!1),m.strm.avail_out===0))return k}return m.insert=0,K===x?(A(m,!0),m.strm.avail_out===0?re:Y):(m.strstart>m.block_start&&(A(m,!1),m.strm.avail_out),k)}),new be(4,4,8,4,ae),new be(4,5,16,8,ae),new be(4,6,32,32,ae),new be(4,4,16,16,ce),new be(8,16,32,32,ce),new be(8,16,128,128,ce),new be(8,32,128,256,ce),new be(32,128,258,1024,ce),new be(32,258,258,4096,ce)],s.deflateInit=function(m,K){return Be(m,K,h,15,8,0)},s.deflateInit2=Be,s.deflateReset=He,s.deflateResetKeep=Ce,s.deflateSetHeader=function(m,K){return m&&m.state?m.state.wrap!==2?g:(m.state.gzhead=K,y):g},s.deflate=function(m,K){var V,N,C,z;if(!m||!m.state||5>8&255),ie(N,N.gzhead.time>>16&255),ie(N,N.gzhead.time>>24&255),ie(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ie(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(ie(N,255&N.gzhead.extra.length),ie(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(m.adler=d(m.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(ie(N,0),ie(N,0),ie(N,0),ie(N,0),ie(N,0),ie(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ie(N,3),N.status=Z);else{var ee=h+(N.w_bits-8<<4)<<8;ee|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(ee|=32),ee+=31-ee%31,N.status=Z,J(N,ee),N.strstart!==0&&(J(N,m.adler>>>16),J(N,65535&m.adler)),m.adler=1}if(N.status===69)if(N.gzhead.extra){for(C=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>C&&(m.adler=d(m.adler,N.pending_buf,N.pending-C,C)),P(m),C=N.pending,N.pending!==N.pending_buf_size));)ie(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>C&&(m.adler=d(m.adler,N.pending_buf,N.pending-C,C)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){C=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>C&&(m.adler=d(m.adler,N.pending_buf,N.pending-C,C)),P(m),C=N.pending,N.pending===N.pending_buf_size)){z=1;break}z=N.gzindexC&&(m.adler=d(m.adler,N.pending_buf,N.pending-C,C)),z===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){C=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>C&&(m.adler=d(m.adler,N.pending_buf,N.pending-C,C)),P(m),C=N.pending,N.pending===N.pending_buf_size)){z=1;break}z=N.gzindexC&&(m.adler=d(m.adler,N.pending_buf,N.pending-C,C)),z===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&P(m),N.pending+2<=N.pending_buf_size&&(ie(N,255&m.adler),ie(N,m.adler>>8&255),m.adler=0,N.status=Z)):N.status=Z),N.pending!==0){if(P(m),m.avail_out===0)return N.last_flush=-1,y}else if(m.avail_in===0&&M(K)<=M(V)&&K!==x)return B(m,-5);if(N.status===666&&m.avail_in!==0)return B(m,-5);if(m.avail_in!==0||N.lookahead!==0||K!==v&&N.status!==666){var se=N.strategy===2?function($,de){for(var ke;;){if($.lookahead===0&&(_e($),$.lookahead===0)){if(de===v)return k;break}if($.match_length=0,ke=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,ke&&(A($,!1),$.strm.avail_out===0))return k}return $.insert=0,de===x?(A($,!0),$.strm.avail_out===0?re:Y):$.last_lit&&(A($,!1),$.strm.avail_out===0)?k:U}(N,K):N.strategy===3?function($,de){for(var ke,pe,ge,Ue,Fe=$.window;;){if($.lookahead<=D){if(_e($),$.lookahead<=D&&de===v)return k;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=O&&0<$.strstart&&(pe=Fe[ge=$.strstart-1])===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]){Ue=$.strstart+D;do;while(pe===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]&&pe===Fe[++ge]&&ge$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=O?(ke=a._tr_tally($,1,$.match_length-O),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(ke=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),ke&&(A($,!1),$.strm.avail_out===0))return k}return $.insert=0,de===x?(A($,!0),$.strm.avail_out===0?re:Y):$.last_lit&&(A($,!1),$.strm.avail_out===0)?k:U}(N,K):i[N.level].func(N,K);if(se!==re&&se!==Y||(N.status=666),se===k||se===re)return m.avail_out===0&&(N.last_flush=-1),y;if(se===U&&(K===1?a._tr_align(N):K!==5&&(a._tr_stored_block(N,0,0,!1),K===3&&(te(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),P(m),m.avail_out===0))return N.last_flush=-1,y}return K!==x?y:N.wrap<=0?1:(N.wrap===2?(ie(N,255&m.adler),ie(N,m.adler>>8&255),ie(N,m.adler>>16&255),ie(N,m.adler>>24&255),ie(N,255&m.total_in),ie(N,m.total_in>>8&255),ie(N,m.total_in>>16&255),ie(N,m.total_in>>24&255)):(J(N,m.adler>>>16),J(N,65535&m.adler)),P(m),0=V.w_size&&(z===0&&(te(V.head),V.strstart=0,V.block_start=0,V.insert=0),de=new o.Buf8(V.w_size),o.arraySet(de,K,ke-V.w_size,V.w_size,0),K=de,ke=V.w_size),ee=m.avail_in,se=m.next_in,$=m.input,m.avail_in=ke,m.next_in=0,m.input=K,_e(V);V.lookahead>=O;){for(N=V.strstart,C=V.lookahead-(O-1);V.ins_h=(V.ins_h<>>=O=L>>>24,b-=O,(O=L>>>16&255)===0)U[p++]=65535&L;else{if(!(16&O)){if(!(64&O)){L=_[(65535&L)+(h&(1<>>=O,b-=O),b<15&&(h+=k[l++]<>>=O=L>>>24,b-=O,!(16&(O=L>>>16&255))){if(!(64&O)){L=S[(65535&L)+(h&(1<>>=O,b-=O,(O=p-v)>3,h&=(1<<(b-=D<<3))-1,i.next_in=l,i.next_out=p,i.avail_in=l>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function h(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(R){var Z;return R&&R.state?(Z=R.state,R.total_in=R.total_out=Z.total=0,R.msg="",Z.wrap&&(R.adler=1&Z.wrap),Z.mode=g,Z.last=0,Z.havedict=0,Z.dmax=32768,Z.head=null,Z.hold=0,Z.bits=0,Z.lencode=Z.lendyn=new i.Buf32(c),Z.distcode=Z.distdyn=new i.Buf32(w),Z.sane=1,Z.back=-1,x):y}function _(R){var Z;return R&&R.state?((Z=R.state).wsize=0,Z.whave=0,Z.wnext=0,b(R)):y}function S(R,Z){var k,U;return R&&R.state?(U=R.state,Z<0?(k=0,Z=-Z):(k=1+(Z>>4),Z<48&&(Z&=15)),Z&&(Z<8||15=Y.wsize?(i.arraySet(Y.window,Z,k-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(U<(re=Y.wsize-Y.wnext)&&(re=U),i.arraySet(Y.window,Z,k-U,re,Y.wnext),(U-=re)?(i.arraySet(Y.window,Z,k-U,U,0),Y.wnext=U,Y.whave=Y.wsize):(Y.wnext+=re,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave>>8&255,k.check=a(k.check,z,2,0),A=P=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&P)<<8)+(P>>8))%31){R.msg="incorrect header check",k.mode=30;break}if((15&P)!=8){R.msg="unknown compression method",k.mode=30;break}if(A-=4,m=8+(15&(P>>>=4)),k.wbits===0)k.wbits=m;else if(m>k.wbits){R.msg="invalid window size",k.mode=30;break}k.dmax=1<>8&1),512&k.flags&&(z[0]=255&P,z[1]=P>>>8&255,k.check=a(k.check,z,2,0)),A=P=0,k.mode=3;case 3:for(;A<32;){if(M===0)break e;M--,P+=U[Y++]<>>8&255,z[2]=P>>>16&255,z[3]=P>>>24&255,k.check=a(k.check,z,4,0)),A=P=0,k.mode=4;case 4:for(;A<16;){if(M===0)break e;M--,P+=U[Y++]<>8),512&k.flags&&(z[0]=255&P,z[1]=P>>>8&255,k.check=a(k.check,z,2,0)),A=P=0,k.mode=5;case 5:if(1024&k.flags){for(;A<16;){if(M===0)break e;M--,P+=U[Y++]<>>8&255,k.check=a(k.check,z,2,0)),A=P=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(M<(oe=k.length)&&(oe=M),oe&&(k.head&&(m=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),i.arraySet(k.head.extra,U,Y,oe,m)),512&k.flags&&(k.check=a(k.check,U,oe,Y)),M-=oe,Y+=oe,k.length-=oe),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(M===0)break e;for(oe=0;m=U[Y+oe++],k.head&&m&&k.length<65536&&(k.head.name+=String.fromCharCode(m)),m&&oe>9&1,k.head.done=!0),R.adler=k.check=0,k.mode=12;break;case 10:for(;A<32;){if(M===0)break e;M--,P+=U[Y++]<>>=7&A,A-=7&A,k.mode=27;break}for(;A<3;){if(M===0)break e;M--,P+=U[Y++]<>>=1)){case 0:k.mode=14;break;case 1:if(D(k),k.mode=20,Z!==6)break;P>>>=2,A-=2;break e;case 2:k.mode=17;break;case 3:R.msg="invalid block type",k.mode=30}P>>>=2,A-=2;break;case 14:for(P>>>=7&A,A-=7&A;A<32;){if(M===0)break e;M--,P+=U[Y++]<>>16^65535)){R.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&P,A=P=0,k.mode=15,Z===6)break e;case 15:k.mode=16;case 16:if(oe=k.length){if(M>>=5,A-=5,k.ndist=1+(31&P),P>>>=5,A-=5,k.ncode=4+(15&P),P>>>=4,A-=4,286>>=3,A-=3}for(;k.have<19;)k.lens[ee[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,V={bits:k.lenbits},K=d(0,k.lens,0,19,k.lencode,0,k.work,V),k.lenbits=V.bits,K){R.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have>>16&255,Te=65535&C,!((ce=C>>>24)<=A);){if(M===0)break e;M--,P+=U[Y++]<>>=ce,A-=ce,k.lens[k.have++]=Te;else{if(Te===16){for(N=ce+2;A>>=ce,A-=ce,k.have===0){R.msg="invalid bit length repeat",k.mode=30;break}m=k.lens[k.have-1],oe=3+(3&P),P>>>=2,A-=2}else if(Te===17){for(N=ce+3;A>>=ce)),P>>>=3,A-=3}else{for(N=ce+7;A>>=ce)),P>>>=7,A-=7}if(k.have+oe>k.nlen+k.ndist){R.msg="invalid bit length repeat",k.mode=30;break}for(;oe--;)k.lens[k.have++]=m}}if(k.mode===30)break;if(k.lens[256]===0){R.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,V={bits:k.lenbits},K=d(p,k.lens,0,k.nlen,k.lencode,0,k.work,V),k.lenbits=V.bits,K){R.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,V={bits:k.distbits},K=d(v,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,V),k.distbits=V.bits,K){R.msg="invalid distances set",k.mode=30;break}if(k.mode=20,Z===6)break e;case 20:k.mode=21;case 21:if(6<=M&&258<=te){R.next_out=B,R.avail_out=te,R.next_in=Y,R.avail_in=M,k.hold=P,k.bits=A,l(R,J),B=R.next_out,re=R.output,te=R.avail_out,Y=R.next_in,U=R.input,M=R.avail_in,P=k.hold,A=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;be=(C=k.lencode[P&(1<>>16&255,Te=65535&C,!((ce=C>>>24)<=A);){if(M===0)break e;M--,P+=U[Y++]<>Ce)])>>>16&255,Te=65535&C,!(Ce+(ce=C>>>24)<=A);){if(M===0)break e;M--,P+=U[Y++]<>>=Ce,A-=Ce,k.back+=Ce}if(P>>>=ce,A-=ce,k.back+=ce,k.length=Te,be===0){k.mode=26;break}if(32&be){k.back=-1,k.mode=12;break}if(64&be){R.msg="invalid literal/length code",k.mode=30;break}k.extra=15&be,k.mode=22;case 22:if(k.extra){for(N=k.extra;A>>=k.extra,A-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;be=(C=k.distcode[P&(1<>>16&255,Te=65535&C,!((ce=C>>>24)<=A);){if(M===0)break e;M--,P+=U[Y++]<>Ce)])>>>16&255,Te=65535&C,!(Ce+(ce=C>>>24)<=A);){if(M===0)break e;M--,P+=U[Y++]<>>=Ce,A-=Ce,k.back+=Ce}if(P>>>=ce,A-=ce,k.back+=ce,64&be){R.msg="invalid distance code",k.mode=30;break}k.offset=Te,k.extra=15&be,k.mode=24;case 24:if(k.extra){for(N=k.extra;A>>=k.extra,A-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){R.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(te===0)break e;if(oe=J-te,k.offset>oe){if((oe=k.offset-oe)>k.whave&&k.sane){R.msg="invalid distance too far back",k.mode=30;break}_e=oe>k.wnext?(oe-=k.wnext,k.wsize-oe):k.wnext-oe,oe>k.length&&(oe=k.length),ae=k.window}else ae=re,_e=B-k.offset,oe=k.length;for(tej?(O=_e[ae+w[Z]],A[ie+w[Z]]):(O=96,0),h=1<>B)+(b-=h)]=L<<24|O<<16|D|0,b!==0;);for(h=1<>=1;if(h!==0?(P&=h-1,P+=h):P=0,Z++,--J[R]==0){if(R===U)break;R=v[x+w[Z]]}if(re>>7)]}function ie(C,z){C.pending_buf[C.pending++]=255&z,C.pending_buf[C.pending++]=z>>>8&255}function J(C,z,ee){C.bi_valid>f-ee?(C.bi_buf|=z<>f-C.bi_valid,C.bi_valid+=ee-f):(C.bi_buf|=z<>>=1,ee<<=1,0<--z;);return ee>>>1}function ae(C,z,ee){var se,$,de=new Array(w+1),ke=0;for(se=1;se<=w;se++)de[se]=ke=ke+ee[se-1]<<1;for($=0;$<=z;$++){var pe=C[2*$+1];pe!==0&&(C[2*$]=_e(de[pe]++,pe))}}function ce(C){var z;for(z=0;z>1;1<=ee;ee--)Ce(C,de,ee);for($=ge;ee=C.heap[1],C.heap[1]=C.heap[C.heap_len--],Ce(C,de,1),se=C.heap[1],C.heap[--C.heap_max]=ee,C.heap[--C.heap_max]=se,de[2*$]=de[2*ee]+de[2*se],C.depth[$]=(C.depth[ee]>=C.depth[se]?C.depth[ee]:C.depth[se])+1,de[2*ee+1]=de[2*se+1]=$,C.heap[1]=$++,Ce(C,de,1),2<=C.heap_len;);C.heap[--C.heap_max]=C.heap[1],function(Fe,ot){var wt,nt,Rt,$e,q,we,fe=ot.dyn_tree,je=ot.max_code,Oe=ot.stat_desc.static_tree,Pe=ot.stat_desc.has_stree,he=ot.stat_desc.extra_bits,Ie=ot.stat_desc.extra_base,Le=ot.stat_desc.max_length,Ae=0;for($e=0;$e<=w;$e++)Fe.bl_count[$e]=0;for(fe[2*Fe.heap[Fe.heap_max]+1]=0,wt=Fe.heap_max+1;wt>=7;$>>=1)if(1&Ue&&pe.dyn_ltree[2*ge]!==0)return o;if(pe.dyn_ltree[18]!==0||pe.dyn_ltree[20]!==0||pe.dyn_ltree[26]!==0)return a;for(ge=32;ge>>3,(de=C.static_len+3+7>>>3)<=$&&($=de)):$=de=ee+5,ee+4<=$&&z!==-1?N(C,z,ee,se):C.strategy===4||de===$?(J(C,2+(se?1:0),3),He(C,le,R)):(J(C,4+(se?1:0),3),function(pe,ge,Ue,Fe){var ot;for(J(pe,ge-257,5),J(pe,Ue-1,5),J(pe,Fe-4,4),ot=0;ot>>8&255,C.pending_buf[C.d_buf+2*C.last_lit+1]=255&z,C.pending_buf[C.l_buf+C.last_lit]=255&ee,C.last_lit++,z===0?C.dyn_ltree[2*ee]++:(C.matches++,z--,C.dyn_ltree[2*(k[ee]+v+1)]++,C.dyn_dtree[2*A(z)]++),C.last_lit===C.lit_bufsize-1},s._tr_align=function(C){J(C,2,3),oe(C,b,le),function(z){z.bi_valid===16?(ie(z,z.bi_buf),z.bi_buf=0,z.bi_valid=0):8<=z.bi_valid&&(z.pending_buf[z.pending++]=255&z.bi_buf,z.bi_buf>>=8,z.bi_valid-=8)}(C)}},{"../utils/common":41}],53:[function(n,r,s){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,s){(function(i){(function(o,a){if(!o.setImmediate){var l,d,p,v,x=1,y={},g=!1,c=o.document,w=Object.getPrototypeOf&&Object.getPrototypeOf(o);w=w&&w.setTimeout?w:o,l={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){h(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,S=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=S,_}}()?(v="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",b,!1):o.attachEvent("onmessage",b),function(_){o.postMessage(v+_,"*")}):o.MessageChannel?((p=new MessageChannel).port1.onmessage=function(_){h(_.data)},function(_){p.port2.postMessage(_)}):c&&"onreadystatechange"in c.createElement("script")?(d=c.documentElement,function(_){var S=c.createElement("script");S.onreadystatechange=function(){h(_),S.onreadystatechange=null,d.removeChild(S),S=null},d.appendChild(S)}):function(_){setTimeout(h,0,_)},w.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var S=new Array(arguments.length-1),T=0;T"u"?i===void 0?this:i:self)}).call(this,typeof Pi<"u"?Pi:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Gm);var a2=Gm.exports;const Af=Su(a2);function Pf({rating:e,onChange:t,size:n=20,disabled:r=!1}){const[s,i]=F.useState(0),o=s||e||0,a=l=>{if(r)return;const d=e===l?0:l;t==null||t(d)};return u.jsxs("div",{className:"flex items-center gap-1",onMouseLeave:()=>i(0),children:[[1,2,3,4,5].map(l=>{const d=l<=o,p=s>0&&l<=s;return u.jsx("button",{type:"button",disabled:r,className:` + transition-all duration-150 + ${r?"cursor-not-allowed opacity-50":"cursor-pointer hover:scale-110"} + ${p?"animate-pulse":""} + `,onMouseEnter:()=>!r&&i(l),onClick:()=>a(l),title:`${l} 星`,children:u.jsx(bi,{size:n,className:` + transition-colors duration-150 + ${d?"fill-yellow-400 text-yellow-400":"fill-none text-gray-300 dark:text-gray-600"} + ${p?"drop-shadow-lg":""} + `})},l)}),o>0&&u.jsxs("span",{className:"ml-2 text-sm text-gray-600 dark:text-gray-400",children:[o," 星"]})]})}function Lf(){const{currentLibraryId:e}=Rn(),{selectedImage:t,selectedImages:n,selectedFolder:r,selectedFolderItem:s,images:i,setSelectedImage:o,setSelectedImages:a,updateImage:l}=Ee(),{setMobileView:d,isResizingPanels:p,resizingSide:v}=Wt(),{copyToClipboard:x}=Ym(),[y,g]=F.useState(!1),[c,w]=F.useState(""),[f,h]=F.useState(!1),[b,_]=F.useState(!1),[S,T]=F.useState(!1),[j,L]=F.useState(0),[O,D]=F.useState(!1),[le,R]=F.useState(0),[Z,k]=F.useState(!1),[U,re]=F.useState(!1),[Y,B]=F.useState(""),M=F.useRef(null),[te,P]=F.useState(!1),A=n.length>0?t&&!n.some(q=>q.id===t.id)?n.length+1:n.length:t?1:0,ie=A>1,J=n.length>0?n[0]:t,{getCurrentLibrary:oe}=Rn(),_e=oe(),ae=()=>{const q=navigator.platform.toLowerCase(),we=navigator.userAgent.toLowerCase();return q.includes("win")||we.includes("windows")?"\\":"/"},ce=q=>{if(!q)return"";const we=ae();return q.replace(/[\\/]+/g,we)},be=q=>{if(!(_e!=null&&_e.path)||!q)return q||"";const we=ae(),fe=_e.path.replace(/[\\/]+$/,""),je=q.replace(/^[\\/]+/,""),Oe=`${fe}${we}${je}`;return ce(Oe)},Te=q=>{if(!q||q.length===0)return"";if(q.length===1)return be(q[0].path);const we=ae(),je=q.map(he=>be(he.path)).map(he=>he.split(/[\\/]/)),Oe=[],Pe=Math.min(...je.map(he=>he.length-1));for(let he=0;heLe[he]===Ie))Oe.push(Ie);else break}return Oe.length>0?Oe.join(we):ce((_e==null?void 0:_e.path)||"")},Ce=async q=>{try{navigator.clipboard&&navigator.clipboard.writeText?await navigator.clipboard.writeText(q):de(q),k(!0),setTimeout(()=>k(!1),2e3)}catch(we){console.error("复制路径失败:",we),alert("复制失败,请重试")}},He=()=>{if(!t||ie)return;const q=t.filename.substring(0,t.filename.lastIndexOf("."))||t.filename;B(q),re(!0),setTimeout(()=>{M.current&&(M.current.focus(),M.current.select())},50)},Be=async()=>{if(!t||!Y.trim()){re(!1),B("");return}const q=t.filename,we=q.substring(q.lastIndexOf(".")),fe=Y.trim()+we;if(fe===q){re(!1),B("");return}try{const je=await Kt.rename(e,t.path,fe),Oe=je.data.newPath,Pe=je.data.newName;l(t.path,{path:Oe,filename:Pe}),console.log(`✅ 重命名成功: ${q} → ${Pe}`)}catch(je){console.error("重命名失败:",je),alert("重命名失败: "+(je.message||"未知错误"))}finally{re(!1),B("")}},m=()=>{re(!1),B("")},K=async q=>{const we=ge();if(we.length!==0){P(!0);try{const fe=we.map(je=>je.path);if(await De.updateRating(e,fe,q),we.forEach(je=>{l(je.path,{rating:q})}),t&&fe.includes(t.path)&&o({...t,rating:q}),n.length>0){const je=n.map(Oe=>fe.includes(Oe.path)?{...Oe,rating:q}:Oe);a(je)}console.log(`✅ 已更新 ${fe.length} 张图片的评分为 ${q} 星`)}catch(fe){console.error("更新评分失败:",fe),alert("更新评分失败: "+(fe.message||"未知错误"))}finally{P(!1)}}};F.useEffect(()=>{const q=()=>{g(window.innerWidth<768)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),F.useEffect(()=>{if(!t||!e){w("");return}const q=C();if(w(q),h(!0),p){h(!1);return}const we=z(),fe=new Image;return fe.onload=()=>{w(we),h(!1)},fe.onerror=()=>{console.error("Failed to load original image"),h(!1)},fe.src=we,()=>{fe.onload=null,fe.onerror=null}},[t,e,p,v]);const V=s&&!t&&n.length===0,N=!V&&(t||n.length>0);if(!V&&!N)return u.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:u.jsx("p",{className:"text-gray-400 dark:text-gray-500 text-sm",children:"选择文件或文件夹查看详情"})});const C=()=>{if(!e||!(t!=null&&t.thumbnail_path))return"";const q=t.thumbnail_path.replace(/\\/g,"/").split("/").pop();return De.getThumbnailUrl(e,q)},z=()=>!e||!(t!=null&&t.path)?"":De.getOriginalUrl(e,t.path),ee=()=>typeof ClipboardItem<"u"&&navigator.clipboard&&typeof navigator.clipboard.write=="function",se=async q=>new Promise(we=>{const fe=document.createElement("div");fe.setAttribute("contenteditable","true"),fe.style.position="fixed",fe.style.left="-9999px",fe.style.top="-9999px",fe.style.opacity="0",document.body.appendChild(fe);const je=document.createElement("img");je.crossOrigin="anonymous",je.onload=()=>{fe.appendChild(je);const Oe=document.createRange();Oe.selectNodeContents(fe);const Pe=window.getSelection();Pe.removeAllRanges(),Pe.addRange(Oe);let he=!1;try{he=document.execCommand("copy")}catch(Ie){console.error("execCommand copy 失败:",Ie)}Pe.removeAllRanges(),document.body.removeChild(fe),we(he)},je.onerror=()=>{document.body.removeChild(fe),we(!1)},je.src=q}),$=async q=>new Promise(async we=>{try{const je=await(await fetch(q)).blob(),Oe=new Image;Oe.crossOrigin="anonymous";const Pe=new Promise((Je,st)=>{Oe.onload=Je,Oe.onerror=st});Oe.src=URL.createObjectURL(je),await Pe;const he=document.createElement("canvas");he.width=Oe.width,he.height=Oe.height,he.getContext("2d").drawImage(Oe,0,0),URL.revokeObjectURL(Oe.src);const Le=he.toDataURL("image/png"),Ae=document.createElement("div");Ae.setAttribute("contenteditable","true"),Ae.style.position="fixed",Ae.style.left="-9999px",Ae.style.top="-9999px",Ae.style.opacity="0",document.body.appendChild(Ae);const ne=document.createElement("img");ne.src=Le,Ae.appendChild(ne),await new Promise(Je=>setTimeout(Je,50));const Se=document.createRange();Se.selectNodeContents(Ae);const ze=window.getSelection();ze.removeAllRanges(),ze.addRange(Se);let qe=!1;try{qe=document.execCommand("copy")}catch(Je){console.error("execCommand copy 失败:",Je)}ze.removeAllRanges(),document.body.removeChild(Ae),we(qe)}catch(fe){console.error("Canvas 复制失败:",fe),we(!1)}}),de=q=>{const we=document.createElement("textarea");we.value=q,we.style.position="fixed",we.style.left="-9999px",we.style.top="-9999px",document.body.appendChild(we),we.focus(),we.select();try{return document.execCommand("copy"),!0}catch(fe){return console.error("execCommand 复制失败:",fe),!1}finally{document.body.removeChild(we)}},ke=async()=>{try{const q=[{type:"file",path:t.path,data:t}];x(q,"copy"),console.log("📋 已复制 1 个文件到应用内剪贴板");const we=De.getOriginalUrl(e,t.path);if(ee())try{const he=await(await fetch(we)).blob(),Ie=new Image,Le=new Promise((qe,Je)=>{Ie.onload=qe,Ie.onerror=Je});Ie.src=URL.createObjectURL(he),await Le;const Ae=document.createElement("canvas");Ae.width=Ie.width,Ae.height=Ie.height,Ae.getContext("2d").drawImage(Ie,0,0),URL.revokeObjectURL(Ie.src);const Se=await new Promise(qe=>{Ae.toBlob(qe,"image/png")}),ze=new ClipboardItem({"image/png":Se});await navigator.clipboard.write([ze]),_(!0),setTimeout(()=>_(!1),2e3);return}catch(Pe){console.warn("Clipboard API 失败,尝试备用方案:",Pe)}if(console.log("尝试 Canvas + execCommand 方案..."),await $(we)){_(!0),setTimeout(()=>_(!1),2e3);return}if(console.log("尝试直接图片 URL 方案..."),await se(we)){_(!0),setTimeout(()=>_(!1),2e3);return}console.warn("所有图片复制方案失败,降级为复制链接"),de(we)?(_(!0),setTimeout(()=>_(!1),2e3),alert(`已复制图片链接到剪贴板 +(当前浏览器环境限制,无法直接复制图片)`)):alert(`复制失败,请手动复制图片链接: +`+we)}catch(q){console.error("复制图片失败:",q),alert("复制图片失败,请重试")}},pe=async q=>new Promise(async we=>{try{const fe=document.createElement("div");fe.setAttribute("contenteditable","true"),fe.style.position="fixed",fe.style.left="-9999px",fe.style.top="-9999px",fe.style.opacity="0",document.body.appendChild(fe);for(const{url:he,filename:Ie}of q)try{const Ae=await(await fetch(he)).blob(),ne=new Image;ne.crossOrigin="anonymous",await new Promise((st,ct)=>{ne.onload=st,ne.onerror=ct,ne.src=URL.createObjectURL(Ae)});const Se=document.createElement("canvas");Se.width=ne.width,Se.height=ne.height,Se.getContext("2d").drawImage(ne,0,0),URL.revokeObjectURL(ne.src);const qe=Se.toDataURL("image/png"),Je=document.createElement("img");Je.src=qe,Je.alt=Ie,Je.style.display="block",Je.style.marginBottom="10px",fe.appendChild(Je)}catch(Le){console.error(`加载图片失败: ${Ie}`,Le)}await new Promise(he=>setTimeout(he,100));const je=document.createRange();je.selectNodeContents(fe);const Oe=window.getSelection();Oe.removeAllRanges(),Oe.addRange(je);let Pe=!1;try{Pe=document.execCommand("copy")}catch(he){console.error("execCommand copy 失败:",he)}Oe.removeAllRanges(),document.body.removeChild(fe),we(Pe)}catch(fe){console.error("批量复制图片失败:",fe),we(!1)}}),ge=()=>n.length>0?t&&!n.some(q=>q.id===t.id)?[t,...n]:n:t?[t]:[],Ue=async()=>{try{const q=ge(),we=q.map(he=>({type:"file",path:he.path,data:he}));if(x(we,"copy"),console.log(`📋 已复制 ${we.length} 个文件到应用内剪贴板`),q.length===1){await ke();return}const fe=q.map(he=>({url:De.getOriginalUrl(e,he.path),filename:he.filename})),je=q.map(he=>he.filename).join(` +`);if(ee())try{const Ie=(await Promise.all(q.map(async Le=>{const Ae=De.getOriginalUrl(e,Le.path),Se=await(await fetch(Ae)).blob();return new Promise(ze=>{const qe=new FileReader;qe.onloadend=()=>{ze({dataUrl:qe.result,filename:Le.filename})},qe.readAsDataURL(Se)})}))).map(({dataUrl:Le,filename:Ae})=>`${Ae}`).join("");await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([Ie],{type:"text/html"}),"text/plain":new Blob([je],{type:"text/plain"})})]),_(!0),setTimeout(()=>_(!1),2e3);return}catch(he){console.warn("Clipboard API 失败,尝试备用方案:",he)}if(console.log("尝试 contenteditable 批量复制方案..."),await pe(fe)){_(!0),setTimeout(()=>_(!1),2e3);return}console.warn("批量图片复制失败,降级为复制文件名"),de(je)?(_(!0),setTimeout(()=>_(!1),2e3),alert(`已复制 ${q.length} 个文件名到剪贴板 +(当前环境限制,建议使用"导出"功能)`)):alert('复制失败,请使用"导出"功能下载图片')}catch(q){console.error("复制图片失败:",q),alert("复制图片失败,请重试")}},Fe=async()=>{T(!0);try{const q=ge();if(q.length===1){const we=De.getOriginalUrl(e,q[0].path),fe=document.createElement("a");fe.href=we,fe.download=q[0].filename,fe.target="_blank",document.body.appendChild(fe),fe.click(),document.body.removeChild(fe)}else{const we=new Af,fe=we.folder("images");L(0);for(let Pe=0;Pe{if(!r){alert("请先选择一个文件夹");return}D(!0),R(0);try{const q=i.filter(he=>he.folder&&he.folder.startsWith(r));if(q.length===0){alert("当前文件夹没有图片");return}const we=new Af,fe=r.split("/").pop()||"images",je=we.folder(fe);for(let he=0;heq<1024?q+" B":q<1024*1024?(q/1024).toFixed(2)+" KB":(q/(1024*1024)).toFixed(2)+" MB",nt=q=>{if(!q)return"无数据";const we=new Date(q);return isNaN(we.getTime())?"无效日期":we.toLocaleString("zh-CN")},Rt=()=>{const q=ge();if(q.length===0)return null;const we=q.reduce((et,tn)=>et+(tn.size||0),0),fe=q.map(et=>et.width).filter(Boolean),je=q.map(et=>et.height).filter(Boolean),Oe=fe.length>0?Math.min(...fe):0,Pe=fe.length>0?Math.max(...fe):0,he=je.length>0?Math.min(...je):0,Ie=je.length>0?Math.max(...je):0,Le=[...new Set(q.map(et=>et.format).filter(Boolean))],Ae=q.map(et=>et.createdAt||et.created_at).filter(Boolean),ne=Ae.length>0?Math.min(...Ae):null,Se=Ae.length>0?Math.max(...Ae):null,ze=q.map(et=>et.modifiedAt||et.modified_at).filter(Boolean),qe=ze.length>0?Math.min(...ze):null,Je=ze.length>0?Math.max(...ze):null,st=q.map(et=>et.size).filter(Boolean),ct=st.length>0?Math.min(...st):0,gt=st.length>0?Math.max(...st):0;return{count:q.length,totalSize:we,sizeRange:{min:ct,max:gt},dimensionRange:{minWidth:Oe,maxWidth:Pe,minHeight:he,maxHeight:Ie},formats:Le,timeRange:{min:ne,max:Se},modifiedTimeRange:{min:qe,max:Je}}},$e=q=>{const we=i.filter(Oe=>{const Pe=Oe.folder||"";return Pe===q||Pe.startsWith(q+"/")}),fe=we.length,je=we.reduce((Oe,Pe)=>Oe+(Pe.size||0),0);return{totalCount:fe,totalSize:je}};if(V){const q=s.path,we=s.name,{totalCount:fe,totalSize:je}=$e(q),Oe=_e!=null&&_e.path?ce(`${_e.path}${ae()}${q}`):q;return u.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:[y&&u.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:u.jsxs("button",{onClick:()=>d("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[u.jsx(ff,{className:"w-5 h-5"}),u.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),u.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:u.jsx("div",{className:"w-full aspect-square bg-gradient-to-br from-blue-50 to-blue-100 dark:from-blue-900 dark:to-blue-800 border border-gray-200 dark:border-gray-600 rounded-lg overflow-hidden relative flex items-center justify-center",children:u.jsx(Yn,{className:"w-32 h-32 text-blue-500 dark:text-blue-300"})})}),u.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"文件夹信息"}),u.jsxs("div",{className:"space-y-2 text-sm",children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件夹名:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100 break-all",children:we})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"包含图片:"}),u.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[fe," 张(含子文件夹)"]})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"总大小:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:wt(je)})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"路径:"}),u.jsxs("div",{className:"flex items-start gap-2 mt-1",children:[u.jsx("p",{className:"flex-1 text-gray-900 dark:text-gray-100 text-xs break-all cursor-pointer hover:text-blue-500 transition-colors",onClick:()=>Ce(Oe),title:"点击复制路径",children:Oe}),u.jsx("button",{onClick:()=>Ce(Oe),className:`flex-shrink-0 p-1 rounded transition-colors ${Z?"text-green-500":"text-gray-400 hover:text-blue-500 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"复制路径",children:Z?u.jsx(rl,{className:"w-4 h-4"}):u.jsx(Co,{className:"w-4 h-4"})})]})]})]})]})}),!y&&fe>0&&u.jsx("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 space-y-2 flex-shrink-0",children:u.jsxs("button",{onClick:ot,disabled:O,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:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(pf,{className:"w-4 h-4"}),u.jsx("span",{children:O?`打包中... ${le}%`:`导出文件夹 (${fe} 张)`})]}),O&&u.jsx("div",{className:"w-full bg-gray-300 dark:bg-gray-600 rounded-full h-1.5 mt-1",children:u.jsx("div",{className:"bg-blue-500 h-1.5 rounded-full transition-all duration-300",style:{width:`${le}%`}})})]})})]})}return u.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:[y&&u.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:u.jsxs("button",{onClick:()=>d("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[u.jsx(ff,{className:"w-5 h-5"}),u.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),u.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:u.jsxs("div",{className:"w-full aspect-square bg-transparent border border-gray-200 dark:border-gray-600 rounded-lg overflow-hidden relative",children:[u.jsx("img",{src:c,alt:J.filename,decoding:"async",className:`w-full h-full object-contain transition-opacity duration-300 ${f?"opacity-75":"opacity-100"}`}),f&&u.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded",children:"加载原图中..."})]})}),u.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:ie?`已选择 ${A} 张图片`:"基本信息"}),u.jsxs("div",{className:"space-y-2 text-sm",children:[ie?(()=>{const q=Rt();return q?u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"数量:"}),u.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[q.count," 张图片"]})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"评分:"}),u.jsx("div",{className:"mt-1",children:u.jsx(Pf,{rating:(()=>{const fe=ge().map(Oe=>Oe.rating||0),je=[...new Set(fe)];return je.length===1?je[0]:0})(),onChange:K,disabled:te})}),(()=>{const fe=ge().map(Oe=>Oe.rating||0);return[...new Set(fe)].length>1?u.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:"已选择的图片评分不一致,点击星星可批量设置评分"}):null})()]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"尺寸范围:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:q.dimensionRange.minWidth===q.dimensionRange.maxWidth&&q.dimensionRange.minHeight===q.dimensionRange.maxHeight?`${q.dimensionRange.minWidth} × ${q.dimensionRange.minHeight}`:`${q.dimensionRange.minWidth}~${q.dimensionRange.maxWidth} × ${q.dimensionRange.minHeight}~${q.dimensionRange.maxHeight}`})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"总大小:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:wt(q.totalSize)})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"格式:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100 uppercase",children:q.formats.join(", ")})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"创建时间:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100 text-xs",children:q.timeRange.min&&q.timeRange.max?q.timeRange.min===q.timeRange.max?nt(q.timeRange.min):`${nt(q.timeRange.min)} ~ ${nt(q.timeRange.max)}`:"无数据"})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"修改时间:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100 text-xs",children:q.modifiedTimeRange.min&&q.modifiedTimeRange.max?q.modifiedTimeRange.min===q.modifiedTimeRange.max?nt(q.modifiedTimeRange.min):`${nt(q.modifiedTimeRange.min)} ~ ${nt(q.modifiedTimeRange.max)}`:"无数据"})]})]}):null})():u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件名:"}),U?u.jsx("input",{ref:M,type:"text",value:Y,onChange:q=>B(q.target.value),onKeyDown:q=>{q.key==="Enter"?(q.preventDefault(),Be()):q.key==="Escape"&&(q.preventDefault(),m())},onBlur:Be,className:"w-full text-gray-900 dark:text-gray-100 bg-transparent border-none outline-none focus:outline-none break-all underline decoration-2 decoration-blue-500 underline-offset-2",style:{padding:0,margin:0}}):u.jsx("p",{className:"text-gray-900 dark:text-gray-100 break-all cursor-pointer hover:text-blue-500 transition-colors",onClick:He,title:"点击编辑文件名",children:t.filename})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"评分:"}),u.jsx("div",{className:"mt-1",children:u.jsx(Pf,{rating:t.rating||0,onChange:K,disabled:te})})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"尺寸:"}),u.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[t.width," × ",t.height]})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件大小:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:wt(t.size)})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"格式:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100 uppercase",children:t.format})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"创建时间:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:nt(t.createdAt||t.created_at)})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"修改时间:"}),u.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:nt(t.modifiedAt||t.modified_at)})]})]}),u.jsxs("div",{children:[u.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"路径:"}),u.jsxs("div",{className:"flex items-start gap-2 mt-1",children:[u.jsx("p",{className:"flex-1 text-gray-900 dark:text-gray-100 text-xs break-all cursor-pointer hover:text-blue-500 transition-colors",onClick:()=>{const q=ie?Te(ge()):be(t.path);Ce(q)},title:"点击复制路径",children:ie?Te(ge()):be(t.path)}),u.jsx("button",{onClick:()=>{const q=ie?Te(ge()):be(t.path);Ce(q)},className:`flex-shrink-0 p-1 rounded transition-colors ${Z?"text-green-500":"text-gray-400 hover:text-blue-500 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"复制路径",children:Z?u.jsx(rl,{className:"w-4 h-4"}):u.jsx(Co,{className:"w-4 h-4"})})]}),ie&&u.jsxs("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:["已选择 ",A," 张图片的共同父路径"]})]})]})]})}),!y&&u.jsxs("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 space-y-2 flex-shrink-0",children:[u.jsx("button",{onClick:Ue,className:`w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all ${b?"bg-green-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:b?u.jsxs(u.Fragment,{children:[u.jsx(rl,{className:"w-4 h-4"}),u.jsxs("span",{children:["已复制",ie?` ${A} 张`:""]})]}):u.jsxs(u.Fragment,{children:[u.jsx(Co,{className:"w-4 h-4"}),u.jsxs("span",{children:["复制图片",ie?` (${A})`:""]})]})}),u.jsxs("button",{onClick:Fe,disabled:S,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:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(tw,{className:"w-4 h-4"}),u.jsx("span",{children:S?`打包中... ${j}%`:`导出图片${ie?` (${A})`:""}`})]}),S&&ie&&u.jsx("div",{className:"w-full bg-gray-300 dark:bg-gray-600 rounded-full h-1.5 mt-1",children:u.jsx("div",{className:"bg-blue-500 h-1.5 rounded-full transition-all duration-300",style:{width:`${j}%`}})})]}),r&&u.jsxs("button",{onClick:ot,disabled:O,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:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(pf,{className:"w-4 h-4"}),u.jsx("span",{children:O?`打包文件夹... ${le}%`:"导出当前文件夹"})]}),O&&u.jsx("div",{className:"w-full bg-gray-300 dark:bg-gray-600 rounded-full h-1.5 mt-1",children:u.jsx("div",{className:"bg-gray-700 dark:bg-gray-300 h-1.5 rounded-full transition-all duration-300",style:{width:`${le}%`}})})]})]})]})}function zf(){const{currentLibraryId:e}=Rn(),{searchKeywords:t,originalImages:n,selectedFolder:r,setSearchKeywords:s,filters:i,setFilters:o,resetFilters:a}=Ee(),{thumbnailHeight:l,setThumbnailHeight:d,mobileView:p}=Wt(),{theme:v,toggleTheme:x}=Um(),[y,g]=F.useState(!1),[c,w]=F.useState(!1),[f,h]=F.useState(!1),[b,_]=F.useState(!1),[S,T]=F.useState(t),j=F.useRef(null),L=i.formats||[],O=i.sizes||[],D=i.orientations||[],le=i.ratings||[];F.useEffect(()=>{const ae=()=>{h(window.innerWidth<768)};return ae(),window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[]),F.useEffect(()=>{a()},[r,a]);const R=ae=>{T(ae),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{s(ae)},300)};F.useEffect(()=>{T(t)},[t]),F.useEffect(()=>()=>{j.current&&clearTimeout(j.current)},[]);const Z=ae=>{if(ae.length===0)return[];const ce=[...ae].sort((V,N)=>V-N),be=ce[0],Te=ce[ce.length-1];if(Te-be<10)return[k(be,Te)];const Ce=5,He=[],Be=Math.log10(be||1),K=(Math.log10(Te)-Be)/Ce;for(let V=0;Vee>=N&&eeV)},k=(ae,ce,be=!1)=>{const Te=Ce=>{const He=Be=>Be<10?Math.round(Be):Be<100?Math.round(Be/5)*5:Be<1e3?Math.round(Be/10)*10:Math.round(Be/50)*50;return Ce<1?`${He(Ce*1024)}B`:Ce<1024?`${He(Ce)}KB`:Ce<1048576?`${He(Ce/1024)}MB`:`${He(Ce/1048576)}GB`};return be?`> ${Te(ae)}`:`${Te(ae)} - ${Te(ce)}`},U=F.useMemo(()=>{if(n.length===0)return{formats:[],sizes:[],hasHorizontal:!1,hasVertical:!1,hasSquare:!1,ratings:[]};const ae=new Set,ce=[],be=new Set;let Te=!1,Ce=!1,He=!1;n.forEach(m=>{m.format&&ae.add(m.format.toLowerCase()),ce.push(m.size/1024);const K=m.width/m.height;K>1.05?Te=!0:K<.95?Ce=!0:He=!0;const V=m.rating||0;be.add(V)});const Be=Z(ce);return{formats:Array.from(ae).sort(),sizes:Be,hasHorizontal:Te,hasVertical:Ce,hasSquare:He,ratings:Array.from(be).sort((m,K)=>K-m)}},[n]),re=ae=>{const ce=L.includes(ae)?L.filter(be=>be!==ae):[...L,ae];o({formats:ce})},Y=ae=>{const ce=O.includes(ae)?O.filter(be=>be!==ae):[...O,ae];o({sizes:ce})},B=ae=>{const ce=D.includes(ae)?D.filter(be=>be!==ae):[...D,ae];o({orientations:ce})},M=ae=>{const ce=le.includes(ae)?le.filter(be=>be!==ae):[...le,ae];o({ratings:ce})},te=()=>{o({formats:[],sizes:[],orientations:[],ratings:[]})},P=async ae=>{d(ae);try{await Lt.updatePreferences({thumbnailHeight:ae})}catch(ce){console.error("Error saving preferences:",ce)}},A=async()=>{if(!(!e||c)){w(!0);try{await br.sync(e)}catch(ae){console.error("Error refreshing:",ae),alert("刷新失败: "+ae.message)}finally{w(!1)}}},ie=U.formats,J=U.sizes.map(ae=>({label:ae})),oe=[{value:"horizontal",label:"横图"},{value:"vertical",label:"竖图"},{value:"square",label:"方图"}].filter(ae=>ae.value==="horizontal"&&U.hasHorizontal||ae.value==="vertical"&&U.hasVertical||ae.value==="square"&&U.hasSquare),_e=U.ratings;if(f){const ae=p!=="sidebar";return u.jsxs("header",{className:"border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[u.jsxs("div",{className:"h-14 flex items-center justify-between px-4",children:[u.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"FlyPic"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("button",{onClick:A,disabled:!e||c,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",children:u.jsx(pu,{className:`w-5 h-5 text-gray-700 dark:text-gray-300 ${c?"animate-spin":""}`})}),u.jsx("button",{onClick:()=>_(!b),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:u.jsx(yf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})}),u.jsx("button",{onClick:x,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:v==="light"?u.jsx(gf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}):u.jsx(vf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})})]})]}),ae&&u.jsx("div",{className:"px-4 pb-3",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("div",{className:"flex-1 relative",children:[u.jsx(mu,{className:"absolute left-3 top-2.5 w-5 h-5 text-gray-400"}),u.jsx("input",{type:"text",placeholder:"搜索图片...",value:t,onChange:ce=>R(ce.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"})]}),u.jsx("button",{onClick:()=>g(!y),className:`p-2 border rounded-lg ${L.length>0||O.length>0||D.length>0||le.length>0?"border-blue-500 bg-blue-50 dark:bg-blue-500/20":"border-gray-300 dark:border-gray-600"}`,children:u.jsx(hf,{className:`w-5 h-5 ${L.length>0||O.length>0||D.length>0||le.length>0?"text-blue-600 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`})})]})}),b&&u.jsx("div",{className:"px-4 pb-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"缩略图大小"}),u.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[l,"px"]})]}),u.jsx("input",{type:"range",min:"150",max:"300",value:l,onChange:ce=>P(parseInt(ce.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 ${(l-150)/150*100}%, #e5e7eb ${(l-150)/150*100}%, #e5e7eb 100%)`}})]})}),ae&&y&&u.jsxs("div",{className:"px-4 pb-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"筛选条件"}),u.jsx("button",{onClick:te,className:"text-xs text-blue-500",children:"清除全部"})]}),u.jsxs("div",{className:"mb-3",children:[u.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"格式"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:ie.map(ce=>u.jsx("button",{onClick:()=>re(ce),className:`px-3 py-1 text-xs rounded-full ${L.includes(ce)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:ce.toUpperCase()},ce))})]}),u.jsxs("div",{className:"mb-3",children:[u.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"尺寸"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:J.map(ce=>u.jsx("button",{onClick:()=>Y(ce.label),className:`px-3 py-1 text-xs rounded-full ${O.includes(ce.label)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:ce.label},ce.label))})]}),u.jsxs("div",{className:"mb-3",children:[u.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"方向"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:oe.map(ce=>u.jsx("button",{onClick:()=>B(ce.value),className:`px-3 py-1 text-xs rounded-full ${D.includes(ce.value)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:ce.label},ce.value))})]}),_e.length>0&&u.jsxs("div",{children:[u.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"评分"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:[5,4,3,2,1,0].filter(ce=>_e.includes(ce)).map(ce=>u.jsx("button",{onClick:()=>M(ce),className:`px-2 py-1 text-xs rounded-full flex items-center gap-1 ${le.includes(ce)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:ce>0?u.jsx(u.Fragment,{children:[...Array(ce)].map((be,Te)=>u.jsx(bi,{size:12,className:"fill-current"},Te))}):u.jsx("span",{children:"未评分"})},ce))})]})]})]})}return u.jsxs("header",{className:"border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[u.jsxs("div",{className:"h-14 flex items-center justify-between px-6",children:[u.jsxs("div",{className:"flex-shrink-0",children:[u.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"FlyPic"}),u.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"轻量快速的图片素材库管理"})]}),u.jsxs("div",{className:"flex-1 max-w-2xl mx-6 flex items-center gap-3",children:[u.jsxs("div",{className:"flex-1 relative",children:[u.jsx(mu,{className:"absolute left-3 top-2.5 w-5 h-5 text-gray-400"}),u.jsx("input",{type:"text",placeholder:"搜索图片... (多个关键词用空格分隔,即时搜索)",value:S,onChange:ae=>R(ae.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"})]}),u.jsxs("button",{onClick:()=>g(!y),className:`relative p-2 border rounded-lg transition-colors ${L.length>0||O.length>0||D.length>0||le.length>0?"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:L.length>0||O.length>0||D.length>0||le.length>0?"筛选(已启用)":"筛选",children:[u.jsx(hf,{className:`w-5 h-5 ${L.length>0||O.length>0||D.length>0||le.length>0?"text-blue-600 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`}),(L.length>0||O.length>0||D.length>0||le.length>0)&&u.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full",style:{backgroundColor:"#3b82f6"}})]})]}),u.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[u.jsx(yf,{className:"w-4 h-4 text-gray-500"}),u.jsx("input",{type:"range",min:"150",max:"300",value:l,onChange:ae=>P(parseInt(ae.target.value)),className:"w-32"}),u.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 w-12",children:[l,"px"]}),u.jsx("button",{onClick:A,disabled:!e||c,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:u.jsx(pu,{className:`w-5 h-5 text-gray-700 dark:text-gray-300 ${c?"animate-spin":""}`})}),u.jsx("button",{onClick:x,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:v==="light"?"切换到暗色模式":"切换到亮色模式",children:v==="light"?u.jsx(gf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}):u.jsx(vf,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})})]})]}),y&&u.jsx("div",{className:"px-6 pb-3",children:u.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[u.jsxs("div",{className:"flex items-center justify-between mb-3",children:[u.jsx("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"筛选条件"}),u.jsx("button",{onClick:te,className:"text-xs text-blue-500 hover:text-blue-600 dark:hover:text-blue-400",children:"清除全部"})]}),u.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"格式"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:U.formats.length>0?U.formats.map(ae=>u.jsx("button",{onClick:()=>re(ae),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${L.includes(ae)?"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:ae.toUpperCase()},ae)):u.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无格式数据"})})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"文件大小"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:U.sizes.length>0?U.sizes.map(ae=>u.jsx("button",{onClick:()=>Y(ae),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${O.includes(ae)?"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:ae},ae)):u.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无大小数据"})})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"图片方向"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:oe.length>0?oe.map(ae=>u.jsx("button",{onClick:()=>B(ae.value),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${D.includes(ae.value)?"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:ae.label},ae.value)):u.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无方向数据"})})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"评分"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:_e.length>0?[5,4,3,2,1,0].filter(ae=>_e.includes(ae)).map(ae=>u.jsx("button",{onClick:()=>M(ae),className:`px-3 py-1.5 text-xs rounded transition-colors text-left flex items-center gap-1.5 ${le.includes(ae)?"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:ae>0?u.jsx(u.Fragment,{children:[...Array(ae)].map((ce,be)=>u.jsx(bi,{size:14,className:"fill-current"},be))}):u.jsx("span",{children:"未评分"})},ae)):u.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无评分数据"})})]})]})]})})]})}function l2(){Um();const{mobileView:e,setMobileView:t}=Wt(),{setLibraries:n,setCurrentLibrary:r,removeLibrary:s,setShowAddLibraryForm:i,triggerExpandLibrarySelector:o}=Rn(),{selectedImage:a}=Ee(),{setScanProgress:l}=or(),[d,p]=F.useState(256),[v,x]=F.useState(320),[y,g]=F.useState(!1),[c,w]=F.useState(!1),[f,h]=F.useState(!1),[b,_]=F.useState(!0),[S,T]=F.useState(null),[j,L]=F.useState(null),O=F.useRef(null);F.useEffect(()=>{const re=()=>{const Y=window.innerWidth<768;h(Y)};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[]),F.useEffect(()=>{f&&a&&t("detail")},[a,f,t]),F.useEffect(()=>{const re=window.location.origin,Y=bo(re,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:5});return Y.on("connect",()=>{const B=(M=5,te=1e3)=>{const P=Rn.getState().currentLibraryId;P&&br.getStatus(P).then(A=>{const ie=A.data||A;ie&&ie.status==="scanning"&&ie.progress?l(ie.progress):M>0&&setTimeout(()=>B(M-1,te),te)}).catch(A=>{M>0&&setTimeout(()=>B(M-1,te),te)})};B(5,1e3)}),Y.on("connect_error",B=>{console.error("❌ 连接错误:",B.message)}),Y.on("scanProgress",B=>{const M=Rn.getState().currentLibraryId;B.libraryId===M&&l(B)}),Y.on("scanComplete",({libraryId:B,results:M})=>{const te=Rn.getState().currentLibraryId;if(B===te){const P=Ee.getState(),A={keywords:P.searchKeywords,...P.filters};P.selectedFolder&&(A.folder=P.selectedFolder),Promise.all([De.getFolders(B),P.selectedFolder||P.searchKeywords||P.filters.formats.length>0?De.search(B,A):Promise.resolve({images:[]}),De.getStats(B)]).then(([ie,J,oe])=>{Ee.getState().setFolders(ie.folders),Ee.getState().setImages(J.images),Ee.getState().setTotalImageCount(oe.total||0),Ee.getState().setTotalSize(oe.totalSize||0)}).catch(ie=>{console.error("❌ 加载数据失败:",ie.message)}).finally(()=>{l(null)})}else l(null)}),Y.on("scanError",({libraryId:B,error:M})=>{l(null),console.error("❌ 扫描错误:",M)}),le(),()=>{Y.disconnect(),fu.cleanup()}},[]);const D=async re=>{try{const[Y,B]=await Promise.all([De.getFolders(re),De.getStats(re)]);Ee.getState().setFolders(Y.folders),Ee.getState().setTotalImageCount(B.total||0),Ee.getState().setTotalSize(B.totalSize||0)}catch(Y){console.error("❌ 加载文件夹失败:",Y.message)}},le=async(re=0)=>{try{T(null);const M=await Lt.getAll(),te=M.data||M;n(te.libraries||[]),r(te.currentLibraryId);const P=te.currentLibraryId;if(te.theme&&Wt.getState().setTheme(te.theme),te.preferences){const{thumbnailHeight:A,leftPanelWidth:ie,rightPanelWidth:J}=te.preferences;A&&Wt.getState().setThumbnailHeight(A),ie&&p(ie),J&&x(J)}if(P){try{const A=await Lt.validate(P),ie=A.data||A;if(ie.status!=="ok"){L({id:P,name:ie.name,path:ie.path,status:ie.status}),_(!1);return}}catch(A){console.warn("验证素材库路径失败:",A.message)}await D(P),br.getStatus(P).then(A=>{const{status:ie,progress:J}=A;ie==="scanning"&&l(J)}).catch(()=>{})}_(!1)}catch(M){console.error(`❌ 加载素材库失败 (${re+1}/5):`,M.message),re<4?(T(`连接服务器中... (${re+1}/5)`),setTimeout(()=>le(re+1),1e3)):(_(!1),T("无法连接到服务器,请检查后端是否启动"))}},R=async(re,Y)=>{try{await Lt.updatePreferences({leftPanelWidth:re,rightPanelWidth:Y})}catch(B){console.error("❌ 保存面板宽度失败:",B.message)}};if(F.useEffect(()=>{if(!y&&!c)return;const re=document.getElementById("left-panel"),Y=document.getElementById("right-panel");let B=d,M=v;const te=O.current.getBoundingClientRect(),P=te.left,A=te.right;let ie=null,J=null,oe=null;const _e=()=>{re&&J!=null&&(re.style.width=`${J}px`,B=J),Y&&oe!=null&&(Y.style.width=`${oe}px`,M=oe),ie=null,J=null,oe=null},ae=be=>{let Te=!1;if(y&&re){const Ce=be.clientX-P;Ce>=200&&Ce<=400&&(J=Ce,Te=!0)}if(c&&Y){const Ce=A-be.clientX;Ce>=280&&Ce<=500&&(oe=Ce,Te=!0)}Te&&ie==null&&(ie=requestAnimationFrame(_e))},ce=()=>{ie&&(cancelAnimationFrame(ie),_e()),p(B),x(M),R(B,M),g(!1),w(!1),Wt.getState().setIsResizingPanels(!1),Wt.getState().setResizingSide(null)};return document.addEventListener("mousemove",ae,{passive:!0}),document.addEventListener("mouseup",ce),document.body.style.userSelect="none",document.body.style.cursor="col-resize",re&&(re.style.transition="none"),Y&&(Y.style.transition="none"),()=>{ie&&(cancelAnimationFrame(ie),ie=null),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",ce),document.body.style.userSelect="",document.body.style.cursor="",re&&(re.style.transition=""),Y&&(Y.style.transition="")}},[y,c]),b)return u.jsx("div",{className:"flex flex-col items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:u.jsxs("div",{className:"flex flex-col items-center gap-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"}),u.jsx("div",{className:"text-lg font-medium text-gray-700 dark:text-gray-300",children:S||"正在连接服务器..."})]})});if(S)return u.jsx("div",{className:"flex flex-col items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:u.jsxs("div",{className:"flex flex-col items-center gap-4 text-center px-4",children:[u.jsx("div",{className:"text-red-500 text-5xl",children:"⚠️"}),u.jsx("div",{className:"text-lg font-medium text-gray-700 dark:text-gray-300",children:S}),u.jsx("button",{onClick:()=>{_(!0),T(null),le(0)},className:"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors",children:"重新连接"})]})});const Z=async()=>{if(j){L(null);try{await br.fullScan(j.id)}catch(re){console.error("启动扫描失败:",re.message),alert("启动扫描失败: "+re.message)}}},k=async()=>{if(j){try{await Lt.remove(j.id,!1),s(j.id),r(null),Ee.getState().setImages([]),Ee.getState().setFolders([]),Ee.getState().setTotalImageCount(0),Ee.getState().setSelectedFolder(null)}catch(re){console.error("移除素材库失败:",re.message)}L(null),setTimeout(()=>{o()},100)}},U=async()=>{if(j){try{await Lt.remove(j.id),s(j.id)}catch(re){console.error("移除素材库失败:",re.message)}L(null),setTimeout(()=>{i(!0)},100)}};return f?u.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[u.jsx(zf,{}),u.jsx(yu,{isOpen:!!j,libraryName:j==null?void 0:j.name,libraryPath:j==null?void 0:j.path,status:j==null?void 0:j.status,onRescan:Z,onOpenOther:k,onCreateNew:U}),u.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[u.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${e==="sidebar"?"translate-x-0":"-translate-x-full"}`,children:u.jsx(wf,{})}),u.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${e==="main"?"translate-x-0":e==="sidebar"?"translate-x-full":"-translate-x-full"}`,children:u.jsx(If,{})}),u.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${e==="detail"?"translate-x-0":"translate-x-full"}`,children:u.jsx(Lf,{})})]}),u.jsxs("div",{className:"flex border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[u.jsxs("button",{onClick:()=>t("sidebar"),className:`flex-1 flex flex-col items-center py-2 ${e==="sidebar"?"text-blue-500":"text-gray-500"}`,children:[u.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.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"})}),u.jsx("span",{className:"text-xs mt-1",children:"文件夹"})]}),u.jsxs("button",{onClick:()=>t("main"),className:`flex-1 flex flex-col items-center py-2 ${e==="main"?"text-blue-500":"text-gray-500"}`,children:[u.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.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"})}),u.jsx("span",{className:"text-xs mt-1",children:"图片"})]}),u.jsxs("button",{onClick:()=>t("detail"),disabled:!a,className:`flex-1 flex flex-col items-center py-2 ${e==="detail"?"text-blue-500":"text-gray-500"} disabled:opacity-30`,children:[u.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.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"})}),u.jsx("span",{className:"text-xs mt-1",children:"详情"})]})]})]}):u.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[u.jsx(zf,{}),u.jsx(yu,{isOpen:!!j,libraryName:j==null?void 0:j.name,libraryPath:j==null?void 0:j.path,status:j==null?void 0:j.status,onRescan:Z,onOpenOther:k,onCreateNew:U}),u.jsxs("div",{ref:O,className:"flex flex-1 overflow-hidden",children:[u.jsx("div",{id:"left-panel",style:{width:`${d}px`},className:"flex-shrink-0 h-full bg-white dark:bg-gray-800",children:u.jsx(wf,{})}),u.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:re=>{re.preventDefault(),Wt.getState().setIsResizingPanels(!0),Wt.getState().setResizingSide("left"),g(!0)},children:u.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 w-5"})}),u.jsx("div",{className:"flex-1 min-w-0 h-full",children:u.jsx(If,{})}),u.jsx("div",{className:`group relative w-1 h-full cursor-col-resize flex-shrink-0 transition-colors ${c?"bg-blue-500":"bg-gray-200 dark:bg-gray-700 hover:bg-blue-400"}`,onMouseDown:re=>{re.preventDefault(),Wt.getState().setIsResizingPanels(!0),Wt.getState().setResizingSide("right"),w(!0)},children:u.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 w-5"})}),u.jsx("div",{id:"right-panel",style:{width:`${v}px`},className:"flex-shrink-0 h-full bg-white dark:bg-gray-800",children:u.jsx(Lf,{})})]})]})}const Qm=Rs(e=>({hasPassword:!1,isAuthenticated:!1,isChecking:!0,setAuthStatus:(t,n)=>e({hasPassword:t,isAuthenticated:n,isChecking:!1}),setChecking:t=>e({isChecking:t}),setAuthenticated:()=>e({isAuthenticated:!0}),logout:()=>e({isAuthenticated:!1})}));function u2(){return tt.get("/auth/status")}function c2(e){return tt.post("/auth/setup",{password:e})}function d2(e){return tt.post("/auth/login",{password:e})}function f2(e,t){return tt.post("/auth/change-password",{oldPassword:e,newPassword:t})}const _u={getAuthStatus:u2,setupPassword:c2,login:d2,changePassword:f2};function Ff(){const[e,t]=F.useState(""),[n,r]=F.useState(!1),[s,i]=F.useState(""),{hasPassword:o,setAuthStatus:a}=Qm(),l=async d=>{var p,v;if(d.preventDefault(),!e){i("请输入密码");return}if(e.length<4){i("密码长度至少为 4 位");return}r(!0),i("");try{let x;o?x=await _u.login(e):x=await _u.setupPassword(e),mm(x.token),a(!0,!0)}catch(x){if(x.status===401)if(((v=(p=x.data)==null?void 0:p.error)==null?void 0:v.remainingAttempts)!==void 0){const y=x.data.error.remainingAttempts;y>0?i(`密码错误,剩余 ${y} 次尝试机会`):i("密码错误,已达到最大尝试次数,请稍后再试")}else i("密码错误");else x.status===429?i(x.message||"登录尝试次数过多,请稍后再试"):x.status===400&&x.message?i(x.message):i(x.message||"操作失败,请稍后重试")}finally{r(!1)}};return u.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800",children:u.jsx("div",{className:"w-full max-w-md",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-2xl shadow-2xl p-8",children:[u.jsxs("div",{className:"text-center mb-8",children:[u.jsx("div",{className:"inline-flex items-center justify-center mb-4",children:u.jsx("img",{src:"/ICON_256.PNG",alt:"FlyPic Logo",className:"w-20 h-20 object-contain",onError:d=>{d.target.src="/favicon.png"}})}),u.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-2",children:"FlyPic 飞图"}),u.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:o?"请输入密码访问":"首次使用,请设置访问密码"})]}),u.jsxs("form",{onSubmit:l,className:"space-y-6",children:[u.jsxs("div",{children:[u.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o?"访问密码":"设置密码"}),u.jsx("input",{id:"password",type:"password",value:e,onChange:d=>t(d.target.value),placeholder:o?"请输入密码":"至少 4 位字符",className:"w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition",disabled:n,autoFocus:!0}),!o&&u.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:"💡 密码将加密存储,请妥善保管"})]}),s&&u.jsx("div",{className:"p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:u.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:s})}),u.jsx("button",{type:"submit",disabled:n,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700 text-white font-medium rounded-lg shadow-lg hover:shadow-xl transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:n?u.jsxs("span",{className:"flex items-center justify-center",children:[u.jsxs("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",fill:"none",viewBox:"0 0 24 24",children:[u.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),u.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"处理中..."]}):o?"登录":"设置密码并进入"})]}),u.jsx("div",{className:"mt-8 pt-6 border-t border-gray-200 dark:border-gray-700",children:u.jsx("p",{className:"text-center text-xs text-gray-500 dark:text-gray-400",children:"轻量 · 快速 · 稳定的图片素材管理"})})]})})})}function h2({children:e}){const{hasPassword:t,isAuthenticated:n,isChecking:r,setAuthStatus:s,logout:i}=Qm();F.useEffect(()=>{o();const a=()=>{i()};return window.addEventListener("auth:unauthorized",a),()=>window.removeEventListener("auth:unauthorized",a)},[]);const o=async()=>{try{const a=await _u.getAuthStatus(),l=Sc();console.log("🔐 认证状态检查:",{hasPassword:a.hasPassword,hasToken:!!l}),s(a.hasPassword,a.hasPassword?!!l:!0)}catch(a){console.error("❌ 检查认证状态失败:",a),a.status===401?s(!0,!1):(console.warn("⚠️ 无法验证认证状态,假设未设置密码"),s(!1,!0))}};return r?u.jsx("div",{className:"flex flex-col items-center justify-center h-screen bg-gray-50 dark:bg-gray-900",children:u.jsxs("div",{className:"flex flex-col items-center gap-4",children:[u.jsx("div",{className:"w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"}),u.jsx("div",{className:"text-lg font-medium text-gray-700 dark:text-gray-300",children:"正在检查认证状态..."})]})}):t?t&&!n?u.jsx(Ff,{}):e:u.jsx(Ff,{})}ul.createRoot(document.getElementById("root")).render(u.jsx(Ve.StrictMode,{children:u.jsx(h2,{children:u.jsx(l2,{})})})); diff --git a/flypic/app/server/public/assets/index-BZhnqNDZ.css b/flypic/app/server/public/assets/index-BZhnqNDZ.css new file mode 100644 index 0000000..e1fd208 --- /dev/null +++ b/flypic/app/server/public/assets/index-BZhnqNDZ.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:#e8e8e8}: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:#a8a8a8}input::placeholder,textarea::placeholder{opacity:1;color:#a8a8a8}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%!important}.container{width:100%}@media (min-width: 640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width: 768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width: 1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width: 1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width: 1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.fixed{position:fixed}.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}.bottom-20{bottom:5rem}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-4{top:1rem}.top-full{top:100%}.-z-10{z-index:-10}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.m-0{margin:0}.mx-4{margin-left:1rem;margin-right:1rem}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-ml-1{margin-left:-.25rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-8{margin-top:2rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-1\.5{height:.375rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-64{max-height:16rem}.max-h-\[600px\]{max-height:600px}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-12{width:3rem}.w-20{width:5rem}.w-3{width:.75rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-80{width:20rem}.w-96{width:24rem}.w-\[500px\]{width:500px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[300px\]{min-width:300px}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-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))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes 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-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.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-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-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-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.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-dashed{border-style:dashed}.border-none{border-style:none}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / 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(232 232 232 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / 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-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(232 232 232 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(212 212 212 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(122 122 122 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(69 69 69 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-indigo-100{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-opacity-0{--tw-bg-opacity: 0}.bg-opacity-20{--tw-bg-opacity: .2}.bg-opacity-50{--tw-bg-opacity: .5}.bg-opacity-90{--tw-bg-opacity: .9}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from: #eff6ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 246 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-100{--tw-gradient-to: #dbeafe var(--tw-gradient-to-position)}.to-indigo-100{--tw-gradient-to: #e0e7ff var(--tw-gradient-to-position)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.fill-blue-200{fill:#bfdbfe}.fill-blue-300{fill:#93c5fd}.fill-current{fill:currentColor}.fill-none{fill:none}.fill-white{fill:#fff}.fill-yellow-200{fill:#fef08a}.fill-yellow-400{fill:#facc15}.fill-yellow-800{fill:#854d0e}.stroke-blue-400{stroke:#60a5fa}.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-20{padding:5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.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-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-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}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-6xl{font-size:3.75rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-none{line-height:1}.text-blue-100{--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(212 212 212 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(168 168 168 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(122 122 122 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(90 90 90 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(69 69 69 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(44 44 44 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(30 30 30 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.decoration-blue-500{text-decoration-color:#3b82f6}.decoration-green-500{text-decoration-color:#22c55e}.decoration-2{text-decoration-thickness:2px}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(168 168 168 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(168 168 168 / var(--tw-placeholder-opacity, 1))}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-lg{--tw-drop-shadow: drop-shadow(0 10px 8px rgb(0 0 0 / .04)) drop-shadow(0 4px 3px rgb(0 0 0 / .1));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.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}:root{--bg-primary: #ffffff;--bg-secondary: #f9fafb;--bg-tertiary: #f3f4f6;--text-primary: #111827;--text-secondary: #6b7280;--border-color: #e5e7eb;--hover-bg: #f3f4f6}.dark{--bg-primary: #1e1e1e;--bg-secondary: #2c2c2c;--bg-tertiary: #323232;--text-primary: #d4d4d4;--text-secondary: #a8a8a8;--border-color: #3a3a3a;--hover-bg: #323232}.dark img{background-color:transparent!important}.dark input,.dark select,.dark textarea{background-color:#1e1e1e;border-color:#3a3a3a;color:#d4d4d4}.dark input:focus,.dark select:focus,.dark textarea:focus{border-color:#5a5a5a;outline:none}.dark input::-moz-placeholder{color:#7a7a7a}.dark input::placeholder{color:#7a7a7a}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#00000026;border-radius:4px;-webkit-transition:background .2s ease;transition:background .2s ease}::-webkit-scrollbar-thumb:hover{background:#00000040}.dark ::-webkit-scrollbar-track{background:#ffffff08}.dark ::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:4px;-webkit-transition:background .2s ease;transition:background .2s ease}.dark ::-webkit-scrollbar-thumb:hover{background:#ffffff40}@keyframes slide-up{0%{transform:translate(-50%,100px);opacity:0}to{transform:translate(-50%);opacity:1}}.animate-slide-up{animation:slide-up .3s ease-out}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-200:hover{--tw-bg-opacity: 1;background-color:rgb(191 219 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-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / 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-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(232 232 232 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(212 212 212 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-20:hover{--tw-bg-opacity: .2}.hover\:from-blue-600:hover{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-700:hover{--tw-gradient-to: #4338ca var(--tw-gradient-to-position)}.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\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-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}.group:hover .group-hover\:text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:border-blue-400:is(.dark *){--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.dark\:border-blue-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(59 130 246 / 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(90 90 90 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(69 69 69 / var(--tw-border-opacity, 1))}.dark\:border-red-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(153 27 27 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.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-300:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(212 212 212 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(90 90 90 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(69 69 69 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(44 44 44 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity, 1))}.dark\:bg-red-900\/20:is(.dark *){background-color:#7f1d1d33}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:from-blue-900:is(.dark *){--tw-gradient-from: #1e3a8a var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 58 138 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-gray-700:is(.dark *){--tw-gradient-from: #454545 var(--tw-gradient-from-position);--tw-gradient-to: rgb(69 69 69 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-gray-900:is(.dark *){--tw-gradient-from: #1e1e1e var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 30 30 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-blue-800:is(.dark *){--tw-gradient-to: #1e40af var(--tw-gradient-to-position)}.dark\:to-gray-600:is(.dark *){--tw-gradient-to: #5a5a5a var(--tw-gradient-to-position)}.dark\:to-gray-800:is(.dark *){--tw-gradient-to: #2c2c2c var(--tw-gradient-to-position)}.dark\:fill-blue-800:is(.dark *){fill:#1e40af}.dark\:fill-blue-900:is(.dark *){fill:#1e3a8a}.dark\:fill-yellow-900:is(.dark *){fill:#713f12}.dark\:stroke-blue-600:is(.dark *){stroke:#2563eb}.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(245 245 245 / var(--tw-text-opacity, 1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(232 232 232 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(212 212 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(168 168 168 / var(--tw-text-opacity, 1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(122 122 122 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(90 90 90 / 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\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:placeholder-gray-500:is(.dark *)::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(122 122 122 / var(--tw-placeholder-opacity, 1))}.dark\:placeholder-gray-500:is(.dark *)::placeholder{--tw-placeholder-opacity: 1;color:rgb(122 122 122 / var(--tw-placeholder-opacity, 1))}.dark\:hover\:bg-blue-500\/30:hover:is(.dark *){background-color:#3b82f64d}.dark\:hover\:bg-blue-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-500:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(122 122 122 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-600:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(90 90 90 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(69 69 69 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-yellow-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(133 77 14 / 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))}@media (min-width: 768px){.md\:flex{display:flex}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/flypic/app/server/public/index.html b/flypic/app/server/public/index.html index 32b8bb1..281e0d1 100644 --- a/flypic/app/server/public/index.html +++ b/flypic/app/server/public/index.html @@ -5,8 +5,8 @@ FlyPic 飞图 - 图片素材库管理 - - + +
diff --git a/flypic/app/server/server.js b/flypic/app/server/server.js index f9034de..f856cb6 100644 --- a/flypic/app/server/server.js +++ b/flypic/app/server/server.js @@ -62,8 +62,11 @@ const io = new Server(server, { // 准备依赖注入 // 包装 config 函数为对象接口 const configManager = { + // 兼容两种命名风格 load: () => config.loadConfig(), save: (data) => config.saveConfig(data), + loadConfig: () => config.loadConfig(), + saveConfig: (data) => config.saveConfig(data), addLibrary: (name, path) => config.addLibrary(name, path), removeLibrary: (id) => config.removeLibrary(id), updateLibrary: (id, updates) => config.updateLibrary(id, updates), @@ -118,6 +121,26 @@ server.listen(PORT, () => { try { const currentConfig = config.loadConfig(); + // 启动定时清理任务(每分钟检查一次过期临时文件) + const fileService = app.get('fileService'); + setInterval(async () => { + if (currentConfig.libraries && currentConfig.libraries.length > 0) { + for (const library of currentConfig.libraries) { + try { + const result = await fileService.cleanExpiredTempFiles(library.id); + if (result.cleaned > 0 || result.thumbnailsCleaned > 0) { + const parts = []; + if (result.cleaned > 0) parts.push(`${result.cleaned} 个过期文件`); + if (result.thumbnailsCleaned > 0) parts.push(`${result.thumbnailsCleaned} 个缩略图`); + console.log(`🧹 已清理: ${parts.join('、')}`); + } + } catch (error) { + // 忽略错误 + } + } + } + }, 60 * 1000); // 每分钟执行一次 + // 恢复所有素材库的扫描状态 if (currentConfig.libraries && currentConfig.libraries.length > 0) { scanManager.restoreAllStates(currentConfig.libraries); diff --git a/flypic/app/server/src/app.js b/flypic/app/server/src/app.js index 7eb6dd8..8ea1194 100644 --- a/flypic/app/server/src/app.js +++ b/flypic/app/server/src/app.js @@ -7,11 +7,14 @@ const express = require('express'); const cors = require('cors'); const path = require('path'); const { errorHandler } = require('./middleware/errorHandler'); +const { createAuthMiddleware } = require('./middleware/authMiddleware'); // 导入服务 const LibraryService = require('./services/LibraryService'); const ImageService = require('./services/ImageService'); const ScanService = require('./services/ScanService'); +const FileService = require('./services/FileService'); +const AuthService = require('./services/AuthService'); /** * 创建 Express 应用 @@ -33,6 +36,8 @@ function createApp(dependencies) { app.use(express.json()); // 初始化服务 + const authService = new AuthService(configManager); + const libraryService = new LibraryService( configManager, dbPool, @@ -54,19 +59,37 @@ function createApp(dependencies) { io ); - // 将服务注入到 app 中,供路由使用 + const fileService = new FileService(dbPool, configManager); + + // 将服务和依赖注入到 app 中,供路由使用 + app.set('configManager', configManager); + app.set('dbPool', dbPool); + app.set('authService', authService); app.set('libraryService', libraryService); app.set('imageService', imageService); app.set('scanService', scanService); + app.set('fileService', fileService); + + // 认证中间件(仅作用于 /api 路由,避免拦截前端静态页面) + app.use('/api', createAuthMiddleware( + () => authService.getPasswordHash(), + () => authService.getJwtSecret() + )); // API 路由 + const authRouter = require('./routes/auth'); const libraryRouter = require('./routes/library'); const imageRouter = require('./routes/image'); const scanRouter = require('./routes/scan'); + const fileRouter = require('./routes/file'); + const uploadRouter = require('./routes/upload'); + app.use('/api/auth', authRouter); app.use('/api/library', libraryRouter); app.use('/api/image', imageRouter); app.use('/api/scan', scanRouter); + app.use('/api/file', fileRouter); + app.use('/api/upload', uploadRouter); // 健康检查 app.get('/api/health', (req, res) => { diff --git a/flypic/app/server/src/middleware/authMiddleware.js b/flypic/app/server/src/middleware/authMiddleware.js new file mode 100644 index 0000000..b5f7fbb --- /dev/null +++ b/flypic/app/server/src/middleware/authMiddleware.js @@ -0,0 +1,106 @@ +/** + * 认证中间件 + * 轻量级访问密码验证 + */ + +const jwt = require('jsonwebtoken'); + +const TOKEN_EXPIRY = '30d'; // Token 有效期 30 天 + +/** + * 生成 JWT Token + * @param {string} jwtSecret - JWT 密钥(从配置文件读取) + */ +function generateToken(jwtSecret) { + if (!jwtSecret) { + throw new Error('JWT_SECRET is required'); + } + return jwt.sign( + { app: 'flypic', timestamp: Date.now() }, + jwtSecret, + { expiresIn: TOKEN_EXPIRY } + ); +} + +/** + * 验证 JWT Token + * @param {string} token - JWT Token + * @param {string} jwtSecret - JWT 密钥(从配置文件读取) + */ +function verifyToken(token, jwtSecret) { + if (!jwtSecret) { + return false; + } + try { + jwt.verify(token, jwtSecret); + return true; + } catch (error) { + return false; + } +} + +/** + * 认证中间件工厂 + * @param {Function} getPasswordHash - 获取密码哈希的函数 + * @param {Function} getJwtSecret - 获取 JWT 密钥的函数 + */ +function createAuthMiddleware(getPasswordHash, getJwtSecret) { + return (req, res, next) => { + // 如果没有设置密码,直接放行 + const passwordHash = getPasswordHash(); + if (!passwordHash) { + return next(); + } + + // 公开接口(登录相关 / 健康检查 / 图片资源) + // 使用 req.originalUrl 获取完整路径(包含 /api 前缀,去除查询字符串) + const fullPath = req.originalUrl.split('?')[0]; + + // 精确匹配的公开路径 + const publicPaths = [ + '/api/auth/status', + '/api/auth/login', + '/api/auth/setup', + '/api/health' + ]; + + // 前缀匹配的公开路径(缩略图 & 原图资源) + const publicPrefixes = [ + '/api/image/thumbnail/', // 缩略图 + '/api/image/original/' // 原图 + ]; + + if ( + publicPaths.includes(fullPath) || + publicPrefixes.some(prefix => fullPath.startsWith(prefix)) + ) { + return next(); + } + + // 检查 Authorization header + const authHeader = req.headers.authorization; + if (!authHeader || !authHeader.startsWith('Bearer ')) { + return res.status(401).json({ + success: false, + error: { message: '未授权访问,请先登录' } + }); + } + + const token = authHeader.substring(7); + const jwtSecret = getJwtSecret(); + if (!verifyToken(token, jwtSecret)) { + return res.status(401).json({ + success: false, + error: { message: 'Token 无效或已过期,请重新登录' } + }); + } + + next(); + }; +} + +module.exports = { + createAuthMiddleware, + generateToken, + verifyToken +}; diff --git a/flypic/app/server/src/middleware/errorHandler.js b/flypic/app/server/src/middleware/errorHandler.js index 8f582ff..f2598e3 100644 --- a/flypic/app/server/src/middleware/errorHandler.js +++ b/flypic/app/server/src/middleware/errorHandler.js @@ -60,7 +60,9 @@ const errorHandler = (err, req, res, next) => { error: { code: err.code, message: err.message, - ...(err.field && { field: err.field }) + ...(err.field && { field: err.field }), + ...(err.remainingAttempts !== undefined && { remainingAttempts: err.remainingAttempts }), + ...(err.currentAttempts !== undefined && { currentAttempts: err.currentAttempts }) } }); } diff --git a/flypic/app/server/src/routes/auth.js b/flypic/app/server/src/routes/auth.js new file mode 100644 index 0000000..54e934d --- /dev/null +++ b/flypic/app/server/src/routes/auth.js @@ -0,0 +1,112 @@ +/** + * 认证路由 + */ + +const express = require('express'); +const router = express.Router(); + +/** + * GET /api/auth/status + * 获取认证状态 + */ +router.get('/status', async (req, res, next) => { + try { + const authService = req.app.get('authService'); + const status = authService.getStatus(); + + res.json({ + success: true, + data: status + }); + } catch (error) { + next(error); + } +}); + +/** + * POST /api/auth/setup + * 首次设置密码 + * Body: { password: string } + */ +router.post('/setup', async (req, res, next) => { + try { + const authService = req.app.get('authService'); + const { password } = req.body; + + if (!password) { + return res.status(400).json({ + success: false, + error: { message: '密码不能为空' } + }); + } + + const result = await authService.setupPassword(password); + + res.json({ + success: true, + data: result + }); + } catch (error) { + next(error); + } +}); + +/** + * POST /api/auth/login + * 登录验证 + * Body: { password: string } + */ +router.post('/login', async (req, res, next) => { + try { + const authService = req.app.get('authService'); + const { password } = req.body; + + if (!password) { + return res.status(400).json({ + success: false, + error: { message: '密码不能为空' } + }); + } + + // 获取客户端 IP(用于防暴力破解) + const clientIP = req.ip || req.connection.remoteAddress || 'unknown'; + const result = await authService.login(password, clientIP); + + res.json({ + success: true, + data: result + }); + } catch (error) { + next(error); + } +}); + +/** + * POST /api/auth/change-password + * 修改密码(需要认证) + * Body: { oldPassword: string, newPassword: string } + */ +router.post('/change-password', async (req, res, next) => { + try { + const authService = req.app.get('authService'); + const { oldPassword, newPassword } = req.body; + + if (!oldPassword || !newPassword) { + return res.status(400).json({ + success: false, + error: { message: '原密码和新密码不能为空' } + }); + } + + const result = await authService.changePassword(oldPassword, newPassword); + + res.json({ + success: true, + data: result + }); + } catch (error) { + next(error); + } +}); + +module.exports = router; diff --git a/flypic/app/server/src/routes/file.js b/flypic/app/server/src/routes/file.js new file mode 100644 index 0000000..ee6e3cb --- /dev/null +++ b/flypic/app/server/src/routes/file.js @@ -0,0 +1,181 @@ +/** + * 文件操作路由 + * 提供删除、重命名、移动、复制等文件操作接口 + */ + +const express = require('express'); +const router = express.Router(); +const { asyncHandler } = require('../middleware/errorHandler'); + +// 服务实例(从 app 中获取) +let fileService; + +router.use((req, res, next) => { + if (!fileService) { + fileService = req.app.get('fileService'); + } + next(); +}); + +/** + * 删除文件或文件夹(移到临时文件夹,5分钟内可撤销) + * DELETE /api/file/delete + * Body: { libraryId, items: [{type, path}] } + */ +router.delete('/delete', asyncHandler(async (req, res) => { + const { libraryId, items } = req.body; + + if (!libraryId || !items || !Array.isArray(items)) { + return res.status(400).json({ + success: false, + error: '缺少必要参数' + }); + } + + const results = await fileService.deleteItems(libraryId, items); + + res.json({ + success: true, + data: results + }); +})); + +/** + * 重命名文件或文件夹 + * PATCH /api/file/rename + * Body: { libraryId, path, newName } + */ +router.patch('/rename', asyncHandler(async (req, res) => { + const { libraryId, path, newName } = req.body; + + if (!libraryId || !path || !newName) { + return res.status(400).json({ + success: false, + error: '缺少必要参数' + }); + } + + const result = await fileService.renameItem(libraryId, path, newName); + + res.json({ + success: true, + data: result + }); +})); + +/** + * 移动文件或文件夹 + * POST /api/file/move + * Body: { libraryId, items: [{type, path}], targetFolder } + */ +router.post('/move', asyncHandler(async (req, res) => { + const { libraryId, items, targetFolder } = req.body; + + if (!libraryId || !items || !Array.isArray(items) || targetFolder === undefined) { + return res.status(400).json({ + success: false, + error: '缺少必要参数' + }); + } + + const results = await fileService.moveItems(libraryId, items, targetFolder); + + res.json({ + success: true, + data: results + }); +})); + +/** + * 复制文件或文件夹 + * POST /api/file/copy + * Body: { libraryId, items: [{type, path}], targetFolder, conflictAction?: 'skip'|'replace'|'rename' } + */ +router.post('/copy', asyncHandler(async (req, res) => { + const { libraryId, items, targetFolder, conflictAction } = req.body; + + if (!libraryId || !items || !Array.isArray(items) || targetFolder === undefined) { + return res.status(400).json({ + success: false, + error: '缺少必要参数' + }); + } + + const results = await fileService.copyItems(libraryId, items, targetFolder, conflictAction); + + res.json({ + success: true, + data: results + }); +})); + +/** + * 更新文件元数据(评分、收藏、标签) + * PATCH /api/file/metadata + * Body: { libraryId, path, rating?, favorite?, tags? } + */ +router.patch('/metadata', asyncHandler(async (req, res) => { + const { libraryId, path, ...metadata } = req.body; + + if (!libraryId || !path) { + return res.status(400).json({ + success: false, + error: '缺少必要参数' + }); + } + + const result = await fileService.updateMetadata(libraryId, path, metadata); + + res.json({ + success: true, + data: result + }); +})); + +/** + * 恢复文件 + */ +router.post('/restore', asyncHandler(async (req, res) => { + const { libraryId, items } = req.body; + + if (!libraryId) { + throw new ValidationError('libraryId'); + } + + if (!Array.isArray(items) || items.length === 0) { + throw new ValidationError('items'); + } + + const fileService = req.app.get('fileService'); + const result = await fileService.restoreItems(libraryId, items); + + res.json({ + success: true, + data: result + }); +})); + +/** + * 创建空文件夹 + * POST /api/file/create-folder + * Body: { libraryId, folderPath } + */ +router.post('/create-folder', asyncHandler(async (req, res) => { + const { libraryId, folderPath } = req.body; + + if (!libraryId || !folderPath) { + return res.status(400).json({ + success: false, + error: '缺少必需参数' + }); + } + + const result = await fileService.createFolder(libraryId, folderPath); + + res.json({ + success: true, + data: result + }); +})); + +module.exports = router; diff --git a/flypic/app/server/src/routes/image.js b/flypic/app/server/src/routes/image.js index 418f56e..4929286 100644 --- a/flypic/app/server/src/routes/image.js +++ b/flypic/app/server/src/routes/image.js @@ -167,4 +167,30 @@ router.get('/original/:libraryId/*', (req, res) => { } }); +/** + * 更新图片评分 + * PUT /api/image/rating + * Body: { libraryId, paths: [string], rating: number } + */ +router.put('/rating', asyncHandler(async (req, res) => { + const { libraryId, paths, rating } = req.body; + + if (!libraryId || !paths || !Array.isArray(paths) || paths.length === 0) { + return res.status(400).json({ + success: false, + message: '缺少必要参数: libraryId, paths' + }); + } + + if (typeof rating !== 'number' || rating < 0 || rating > 5) { + return res.status(400).json({ + success: false, + message: '评分必须是 0-5 之间的整数' + }); + } + + const result = await imageService.updateRating(libraryId, paths, rating); + res.json({ success: true, data: result }); +})); + module.exports = router; diff --git a/flypic/app/server/src/routes/upload.js b/flypic/app/server/src/routes/upload.js new file mode 100644 index 0000000..e8b1da1 --- /dev/null +++ b/flypic/app/server/src/routes/upload.js @@ -0,0 +1,231 @@ +/** + * 文件上传路由 + * 支持拖拽上传图片到指定文件夹 + */ + +const express = require('express'); +const router = express.Router(); +const multer = require('multer'); +const path = require('path'); +const fs = require('fs'); +const { asyncHandler } = require('../middleware/errorHandler'); +const { processImage } = require('../../utils/scanner'); + +// 配置 multer 使用内存存储 +const storage = multer.memoryStorage(); +const upload = multer({ + storage: storage, + limits: { + fileSize: 100 * 1024 * 1024, // 100MB + } + // 移除文件格式限制,让扫描逻辑自动处理 +}); + +/** + * 上传图片到指定文件夹 + * POST /api/upload + * FormData: { libraryId, targetFolder, files[], conflictAction? } + * conflictAction: 'skip' | 'replace' | 'rename' + */ +router.post('/', upload.array('files', 50), asyncHandler(async (req, res) => { + console.log('📤 收到上传请求'); + console.log(' libraryId:', req.body.libraryId); + console.log(' targetFolder:', req.body.targetFolder); + console.log(' conflictAction:', req.body.conflictAction); + console.log(' 文件数量:', req.files?.length); + + const { libraryId, targetFolder, conflictAction } = req.body; + const files = req.files; + + if (!libraryId) { + console.error('❌ 缺少 libraryId 参数'); + return res.status(400).json({ + success: false, + error: '缺少 libraryId 参数' + }); + } + + if (!files || files.length === 0) { + console.error('❌ 没有上传文件'); + return res.status(400).json({ + success: false, + error: '没有上传文件' + }); + } + + // 获取依赖 + const dbPool = req.app.get('dbPool'); + const configManager = req.app.get('configManager'); + + if (!dbPool || !configManager) { + console.error('❌ 服务未初始化'); + return res.status(500).json({ + success: false, + error: '服务未初始化' + }); + } + + // 获取素材库配置 + const config = configManager.load(); + const library = config.libraries.find(lib => lib.id === libraryId); + + if (!library) { + console.error('❌ 素材库不存在:', libraryId); + return res.status(404).json({ + success: false, + error: '素材库不存在' + }); + } + + // 获取数据库实例 + const db = dbPool.acquire(library.path); + const libraryPath = library.path; + const targetPath = targetFolder + ? path.join(libraryPath, targetFolder) + : libraryPath; + + // 确保目标文件夹存在 + if (!fs.existsSync(targetPath)) { + fs.mkdirSync(targetPath, { recursive: true }); + } + + const results = { + success: [], + failed: [], + conflicts: [] // 改为 conflicts,与粘贴逻辑一致 + }; + + // 用于后台处理的文件列表 + const filesToProcess = []; + + // 第一阶段:保存文件(根据 conflictAction 处理冲突) + for (const file of files) { + try { + // 修复中文文件名乱码:multer 默认使用 latin1 编码,需要转换为 utf8 + let filename = Buffer.from(file.originalname, 'latin1').toString('utf8'); + let filePath = path.join(targetPath, filename); + + // 检查文件是否已存在 + if (fs.existsSync(filePath)) { + // 如果没有指定冲突处理方式,收集冲突信息返回给前端 + if (!conflictAction) { + const relativePath = targetFolder + ? path.join(targetFolder, filename).replace(/\\/g, '/') + : filename; + results.conflicts.push({ + name: filename, + path: relativePath + }); + console.log(`⚠️ 冲突: ${filename} (文件已存在)`); + continue; + } + + // 根据 conflictAction 处理冲突 + if (conflictAction === 'skip') { + console.log(`⏭️ 跳过: ${filename} (文件已存在)`); + continue; + } else if (conflictAction === 'replace') { + // 覆盖:删除旧文件 + console.log(`🔄 覆盖: ${filename}`); + fs.unlinkSync(filePath); + } else if (conflictAction === 'rename') { + // 重命名:生成新文件名 + const ext = path.extname(filename); + const nameWithoutExt = filename.substring(0, filename.length - ext.length); + let counter = 1; + let newFilename = filename; + let newFilePath = filePath; + + while (fs.existsSync(newFilePath)) { + newFilename = `${nameWithoutExt} (${counter})${ext}`; + newFilePath = path.join(targetPath, newFilename); + counter++; + } + + filename = newFilename; + filePath = newFilePath; + console.log(`📝 重命名: ${file.originalname} → ${filename}`); + } + } + + // 写入文件(同步,快速) + fs.writeFileSync(filePath, file.buffer); + console.log(`📥 已保存: ${filename} (${(file.size / 1024).toFixed(2)} KB)`); + + // 计算相对路径(使用最终的文件名) + const relativePath = targetFolder + ? path.join(targetFolder, filename).replace(/\\/g, '/') + : filename; + + results.success.push({ + filename, + path: relativePath, + size: file.size + }); + + // 添加到待处理列表(只处理图片文件) + const ext = path.extname(filename).toLowerCase(); + const imageExts = ['.jpg', '.jpeg', '.png', '.webp', '.gif', '.bmp', '.tiff', '.svg']; + if (imageExts.includes(ext)) { + filesToProcess.push({ filePath, filename }); + } + } catch (error) { + console.error(`❌ 保存失败: ${file.originalname}`, error); + results.failed.push({ + filename: file.originalname, + error: error.message + }); + } + } + + // 第二阶段:后台异步处理图片(生成缩略图、提取元数据) + // 不阻塞响应,让前端可以立即刷新 + if (filesToProcess.length > 0) { + setImmediate(async () => { + console.log(`🔄 开始后台处理 ${filesToProcess.length} 个图片...`); + for (const { filePath, filename } of filesToProcess) { + try { + await processImage(filePath, libraryPath, db.db); + console.log(`✅ 已处理: ${filename}`); + } catch (processError) { + console.error(`❌ 处理图片失败: ${filename}`, processError.message); + } + } + console.log(`✅ 后台处理完成`); + }); + } + + // 更新文件夹图片计数 + if (targetFolder && results.success.length > 0) { + try { + console.log(`📊 更新文件夹计数: ${targetFolder}`); + const updateStmt = db.db.prepare(` + UPDATE folders + SET image_count = ( + SELECT COUNT(*) FROM images WHERE folder = ? OR folder LIKE ? + ), + last_scan = ? + WHERE path = ? + `); + updateStmt.run( + targetFolder, + targetFolder + '/%', + Date.now(), + targetFolder + ); + console.log(`✅ 文件夹计数已更新`); + } catch (error) { + console.error('❌ 更新文件夹计数失败:', error); + console.error(' 错误详情:', error.stack); + } + } + + console.log(`📋 上传结果: 成功 ${results.success.length}, 失败 ${results.failed.length}, 冲突 ${results.conflicts.length}`); + + res.json({ + success: true, + data: results + }); +})); + +module.exports = router; diff --git a/flypic/app/server/src/services/AuthService.js b/flypic/app/server/src/services/AuthService.js new file mode 100644 index 0000000..bf81573 --- /dev/null +++ b/flypic/app/server/src/services/AuthService.js @@ -0,0 +1,203 @@ +/** + * 认证服务 + * 处理密码设置、验证、修改 + */ + +const bcrypt = require('bcrypt'); +const crypto = require('crypto'); +const { generateToken } = require('../middleware/authMiddleware'); +const { AppError } = require('../middleware/errorHandler'); + +const SALT_ROUNDS = 10; +const MAX_LOGIN_ATTEMPTS = 30; // 最大登录尝试次数 +const ATTEMPT_WINDOW = 5 * 60 * 1000; // 5分钟窗口期 + +class AuthService { + constructor(configManager) { + this.configManager = configManager; + // 登录失败记录:IP → { count, firstAttempt, lastAttempt } + this.loginAttempts = new Map(); + + // 定期清理过期的登录尝试记录(每10分钟) + setInterval(() => { + const now = Date.now(); + for (const [ip, data] of this.loginAttempts.entries()) { + if (now - data.lastAttempt > ATTEMPT_WINDOW) { + this.loginAttempts.delete(ip); + } + } + }, 10 * 60 * 1000); + } + + /** + * 检查是否已设置密码 + */ + hasPassword() { + const config = this.configManager.loadConfig(); + return !!config.passwordHash; + } + + /** + * 获取密码哈希 + */ + getPasswordHash() { + const config = this.configManager.loadConfig(); + return config.passwordHash || null; + } + + /** + * 获取 JWT 密钥 + */ + getJwtSecret() { + const config = this.configManager.loadConfig(); + return config.jwtSecret || null; + } + + /** + * 设置密码(首次设置) + */ + async setupPassword(password) { + if (this.hasPassword()) { + // 已设置密码,属于业务错误 + throw new AppError('密码已设置,请使用修改密码功能', 400, 'PASSWORD_ALREADY_SET'); + } + + if (!password || password.length < 4) { + throw new AppError('密码长度至少为 4 位', 400, 'INVALID_PASSWORD'); + } + + const passwordHash = await bcrypt.hash(password, SALT_ROUNDS); + const config = this.configManager.loadConfig(); + + // 生成随机 JWT 密钥(首次设置时) + if (!config.jwtSecret) { + config.jwtSecret = crypto.randomBytes(32).toString('hex'); + console.log('🔐 已生成随机 JWT 密钥'); + } + + config.passwordHash = passwordHash; + this.configManager.saveConfig(config); + + return { token: generateToken(config.jwtSecret) }; + } + + /** + * 验证密码并登录 + * @param {string} password - 密码 + * @param {string} clientIP - 客户端IP(用于防暴力破解) + */ + async login(password, clientIP = 'unknown') { + if (!this.hasPassword()) { + // 未设置密码,提示先设置 + throw new AppError('未设置密码,请先设置密码', 400, 'PASSWORD_NOT_SET'); + } + + // 检查登录尝试次数(防暴力破解) + const now = Date.now(); + const attempts = this.loginAttempts.get(clientIP); + + if (attempts) { + // 检查是否在窗口期内 + if (now - attempts.firstAttempt < ATTEMPT_WINDOW) { + // 仍在窗口期内 + if (attempts.count >= MAX_LOGIN_ATTEMPTS) { + const remainingTime = Math.ceil((ATTEMPT_WINDOW - (now - attempts.firstAttempt)) / 1000); + throw new AppError( + `登录尝试次数过多,请 ${remainingTime} 秒后再试`, + 429, + 'TOO_MANY_ATTEMPTS' + ); + } + } else { + // 超过窗口期,重置计数 + this.loginAttempts.delete(clientIP); + } + } + + const passwordHash = this.getPasswordHash(); + const jwtSecret = this.getJwtSecret(); + + if (!jwtSecret) { + throw new AppError('系统配置错误,请重新设置密码', 500, 'MISSING_JWT_SECRET'); + } + + const isValid = await bcrypt.compare(password, passwordHash); + + if (!isValid) { + // 记录失败尝试 + if (attempts) { + attempts.count++; + attempts.lastAttempt = now; + } else { + this.loginAttempts.set(clientIP, { + count: 1, + firstAttempt: now, + lastAttempt: now + }); + } + + // 密码错误:返回 401 未授权,并附带剩余尝试次数 + const currentAttempts = attempts ? attempts.count : 1; + const remainingAttempts = MAX_LOGIN_ATTEMPTS - currentAttempts; + console.log(`⚠️ 登录失败 [${clientIP}]: 已尝试 ${currentAttempts} 次,剩余 ${remainingAttempts} 次`); + + // 创建错误并附带额外信息 + const error = new AppError('密码错误', 401, 'INVALID_PASSWORD'); + error.remainingAttempts = remainingAttempts; + error.currentAttempts = currentAttempts; + throw error; + } + + // 登录成功,清除尝试记录 + this.loginAttempts.delete(clientIP); + console.log(`✅ 登录成功 [${clientIP}]`); + + return { token: generateToken(jwtSecret) }; + } + + /** + * 修改密码 + */ + async changePassword(oldPassword, newPassword) { + if (!this.hasPassword()) { + throw new AppError('未设置密码', 400, 'PASSWORD_NOT_SET'); + } + + if (!newPassword || newPassword.length < 4) { + throw new AppError('新密码长度至少为 4 位', 400, 'INVALID_NEW_PASSWORD'); + } + + // 验证旧密码 + const passwordHash = this.getPasswordHash(); + const isValid = await bcrypt.compare(oldPassword, passwordHash); + + if (!isValid) { + throw new AppError('原密码错误', 401, 'INVALID_OLD_PASSWORD'); + } + + // 设置新密码 + const newPasswordHash = await bcrypt.hash(newPassword, SALT_ROUNDS); + const config = this.configManager.loadConfig(); + config.passwordHash = newPasswordHash; + this.configManager.saveConfig(config); + + const jwtSecret = this.getJwtSecret(); + if (!jwtSecret) { + throw new AppError('系统配置错误', 500, 'MISSING_JWT_SECRET'); + } + + return { token: generateToken(jwtSecret) }; + } + + /** + * 获取认证状态 + */ + getStatus() { + return { + hasPassword: this.hasPassword(), + requireAuth: this.hasPassword() + }; + } +} + +module.exports = AuthService; diff --git a/flypic/app/server/src/services/FileService.js b/flypic/app/server/src/services/FileService.js new file mode 100644 index 0000000..33bf705 --- /dev/null +++ b/flypic/app/server/src/services/FileService.js @@ -0,0 +1,1064 @@ +/** + * 文件操作服务 + * 提供删除、重命名、移动、复制等文件操作功能 + */ + +const fs = require('fs'); +const path = require('path'); +const { processImage } = require('../../utils/scanner'); + +// 临时备份目录(用于撤销恢复)- 放在 .flypic 内部 +const TEMP_BACKUP_DIR = '.flypic/temp_backup'; + +class FileService { + constructor(dbPool, configManager) { + this.dbPool = dbPool; + this.configManager = configManager; + } + + /** + * 恢复文件(从临时备份恢复) + * @param {string} libraryId - 素材库ID + * @param {Array} items - 待恢复项 [{type: 'file'|'folder', path: 'relative/path'}] + */ + async restoreItems(libraryId, items) { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + const backupDir = path.join(libraryPath, TEMP_BACKUP_DIR); + const results = { success: [], failed: [] }; + + if (!fs.existsSync(backupDir)) { + throw new Error('备份目录不存在,无法恢复'); + } + + for (const item of items) { + try { + const backupPath = path.join(backupDir, item.path); + const originalPath = path.join(libraryPath, item.path); + const metaPath = backupPath + '.meta.json'; + + console.log(`🔄 开始恢复: ${item.path} (${item.type})`); + + // 检查备份是否存在 + if (!fs.existsSync(backupPath)) { + results.failed.push({ path: item.path, error: '备份不存在(可能已超过5分钟被清理)' }); + continue; + } + + // 确保目标目录存在 + const targetDir = path.dirname(originalPath); + if (!fs.existsSync(targetDir)) { + fs.mkdirSync(targetDir, { recursive: true }); + } + + // 读取元数据文件(包含数据库记录) + let imageRecords = null; + let folderRecords = null; + if (fs.existsSync(metaPath)) { + try { + const metaContent = JSON.parse(fs.readFileSync(metaPath, 'utf8')); + imageRecords = metaContent.imageRecords; + folderRecords = metaContent.folderRecords; + console.log(` 读取到 ${Array.isArray(imageRecords) ? imageRecords.length : (imageRecords ? 1 : 0)} 条图片记录`); + console.log(` 读取到 ${folderRecords ? folderRecords.length : 0} 条文件夹记录`); + } catch (error) { + console.warn(`读取meta失败 ${metaPath}:`, error); + } + } + + // 移动回原位置 + try { + fs.renameSync(backupPath, originalPath); + } catch (renameError) { + console.log(` ⚠️ rename失败,使用复制方式`); + // rename 失败时使用复制+删除 + if (item.type === 'folder') { + this._copyDirSync(backupPath, originalPath); + fs.rmSync(backupPath, { recursive: true, force: true }); + } else { + fs.copyFileSync(backupPath, originalPath); + fs.unlinkSync(backupPath); + } + } + + // 恢复数据库记录(先文件夹后图片) + if (folderRecords && folderRecords.length > 0) { + for (const folderRecord of folderRecords) { + try { + const stmt = db.db.prepare( + 'INSERT OR REPLACE INTO folders (path, parent_path, name, image_count, last_scan) VALUES (?, ?, ?, ?, ?)' + ); + stmt.run( + folderRecord.path, + folderRecord.parent_path || null, + folderRecord.name, + folderRecord.image_count || 0, + folderRecord.last_scan || Date.now() + ); + } catch (error) { + console.warn(`恢复文件夹记录失败: ${folderRecord.path}`, error); + } + } + } else if (item.type === 'folder') { + // 空文件夹没有数据库记录,需要重新创建 + try { + const folderName = path.basename(item.path); + const parentPath = path.dirname(item.path); + const stmt = db.db.prepare( + 'INSERT OR REPLACE INTO folders (path, parent_path, name, image_count, last_scan) VALUES (?, ?, ?, ?, ?)' + ); + stmt.run( + item.path, + parentPath === '.' ? null : parentPath, + folderName, + 0, + Date.now() + ); + console.log(` 创建空文件夹记录: ${item.path}`); + } catch (error) { + console.warn(`创建文件夹记录失败: ${item.path}`, error); + } + } + + if (imageRecords) { + const records = Array.isArray(imageRecords) ? imageRecords : [imageRecords]; + for (const record of records) { + try { + db.insertImage(record); + } catch (error) { + console.warn(`恢复图片记录失败: ${record.path}`, error); + } + } + } + + // 删除元数据文件 + if (fs.existsSync(metaPath)) { + fs.unlinkSync(metaPath); + } + + results.success.push(item.path); + console.log(`✅ 恢复成功: ${item.path}`); + } catch (error) { + console.error(`恢复失败 ${item.path}:`, error); + results.failed.push({ path: item.path, error: error.message }); + } + } + + // 如果备份目录为空,删除它 + try { + const files = fs.readdirSync(backupDir); + if (files.length === 0) { + fs.rmdirSync(backupDir); + } + } catch (error) { + // 忽略错误 + } + + // 更新文件夹计数(关键:确保计数准确) + if (results.success.length > 0) { + db.updateAllFolderCounts(); + } + + return results; + } + + /** + * 清理过期的临时文件(超过5分钟的移入回收站) + * @param {string} libraryId - 素材库ID + */ + async cleanExpiredTempFiles(libraryId) { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + const backupDir = path.join(libraryPath, TEMP_BACKUP_DIR); + + if (!fs.existsSync(backupDir)) { + return { cleaned: 0, failed: 0, thumbnailsCleaned: 0 }; + } + + const FIVE_MINUTES = 5 * 60 * 1000; // 5分钟 + const now = Date.now(); + let cleaned = 0; + let failed = 0; + let thumbnailsCleaned = 0; // 统计清理的缩略图数量 + + // 递归扫描备份目录 + const scanDir = async (dir) => { + const files = fs.readdirSync(dir); + + for (const file of files) { + const fullPath = path.join(dir, file); + + // 跳过 meta 文件 + if (file.endsWith('.meta.json')) continue; + + const metaPath = fullPath + '.meta.json'; + + // 检查是否有对应的 meta 文件 + if (fs.existsSync(metaPath)) { + try { + const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8')); + const age = now - meta.deletedAt; + + // 超过5分钟,移入系统回收站 + if (age > FIVE_MINUTES) { + try { + // 1. 清理缩略图(在移入回收站前) + if (meta.imageRecords) { + const records = Array.isArray(meta.imageRecords) ? meta.imageRecords : [meta.imageRecords]; + for (const record of records) { + if (record.thumbnail_path) { + try { + const thumbnailFullPath = path.join(libraryPath, record.thumbnail_path); + if (fs.existsSync(thumbnailFullPath)) { + fs.unlinkSync(thumbnailFullPath); + thumbnailsCleaned++; + console.log(`🧹 已清理缩略图: ${record.thumbnail_path}`); + } + } catch (thumbError) { + console.warn(`清理缩略图失败 ${record.thumbnail_path}:`, thumbError.message); + } + } + } + } + + // 2. 移入系统回收站 + // trash v8 是 ESM 模块,需要使用动态 import + const { default: trash } = await import('trash'); + await trash([fullPath]); + fs.unlinkSync(metaPath); // 删除 meta 文件 + cleaned++; + console.log(`🗑️ 已将过期文件移入回收站: ${meta.originalPath}`); + } catch (error) { + console.error(`清理失败 ${meta.originalPath}:`, error); + failed++; + } + } + } catch (error) { + console.error(`读取 meta 失败 ${metaPath}:`, error); + } + } else if (fs.statSync(fullPath).isDirectory()) { + // 递归处理子目录 + await scanDir(fullPath); + } + } + }; + + await scanDir(backupDir); + + // 清理完成后,递归删除所有空文件夹 + const removeEmptyDirs = (dir) => { + try { + // 检查目录是否存在 + if (!fs.existsSync(dir)) { + return; + } + + // 读取目录内容 + let entries; + try { + entries = fs.readdirSync(dir); + } catch (error) { + // 目录可能已被删除或无权限访问 + return; + } + + // 先递归处理所有子目录 + for (const entry of entries) { + const fullPath = path.join(dir, entry); + try { + // 检查是否存在且为目录 + if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) { + removeEmptyDirs(fullPath); + } + } catch (error) { + // 文件可能在处理过程中被删除,忽略 + continue; + } + } + + // 再次检查当前目录是否为空(因为子目录可能已被删除) + let remainingFiles; + try { + remainingFiles = fs.readdirSync(dir); + } catch (error) { + // 目录可能已被删除 + return; + } + + // 如果目录为空,则删除它(除了根 temp_backup 目录) + if (remainingFiles.length === 0) { + if (dir === backupDir) { + // 根目录也删除(如果完全为空) + try { + fs.rmdirSync(dir); + console.log(`🧹 已删除空的备份目录: ${TEMP_BACKUP_DIR}`); + } catch (error) { + // 忽略根目录删除失败 + } + } else { + // 子目录删除 + try { + fs.rmdirSync(dir); + const relativePath = path.relative(backupDir, dir); + console.log(`🧹 已删除空文件夹: ${relativePath}`); + } catch (error) { + // 忽略删除失败(可能权限问题) + } + } + } + } catch (error) { + // 忽略所有其他错误 + } + }; + + // 执行清理空文件夹 + try { + removeEmptyDirs(backupDir); + } catch (error) { + console.warn('[cleanExpiredTempFiles] 清理空文件夹时出错:', error.message); + } + + return { cleaned, failed, thumbnailsCleaned }; + } + + /** + * 递归复制目录 + */ + _copyDirSync(src, dest) { + fs.mkdirSync(dest, { recursive: true }); + const files = fs.readdirSync(src); + + for (const file of files) { + const srcPath = path.join(src, file); + const destPath = path.join(dest, file); + const stat = fs.statSync(srcPath); + + if (stat.isDirectory()) { + this._copyDirSync(srcPath, destPath); + } else { + fs.copyFileSync(srcPath, destPath); + } + } + } + + /** + * 获取数据库实例 + */ + _getDatabase(libraryId) { + const config = this.configManager.load(); + const library = config.libraries.find(lib => lib.id === libraryId); + if (!library) { + throw new Error(`素材库不存在: ${libraryId}`); + } + return this.dbPool.acquire(library.path); + } + + /** + * 删除文件或文件夹(移到临时文件夹,5分钟内可撤销) + * @param {string} libraryId - 素材库ID + * @param {Array} items - 待删除项 [{type: 'file'|'folder', path: 'relative/path'}] + */ + async deleteItems(libraryId, items) { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + const results = { success: [], failed: [] }; + + for (const item of items) { + try { + const fullPath = path.join(libraryPath, item.path); + + // 检查文件/文件夹是否存在 + if (!fs.existsSync(fullPath)) { + if (item.type === 'folder') { + // 物理文件夹已不存在:视为只需要清理数据库中的“空壳”记录 + console.warn(`目标文件夹不存在,仅清理数据库记录: ${item.path}`); + try { + db.deleteImagesByFolderPrefix(item.path); + db.deleteFoldersByPrefix(item.path); + results.success.push(item.path); + } catch (e) { + console.error(`清理不存在文件夹的数据库记录失败 ${item.path}:`, e.message); + results.failed.push({ path: item.path, error: e.message }); + } + } else { + // 文件不存在仍然视为失败,提示用户 + results.failed.push({ path: item.path, error: '文件不存在' }); + } + continue; + } + + // 移到临时备份文件夹(5分钟内可撤销) + const backupDir = path.join(libraryPath, TEMP_BACKUP_DIR); + if (!fs.existsSync(backupDir)) { + fs.mkdirSync(backupDir, { recursive: true }); + } + + const backupPath = path.join(backupDir, item.path); + const backupParentDir = path.dirname(backupPath); + + // 确保备份目录存在 + if (!fs.existsSync(backupParentDir)) { + fs.mkdirSync(backupParentDir, { recursive: true }); + } + + // 移动文件到备份目录 + try { + // 尝试直接 rename(快速) + fs.renameSync(fullPath, backupPath); + } catch (renameError) { + // rename 失败(可能是权限问题或跨磁盘),使用复制+删除 + console.log(`⚠️ rename失败,使用复制方式: ${item.path}`); + if (item.type === 'folder') { + // 文件夹:递归复制 + this._copyDirSync(fullPath, backupPath); + // 删除原文件夹 + fs.rmSync(fullPath, { recursive: true, force: true }); + } else { + // 文件:直接复制 + fs.copyFileSync(fullPath, backupPath); + fs.unlinkSync(fullPath); + } + } + + // 记录删除时间(用于5分钟后清理) + const metaPath = backupPath + '.meta.json'; + fs.writeFileSync(metaPath, JSON.stringify({ + originalPath: item.path, + deletedAt: Date.now(), + type: item.type + })); + + console.log(`📦 已移入临时文件夹: ${item.path}`); + + // 删除数据库记录前,先保存到meta(恢复时需要) + let imageRecords = null; + let folderRecords = null; + + if (item.type === 'folder') { + // 保存文件夹内所有图片和文件夹的数据库记录 + imageRecords = db.getImagesByFolderPrefix(item.path); + const stmt = db.db.prepare('SELECT * FROM folders WHERE path = ? OR path LIKE ?'); + folderRecords = stmt.all(item.path, `${item.path}/%`); + + console.log(`🔍 删除文件夹: ${item.path} (图片:${imageRecords?.length || 0}, 子文件夹:${folderRecords?.length || 0})`); + + // 删除数据库记录 + db.deleteImagesByFolderPrefix(item.path); + db.deleteFoldersByPrefix(item.path); + } else { + // 保存单个文件的数据库记录 + imageRecords = db.getImageByPath(item.path); + db.deleteImage(item.path); + } + + // 更新meta文件,包含数据库记录(只保存非空记录) + const metaContent = JSON.parse(fs.readFileSync(metaPath, 'utf8')); + if (imageRecords && (Array.isArray(imageRecords) ? imageRecords.length > 0 : true)) { + metaContent.imageRecords = imageRecords; + } + if (folderRecords && folderRecords.length > 0) { + metaContent.folderRecords = folderRecords; + } + fs.writeFileSync(metaPath, JSON.stringify(metaContent)); + + // 删除缩略图(可选,因为缩略图基于 hash,可能被其他文件共享) + // this._deleteThumbnail(db, item.path); + + results.success.push(item.path); + } catch (error) { + console.error(`删除失败 ${item.path}:`, error.message); + results.failed.push({ path: item.path, error: error.message }); + } + } + + // 更新文件夹计数 + if (results.success.length > 0) { + db.updateAllFolderCounts(); + } + + return results; + } + + /** + * 递归复制文件夹(辅助方法) + * @private + */ + _copyDirSync(src, dest) { + // 创建目标目录 + if (!fs.existsSync(dest)) { + fs.mkdirSync(dest, { recursive: true }); + } + + // 读取源目录内容 + const entries = fs.readdirSync(src, { withFileTypes: true }); + + for (const entry of entries) { + const srcPath = path.join(src, entry.name); + const destPath = path.join(dest, entry.name); + + if (entry.isDirectory()) { + // 递归复制子目录 + this._copyDirSync(srcPath, destPath); + } else { + // 复制文件 + fs.copyFileSync(srcPath, destPath); + } + } + } + + /** + * 重命名文件或文件夹 + * @param {string} libraryId - 素材库ID + * @param {string} oldPath - 旧路径(相对路径,使用正斜杠) + * @param {string} newName - 新名称(不含路径) + */ + async renameItem(libraryId, oldPath, newName) { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + + // 归一化旧路径,确保使用正斜杠 + const normalizedOldPath = oldPath.replace(/\\/g, '/'); + const fullOldPath = path.join(libraryPath, normalizedOldPath); + + // 检查文件/文件夹是否存在 + if (!fs.existsSync(fullOldPath)) { + throw new Error('文件不存在'); + } + + const stat = fs.lstatSync(fullOldPath); + const isDirectory = stat.isDirectory(); + + const directory = path.dirname(fullOldPath); + const initialNewPath = path.join(directory, newName); + + // 如果目标已存在,则自动编号避免冲突 + let finalFullNewPath = initialNewPath; + let finalNewName = newName; + + if (fs.existsSync(finalFullNewPath)) { + const ext = isDirectory ? '' : path.extname(newName); + const basename = isDirectory ? newName : path.basename(newName, ext); + let counter = 1; + + while (fs.existsSync(finalFullNewPath)) { + const numberedName = isDirectory + ? `${basename} (${counter})` + : `${basename} (${counter})${ext}`; + finalFullNewPath = path.join(directory, numberedName); + finalNewName = numberedName; + counter++; + } + } + + // 执行重命名(文件或文件夹) + fs.renameSync(fullOldPath, finalFullNewPath); + + // 计算新的相对路径 + const newRelativePath = path + .relative(libraryPath, finalFullNewPath) + .replace(/\\/g, '/'); + + if (isDirectory) { + // 文件夹:更新 folders 表与 images 表中所有相关记录 + this._updateFolderPathInDatabase(db, normalizedOldPath, newRelativePath); + } else { + // 单个文件:仅更新 images 表中的一条记录 + this._updatePathInDatabase(db, normalizedOldPath, newRelativePath); + } + + return { newPath: newRelativePath, newName: finalNewName }; + } + + /** + * 移动文件或文件夹 + * @param {string} libraryId - 素材库ID + * @param {Array} items - 待移动项 + * @param {string} targetFolder - 目标文件夹(相对路径) + */ + async moveItems(libraryId, items, targetFolder) { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + const results = { success: [], failed: [] }; + + for (const item of items) { + try { + // 归一化路径(使用正斜杠) + const oldPath = item.path.replace(/\\/g, '/'); + const fileName = path.basename(oldPath); + const normalizedTarget = targetFolder ? targetFolder.replace(/\\/g, '/') : ''; + + // 目标文件夹相对路径 + const newRelativeFolder = normalizedTarget + ? `${normalizedTarget}/${fileName}` + : fileName; + + const oldFullPath = path.join(libraryPath, oldPath); + const newFullPath = path.join(libraryPath, newRelativeFolder); + + // 检查源路径是否存在 + if (!fs.existsSync(oldFullPath)) { + results.failed.push({ path: oldPath, error: '源文件不存在' }); + continue; + } + + // 检查目标父级文件夹是否存在 + const targetFullPath = normalizedTarget + ? path.join(libraryPath, normalizedTarget) + : libraryPath; + if (!fs.existsSync(targetFullPath)) { + fs.mkdirSync(targetFullPath, { recursive: true }); + } + + // 检查目标是否已存在同名文件/文件夹 + if (fs.existsSync(newFullPath)) { + results.failed.push({ path: oldPath, error: '目标位置已存在同名文件' }); + continue; + } + + if (item.type === 'folder') { + // ===== 文件夹移动逻辑 ===== + + // 1. 先在磁盘上移动整个文件夹树 + fs.renameSync(oldFullPath, newFullPath); + + // 2. 更新 folders 表中该文件夹及其所有子文件夹的 path / parent_path + const oldFolderPath = oldPath; + const newFolderPath = newRelativeFolder; + const len = oldFolderPath.length + 1; // 用于 substr 去掉前缀 + + // 2.1 更新根文件夹记录 + const updateRootFolderStmt = db.db.prepare(` + UPDATE folders + SET path = ?, parent_path = ? + WHERE path = ? + `); + updateRootFolderStmt.run( + newFolderPath, + normalizedTarget || null, + oldFolderPath + ); + + // 2.2 更新子文件夹记录(保持层级结构) + const updateChildFoldersStmt = db.db.prepare(` + UPDATE folders + SET path = ? || substr(path, ?), + parent_path = ? || substr(parent_path, ?) + WHERE path LIKE ? + `); + updateChildFoldersStmt.run( + newFolderPath, + len, + newFolderPath, + len, + `${oldFolderPath}/%` + ); + + // 3. 更新 images 表中所有属于该文件夹及子文件夹的图片路径和 folder 字段 + const updateImagesStmt = db.db.prepare(` + UPDATE images + SET path = ? || substr(path, ?), + folder = ? || substr(folder, ?) + WHERE folder = ? OR folder LIKE ? + `); + updateImagesStmt.run( + newFolderPath, + len, + newFolderPath, + len, + oldFolderPath, + `${oldFolderPath}/%` + ); + + results.success.push({ oldPath: oldFolderPath, newPath: newFolderPath }); + } else { + // ===== 单个文件移动逻辑(保持原有行为) ===== + + // 移动文件(同分区使用 rename,跨分区自动降级为复制+删除) + fs.renameSync(oldFullPath, newFullPath); + + // 更新数据库(单个图片记录) + const newRelativePath = newRelativeFolder.replace(/\\/g, '/'); + this._updatePathInDatabase(db, oldPath, newRelativePath); + + results.success.push({ oldPath, newPath: newRelativePath }); + } + } catch (error) { + console.error(`移动失败 ${item.path}:`, error.message); + results.failed.push({ path: item.path, error: error.message }); + } + } + + // 更新文件夹计数 + if (results.success.length > 0) { + db.updateAllFolderCounts(); + } + + return results; + } + + /** + * 复制文件或文件夹 + * @param {string} libraryId - 素材库ID + * @param {Array} items - 待复制项 + * @param {string} targetFolder - 目标文件夹(相对路径) + * @param {string} conflictAction - 冲突处理方式: 'skip'|'replace'|'rename' + */ + async copyItems(libraryId, items, targetFolder, conflictAction = 'rename') { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + const results = { success: [], failed: [], conflicts: [] }; + + // 确保目标文件夹存在 + const targetFullPath = path.join(libraryPath, targetFolder || ''); + if (!fs.existsSync(targetFullPath)) { + fs.mkdirSync(targetFullPath, { recursive: true }); + } + + for (const item of items) { + try { + const srcFullPath = path.join(libraryPath, item.path); + const fileName = path.basename(item.path); + const dstFullPath = path.join(targetFullPath, fileName); + + // 检查源文件是否存在 + if (!fs.existsSync(srcFullPath)) { + results.failed.push({ path: item.path, error: '源文件不存在' }); + continue; + } + + // 处理冲突 + let finalDstPath = dstFullPath; + const isDirectory = item.type === 'folder'; + + // 检查是否与源路径相同(在同一文件夹内复制粘贴) + if (srcFullPath === dstFullPath) { + // 记录冲突 + results.conflicts.push({ path: item.path, name: fileName }); + + if (conflictAction === 'skip') { + // 跳过:源和目标相同,直接跳过 + console.log(`⏭️ 跳过(源和目标相同): ${fileName}`); + continue; + } else if (conflictAction === 'replace') { + // 覆盖:源和目标相同,无法覆盖自己,跳过 + console.log(`⏭️ 跳过(无法覆盖自己): ${fileName}`); + continue; + } else if (conflictAction === 'rename') { + // 重命名:自动编号创建副本 + const ext = isDirectory ? '' : path.extname(fileName); + const basename = isDirectory ? fileName : path.basename(fileName, ext); + let counter = 1; + + while (fs.existsSync(finalDstPath)) { + const numberedName = isDirectory + ? `${basename} (${counter})` + : `${basename} (${counter})${ext}`; + finalDstPath = path.join(targetFullPath, numberedName); + counter++; + } + console.log(`✏️ 创建副本: ${path.basename(finalDstPath)}`); + } + } else if (fs.existsSync(dstFullPath)) { + // 目标文件存在但与源不同 + results.conflicts.push({ path: item.path, name: fileName }); + + if (conflictAction === 'skip') { + // 跳过冲突文件 + console.log(`⏭️ 跳过冲突文件: ${fileName}`); + continue; + } else if (conflictAction === 'replace') { + // 覆盖:先删除目标文件/文件夹 + console.log(`🔄 覆盖文件: ${fileName}`); + if (fs.statSync(dstFullPath).isDirectory()) { + fs.rmSync(dstFullPath, { recursive: true, force: true }); + } else { + fs.unlinkSync(dstFullPath); + } + } else if (conflictAction === 'rename') { + // 重命名:自动编号 + const ext = isDirectory ? '' : path.extname(fileName); + const basename = isDirectory ? fileName : path.basename(fileName, ext); + let counter = 1; + + while (fs.existsSync(finalDstPath)) { + const numberedName = isDirectory + ? `${basename} (${counter})` + : `${basename} (${counter})${ext}`; + finalDstPath = path.join(targetFullPath, numberedName); + counter++; + } + console.log(`✏️ 重命名为: ${path.basename(finalDstPath)}`); + } + } + + // 复制文件或文件夹 + if (item.type === 'folder') { + // 复制整个文件夹 + fs.cpSync(srcFullPath, finalDstPath, { recursive: true }); + + // 递归处理文件夹中的所有图片(生成缩略图、入库) + await this._processFolderImages(finalDstPath, libraryPath, db); + } else { + // 复制单个文件 + fs.copyFileSync(srcFullPath, finalDstPath); + + // 处理新文件(生成缩略图、入库) + await processImage(finalDstPath, libraryPath, db); + } + + const newRelativePath = path.relative(libraryPath, finalDstPath).replace(/\\/g, '/'); + results.success.push({ oldPath: item.path, newPath: newRelativePath }); + console.log(`✅ 复制成功: ${item.path} → ${newRelativePath}`); + } catch (error) { + console.error(`复制失败 ${item.path}:`, error.message); + results.failed.push({ path: item.path, error: error.message }); + } + } + + // 更新文件夹计数 + if (results.success.length > 0) { + db.updateAllFolderCounts(); + } + + return results; + } + + /** + * 递归处理文件夹中的所有图片 + * @private + */ + async _processFolderImages(folderPath, libraryPath, db) { + const entries = fs.readdirSync(folderPath, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(folderPath, entry.name); + + if (entry.isDirectory()) { + // 跳过 .flypic 目录 + if (entry.name === '.flypic') continue; + + // 递归处理子文件夹 + await this._processFolderImages(fullPath, libraryPath, db); + } else { + // 检查是否是图片文件 + const ext = path.extname(entry.name).toLowerCase(); + const imageExts = ['.jpg', '.jpeg', '.png', '.webp', '.gif', '.bmp', '.tiff']; + + if (imageExts.includes(ext)) { + try { + await processImage(fullPath, libraryPath, db); + } catch (error) { + console.warn(`处理图片失败 ${entry.name}:`, error.message); + } + } + } + } + } + + /** + * 更新文件元数据(评分、收藏、标签) + * @param {string} libraryId - 素材库ID + * @param {string} imagePath - 图片路径(相对路径) + * @param {Object} metadata - 元数据 {rating, favorite, tags} + */ + async updateMetadata(libraryId, imagePath, metadata) { + const db = this._getDatabase(libraryId); + + const updates = {}; + if (metadata.rating !== undefined) updates.rating = metadata.rating; + if (metadata.favorite !== undefined) updates.favorite = metadata.favorite; + if (metadata.tags !== undefined) { + updates.tags = Array.isArray(metadata.tags) + ? JSON.stringify(metadata.tags) + : metadata.tags; + } + + if (Object.keys(updates).length === 0) { + throw new Error('没有要更新的元数据'); + } + + // 构建 SQL 更新语句 + const fields = Object.keys(updates).map(key => `${key} = ?`).join(', '); + const values = [...Object.values(updates), imagePath]; + + const stmt = db.db.prepare(`UPDATE images SET ${fields} WHERE path = ?`); + const result = stmt.run(...values); + + if (result.changes === 0) { + throw new Error('图片不存在'); + } + + // 更新数据库修改时间 + db.updateLastModified(); + + return db.getImageByPath(imagePath); + } + + /** + * 更新数据库中的路径(仅用于单个文件) + * @private + */ + _updatePathInDatabase(db, oldPath, newPath) { + const image = db.getImageByPath(oldPath); + if (!image) { + return; + } + + const newFilename = path.basename(newPath); + const newFolder = path.dirname(newPath); + + const stmt = db.db.prepare(` + UPDATE images + SET path = ?, filename = ?, folder = ? + WHERE path = ? + `); + + stmt.run( + newPath, + newFilename, + newFolder === '.' ? '' : newFolder.replace(/\\/g, '/'), + oldPath + ); + + db.updateLastModified(); + } + + /** + * 更新数据库中的文件夹路径(folders + images) + * @private + */ + _updateFolderPathInDatabase(db, oldFolderPath, newFolderPath) { + const normalizedOld = oldFolderPath.replace(/\\/g, '/'); + const normalizedNew = newFolderPath.replace(/\\/g, '/'); + + const len = normalizedOld.length + 1; // 用于去掉前缀 + + // 1. 更新根文件夹记录(path / name,parent_path 保持不变) + const rootFolder = db.getFolderByPath(normalizedOld); + const parentPath = rootFolder ? rootFolder.parent_path : path.dirname(normalizedOld); + + const updateRootFolderStmt = db.db.prepare(` + UPDATE folders + SET path = ?, parent_path = ?, name = ? + WHERE path = ? + `); + updateRootFolderStmt.run( + normalizedNew, + parentPath || null, + path.basename(normalizedNew), + normalizedOld + ); + + // 2. 更新子文件夹记录(保持层级结构) + const updateChildFoldersStmt = db.db.prepare(` + UPDATE folders + SET path = ? || substr(path, ?), + parent_path = ? || substr(parent_path, ?) + WHERE path LIKE ? + `); + updateChildFoldersStmt.run( + normalizedNew, + len, + normalizedNew, + len, + `${normalizedOld}/%` + ); + + // 3. 更新 images 表中所有属于该文件夹及子文件夹的图片路径和 folder 字段 + const updateImagesStmt = db.db.prepare(` + UPDATE images + SET path = ? || substr(path, ?), + folder = ? || substr(folder, ?) + WHERE folder = ? OR folder LIKE ? + `); + updateImagesStmt.run( + normalizedNew, + len, + normalizedNew, + len, + normalizedOld, + `${normalizedOld}/%` + ); + + // 4. 重新计算所有文件夹的图片数量 + db.updateAllFolderCounts(); + db.updateLastModified(); + } + + /** + * 创建空文件夹 + * @param {string} libraryId - 素材库ID + * @param {string} folderPath - 文件夹路径(相对路径) + */ + async createFolder(libraryId, folderPath) { + const db = this._getDatabase(libraryId); + const libraryPath = db.libraryPath; + const fullPath = path.join(libraryPath, folderPath); + + // 检查文件夹是否已存在 + if (fs.existsSync(fullPath)) { + throw new Error('文件夹已存在'); + } + + // 创建文件夹 + fs.mkdirSync(fullPath, { recursive: true }); + console.log(`📁 创建文件夹: ${folderPath}`); + + // 添加到数据库 + const normalizedPath = folderPath.replace(/\\/g, '/'); + const parentPath = normalizedPath.includes('/') + ? normalizedPath.substring(0, normalizedPath.lastIndexOf('/')) + : ''; + const name = normalizedPath.split('/').pop(); + + // 确保父文件夹链存在 + if (parentPath) { + let current = parentPath; + while (current && current !== '.') { + const existing = db.getFolderByPath(current); + if (!existing) { + const parent = path.posix.dirname(current); + const folderName = current.split('/').pop(); + db.insertFolder({ + path: current, + parent_path: parent === '.' ? '' : parent, + name: folderName, + image_count: 0 + }); + } + const parent = path.posix.dirname(current); + if (parent === current) break; + current = parent; + } + } + + // 插入新文件夹 + db.insertFolder({ + path: normalizedPath, + parent_path: parentPath, + name: name, + image_count: 0 + }); + + return { path: normalizedPath }; + } + + /** + * 删除缩略图(私有方法) + */ + _deleteThumbnail(db, imagePath) { + const image = db.getImageByPath(imagePath); + if (!image || !image.thumbnail_path) return; + + try { + const thumbnailFullPath = path.join(db.libraryPath, image.thumbnail_path); + if (fs.existsSync(thumbnailFullPath)) { + fs.unlinkSync(thumbnailFullPath); + } + } catch (error) { + console.warn(`删除缩略图失败: ${error.message}`); + } + } +} + +module.exports = FileService; diff --git a/flypic/app/server/src/services/ImageService.js b/flypic/app/server/src/services/ImageService.js index c0d9e19..62c992a 100644 --- a/flypic/app/server/src/services/ImageService.js +++ b/flypic/app/server/src/services/ImageService.js @@ -162,6 +162,52 @@ class ImageService { } } + /** + * 批量更新图片评分 + */ + async updateRating(libraryId, paths, rating) { + const library = this._getLibrary(libraryId); + const db = this.dbPool.acquire(library.path); + + try { + const imageModel = new ImageModel(db.db); + const results = { + success: [], + failed: [] + }; + + // 批量更新 + for (const imagePath of paths) { + try { + const stmt = db.db.prepare('UPDATE images SET rating = ? WHERE path = ?'); + const result = stmt.run(rating, imagePath); + + if (result.changes > 0) { + results.success.push(imagePath); + } else { + results.failed.push({ path: imagePath, error: '图片不存在' }); + } + } catch (error) { + results.failed.push({ path: imagePath, error: error.message }); + } + } + + // 更新数据库修改时间 + if (results.success.length > 0) { + db.updateLastModified(); + } + + return { + updated: results.success.length, + failed: results.failed.length, + success: results.success, + failed: results.failed + }; + } finally { + this.dbPool.release(library.path); + } + } + /** * 获取素材库对象 * @private diff --git a/flypic/app/server/utils/lightweightWatcher.js b/flypic/app/server/utils/lightweightWatcher.js index 1fa565b..9221308 100644 --- a/flypic/app/server/utils/lightweightWatcher.js +++ b/flypic/app/server/utils/lightweightWatcher.js @@ -180,13 +180,14 @@ class LightweightWatcher { try { // 获取数据库中这些文件夹的文件列表 + // 🔥 关键修复:只查询文件夹直接包含的文件,不包含子文件夹 + // 因为 _scanFolder 不递归扫描,如果这里包含子文件夹,会误删子文件夹的记录 const dbFiles = new Set(); for (const folder of changedFolders) { const relativePath = path.relative(libraryPath, folder).replace(/\\/g, '/'); - // 使用正确的 SQL 模式匹配 - const pattern = relativePath ? `${relativePath}/%` : '%'; - const stmt = db.db.prepare('SELECT path FROM images WHERE folder = ? OR folder LIKE ?'); - const rows = stmt.all(relativePath, pattern); + // 只查询 folder = ? 的记录,不包含子文件夹(去掉 OR folder LIKE ?/%) + const stmt = db.db.prepare('SELECT path FROM images WHERE folder = ?'); + const rows = stmt.all(relativePath); rows.forEach(row => dbFiles.add(row.path)); } diff --git a/flypic/cmd/uninstall_callback b/flypic/cmd/uninstall_callback index 06bd986..7831918 100644 --- a/flypic/cmd/uninstall_callback +++ b/flypic/cmd/uninstall_callback @@ -1,2 +1,27 @@ #!/bin/bash + +# FlyPic 卸载后清理脚本 +# 清理应用配置文件(包括密码、JWT密钥等) +# 不清理素材库中的 .flypic 数据(缩略图、数据库等) + +echo "🧹 FlyPic 卸载清理..." + +# 清理应用配置文件 +if [ -n "$TRIM_PKGVAR" ]; then + CONFIG_FILE="$TRIM_PKGVAR/config.json" + + if [ -f "$CONFIG_FILE" ]; then + echo "清理配置文件: $CONFIG_FILE" + rm -f "$CONFIG_FILE" + echo "✅ 配置文件已清理" + else + echo "📝 未找到配置文件,跳过" + fi +else + echo "⚠️ 未检测到飞牛环境变量" +fi + +echo "✨ 卸载清理完成" +echo "💡 素材库中的 .flypic 数据已保留" + exit 0 diff --git a/flypic/manifest b/flypic/manifest index 3ccb7bc..e7e82d8 100644 --- a/flypic/manifest +++ b/flypic/manifest @@ -1,5 +1,5 @@ appname=flypic -version=1.0.5 +version=1.2.0 desc=飞图 - 专为飞牛 fnOS 设计的轻量、快速、稳定的图像素材检索浏览应用,支持数十万级别图片流畅浏览,非侵入式设计,100% 开源免费 arch=x86_64 display_name=FlyPic diff --git a/frontend/package.json b/frontend/package.json index fadca27..74ccff7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "flypic-frontend", - "version": "1.0.5", + "version": "1.2.0", "private": true, "type": "module", "scripts": { diff --git a/package-lock.json b/package-lock.json index fbc1b49..b2cbad1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ }, "frontend": { "name": "flypic-frontend", - "version": "1.0.5", + "version": "1.2.0", "dependencies": { "axios": "^1.6.2", "jszip": "^3.10.1", @@ -859,8 +859,8 @@ } }, "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", + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.0.tgz", "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", "cpu": [ "arm" @@ -973,7 +973,7 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.0.5" + "@img/sharp-libvips-linux-arm": "1.2.0" } }, "node_modules/@img/sharp-linux-arm64": { @@ -2199,7 +2199,7 @@ "license": "MIT", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.5", + "content-type": "~1.2.0", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -2587,8 +2587,8 @@ } }, "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.2.0.tgz", "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "license": "MIT", "engines": { @@ -3954,7 +3954,7 @@ "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", - "setimmediate": "^1.0.5" + "setimmediate": "^1.2.0" } }, "node_modules/jszip/node_modules/readable-stream": { @@ -5524,8 +5524,8 @@ } }, "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.0.5.tgz", + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.2.0.tgz", "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", "license": "MIT" }, @@ -5557,7 +5557,7 @@ "@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-arm": "1.2.0", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4",