diff --git a/.gitignore b/.gitignore index 31dd8f7..a51bd51 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,8 @@ Knowledge base/ # 构建输出 dist/ -.zip +flypic/ +flypic.zip # 测试数据 test-library/ diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 0c74207..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,83 +0,0 @@ -# FlyPic 更新日志 - -## [0.2.0] - 2024-12-03 - -### 🎉 重大更新:代码架构重构 - -#### ✨ 新增 -- **后端三层架构**:Config → Model → Service → Route - - 新增 `backend/src/config/` - 统一配置管理 - - 新增 `backend/src/models/` - 数据访问层(Repository Pattern) - - 新增 `backend/src/services/` - 业务逻辑层 - - 新增 `backend/src/routes/` - HTTP 接口层(薄层) - - 新增 `backend/src/middleware/` - 统一错误处理和验证 - - 新增 `backend/src/utils/` - 工具函数(字段映射、日志) - -- **前端模块化架构**:Store → Hooks → API → Components - - 新增 `frontend/src/stores/` - 状态管理拆分(4个独立Store) - - 新增 `frontend/src/api/` - HTTP 客户端(Fetch替代axios) - - 新增 `frontend/src/hooks/` - 自定义 Hooks - - 新增 `frontend/src/constants/` - 前端常量 - -#### 🔧 改进 -- **代码质量** - - 代码行数减少 30% - - 代码重复率降低 50% - - 圈复杂度降低 40% - -- **架构优化** - - 清晰的分层架构 - - 统一的错误处理 - - 规范的命名(全部 camelCase) - - 完整的 JSDoc 注释 - -- **可维护性** - - 业务逻辑集中在 Service 层 - - 路由层只处理 HTTP - - 依赖注入设计 - - 易于测试和扩展 - -#### 🗑️ 移除 -- 移除重构过程中的临时文档 -- 备份旧的 server.js 为 server-old-backup.js - -#### 📝 文档 -- 保留 `重构完成报告.md` 作为架构参考 -- 保留 `README.md` 和 `飞牛打包部署指南.md` - ---- - -## [1.0.0] - 2024-11-XX - -### 初始版本 - -#### ✨ 功能 -- 多素材库管理(添加/删除/切换) -- 智能扫描系统(全量扫描 + 增量同步) -- 缩略图生成(WebP格式,30-50KB) -- SQLite 数据库存储 -- 多关键词搜索(AND逻辑) -- Google Photos 风格瀑布流布局 -- 亮色/暗色主题切换 -- 实时扫描进度显示 -- 图片详情面板 - -#### 🛠️ 技术栈 -- 后端:Node.js + Express + Sharp + better-sqlite3 + Socket.IO -- 前端:React + Vite + TailwindCSS + react-photo-view + zustand - ---- - -## 版本说明 - -### 版本号规则 -- 主版本号:重大架构变更 -- 次版本号:新功能添加 -- 修订号:Bug 修复和小改进 - -### 支持的格式 -jpg, jpeg, png, webp, gif, bmp, tiff - -### 端口配置 -- 后端:15002 -- 前端开发:5173 diff --git a/flypic.zip b/flypic.zip deleted file mode 100644 index 1acbded..0000000 Binary files a/flypic.zip and /dev/null differ diff --git a/flypic/app/server/package-lock.json b/flypic/app/server/package-lock.json index efce4da..bb48846 100644 --- a/flypic/app/server/package-lock.json +++ b/flypic/app/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "flypic-backend", - "version": "1.0.0", + "version": "1.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "flypic-backend", - "version": "1.0.0", + "version": "1.0.5", "dependencies": { "better-sqlite3": "^9.2.2", "chokidar": "^3.6.0", diff --git a/flypic/app/server/package.json b/flypic/app/server/package.json index 602765a..8775514 100644 --- a/flypic/app/server/package.json +++ b/flypic/app/server/package.json @@ -1,6 +1,6 @@ { "name": "flypic-backend", - "version": "1.0.0", + "version": "1.0.5", "description": "FlyPic backend server", "main": "server.js", "scripts": { diff --git a/flypic/app/server/public/assets/index-CcwAM3eE.css b/flypic/app/server/public/assets/index-CcwAM3eE.css deleted file mode 100644 index f44d34c..0000000 --- a/flypic/app/server/public/assets/index-CcwAM3eE.css +++ /dev/null @@ -1 +0,0 @@ -.PhotoView-Portal{direction:ltr;height:100%;left:0;overflow:hidden;position:fixed;top:0;touch-action:none;width:100%;z-index:2000}@keyframes PhotoView__rotate{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes PhotoView__delayIn{0%,50%{opacity:0}to{opacity:1}}.PhotoView__Spinner{animation:PhotoView__delayIn .4s linear both}.PhotoView__Spinner svg{animation:PhotoView__rotate .6s linear infinite}.PhotoView__Photo{cursor:grab;max-width:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.PhotoView__Photo:active{cursor:grabbing}.PhotoView__icon{display:inline-block;left:0;position:absolute;top:0;transform:translate(-50%,-50%)}.PhotoView__PhotoBox,.PhotoView__PhotoWrap{bottom:0;direction:ltr;left:0;position:absolute;right:0;top:0;touch-action:none;width:100%}.PhotoView__PhotoWrap{overflow:hidden;z-index:10}.PhotoView__PhotoBox{transform-origin:left top}@keyframes PhotoView__fade{0%{opacity:0}to{opacity:1}}.PhotoView-Slider__clean .PhotoView-Slider__ArrowLeft,.PhotoView-Slider__clean .PhotoView-Slider__ArrowRight,.PhotoView-Slider__clean .PhotoView-Slider__BannerWrap,.PhotoView-Slider__clean .PhotoView-Slider__Overlay,.PhotoView-Slider__willClose .PhotoView-Slider__BannerWrap:hover{opacity:0}.PhotoView-Slider__Backdrop{background:#000;height:100%;left:0;position:absolute;top:0;transition-property:background-color;width:100%;z-index:-1}.PhotoView-Slider__fadeIn{animation:PhotoView__fade linear both;opacity:0}.PhotoView-Slider__fadeOut{animation:PhotoView__fade linear reverse both;opacity:0}.PhotoView-Slider__BannerWrap{align-items:center;background-color:#00000080;color:#fff;display:flex;height:44px;justify-content:space-between;left:0;position:absolute;top:0;transition:opacity .2s ease-out;width:100%;z-index:20}.PhotoView-Slider__BannerWrap:hover{opacity:1}.PhotoView-Slider__Counter{font-size:14px;opacity:.75;padding:0 10px}.PhotoView-Slider__BannerRight{align-items:center;display:flex;height:100%}.PhotoView-Slider__toolbarIcon{fill:#fff;box-sizing:border-box;cursor:pointer;opacity:.75;padding:10px;transition:opacity .2s linear}.PhotoView-Slider__toolbarIcon:hover{opacity:1}.PhotoView-Slider__ArrowLeft,.PhotoView-Slider__ArrowRight{align-items:center;bottom:0;cursor:pointer;display:flex;height:100px;justify-content:center;margin:auto;opacity:.75;position:absolute;top:0;transition:opacity .2s linear;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:70px;z-index:20}.PhotoView-Slider__ArrowLeft:hover,.PhotoView-Slider__ArrowRight:hover{opacity:1}.PhotoView-Slider__ArrowLeft svg,.PhotoView-Slider__ArrowRight svg{fill:#fff;background:#0000004d;box-sizing:content-box;height:24px;padding:10px;width:24px}.PhotoView-Slider__ArrowLeft{left:0}.PhotoView-Slider__ArrowRight{right:0}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!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}.left-0{left:0}.left-2{left:.5rem}.left-3{left:.75rem}.right-0{right:0}.right-2{right:.5rem}.top-0{top:0}.top-2{top:.5rem}.top-2\.5{top:.625rem}.-z-10{z-index:-10}.z-10{z-index:10}.z-50{z-index:50}.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}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.grid{display:grid}.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-3{height:.75rem}.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-full{max-height:100%}.min-h-0{min-height:0px}.w-1{width:.25rem}.w-12{width:3rem}.w-3{width:.75rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-80{width:20rem}.w-96{width:24rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-full{max-width:100%}.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-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.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-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-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-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / 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-300{--tw-bg-opacity: 1;background-color:rgb(216 180 254 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-opacity-0{--tw-bg-opacity: 0}.bg-opacity-50{--tw-bg-opacity: .5}.bg-opacity-90{--tw-bg-opacity: .9}.fill-white{fill:#fff}.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-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-8{padding-left:2rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-3{padding-top:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.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}.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(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-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-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-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.opacity-100{opacity:1}.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)}.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-300{transition-duration:.3s}*{margin:0;padding:0;box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#root{width:100vw;height:100vh;overflow:hidden}.dark{--tw-bg-opacity: 1}.dark .bg-gray-900{background-color:#0a0a0a!important}.dark .bg-gray-800{background-color:#252525!important}.dark .bg-gray-700{background-color:#2a2a2a!important}.dark .bg-gray-600,.dark .bg-gray-500{background-color:#3a3a3a!important}.dark .bg-gray-400{background-color:#4a4a4a!important}.dark .bg-gray-300{background-color:#2a2a2a!important}.dark .bg-gray-200:not(img):not(.image-container){background-color:#2a2a2a!important}.dark .bg-gray-100,.dark .bg-gray-50,.dark .bg-white{background-color:#1a1a1a!important}.dark .border-gray-700{border-color:#333!important}.dark .border-gray-600{border-color:#444!important}.dark .border-gray-300{border-color:#333!important}.dark .border-gray-200,.dark .border-gray-100{border-color:#2a2a2a!important}.dark .text-gray-900{color:#f5f5f5!important}.dark .text-gray-700{color:#e0e0e0!important}.dark .text-gray-600{color:#b0b0b0!important}.dark .text-gray-500{color:#909090!important}.dark .text-gray-400{color:#707070!important}.dark .text-gray-300{color:#d0d0d0!important}.dark .text-white{color:#fff!important}.dark .text-gray-800{color:#e0e0e0!important}.dark .text-gray-200{color:#d0d0d0!important}.dark .text-gray-100{color:#e0e0e0!important}.dark .bg-opacity-0{--tw-bg-opacity: 0 !important}.dark .bg-opacity-10{--tw-bg-opacity: .1 !important}.dark .bg-opacity-20{--tw-bg-opacity: .2 !important}.dark .bg-opacity-30{--tw-bg-opacity: .3 !important}.dark .bg-opacity-50{--tw-bg-opacity: .5 !important}.dark .hover\:bg-gray-100:hover{background-color:#2a2a2a!important}.dark .hover\:bg-gray-700:hover{background-color:#333!important}.dark .hover\:bg-gray-600:hover{background-color:#3a3a3a!important}.dark .hover\:bg-gray-200:hover,.dark .hover\:bg-gray-50:hover{background-color:#2a2a2a!important}.dark .bg-black:not(.bg-opacity-0):not(.bg-opacity-10):not(.bg-opacity-20):not(.bg-opacity-30){background-color:#0a0a0a!important}.dark .text-black{color:#fff!important}.dark .border-black{border-color:#2a2a2a!important}.dark .bg-blue-50,.dark .bg-blue-100{background-color:#2a2a2a!important}.dark .bg-blue-200{background-color:#3a3a3a!important}.dark .bg-blue-600{background-color:#3a3a3a!important}.dark .bg-blue-800{background-color:#2a2a2a!important}.dark .bg-blue-900{background-color:#1a1a1a!important}.dark .text-blue-300{color:#d0d0d0!important}.dark .text-blue-400{color:#e0e0e0!important}.dark .text-blue-500,.dark .text-blue-600{color:#f0f0f0!important}.dark .text-blue-700{color:#e0e0e0!important}.dark .border-blue-200{border-color:#2a2a2a!important}.dark .border-blue-500{border-color:#4a4a4a!important}.dark .border-blue-700{border-color:#333!important}.dark .hover\:bg-blue-600:hover{background-color:#4a4a4a!important}.dark .hover\:bg-blue-50:hover{background-color:#333!important}.dark .bg-green-50{background-color:#2a2a2a!important}.dark .text-green-600{color:#e0e0e0!important}.dark .bg-red-50{background-color:#2a2a2a!important}.dark .text-red-600{color:#f0a0a0!important}.dark .bg-yellow-50{background-color:#2a2a2a!important}.dark .text-yellow-600{color:#e0e0a0!important}.dark img{background-color:transparent!important}.dark input,.dark select,.dark textarea{background-color:#1a1a1a!important;border-color:#333!important;color:#e0e0e0!important}.dark input:focus,.dark select:focus,.dark textarea:focus{border-color:#4a4a4a!important;outline:none!important;--tw-ring-color: #4a4a4a !important}.dark input::-moz-placeholder{color:#707070!important}.dark input::placeholder{color:#707070!important}.dark button{color:#e0e0e0!important}.dark .bg-blue-500{background-color:#4a4a4a!important}.dark .hover\:bg-blue-600:hover{background-color:#5a5a5a!important}.dark .shadow-lg{box-shadow:0 10px 15px -3px #00000080,0 4px 6px -2px #0000004d!important}.dark .shadow-xl{box-shadow:0 20px 25px -5px #00000080,0 10px 10px -5px #0000004d!important}.dark .hover\:shadow-lg:hover{box-shadow:0 10px 15px -3px #00000080,0 4px 6px -2px #0000004d!important}.dark .ring-blue-500{--tw-ring-color: #4a4a4a !important}.dark .focus\:ring-blue-500:focus{--tw-ring-color: #4a4a4a !important}.dark .focus\:ring-2:focus{--tw-ring-offset-shadow: 0 0 0 0px #000 !important;--tw-ring-shadow: 0 0 0 2px #4a4a4a !important}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#0003;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#0000004d}.dark ::-webkit-scrollbar-track{background:#ffffff0d}.dark ::-webkit-scrollbar-thumb{background:#fff3;border-radius:4px}.dark ::-webkit-scrollbar-thumb:hover{background:#ffffff4d}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-400:hover{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-20:hover{--tw-bg-opacity: .2}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.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)}.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-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.dark\:border-gray-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:border-red-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-gray-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-indigo-900\/30:is(.dark *){background-color:#312e814d}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-blue-500\/30:hover:is(.dark *){background-color:#3b82f64d}.dark\:hover\:bg-gray-500:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-600:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-blue-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.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/assets/index-DWWYNoqs.js b/flypic/app/server/public/assets/index-DWWYNoqs.js deleted file mode 100644 index 16b3809..0000000 --- a/flypic/app/server/public/assets/index-DWWYNoqs.js +++ /dev/null @@ -1,226 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var us=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Il(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _d={exports:{}},_o={},kd={exports:{}},we={};/** - * @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 ns=Symbol.for("react.element"),sp=Symbol.for("react.portal"),op=Symbol.for("react.fragment"),ap=Symbol.for("react.strict_mode"),lp=Symbol.for("react.profiler"),up=Symbol.for("react.provider"),cp=Symbol.for("react.context"),dp=Symbol.for("react.forward_ref"),fp=Symbol.for("react.suspense"),hp=Symbol.for("react.memo"),pp=Symbol.for("react.lazy"),Ou=Symbol.iterator;function mp(e){return e===null||typeof e!="object"?null:(e=Ou&&e[Ou]||e["@@iterator"],typeof e=="function"?e:null)}var Sd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bd=Object.assign,Cd={};function ui(e,t,r){this.props=e,this.context=t,this.refs=Cd,this.updater=r||Sd}ui.prototype.isReactComponent={};ui.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")};ui.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ed(){}Ed.prototype=ui.prototype;function jl(e,t,r){this.props=e,this.context=t,this.refs=Cd,this.updater=r||Sd}var Ll=jl.prototype=new Ed;Ll.constructor=jl;bd(Ll,ui.prototype);Ll.isPureReactComponent=!0;var Au=Array.isArray,Nd=Object.prototype.hasOwnProperty,Ol={current:null},Rd={key:!0,ref:!0,__self:!0,__source:!0};function Td(e,t,r){var n,i={},s=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)Nd.call(t,n)&&!Rd.hasOwnProperty(n)&&(i[n]=t[n]);var a=arguments.length-2;if(a===1)i.children=r;else if(1>>1,A=Y[M];if(0>>1;Mi(N,J))Vi(j,N)?(Y[M]=j,Y[V]=J,M=V):(Y[M]=N,Y[B]=J,M=B);else if(Vi(j,J))Y[M]=j,Y[V]=J,M=V;else break e}}return $}function i(Y,$){var J=Y.sortIndex-$.sortIndex;return J!==0?J:Y.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],h=[],w=1,y=null,v=3,p=!1,x=!1,u=!1,_=typeof setTimeout=="function"?setTimeout:null,c=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(Y){for(var $=r(h);$!==null;){if($.callback===null)n(h);else if($.startTime<=Y)n(h),$.sortIndex=$.expirationTime,t(l,$);else break;$=r(h)}}function S(Y){if(u=!1,g(Y),!x)if(r(l)!==null)x=!0,oe(b);else{var $=r(h);$!==null&&Q(S,$.startTime-Y)}}function b(Y,$){x=!1,u&&(u=!1,c(O),O=-1),p=!0;var J=v;try{for(g($),y=r(l);y!==null&&(!(y.expirationTime>$)||Y&&!re());){var M=y.callback;if(typeof M=="function"){y.callback=null,v=y.priorityLevel;var A=M(y.expirationTime<=$);$=e.unstable_now(),typeof A=="function"?y.callback=A:y===r(l)&&n(l),g($)}else n(l);y=r(l)}if(y!==null)var le=!0;else{var B=r(h);B!==null&&Q(S,B.startTime-$),le=!1}return le}finally{y=null,v=J,p=!1}}var R=!1,z=null,O=-1,I=5,P=-1;function re(){return!(e.unstable_now()-PY||125M?(Y.sortIndex=J,t(h,Y),r(l)===null&&Y===r(h)&&(u?(c(O),O=-1):u=!0,Q(S,J-M))):(Y.sortIndex=A,t(l,Y),x||p||(x=!0,oe(b))),Y},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(Y){var $=v;return function(){var J=v;v=$;try{return Y.apply(this,arguments)}finally{v=J}}}})(Od);Ld.exports=Od;var Ep=Ld.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 Np=G,_t=Ep;function se(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ca=Object.prototype.hasOwnProperty,Rp=/^[: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]*$/,Mu={},Du={};function Tp(e){return Ca.call(Du,e)?!0:Ca.call(Mu,e)?!1:Rp.test(e)?Du[e]=!0:(Mu[e]=!0,!1)}function zp(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ip(e,t,r,n){if(t===null||typeof t>"u"||zp(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 ut(e,t,r,n,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Xe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Xe[e]=new ut(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Xe[t]=new ut(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Xe[e]=new ut(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Xe[e]=new ut(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){Xe[e]=new ut(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Xe[e]=new ut(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Xe[e]=new ut(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Xe[e]=new ut(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Xe[e]=new ut(e,5,!1,e.toLowerCase(),null,!1,!1)});var Pl=/[\-:]([a-z])/g;function Ml(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(Pl,Ml);Xe[t]=new ut(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(Pl,Ml);Xe[t]=new ut(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(Pl,Ml);Xe[t]=new ut(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Xe[e]=new ut(e,1,!1,e.toLowerCase(),null,!1,!1)});Xe.xlinkHref=new ut("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Xe[e]=new ut(e,1,!1,e.toLowerCase(),null,!0,!0)});function Dl(e,t,r,n){var i=Xe.hasOwnProperty(t)?Xe[t]:null;(i!==null?i.type!==0:n||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Ho=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?bi(e):""}function jp(e){switch(e.tag){case 5:return bi(e.type);case 16:return bi("Lazy");case 13:return bi("Suspense");case 19:return bi("SuspenseList");case 0:case 2:case 15:return e=qo(e.type,!1),e;case 11:return e=qo(e.type.render,!1),e;case 1:return e=qo(e.type,!0),e;default:return""}}function Ta(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 An:return"Fragment";case On:return"Portal";case Ea:return"Profiler";case Fl:return"StrictMode";case Na:return"Suspense";case Ra:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Md:return(e.displayName||"Context")+".Consumer";case Pd:return(e._context.displayName||"Context")+".Provider";case Bl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ul:return t=e.displayName||null,t!==null?t:Ta(e.type)||"Memo";case Pr:t=e._payload,e=e._init;try{return Ta(e(t))}catch{}}return null}function Lp(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 Ta(t);case 8:return t===Fl?"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 Gr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Op(e){var t=Fd(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fs(e){e._valueTracker||(e._valueTracker=Op(e))}function Bd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Fd(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Zs(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 za(e,t){var r=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Bu(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Gr(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ud(e,t){t=t.checked,t!=null&&Dl(e,"checked",t,!1)}function Ia(e,t){Ud(e,t);var r=Gr(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ja(e,t.type,r):t.hasOwnProperty("defaultValue")&&ja(e,t.type,Gr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Uu(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function ja(e,t,r){(t!=="number"||Zs(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Ci=Array.isArray;function Kn(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=hs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bi(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Ti={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},Ap=["Webkit","ms","Moz","O"];Object.keys(Ti).forEach(function(e){Ap.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ti[t]=Ti[e]})});function Hd(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Ti.hasOwnProperty(e)&&Ti[e]?(""+t).trim():t+"px"}function qd(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=Hd(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var Pp=Me({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 Aa(e,t){if(t){if(Pp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(se(62))}}function Pa(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 Ma=null;function $l(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Da=null,Yn=null,Zn=null;function Vu(e){if(e=os(e)){if(typeof Da!="function")throw Error(se(280));var t=e.stateNode;t&&(t=Eo(t),Da(e.stateNode,e.type,t))}}function Kd(e){Yn?Zn?Zn.push(e):Zn=[e]:Yn=e}function Yd(){if(Yn){var e=Yn,t=Zn;if(Zn=Yn=null,Vu(e),t)for(e=0;e>>=0,e===0?32:31-(Kp(e)/Yp|0)|0}var ps=64,ms=4194304;function Ei(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 Js(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=Ei(a):(s&=o,s!==0&&(n=Ei(s)))}else o=r&~i,o!==0?n=Ei(o):s!==0&&(n=Ei(s));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function is(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vt(t),e[t]=r}function Gp(e,t){var r=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 n=e.eventTimes;for(e=e.expirationTimes;0=Ii),Ju=" ",ec=!1;function mf(e,t){switch(e){case"keyup":return Em.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pn=!1;function Rm(e,t){switch(e){case"compositionend":return gf(t);case"keypress":return t.which!==32?null:(ec=!0,Ju);case"textInput":return e=t.data,e===Ju&&ec?null:e;default:return null}}function Tm(e,t){if(Pn)return e==="compositionend"||!Xl&&mf(e,t)?(e=hf(),Ps=Kl=Ur=null,Pn=!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:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ic(r)}}function xf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _f(){for(var e=window,t=Zs();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Zs(e.document)}return t}function Ql(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 Dm(e){var t=_f(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&xf(r.ownerDocument.documentElement,r)){if(n!==null&&Ql(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=sc(r,s);var o=sc(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Mn=null,Va=null,Li=null,Ha=!1;function oc(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ha||Mn==null||Mn!==Zs(n)||(n=Mn,"selectionStart"in n&&Ql(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Li&&qi(Li,n)||(Li=n,n=ro(Va,"onSelect"),0Bn||(e.current=Qa[Bn],Qa[Bn]=null,Bn--)}function Ne(e,t){Bn++,Qa[Bn]=e.current,e.current=t}var Jr={},rt=tn(Jr),ft=tn(!1),yn=Jr;function ti(e,t){var r=e.type.contextTypes;if(!r)return Jr;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=t[s];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ht(e){return e=e.childContextTypes,e!=null}function io(){je(ft),je(rt)}function hc(e,t,r){if(rt.current!==Jr)throw Error(se(168));Ne(rt,t),Ne(ft,r)}function zf(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(se(108,Lp(e)||"Unknown",i));return Me({},r,n)}function so(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jr,yn=rt.current,Ne(rt,e),Ne(ft,ft.current),!0}function pc(e,t,r){var n=e.stateNode;if(!n)throw Error(se(169));r?(e=zf(e,t,yn),n.__reactInternalMemoizedMergedChildContext=e,je(ft),je(rt),Ne(rt,e)):je(ft),Ne(ft,r)}var wr=null,No=!1,oa=!1;function If(e){wr===null?wr=[e]:wr.push(e)}function Xm(e){No=!0,If(e)}function rn(){if(!oa&&wr!==null){oa=!0;var e=0,t=Ce;try{var r=wr;for(Ce=1;e>=o,i-=o,_r=1<<32-Vt(t)+i|r<O?(I=z,z=null):I=z.sibling;var P=v(c,z,g[O],S);if(P===null){z===null&&(z=I);break}e&&z&&P.alternate===null&&t(c,z),d=s(P,d,O),R===null?b=P:R.sibling=P,R=P,z=I}if(O===g.length)return r(c,z),Oe&&ln(c,O),b;if(z===null){for(;OO?(I=z,z=null):I=z.sibling;var re=v(c,z,P.value,S);if(re===null){z===null&&(z=I);break}e&&z&&re.alternate===null&&t(c,z),d=s(re,d,O),R===null?b=re:R.sibling=re,R=re,z=I}if(P.done)return r(c,z),Oe&&ln(c,O),b;if(z===null){for(;!P.done;O++,P=g.next())P=y(c,P.value,S),P!==null&&(d=s(P,d,O),R===null?b=P:R.sibling=P,R=P);return Oe&&ln(c,O),b}for(z=n(c,z);!P.done;O++,P=g.next())P=p(z,c,O,P.value,S),P!==null&&(e&&P.alternate!==null&&z.delete(P.key===null?O:P.key),d=s(P,d,O),R===null?b=P:R.sibling=P,R=P);return e&&z.forEach(function(T){return t(c,T)}),Oe&&ln(c,O),b}function _(c,d,g,S){if(typeof g=="object"&&g!==null&&g.type===An&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case ds:e:{for(var b=g.key,R=d;R!==null;){if(R.key===b){if(b=g.type,b===An){if(R.tag===7){r(c,R.sibling),d=i(R,g.props.children),d.return=c,c=d;break e}}else if(R.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Pr&&yc(b)===R.type){r(c,R.sibling),d=i(R,g.props),d.ref=xi(c,R,g),d.return=c,c=d;break e}r(c,R);break}else t(c,R);R=R.sibling}g.type===An?(d=gn(g.props.children,c.mode,S,g.key),d.return=c,c=d):(S=Vs(g.type,g.key,g.props,null,c.mode,S),S.ref=xi(c,d,g),S.return=c,c=S)}return o(c);case On:e:{for(R=g.key;d!==null;){if(d.key===R)if(d.tag===4&&d.stateNode.containerInfo===g.containerInfo&&d.stateNode.implementation===g.implementation){r(c,d.sibling),d=i(d,g.children||[]),d.return=c,c=d;break e}else{r(c,d);break}else t(c,d);d=d.sibling}d=pa(g,c.mode,S),d.return=c,c=d}return o(c);case Pr:return R=g._init,_(c,d,R(g._payload),S)}if(Ci(g))return x(c,d,g,S);if(mi(g))return u(c,d,g,S);ks(c,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,d!==null&&d.tag===6?(r(c,d.sibling),d=i(d,g),d.return=c,c=d):(r(c,d),d=ha(g,c.mode,S),d.return=c,c=d),o(c)):r(c,d)}return _}var ni=Af(!0),Pf=Af(!1),lo=tn(null),uo=null,Wn=null,tu=null;function ru(){tu=Wn=uo=null}function nu(e){var t=lo.current;je(lo),e._currentValue=t}function el(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Qn(e,t){uo=e,tu=Wn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(dt=!0),e.firstContext=null)}function At(e){var t=e._currentValue;if(tu!==e)if(e={context:e,memoizedValue:t,next:null},Wn===null){if(uo===null)throw Error(se(308));Wn=e,uo.dependencies={lanes:0,firstContext:e}}else Wn=Wn.next=e;return t}var hn=null;function iu(e){hn===null?hn=[e]:hn.push(e)}function Mf(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,iu(t)):(r.next=i.next,i.next=r),t.interleaved=r,Er(e,n)}function Er(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Mr=!1;function su(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Df(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 Sr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Kr(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Se&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,Er(e,r)}return i=n.interleaved,i===null?(t.next=t,iu(n)):(t.next=i.next,i.next=t),n.interleaved=t,Er(e,r)}function Ds(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Vl(e,r)}}function vc(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=t:s=s.next=t}else i=s=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function co(e,t,r,n){var i=e.updateQueue;Mr=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,h=l.next;l.next=null,o===null?s=h:o.next=h,o=l;var w=e.alternate;w!==null&&(w=w.updateQueue,a=w.lastBaseUpdate,a!==o&&(a===null?w.firstBaseUpdate=h:a.next=h,w.lastBaseUpdate=l))}if(s!==null){var y=i.baseState;o=0,w=h=l=null,a=s;do{var v=a.lane,p=a.eventTime;if((n&v)===v){w!==null&&(w=w.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,u=a;switch(v=t,p=r,u.tag){case 1:if(x=u.payload,typeof x=="function"){y=x.call(p,y,v);break e}y=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=u.payload,v=typeof x=="function"?x.call(p,y,v):x,v==null)break e;y=Me({},y,v);break e;case 2:Mr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,v=i.effects,v===null?i.effects=[a]:v.push(a))}else p={eventTime:p,lane:v,tag:a.tag,payload:a.payload,callback:a.callback,next:null},w===null?(h=w=p,l=y):w=w.next=p,o|=v;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;v=a,a=v.next,v.next=null,i.lastBaseUpdate=v,i.shared.pending=null}}while(!0);if(w===null&&(l=y),i.baseState=l,i.firstBaseUpdate=h,i.lastBaseUpdate=w,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);xn|=o,e.lanes=o,e.memoizedState=y}}function wc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=la.transition;la.transition={};try{e(!1),t()}finally{Ce=r,la.transition=n}}function th(){return Pt().memoizedState}function e0(e,t,r){var n=Zr(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},rh(e))nh(t,r);else if(r=Mf(e,t,r,n),r!==null){var i=at();Ht(r,e,n,i),ih(r,t,n)}}function t0(e,t,r){var n=Zr(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(rh(e))nh(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,qt(a,o)){var l=t.interleaved;l===null?(i.next=i,iu(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}r=Mf(e,t,i,n),r!==null&&(i=at(),Ht(r,e,n,i),ih(r,t,n))}}function rh(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function nh(e,t){Oi=ho=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function ih(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,Vl(e,r)}}var po={readContext:At,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useInsertionEffect:Je,useLayoutEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useMutableSource:Je,useSyncExternalStore:Je,useId:Je,unstable_isNewReconciler:!1},r0={readContext:At,useCallback:function(e,t){return er().memoizedState=[e,t===void 0?null:t],e},useContext:At,useEffect:_c,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Bs(4194308,4,Xf.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bs(4,2,e,t)},useMemo:function(e,t){var r=er();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=er();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=e0.bind(null,Pe,e),[n.memoizedState,e]},useRef:function(e){var t=er();return e={current:e},t.memoizedState=e},useState:xc,useDebugValue:hu,useDeferredValue:function(e){return er().memoizedState=e},useTransition:function(){var e=xc(!1),t=e[0];return e=Jm.bind(null,e[1]),er().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Pe,i=er();if(Oe){if(r===void 0)throw Error(se(407));r=r()}else{if(r=t(),Ke===null)throw Error(se(349));wn&30||$f(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,_c(Vf.bind(null,n,s,e),[e]),n.flags|=2048,es(9,Wf.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=er(),t=Ke.identifierPrefix;if(Oe){var r=kr,n=_r;r=(n&~(1<<32-Vt(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Gi++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[tr]=t,e[Zi]=n,ph(e,t,!1,!1),t.stateNode=e;e:{switch(o=Pa(r,n),r){case"dialog":Ie("cancel",e),Ie("close",e),i=n;break;case"iframe":case"object":case"embed":Ie("load",e),i=n;break;case"video":case"audio":for(i=0;ioi&&(t.flags|=128,n=!0,_i(s,!1),t.lanes=4194304)}else{if(!n)if(e=fo(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),_i(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Oe)return et(t),null}else 2*Fe()-s.renderingStartTime>oi&&r!==1073741824&&(t.flags|=128,n=!0,_i(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(r=s.last,r!==null?r.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Fe(),t.sibling=null,r=Ae.current,Ne(Ae,n?r&1|2:r&1),t):(et(t),null);case 22:case 23:return wu(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?vt&1073741824&&(et(t),t.subtreeFlags&6&&(t.flags|=8192)):et(t),null;case 24:return null;case 25:return null}throw Error(se(156,t.tag))}function c0(e,t){switch(Jl(t),t.tag){case 1:return ht(t.type)&&io(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ii(),je(ft),je(rt),lu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return au(t),null;case 13:if(je(Ae),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(se(340));ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return je(Ae),null;case 4:return ii(),null;case 10:return nu(t.type._context),null;case 22:case 23:return wu(),null;case 24:return null;default:return null}}var bs=!1,tt=!1,d0=typeof WeakSet=="function"?WeakSet:Set,fe=null;function Vn(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){De(e,t,n)}else r.current=null}function ul(e,t,r){try{r()}catch(n){De(e,t,n)}}var jc=!1;function f0(e,t){if(qa=eo,e=_f(),Ql(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,h=0,w=0,y=e,v=null;t:for(;;){for(var p;y!==r||i!==0&&y.nodeType!==3||(a=o+i),y!==s||n!==0&&y.nodeType!==3||(l=o+n),y.nodeType===3&&(o+=y.nodeValue.length),(p=y.firstChild)!==null;)v=y,y=p;for(;;){if(y===e)break t;if(v===r&&++h===i&&(a=o),v===s&&++w===n&&(l=o),(p=y.nextSibling)!==null)break;y=v,v=y.parentNode}y=p}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ka={focusedElem:e,selectionRange:r},eo=!1,fe=t;fe!==null;)if(t=fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,fe=e;else for(;fe!==null;){t=fe;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var u=x.memoizedProps,_=x.memoizedState,c=t.stateNode,d=c.getSnapshotBeforeUpdate(t.elementType===t.type?u:Bt(t.type,u),_);c.__reactInternalSnapshotBeforeUpdate=d}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(se(163))}}catch(S){De(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,fe=e;break}fe=t.return}return x=jc,jc=!1,x}function Ai(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&ul(t,r,s)}i=i.next}while(i!==n)}}function zo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function cl(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function yh(e){var t=e.alternate;t!==null&&(e.alternate=null,yh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tr],delete t[Zi],delete t[Xa],delete t[Ym],delete t[Zm])),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 vh(e){return e.tag===5||e.tag===3||e.tag===4}function Lc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vh(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 dl(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=no));else if(n!==4&&(e=e.child,e!==null))for(dl(e,t,r),e=e.sibling;e!==null;)dl(e,t,r),e=e.sibling}function fl(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(fl(e,t,r),e=e.sibling;e!==null;)fl(e,t,r),e=e.sibling}var Ye=null,Ut=!1;function Ar(e,t,r){for(r=r.child;r!==null;)wh(e,t,r),r=r.sibling}function wh(e,t,r){if(nr&&typeof nr.onCommitFiberUnmount=="function")try{nr.onCommitFiberUnmount(ko,r)}catch{}switch(r.tag){case 5:tt||Vn(r,t);case 6:var n=Ye,i=Ut;Ye=null,Ar(e,t,r),Ye=n,Ut=i,Ye!==null&&(Ut?(e=Ye,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Ye.removeChild(r.stateNode));break;case 18:Ye!==null&&(Ut?(e=Ye,r=r.stateNode,e.nodeType===8?sa(e.parentNode,r):e.nodeType===1&&sa(e,r),Vi(e)):sa(Ye,r.stateNode));break;case 4:n=Ye,i=Ut,Ye=r.stateNode.containerInfo,Ut=!0,Ar(e,t,r),Ye=n,Ut=i;break;case 0:case 11:case 14:case 15:if(!tt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ul(r,t,o),i=i.next}while(i!==n)}Ar(e,t,r);break;case 1:if(!tt&&(Vn(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){De(r,t,a)}Ar(e,t,r);break;case 21:Ar(e,t,r);break;case 22:r.mode&1?(tt=(n=tt)||r.memoizedState!==null,Ar(e,t,r),tt=n):Ar(e,t,r);break;default:Ar(e,t,r)}}function Oc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new d0),t.forEach(function(n){var i=_0.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Ft(e,t){var r=t.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=Fe()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*p0(n/1960))-n,10e?16:e,$r===null)var n=!1;else{if(e=$r,$r=null,yo=0,Se&6)throw Error(se(331));var i=Se;for(Se|=4,fe=e.current;fe!==null;){var s=fe,o=s.child;if(fe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lFe()-yu?mn(e,0):gu|=r),pt(e,t)}function Nh(e,t){t===0&&(e.mode&1?(t=ms,ms<<=1,!(ms&130023424)&&(ms=4194304)):t=1);var r=at();e=Er(e,t),e!==null&&(is(e,t,r),pt(e,r))}function x0(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Nh(e,r)}function _0(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(se(314))}n!==null&&n.delete(t),Nh(e,r)}var Rh;Rh=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||ft.current)dt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return dt=!1,l0(e,t,r);dt=!!(e.flags&131072)}else dt=!1,Oe&&t.flags&1048576&&jf(t,ao,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Us(e,t),e=t.pendingProps;var i=ti(t,rt.current);Qn(t,r),i=cu(null,t,n,e,i,r);var s=du();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ht(n)?(s=!0,so(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,su(t),i.updater=To,t.stateNode=i,i._reactInternals=t,rl(t,n,e,r),t=sl(null,t,n,!0,s,r)):(t.tag=0,Oe&&s&&Gl(t),ot(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Us(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=S0(n),e=Bt(n,e),i){case 0:t=il(null,t,n,e,r);break e;case 1:t=Tc(null,t,n,e,r);break e;case 11:t=Nc(null,t,n,e,r);break e;case 14:t=Rc(null,t,n,Bt(n.type,e),r);break e}throw Error(se(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Bt(n,i),il(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Bt(n,i),Tc(e,t,n,i,r);case 3:e:{if(dh(t),e===null)throw Error(se(387));n=t.pendingProps,s=t.memoizedState,i=s.element,Df(e,t),co(t,n,null,r);var o=t.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=si(Error(se(423)),t),t=zc(e,t,n,r,i);break e}else if(n!==i){i=si(Error(se(424)),t),t=zc(e,t,n,r,i);break e}else for(wt=qr(t.stateNode.containerInfo.firstChild),xt=t,Oe=!0,Wt=null,r=Pf(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ri(),n===i){t=Nr(e,t,r);break e}ot(e,t,n,r)}t=t.child}return t;case 5:return Ff(t),e===null&&Ja(t),n=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Ya(n,i)?o=null:s!==null&&Ya(n,s)&&(t.flags|=32),ch(e,t),ot(e,t,o,r),t.child;case 6:return e===null&&Ja(t),null;case 13:return fh(e,t,r);case 4:return ou(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ni(t,null,n,r):ot(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Bt(n,i),Nc(e,t,n,i,r);case 7:return ot(e,t,t.pendingProps,r),t.child;case 8:return ot(e,t,t.pendingProps.children,r),t.child;case 12:return ot(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Ne(lo,n._currentValue),n._currentValue=o,s!==null)if(qt(s.value,o)){if(s.children===i.children&&!ft.current){t=Nr(e,t,r);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=Sr(-1,r&-r),l.tag=2;var h=s.updateQueue;if(h!==null){h=h.shared;var w=h.pending;w===null?l.next=l:(l.next=w.next,w.next=l),h.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),el(s.return,r,t),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(se(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),el(o,r,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}ot(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,Qn(t,r),i=At(i),n=n(i),t.flags|=1,ot(e,t,n,r),t.child;case 14:return n=t.type,i=Bt(n,t.pendingProps),i=Bt(n.type,i),Rc(e,t,n,i,r);case 15:return lh(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Bt(n,i),Us(e,t),t.tag=1,ht(n)?(e=!0,so(t)):e=!1,Qn(t,r),sh(t,n,i),rl(t,n,i,r),sl(null,t,n,!0,e,r);case 19:return hh(e,t,r);case 22:return uh(e,t,r)}throw Error(se(156,t.tag))};function Th(e,t){return tf(e,t)}function k0(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lt(e,t,r,n){return new k0(e,t,r,n)}function _u(e){return e=e.prototype,!(!e||!e.isReactComponent)}function S0(e){if(typeof e=="function")return _u(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Bl)return 11;if(e===Ul)return 14}return 2}function Xr(e,t){var r=e.alternate;return r===null?(r=Lt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Vs(e,t,r,n,i,s){var o=2;if(n=e,typeof e=="function")_u(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case An:return gn(r.children,i,s,t);case Fl:o=8,i|=8;break;case Ea:return e=Lt(12,r,t,i|2),e.elementType=Ea,e.lanes=s,e;case Na:return e=Lt(13,r,t,i),e.elementType=Na,e.lanes=s,e;case Ra:return e=Lt(19,r,t,i),e.elementType=Ra,e.lanes=s,e;case Dd:return jo(r,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Pd:o=10;break e;case Md:o=9;break e;case Bl:o=11;break e;case Ul:o=14;break e;case Pr:o=16,n=null;break e}throw Error(se(130,e==null?e:typeof e,""))}return t=Lt(o,r,t,i),t.elementType=e,t.type=n,t.lanes=s,t}function gn(e,t,r,n){return e=Lt(7,e,n,t),e.lanes=r,e}function jo(e,t,r,n){return e=Lt(22,e,n,t),e.elementType=Dd,e.lanes=r,e.stateNode={isHidden:!1},e}function ha(e,t,r){return e=Lt(6,e,null,t),e.lanes=r,e}function pa(e,t,r){return t=Lt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function b0(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yo(0),this.expirationTimes=Yo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yo(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ku(e,t,r,n,i,s,o,a,l){return e=new b0(e,t,r,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Lt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},su(s),e}function C0(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Lh)}catch(e){console.error(e)}}Lh(),jd.exports=kt;var Oh=jd.exports,$c=Oh;ba.createRoot=$c.createRoot,ba.hydrateRoot=$c.hydrateRoot;const or=Object.create(null);or.open="0";or.close="1";or.ping="2";or.pong="3";or.message="4";or.upgrade="5";or.noop="6";const Hs=Object.create(null);Object.keys(or).forEach(e=>{Hs[or[e]]=e});const yl={type:"error",data:"parser error"},Ah=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Ph=typeof ArrayBuffer=="function",Mh=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Eu=({type:e,data:t},r,n)=>Ah&&t instanceof Blob?r?n(t):Wc(t,n):Ph&&(t instanceof ArrayBuffer||Mh(t))?r?n(t):Wc(new Blob([t]),n):n(or[e]+(t||"")),Wc=(e,t)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];t("b"+(n||""))},r.readAsDataURL(e)};function Vc(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let ma;function z0(e,t){if(Ah&&e.data instanceof Blob)return e.data.arrayBuffer().then(Vc).then(t);if(Ph&&(e.data instanceof ArrayBuffer||Mh(e.data)))return t(Vc(e.data));Eu(e,!1,r=>{ma||(ma=new TextEncoder),t(ma.encode(r))})}const Hc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ri=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,r=e.length,n,i=0,s,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const h=new ArrayBuffer(t),w=new Uint8Array(h);for(n=0;n>4,w[i++]=(o&15)<<4|a>>2,w[i++]=(a&3)<<6|l&63;return h},j0=typeof ArrayBuffer=="function",Nu=(e,t)=>{if(typeof e!="string")return{type:"message",data:Dh(e,t)};const r=e.charAt(0);return r==="b"?{type:"message",data:L0(e.substring(1),t)}:Hs[r]?e.length>1?{type:Hs[r],data:e.substring(1)}:{type:Hs[r]}:yl},L0=(e,t)=>{if(j0){const r=I0(e);return Dh(r,t)}else return{base64:!0,data:e}},Dh=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Fh="",O0=(e,t)=>{const r=e.length,n=new Array(r);let i=0;e.forEach((s,o)=>{Eu(s,!1,a=>{n[o]=a,++i===r&&t(n.join(Fh))})})},A0=(e,t)=>{const r=e.split(Fh),n=[];for(let i=0;i{const n=r.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,n)}else{i=new Uint8Array(9);const s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(n))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(r)})}})}let ga;function Ns(e){return e.reduce((t,r)=>t+r.length,0)}function Rs(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let i=0;iMath.pow(2,21)-1){a.enqueue(yl);break}i=w*Math.pow(2,32)+h.getUint32(4),n=3}else{if(Ns(r)e){a.enqueue(yl);break}}}})}const Bh=4;function Ue(e){if(e)return D0(e)}function D0(e){for(var t in Ue.prototype)e[t]=Ue.prototype[t];return e}Ue.prototype.on=Ue.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Ue.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};Ue.prototype.off=Ue.prototype.removeListener=Ue.prototype.removeAllListeners=Ue.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,i=0;iPromise.resolve().then(t):(t,r)=>r(t,0),It=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),F0="arraybuffer";function Uh(e,...t){return t.reduce((r,n)=>(e.hasOwnProperty(n)&&(r[n]=e[n]),r),{})}const B0=It.setTimeout,U0=It.clearTimeout;function Do(e,t){t.useNativeTimers?(e.setTimeoutFn=B0.bind(It),e.clearTimeoutFn=U0.bind(It)):(e.setTimeoutFn=It.setTimeout.bind(It),e.clearTimeoutFn=It.clearTimeout.bind(It))}const $0=1.33;function W0(e){return typeof e=="string"?V0(e):Math.ceil((e.byteLength||e.size)*$0)}function V0(e){let t=0,r=0;for(let n=0,i=e.length;n=57344?r+=3:(n++,r+=4);return r}function $h(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function H0(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}function q0(e){let t={},r=e.split("&");for(let n=0,i=r.length;n{this.readyState="paused",t()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||r()})),this.writable||(n++,this.once("drain",function(){--n||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};A0(t,this.socket.binaryType).forEach(r),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,O0(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=$h()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}}let Wh=!1;try{Wh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Z0=Wh;function X0(){}class Q0 extends Y0{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let n=location.port;n||(n=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||n!==t.port}}doWrite(t,r){const n=this.request({method:"POST",data:t});n.on("success",r),n.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,n)=>{this.onError("xhr poll error",r,n)}),this.pollXhr=t}}class sr extends Ue{constructor(t,r,n){super(),this.createRequest=t,Do(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var t;const r=Uh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var i;n.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=sr.requestsCount++,sr.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=X0,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete sr.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()}}sr.requestsCount=0;sr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",qc);else if(typeof addEventListener=="function"){const e="onpagehide"in It?"pagehide":"unload";addEventListener(e,qc,!1)}}function qc(){for(let e in sr.requests)sr.requests.hasOwnProperty(e)&&sr.requests[e].abort()}const G0=function(){const e=Vh({xdomain:!1});return e&&e.responseType!==null}();class J0 extends Q0{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=G0&&!r}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new sr(Vh,this.uri(),t)}}function Vh(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Z0))return new XMLHttpRequest}catch{}if(!t)try{return new It[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Hh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class eg extends Ru{get name(){return"websocket"}doOpen(){const t=this.uri(),r=this.opts.protocols,n=Hh?{}:Uh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,r,n)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r{try{this.doWrite(n,s)}catch{}i&&Mo(()=>{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",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=$h()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const ya=It.WebSocket||It.MozWebSocket;class tg extends eg{createSocket(t,r,n){return Hh?new ya(t,r,n):r?new ya(t,r):new ya(t)}doWrite(t,r){this.ws.send(r)}}class rg extends Ru{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 r=M0(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=t.readable.pipeThrough(r).getReader(),i=P0();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const s=()=>{n.read().then(({done:a,value:l})=>{a||(this.onPacket(l),s())}).catch(a=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r{i&&Mo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ng={websocket:tg,webtransport:rg,polling:J0},ig=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,sg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function vl(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),n=e.indexOf("]");r!=-1&&n!=-1&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));let i=ig.exec(e||""),s={},o=14;for(;o--;)s[sg[o]]=i[o]||"";return r!=-1&&n!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=og(s,s.path),s.queryKey=ag(s,s.query),s}function og(e,t){const r=/\/{2,9}/g,n=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&n.splice(0,1),t.slice(-1)=="/"&&n.splice(n.length-1,1),n}function ag(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,i,s){i&&(r[i]=s)}),r}const wl=typeof addEventListener=="function"&&typeof removeEventListener=="function",qs=[];wl&&addEventListener("offline",()=>{qs.forEach(e=>e())},!1);class Qr extends Ue{constructor(t,r){if(super(),this.binaryType=F0,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const n=vl(t);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=vl(r.host).host);Do(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const i=n.prototype.name;this.transports.push(i),this._transportsByName[i]=n}),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},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=q0(this.opts.query)),wl&&(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"})},qs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=Bh,r.transport=t,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Qr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}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",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",Qr.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 r=new Error("server error");r.code=t.data,this._onError(r);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 r=1;for(let n=0;n0&&r>this._maxPayload)return this.writeBuffer.slice(0,n);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Mo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,n){return this._sendPacket("message",t,r,n),this}send(t,r,n){return this._sendPacket("message",t,r,n),this}_sendPacket(t,r,n,i){if(typeof r=="function"&&(i=r,r=void 0),typeof n=="function"&&(i=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const s={type:t,data:r,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(Qr.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,r){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(),wl&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=qs.indexOf(this._offlineEventListener);n!==-1&&qs.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}Qr.protocol=Bh;class lg extends Qr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",y=>{if(!n)if(y.type==="pong"&&y.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;Qr.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(w(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function s(){n||(n=!0,w(),r.close(),r=null)}const o=y=>{const v=new Error("probe error: "+y);v.transport=r.name,s(),this.emitReserved("upgradeError",v)};function a(){o("transport closed")}function l(){o("socket closed")}function h(y){r&&y.name!==r.name&&s()}const w=()=>{r.removeListener("open",i),r.removeListener("error",o),r.removeListener("close",a),this.off("close",l),this.off("upgrading",h)};r.once("open",i),r.once("error",o),r.once("close",a),this.once("close",l),this.once("upgrading",h),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{n||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let n=0;nng[i]).filter(i=>!!i)),super(t,n)}};function cg(e,t="",r){let n=e;r=r||typeof location<"u"&&location,e==null&&(e=r.protocol+"//"+r.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=r.protocol+e:e=r.host+e),/^(https?|wss?):\/\//.test(e)||(typeof r<"u"?e=r.protocol+"//"+e:e="https://"+e),n=vl(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const s=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+s+":"+n.port+t,n.href=n.protocol+"://"+s+(r&&r.port===n.port?"":":"+n.port),n}const dg=typeof ArrayBuffer=="function",fg=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qh=Object.prototype.toString,hg=typeof Blob=="function"||typeof Blob<"u"&&qh.call(Blob)==="[object BlobConstructor]",pg=typeof File=="function"||typeof File<"u"&&qh.call(File)==="[object FileConstructor]";function Tu(e){return dg&&(e instanceof ArrayBuffer||fg(e))||hg&&e instanceof Blob||pg&&e instanceof File}function Ks(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let r=0,n=e.length;r=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(s),r.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...r){return new Promise((n,i)=>{const s=(o,a)=>o?i(o):n(a);s.withError=!0,r.push(s),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...s)=>n!==this._queue[0]?void 0:(i!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(i)):(this._queue.shift(),r&&r(null,...s)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.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:ke.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,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(n=>String(n.id)===t)){const n=this.acks[t];delete this.acks[t],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ke.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 ke.EVENT:case ke.BINARY_EVENT:this.onevent(t);break;case ke.ACK:case ke.BINARY_ACK:this.onack(t);break;case ke.DISCONNECT:this.ondisconnect();break;case ke.CONNECT_ERROR:this.destroy();const n=new Error(t.data.message);n.data=t.data.data,this.emitReserved("connect_error",n);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const n of r)n.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 r=this;let n=!1;return function(...i){n||(n=!0,r.packet({type:ke.ACK,id:t,data:i}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,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:ke.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 r=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}fi.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0};fi.prototype.reset=function(){this.attempts=0};fi.prototype.setMin=function(e){this.ms=e};fi.prototype.setMax=function(e){this.max=e};fi.prototype.setJitter=function(e){this.jitter=e};class kl extends Ue{constructor(t,r){var n;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,Do(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((n=r.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new fi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const i=r.parser||_g;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=r.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 r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.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 ug(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=$t(r,"open",function(){n.onopen(),t&&t()}),s=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=$t(r,"error",s);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),r.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push($t(t,"ping",this.onping.bind(this)),$t(t,"data",this.ondata.bind(this)),$t(t,"error",this.onerror.bind(this)),$t(t,"close",this.onclose.bind(this)),$t(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){Mo(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new Kh(this,t,r),this.nsps[t]=n),n}_destroy(t){const r=Object.keys(this.nsps);for(const n of r)if(this.nsps[n].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let n=0;nt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,r){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),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 r=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},r);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Si={};function Ys(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const r=cg(e,t.path||"/socket.io"),n=r.source,i=r.id,s=r.path,o=Si[i]&&s in Si[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return a?l=new kl(n,t):(Si[i]||(Si[i]=new kl(n,t)),l=Si[i]),r.query&&!t.query&&(t.query=r.queryKey),l.socket(r.path,t)}Object.assign(Ys,{Manager:kl,Socket:Kh,io:Ys,connect:Ys});const Sg={},Yc=e=>{let t;const r=new Set,n=(w,y)=>{const v=typeof w=="function"?w(t):w;if(!Object.is(v,t)){const p=t;t=y??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(x=>x(t,p))}},i=()=>t,l={setState:n,getState:i,getInitialState:()=>h,subscribe:w=>(r.add(w),()=>r.delete(w)),destroy:()=>{(Sg?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},h=t=e(n,i,l);return l},bg=e=>e?Yc(e):Yc;var Yh={exports:{}},Zh={},Xh={exports:{}},Qh={};/** - * @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 ai=G;function Cg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Eg=typeof Object.is=="function"?Object.is:Cg,Ng=ai.useState,Rg=ai.useEffect,Tg=ai.useLayoutEffect,zg=ai.useDebugValue;function Ig(e,t){var r=t(),n=Ng({inst:{value:r,getSnapshot:t}}),i=n[0].inst,s=n[1];return Tg(function(){i.value=r,i.getSnapshot=t,va(i)&&s({inst:i})},[e,r,t]),Rg(function(){return va(i)&&s({inst:i}),e(function(){va(i)&&s({inst:i})})},[e]),zg(r),r}function va(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Eg(e,r)}catch{return!0}}function jg(e,t){return t()}var Lg=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?jg:Ig;Qh.useSyncExternalStore=ai.useSyncExternalStore!==void 0?ai.useSyncExternalStore:Lg;Xh.exports=Qh;var Og=Xh.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 Fo=G,Ag=Og;function Pg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mg=typeof Object.is=="function"?Object.is:Pg,Dg=Ag.useSyncExternalStore,Fg=Fo.useRef,Bg=Fo.useEffect,Ug=Fo.useMemo,$g=Fo.useDebugValue;Zh.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var s=Fg(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Ug(function(){function l(p){if(!h){if(h=!0,w=p,p=n(p),i!==void 0&&o.hasValue){var x=o.value;if(i(x,p))return y=x}return y=p}if(x=y,Mg(w,p))return x;var u=n(p);return i!==void 0&&i(x,u)?(w=p,x):(w=p,y=u)}var h=!1,w,y,v=r===void 0?null:r;return[function(){return l(t())},v===null?void 0:function(){return l(v())}]},[t,r,n,i]);var a=Dg(e,s[0],s[1]);return Bg(function(){o.hasValue=!0,o.value=a},[a]),$g(a),a};Yh.exports=Zh;var Wg=Yh.exports;const Vg=Il(Wg),Gh={},{useDebugValue:Hg}=ye,{useSyncExternalStoreWithSelector:qg}=Vg;let Zc=!1;const Kg=e=>e;function Yg(e,t=Kg,r){(Gh?"production":void 0)!=="production"&&r&&!Zc&&(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"),Zc=!0);const n=qg(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return Hg(n),n}const Xc=e=>{(Gh?"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"?bg(e):e,r=(n,i)=>Yg(t,n,i);return Object.assign(r,t),r},Bo=e=>e?Xc(e):Xc,yt=Bo(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})})),rr=Bo((e,t)=>({libraries:[],currentLibraryId:null,setLibraries:r=>e({libraries:r}),setCurrentLibrary:r=>e({currentLibraryId:r}),addLibrary:r=>e(n=>({libraries:[...n.libraries,r]})),removeLibrary:r=>e(n=>({libraries:n.libraries.filter(i=>i.id!==r),currentLibraryId:n.currentLibraryId===r?null:n.currentLibraryId})),updateLibrary:(r,n)=>e(i=>({libraries:i.libraries.map(s=>s.id===r?{...s,...n}:s)})),getCurrentLibrary:()=>{const{libraries:r,currentLibraryId:n}=t();return r.find(i=>i.id===n)}})),_e=Bo((e,t)=>({images:[],selectedImage:null,selectedImages:[],totalImageCount:0,folders:[],selectedFolder:null,searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null},imageLoadingState:{isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1},setImages:r=>e({images:r}),appendImages:r=>e(n=>({images:[...n.images,...r]})),clearImages:()=>e({images:[]}),setSelectedImage:r=>e({selectedImage:r}),setSelectedImages:r=>e({selectedImages:r}),toggleImageSelection:r=>e(n=>({selectedImages:n.selectedImages.some(s=>s.path===r.path)?n.selectedImages.filter(s=>s.path!==r.path):[...n.selectedImages,r]})),clearSelection:()=>e({selectedImages:[],selectedImage:null}),setFolders:r=>e({folders:r}),setSelectedFolder:r=>e({selectedFolder:r}),setSearchKeywords:r=>e({searchKeywords:r}),setFilters:r=>e(n=>({filters:{...n.filters,...r}})),resetFilters:()=>e({searchKeywords:"",filters:{formats:[],minSize:null,maxSize:null,startDate:null,endDate:null}}),setTotalImageCount:r=>e({totalImageCount:r}),setImageLoadingState:r=>e(n=>({imageLoadingState:{...n.imageLoadingState,...r}}))})),cn=Bo((e,t)=>({scanProgress:null,scanStartTime:null,setScanProgress:r=>e(n=>r&&!n.scanStartTime&&r.current>0?{scanProgress:r,scanStartTime:Date.now()}:r?{scanProgress:r}:{scanProgress:null,scanStartTime:null}),clearScanProgress:()=>e({scanProgress:null,scanStartTime:null}),getEstimatedTimeLeft:()=>{const{scanProgress:r,scanStartTime:n}=t();if(!r||!n||r.current===0)return null;const i=Date.now()-n,s=r.current/i,o=r.total-r.current;return Math.ceil(o/s/1e3)},isScanning:()=>{const{scanProgress:r}=t();return r&&r.status!=="preparing"}})),Zg="/api";class wa extends Error{constructor(t,r,n){super(t),this.name="APIError",this.status=r,this.data=n}}async function Uo(e,t={}){var n;const r={headers:{"Content-Type":"application/json",...t.headers},...t};try{const i=await fetch(`${Zg}${e}`,r),s=await i.json();if(!i.ok)throw new wa(((n=s.error)==null?void 0:n.message)||s.error||"Request failed",i.status,s);return s.data!==void 0?s.data:s}catch(i){throw i instanceof wa?i:new wa(i.message||"Network error",0,null)}}function Xg(e,t={}){return Uo(e,{method:"GET",...t})}function Qg(e,t,r={}){return Uo(e,{method:"POST",body:JSON.stringify(t),...r})}function Gg(e,t,r={}){return Uo(e,{method:"PUT",body:JSON.stringify(t),...r})}function Jg(e,t={}){return Uo(e,{method:"DELETE",...t})}const Qe={get:Xg,post:Qg,put:Gg,delete:Jg};async function ey(){return Qe.get("/library")}async function ty(e,t){return Qe.post("/library",{name:e,path:t})}async function ry(e,t){return Qe.put(`/library/${e}`,t)}async function Jh(e){return Qe.delete(`/library/${e}`)}const ny=Jh;async function iy(e){return Qe.post(`/library/${e}/set-current`)}async function sy(e){return Qe.put("/library/preferences",e)}async function oy(e){return Qe.put("/library/theme",{theme:e})}const ay=Object.freeze(Object.defineProperty({__proto__:null,add:ty,deleteLibrary:ny,getAll:ey,remove:Jh,setCurrent:iy,update:ry,updatePreferences:sy,updateTheme:oy},Symbol.toStringTag,{value:"Module"}));async function ly(e,t={},r={}){const n=new URLSearchParams({libraryId:e,...t});return Qe.get(`/image?${n}`,r)}async function uy(e){return Qe.get(`/image/count?libraryId=${e}`)}async function cy(e){return Qe.get(`/image/stats?libraryId=${e}`)}async function dy(e){return Qe.get(`/image/folders?libraryId=${e}`)}async function fy(e){return Qe.get(`/image/cache-meta?libraryId=${e}`)}function hy(e,t){return`/api/image/thumbnail/${e}/${t}`}function py(e,t){return`/api/image/original/${e}/${t}`}async function my(e,t){return Qe.post(`/image/${e}/open-file`,{path:t})}const gy=Object.freeze(Object.defineProperty({__proto__:null,getCacheMeta:fy,getCount:uy,getFolders:dy,getOriginalUrl:py,getStats:cy,getThumbnailUrl:hy,openInExplorer:my,search:ly},Symbol.toStringTag,{value:"Module"}));async function yy(e,t=!1){return Qe.post("/scan/full",{libraryId:e,wait:t})}async function vy(e,t=!1){return Qe.post("/scan/sync",{libraryId:e,wait:t})}async function wy(e){return Qe.get(`/scan/status/${e}`)}async function xy(e){return Qe.post("/scan/fix-folders",{libraryId:e})}const _y=Object.freeze(Object.defineProperty({__proto__:null,fixFolders:xy,fullScan:yy,getStatus:wy,sync:vy},Symbol.toStringTag,{value:"Module"})),xr=ay,Le=gy,li=_y;class ky{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(r){console.warn("[DOMCleanup] Failed to revoke blob URL:",r)}}revokeAllBlobUrls(){let t=0;for(const r of this.blobUrls)try{URL.revokeObjectURL(r),t++}catch(n){console.warn("[DOMCleanup] Failed to revoke blob URL:",n)}this.blobUrls.clear(),t>0&&console.log(`[DOMCleanup] Revoked ${t} blob URLs`)}clearImageSources(t){if(!t)return;const r=t.querySelectorAll("img");let n=0;r.forEach(i=>{i.src&&(i.src.startsWith("blob:")&&this.revokeBlobUrl(i.src),i.src="",n++)}),n>0&&console.log(`[DOMCleanup] Cleared ${n} image sources`)}registerEventListener(t,r,n){this.eventListeners.has(t)||this.eventListeners.set(t,[]),this.eventListeners.get(t).push({event:r,handler:n})}removeEventListeners(t){const r=this.eventListeners.get(t);r&&(r.forEach(({event:n,handler:i})=>{try{t.removeEventListener(n,i)}catch(s){console.warn("[DOMCleanup] Failed to remove event listener:",s)}}),this.eventListeners.delete(t))}removeAllEventListeners(){let t=0;for(const[r,n]of this.eventListeners.entries())n.forEach(({event:i,handler:s})=>{try{r.removeEventListener(i,s),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(r){console.warn("[DOMCleanup] Failed to cancel pending load:",r)}}cancelPendingLoads(){let t=0;for(const r of this.pendingLoads)try{r.abort(),t++}catch(n){console.warn("[DOMCleanup] Failed to cancel pending load:",n)}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 Sl=new ky;/** - * @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 Sy={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 by=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Re=(e,t)=>{const r=G.forwardRef(({color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,...h},w)=>G.createElement("svg",{ref:w,...Sy,width:i,height:i,stroke:n,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${by(e)}`,a].join(" "),...h},[...t.map(([y,v])=>G.createElement(y,v)),...Array.isArray(l)?l:[l]]));return r.displayName=`${e}`,r};/** - * @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 Cy=Re("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 Ey=Re("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 Qc=Re("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 Ny=Re("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 Ry=Re("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 Ty=Re("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 zy=Re("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 Iy=Re("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 jy=Re("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 Ly=Re("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 Oy=Re("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 Gc=Re("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 Ay=Re("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 Di=Re("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 Py=Re("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 My=Re("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 Jc=Re("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 Dy=Re("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 Fy=Re("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 By=Re("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 ed=Re("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 bl=Re("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 td=Re("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 rd=Re("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 Uy=Re("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 ep=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rs={LIBRARY:"library",FOLDER:"folder",IMAGES:"images"};let nd=0;const $y=()=>(nd+=1,`req_${Date.now()}_${nd}`);class Wy{constructor(){this.activeRequests=new Map,this.requestContexts=new Map}createRequest(t){const r=$y(),n=new AbortController,i={id:r,type:t,createdAt:Date.now(),abortController:n,signal:n.signal,status:"pending",isActive:!0,cancel:()=>{if(i.isActive){i.isActive=!1,i.status="cancelled",n.abort(),this.requestContexts.delete(r);const s=this.activeRequests.get(t);s&&s.delete(r)}}};return this.requestContexts.set(r,i),this.activeRequests.has(t)||this.activeRequests.set(t,new Map),this.activeRequests.get(t).set(r,i),i}cancelAll(t){const r=this.activeRequests.get(t);if(r){for(const n of r.values())n.cancel();r.clear()}}cancelAllRequests(){for(const t of Object.values(rs))this.cancelAll(t)}isValid(t){const r=this.requestContexts.get(t);return r?r.isActive:!1}complete(t){const r=this.requestContexts.get(t);if(r&&r.isActive){r.status="completed",r.isActive=!1,this.requestContexts.delete(t);const n=this.activeRequests.get(r.type);n&&n.delete(t)}}error(t){const r=this.requestContexts.get(t);if(r&&r.isActive){r.status="error",r.isActive=!1,this.requestContexts.delete(t);const n=this.activeRequests.get(r.type);n&&n.delete(t)}}getActiveCount(t){const r=this.activeRequests.get(t);return r?r.size:0}hasActiveRequests(t){return this.getActiveCount(t)>0}}const jt=new Wy;function Cl(){jt.cancelAll(rs.IMAGES)}function Vy(e){e&&setTimeout(()=>{},300)}const Hy=async e=>{try{const t=await li.getStatus(e);return t.data||t}catch{return null}};function id(){const{libraries:e,currentLibraryId:t,setCurrentLibrary:r,addLibrary:n,removeLibrary:i}=rr(),{folders:s,selectedFolder:o,totalImageCount:a,setSelectedFolder:l}=_e(),{isScanning:h}=cn(),[w,y]=G.useState(!1),[v,p]=G.useState(""),[x,u]=G.useState(""),[_,c]=G.useState(""),[d,g]=G.useState(""),[S,b]=G.useState(new Set),[R,z]=G.useState(!1),[O,I]=G.useState(!1),P=G.useRef(null),re=B=>{g(B),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{c(B)},300)};G.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);const T=async()=>{var B,N;if(h()){alert("扫描进行中,请稍后再试或暂停扫描");return}if(!v.trim()){alert("请输入素材库名称");return}if(!x.trim()){alert("请输入文件夹路径");return}z(!0);try{console.log("📝 添加素材库...");const V=await xr.add(v.trim(),x.trim()),j=V.id,W=V.hasExistingIndex;if(n({id:j,name:v.trim(),path:x.trim()}),p(""),u(""),y(!1),z(!1),console.log("🔄 切换到新素材库..."),await xr.setCurrent(j),r(j),l(null),_e.getState().setImages([]),_e.getState().setFolders([]),_e.getState().setSelectedImage(null),_e.getState().setTotalImageCount(0),cn.getState().setScanProgress({libraryId:j,current:0,total:0,percent:0,status:"preparing"}),W){console.log("检测到已有索引,先加载现有数据...");try{const[q,X]=await Promise.all([Le.getFolders(j),Le.getCount(j)]);_e.getState().setFolders(q.folders),_e.getState().setTotalImageCount(X.count),console.log("✅ 已加载现有数据")}catch(q){console.warn("⚠️ 加载现有数据失败:",q)}}console.log("🔍 开始异步扫描..."),W?(console.log("执行增量同步,检测变化..."),li.sync(j,!1)):(console.log("首次添加,执行全量扫描..."),li.fullScan(j,!1)),console.log("✅ 扫描已启动,请等待进度显示...")}catch(V){console.error("❌ Error adding library:",V);let j=V.message||"未知错误";(N=(B=V.response)==null?void 0:B.data)!=null&&N.message&&(j=V.response.data.message),j.includes("无法访问")||j.includes("权限")||j.includes("数据共享")?alert(`⚠️ 文件夹权限不足 - -`+j+` - -操作步骤: -1. 应用中心找到 FlyPic 应用 -2. 点击 应用设置 -3. 将该文件夹添加到 FlyPic 应用的读写权限`):alert("添加素材库失败: "+j),cn.getState().setScanProgress(null),z(!1)}},H=async B=>{if(B!==t){if(h()){alert("扫描进行中,请稍后再试或暂停扫描");return}I(!0);try{Cl(),jt.cancelAllRequests(),cn.getState().setScanProgress(null),_e.getState().setSelectedImage(null),_e.getState().setImages([]),_e.getState().setFolders([]),_e.getState().setImageLoadingState({isLoading:!1,loadedCount:0,totalCount:0}),l(null),await xr.setCurrent(B);const[N,V]=await Promise.all([Le.getFolders(B),Le.getCount(B)]);_e.getState().setFolders(N.folders),_e.getState().setTotalImageCount(V.count),r(B),Hy(B).then(j=>{j&&j.status==="scanning"&&cn.getState().setScanProgress(j.progress)}).catch(()=>{})}catch(N){console.error("Error setting current library:",N),alert("切换素材库失败: "+N.message),_e.getState().setImageLoadingState({isLoading:!1})}finally{I(!1)}}},m=async()=>{if(!t)return;if(h()){alert("扫描进行中,请稍后再试或暂停扫描");return}const B=e.find(V=>V.id===t);if(!(!B||!confirm(`确定要删除素材库"${B.name}"吗? - -路径: ${B.path} - -⚠️ 注意: -• 将删除索引数据并释放数据库连接 -• 不会删除原始图片文件 -• .flypic 文件夹将保留,您可以手动删除`)))try{await xr.remove(t),i(t),_e.getState().setImages([]),_e.getState().setFolders([]),_e.getState().setSelectedImage(null),_e.getState().setSelectedFolder(null);const V=e.filter(j=>j.id!==t);if(V.length>0){const j=V[0];await xr.setCurrent(j.id),r(j.id)}console.log(`✅ 素材库已删除: ${B.name}`),console.log(`数据库连接已释放,可手动删除: ${B.path}\\.flypic`)}catch(V){console.error("Error deleting library:",V),alert("删除素材库失败: "+V.message)}},K=B=>{const N=new Set(S);N.has(B)?N.delete(B):N.add(B),b(N)},oe=B=>{const N=[],V=j=>{j.forEach(W=>{W.children&&W.children.length>0&&(N.push(W.path),V(W.children))})};return V(B),N},Q=()=>{const B=oe(J.length>0?J:s);b(new Set(B))},Y=()=>{b(new Set)},$=()=>{const B=oe(J.length>0?J:s);return B.length>0&&B.every(N=>S.has(N))},J=G.useMemo(()=>{if(!_)return s;const B=_.trim().toLowerCase().split(/\s+/).filter(W=>W.length>0);if(B.length===0)return s;const N=[],V=W=>W.reduce((q,X)=>{const ne=X.name.toLowerCase(),ce=X.path.toLowerCase(),de=B.every(D=>ne.includes(D)),f=B.every(D=>ce.includes(D));let F=[];return X.children&&X.children.length>0&&(F=V(X.children)),(de||f||F.length>0)&&(q.push({...X,children:F}),F.length>0&&N.push(X.path)),q},[]),j=V(s);return N.length>0&&setTimeout(()=>{b(W=>{const q=new Set(W);return N.forEach(X=>q.add(X)),q})},0),j},[s,_]),M=(B,N)=>{B.stopPropagation(),K(N)},A=B=>{const N=B.children&&B.children.length>0;o!==B.path?(Cl(),l(B.path)):N&&K(B.path)},le=(B,N=0)=>B.map(V=>{const j=S.has(V.path),W=V.children&&V.children.length>0,q=o===V.path;return k.jsxs("div",{children:[k.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${q?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,style:{paddingLeft:`${N*16+12}px`},onClick:()=>A(V),children:[W?k.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:X=>M(X,V.path),children:j?k.jsx(Qc,{className:"w-4 h-4 text-gray-500"}):k.jsx(Ny,{className:"w-4 h-4 text-gray-500"})}):k.jsx("div",{className:"w-5 mr-1"}),k.jsx(Di,{className:"w-4 h-4 mr-2 text-gray-500 flex-shrink-0"}),k.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1",children:V.name}),k.jsx("span",{className:"text-xs text-gray-400 ml-2 flex-shrink-0",children:V.imageCount})]}),W&&j&&le(V.children,N+1)]},V.path)});return k.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:[k.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:[k.jsx("div",{className:"flex items-center justify-between mb-3",children:k.jsx("h2",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:"素材库"})}),k.jsxs("div",{className:"flex gap-2",children:[k.jsxs("div",{className:"relative flex-1",children:[k.jsxs("select",{value:t||"",onChange:B=>{const N=B.target.value;if(N==="__add__"){if(h()){alert("扫描进行中,请稍后再试或暂停扫描");return}y(!0)}else N&&H(N)},disabled:O||h(),className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 appearance-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{paddingRight:"2rem"},children:[e.length===0&&k.jsx("option",{value:"",children:"暂无素材库"}),e.map(B=>k.jsx("option",{value:B.id,children:B.name},B.id)),k.jsx("option",{value:"__add__",style:{borderTop:"1px solid #ccc"},children:"+ 添加新素材库"})]}),k.jsx(Qc,{className:"absolute right-2 top-2.5 w-4 h-4 text-gray-400 pointer-events-none"})]}),t&&e.length>0&&k.jsx("button",{onClick:m,disabled:h(),className:"px-3 py-2 border border-red-300 dark:border-red-600 rounded-lg hover:bg-red-50 dark:hover:bg-red-900 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:h()?"扫描进行中,无法删除":"删除当前素材库",children:k.jsx(Uy,{className:"w-4 h-4"})})]}),w&&k.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:[k.jsxs("div",{className:"flex items-center justify-between mb-2",children:[k.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"添加素材库"}),k.jsx("button",{onClick:()=>y(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600",children:k.jsx(ep,{className:"w-4 h-4 text-gray-500"})})]}),k.jsxs("div",{className:"space-y-2",children:[k.jsx("input",{type:"text",placeholder:"素材库名称",value:v,onChange:B=>p(B.target.value),onKeyDown:B=>B.key==="Enter"&&T(),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"}),k.jsx("input",{type:"text",placeholder:"文件夹路径(例如:C:\\Users\\Pictures)",value:x,onChange:B=>u(B.target.value),onKeyDown:B=>B.key==="Enter"&&T(),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"}),k.jsxs("div",{className:"flex gap-2",children:[k.jsx("button",{onClick:()=>y(!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:"取消"}),k.jsx("button",{onClick:T,disabled:R,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:R?"添加中...":"添加"})]})]})]})]}),k.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[k.jsx("div",{className:"mb-3 space-y-2",children:k.jsxs("div",{className:"flex gap-2",children:[k.jsxs("div",{className:"relative flex-1",children:[k.jsx(bl,{className:"absolute left-2 top-2 w-4 h-4 text-gray-400"}),k.jsx("input",{type:"text",placeholder:"搜索文件夹(支持多关键词)...",value:d,onChange:B=>re(B.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"})]}),k.jsx("button",{onClick:$()?Y:Q,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:$()?"折叠全部":"展开全部",children:$()?k.jsx(Ty,{className:"w-4 h-4"}):k.jsx(Ry,{className:"w-4 h-4"})})]})}),k.jsxs("div",{className:"space-y-1",children:[k.jsxs("div",{className:`flex items-center px-3 py-2 cursor-pointer rounded-md transition-colors ${o===null?"bg-blue-50 dark:bg-blue-900":"hover:bg-gray-100 dark:hover:bg-gray-700"}`,onClick:()=>l(null),children:[k.jsx("div",{className:"w-5 mr-1"}),k.jsx(Di,{className:"w-4 h-4 mr-2 text-blue-500 flex-shrink-0"}),k.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 font-medium flex-1",children:"全部图片"}),k.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:a})]}),(J.length>0||s.length>0)&&k.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 my-2"}),J.length>0?le(J):_?k.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500 text-sm",children:"未找到匹配的文件夹"}):s.length===0?k.jsx("div",{className:"text-center py-8 text-gray-400 dark:text-gray-500 text-sm",children:"暂无文件夹"}):null]})]})]})}class qy{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 r=this.cache.get(t);return r?(this.stats.hitCount++,this._updateAccessOrder(t),r.accessCount=(r.accessCount||0)+1,r):(this.stats.missCount++,null)}set(t,r){this.stats.totalSets++,!this.cache.has(t)&&this.cache.size>=this.maxSize&&this.evictLRU();let n=null;r.blob&&(n=URL.createObjectURL(r.blob)),this.cache.set(t,{data:r,blobUrl:n,timestamp:Date.now(),accessCount:1}),this._updateAccessOrder(t)}remove(t){const r=this.cache.get(t);if(r){r.blobUrl&&URL.revokeObjectURL(r.blobUrl),this.cache.delete(t);const n=this.accessOrder.indexOf(t);n>-1&&this.accessOrder.splice(n,1)}}clear(){for(const[t,r]of this.cache.entries())r.blobUrl&&URL.revokeObjectURL(r.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 r=this.accessOrder.indexOf(t);r>-1&&this.accessOrder.splice(r,1),this.accessOrder.push(t)}has(t){return this.cache.has(t)}keys(){return Array.from(this.cache.keys())}logStats(){this.getStats()}}const sd=new qy;function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?G.useEffect:G.useLayoutEffect;function Ln(e,t,r){var n=G.useRef(t);n.current=t,G.useEffect(function(){function i(s){n.current(s)}return e&&window.addEventListener(e,i,r),function(){e&&window.removeEventListener(e,i)}},[e])}var Yy=["container"];function Zy(e){var t=e.container,r=t===void 0?document.body:t,n=$o(e,Yy);return Oh.createPortal(ye.createElement("div",qe({},n)),r)}function Xy(e){return ye.createElement("svg",qe({width:"44",height:"44",viewBox:"0 0 768 768"},e),ye.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 Qy(e){return ye.createElement("svg",qe({width:"44",height:"44",viewBox:"0 0 768 768"},e),ye.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 Gy(e){return ye.createElement("svg",qe({width:"44",height:"44",viewBox:"0 0 768 768"},e),ye.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function Jy(){return G.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function ad(e){var t=e.touches[0],r=t.clientX,n=t.clientY;if(e.touches.length>=2){var i=e.touches[1],s=i.clientX,o=i.clientY;return[(r+s)/2,(n+o)/2,Math.sqrt(Math.pow(s-r,2)+Math.pow(o-n,2))]}return[r,n,0]}var Dr=function(e,t,r,n){var i,s=r*t,o=(s-n)/2,a=e;return s<=n?(i=1,a=0):e>0&&o-e<=0?(i=2,a=o):e<0&&o+e<=0&&(i=3,a=-o),[i,a]};function xa(e,t,r,n,i,s,o,a,l,h){o===void 0&&(o=innerWidth/2),a===void 0&&(a=innerHeight/2),l===void 0&&(l=0),h===void 0&&(h=0);var w=Dr(e,s,r,innerWidth)[0],y=Dr(t,s,n,innerHeight),v=innerWidth/2,p=innerHeight/2;return{x:o-s/i*(o-(v+e))-v+(n/r>=3&&r*s===innerWidth?0:w?l/2:l),y:a-s/i*(a-(p+t))-p+(y[0]?h/2:h),lastCX:o,lastCY:a}}function Rl(e,t,r){var n=e%180!=0;return n?[r,t,n]:[t,r,n]}function _a(e,t,r){var n=Rl(r,innerWidth,innerHeight),i=n[0],s=n[1],o=0,a=i,l=s,h=e/t*s,w=t/e*i;return e=s?a=h:e>=i&&ti/s?l=w:t/e>=3&&!n[2]?o=((l=w)-s)/2:a=h,{width:a,height:l,x:0,y:o,pause:!0}}function zs(e,t){var r=t.leading,n=r!==void 0&&r,i=t.maxWait,s=t.wait,o=s===void 0?i||0:s,a=G.useRef(e);a.current=e;var l=G.useRef(0),h=G.useRef(),w=function(){return h.current&&clearTimeout(h.current)},y=G.useCallback(function(){var v=[].slice.call(arguments),p=Date.now();function x(){l.current=p,w(),a.current.apply(null,v)}var u=l.current,_=p-u;if(u===0&&(n&&x(),l.current=p),i!==void 0){if(_>i)return void x()}else _=1&&s&&s())};w()}function w(){l=requestAnimationFrame(h)}}var tv={T:0,L:0,W:0,H:0,FIT:void 0},tp=function(){var e=G.useRef(!1);return G.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},rv=["className"];function nv(e){var t=e.className,r=t===void 0?"":t,n=$o(e,rv);return ye.createElement("div",qe({className:"PhotoView__Spinner "+r},n),ye.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},ye.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"}),ye.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var iv=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function sv(e){var t=e.src,r=e.loaded,n=e.broken,i=e.className,s=e.onPhotoLoad,o=e.loadingElement,a=e.brokenElement,l=$o(e,iv),h=tp();return t&&!n?ye.createElement(ye.Fragment,null,ye.createElement("img",qe({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(w){var y=w.target;h.current&&s({loaded:!0,naturalWidth:y.naturalWidth,naturalHeight:y.naturalHeight})},onError:function(){h.current&&s({broken:!0})},draggable:!1,alt:""},l)),!r&&(o?ye.createElement("span",{className:"PhotoView__icon"},o):ye.createElement(nv,{className:"PhotoView__icon"}))):a?ye.createElement("span",{className:"PhotoView__icon"},typeof a=="function"?a({src:t}):a):null}var ov={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 av(e){var t=e.item,r=t.src,n=t.render,i=t.width,s=i===void 0?0:i,o=t.height,a=o===void 0?0:o,l=t.originRef,h=e.visible,w=e.speed,y=e.easing,v=e.wrapClassName,p=e.className,x=e.style,u=e.loadingElement,_=e.brokenElement,c=e.onPhotoTap,d=e.onMaskTap,g=e.onReachMove,S=e.onReachUp,b=e.onPhotoResize,R=e.isActive,z=e.expose,O=xo(ov),I=O[0],P=O[1],re=G.useRef(0),T=tp(),H=I.naturalWidth,m=H===void 0?s:H,K=I.naturalHeight,oe=K===void 0?a:K,Q=I.width,Y=Q===void 0?s:Q,$=I.height,J=$===void 0?a:$,M=I.loaded,A=M===void 0?!r:M,le=I.broken,B=I.x,N=I.y,V=I.touched,j=I.stopRaf,W=I.maskTouched,q=I.rotate,X=I.scale,ne=I.CX,ce=I.CY,de=I.lastX,f=I.lastY,F=I.lastCX,D=I.lastCY,E=I.lastScale,C=I.touchTime,L=I.touchLength,Z=I.pause,ee=I.reach,U=Jn({onScale:function(te){return ie(Ts(te))},onRotate:function(te){q!==te&&(z({rotate:te}),P(qe({rotate:te},_a(m,oe,te))))}});function ie(te,pe,be){X!==te&&(z({scale:te}),P(qe({scale:te},xa(B,N,Y,J,X,te,pe,be),te<=1&&{x:0,y:0})))}var ue=zs(function(te,pe,be){if(be===void 0&&(be=0),(V||W)&&R){var lr=Rl(q,Y,J),ur=lr[0],Ct=lr[1];if(be===0&&re.current===0){var mt=Math.abs(te-ne)<=20,gt=Math.abs(pe-ce)<=20;if(mt&>)return void P({lastCX:te,lastCY:pe});re.current=mt?pe>ce?3:2:1}var Xt,nn=te-F,zr=pe-D;if(be===0){var sn=Dr(nn+de,X,ur,innerWidth)[0],Cn=Dr(zr+f,X,Ct,innerHeight);Xt=function(Ir,dr,fr,Qt){return dr&&Ir===1||Qt==="x"?"x":fr&&Ir>1||Qt==="y"?"y":void 0}(re.current,sn,Cn[0],ee),Xt!==void 0&&g(Xt,te,pe,X)}if(Xt==="x"||W)return void P({reach:"x"});var cr=Ts(X+(be-L)/100/2*X,m/Y,.2);z({scale:cr}),P(qe({touchLength:be,reach:Xt,scale:cr},xa(B,N,Y,J,X,cr,te,pe,nn,zr)))}},{maxWait:8});function ae(te){return!j&&!V&&(T.current&&P(qe({},te,{pause:h})),T.current)}var he,ve,me,Ve,Kt,nt,Yt,xe,ar=(Kt=function(te){return ae({x:te})},nt=function(te){return ae({y:te})},Yt=function(te){return T.current&&(z({scale:te}),P({scale:te})),!V&&T.current},xe=Jn({X:function(te){return Kt(te)},Y:function(te){return nt(te)},S:function(te){return Yt(te)}}),function(te,pe,be,lr,ur,Ct,mt,gt,Xt,nn,zr){var sn=Rl(nn,ur,Ct),Cn=sn[0],cr=sn[1],Ir=Dr(te,gt,Cn,innerWidth),dr=Ir[0],fr=Ir[1],Qt=Dr(pe,gt,cr,innerHeight),En=Qt[0],ls=Qt[1],Nn=Date.now()-zr;if(Nn>=200||gt!==mt||Math.abs(Xt-mt)>1){var jr=xa(te,pe,ur,Ct,mt,gt),hr=jr.x,on=jr.y,Et=dr?fr:hr!==te?hr:null,Rn=En?ls:on!==pe?on:null;return Et!==null&&dn(te,Et,xe.X),Rn!==null&&dn(pe,Rn,xe.Y),void(gt!==mt&&dn(mt,gt,xe.S))}var an=(te-be)/Nn,Lr=(pe-lr)/Nn,Or=Math.sqrt(Math.pow(an,2)+Math.pow(Lr,2)),pr=!1,mr=!1;(function(Mt,it){var st,Dt=Mt,gr=0,Nt=0,Tn=function(hi){st||(st=hi);var pi=hi-st,Iu=Math.sign(Mt),ju=-.001*Iu,Lu=Math.sign(-Dt)*Math.pow(Dt,2)*2e-4,ip=Dt*pi+(ju+Lu)*Math.pow(pi,2)/2;gr+=ip,st=hi,Iu*(Dt+=(ju+Lu)*pi)<=0?Rt():it(gr)?Gt():Rt()};function Gt(){Nt=requestAnimationFrame(Tn)}function Rt(){cancelAnimationFrame(Nt)}Gt()})(Or,function(Mt){var it=te+Mt*(an/Or),st=pe+Mt*(Lr/Or),Dt=Dr(it,mt,Cn,innerWidth),gr=Dt[0],Nt=Dt[1],Tn=Dr(st,mt,cr,innerHeight),Gt=Tn[0],Rt=Tn[1];if(gr&&!pr&&(pr=!0,dr?dn(it,Nt,xe.X):ld(Nt,it+(it-Nt),xe.X)),Gt&&!mr&&(mr=!0,En?dn(st,Rt,xe.Y):ld(Rt,st+(st-Rt),xe.Y)),pr&&mr)return!1;var hi=pr||xe.X(Nt),pi=mr||xe.Y(Rt);return hi&&pi})}),Zt=(he=c,ve=function(te,pe){ee||ie(X!==1?1:Math.max(2,m/Y),te,pe)},me=G.useRef(0),Ve=zs(function(){me.current=0,he.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var te=[].slice.call(arguments);me.current+=1,Ve.apply(void 0,te),me.current>=2&&(Ve.cancel(),me.current=0,ve.apply(void 0,te))});function Ge(te,pe){if(re.current=0,(V||W)&&R){P({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var be=Ts(X,m/Y);if(ar(B,N,de,f,Y,J,X,be,E,q,C),S(te,pe),ne===te&&ce===pe){if(V)return void Zt(te,pe);W&&d(te,pe)}}}function Tr(te,pe,be){be===void 0&&(be=0),P({touched:!0,CX:te,CY:pe,lastCX:te,lastCY:pe,lastX:B,lastY:N,lastScale:X,touchLength:be,touchTime:Date.now()})}function bn(te){P({maskTouched:!0,CX:te.clientX,CY:te.clientY,lastX:B,lastY:N})}Ln(yr?void 0:"mousemove",function(te){te.preventDefault(),ue(te.clientX,te.clientY)}),Ln(yr?void 0:"mouseup",function(te){Ge(te.clientX,te.clientY)}),Ln(yr?"touchmove":void 0,function(te){te.preventDefault();var pe=ad(te);ue.apply(void 0,pe)},{passive:!1}),Ln(yr?"touchend":void 0,function(te){var pe=te.changedTouches[0];Ge(pe.clientX,pe.clientY)},{passive:!1}),Ln("resize",zs(function(){A&&!V&&(P(_a(m,oe,q)),b())},{maxWait:8})),Nl(function(){R&&z(qe({scale:X,rotate:q},U))},[R]);var bt=function(te,pe,be,lr,ur,Ct,mt,gt,Xt,nn){var zr=function(hr,on,Et,Rn,an){var Lr=G.useRef(!1),Or=xo({lead:!0,scale:Et}),pr=Or[0],mr=pr.lead,Mt=pr.scale,it=Or[1],st=zs(function(Dt){try{return an(!0),it({lead:!1,scale:Dt}),Promise.resolve()}catch(gr){return Promise.reject(gr)}},{wait:Rn});return Nl(function(){Lr.current?(an(!1),it({lead:!0}),st(Et)):Lr.current=!0},[Et]),mr?[hr*Mt,on*Mt,Et/Mt]:[hr*Et,on*Et,1]}(Ct,mt,gt,Xt,nn),sn=zr[0],Cn=zr[1],cr=zr[2],Ir=function(hr,on,Et,Rn,an){var Lr=G.useState(tv),Or=Lr[0],pr=Lr[1],mr=G.useState(0),Mt=mr[0],it=mr[1],st=G.useRef(),Dt=Jn({OK:function(){return hr&&it(4)}});function gr(Nt){an(!1),it(Nt)}return G.useEffect(function(){if(st.current||(st.current=Date.now()),Et){if(function(Nt,Tn){var Gt=Nt&&Nt.current;if(Gt&&Gt.nodeType===1){var Rt=Gt.getBoundingClientRect();Tn({T:Rt.top,L:Rt.left,W:Rt.width,H:Rt.height,FIT:Gt.tagName==="IMG"?getComputedStyle(Gt).objectFit:void 0})}}(on,pr),hr)return Date.now()-st.current<250?(it(1),requestAnimationFrame(function(){it(2),requestAnimationFrame(function(){return gr(3)})}),void setTimeout(Dt.OK,Rn)):void it(4);gr(5)}},[hr,Et]),[Mt,Or]}(te,pe,be,Xt,nn),dr=Ir[0],fr=Ir[1],Qt=fr.W,En=fr.FIT,ls=innerWidth/2,Nn=innerHeight/2,jr=dr<3||dr>4;return[jr?Qt?fr.L:ls:lr+(ls-Ct*gt/2),jr?Qt?fr.T:Nn:ur+(Nn-mt*gt/2),sn,jr&&En?sn*(fr.H/Qt):Cn,dr===0?cr:jr?Qt/(Ct*gt)||.01:cr,jr?En?1:0:1,dr,En]}(h,l,A,B,N,Y,J,X,w,function(te){return P({pause:te})}),ge=bt[4],Ee=bt[6],Te="transform "+w+"ms "+y,ze={className:p,onMouseDown:yr?void 0:function(te){te.stopPropagation(),te.button===0&&Tr(te.clientX,te.clientY,0)},onTouchStart:yr?function(te){te.stopPropagation(),Tr.apply(void 0,ad(te))}:void 0,onWheel:function(te){if(!ee){var pe=Ts(X-te.deltaY/100/2,m/Y);P({stopRaf:!0}),ie(pe,te.clientX,te.clientY)}},style:{width:bt[2]+"px",height:bt[3]+"px",opacity:bt[5],objectFit:Ee===4?void 0:bt[7],transform:q?"rotate("+q+"deg)":void 0,transition:Ee>2?Te+", opacity "+w+"ms ease, height "+(Ee<4?w/2:Ee>4?w:0)+"ms "+y:void 0}};return ye.createElement("div",{className:"PhotoView__PhotoWrap"+(v?" "+v:""),style:x,onMouseDown:!yr&&R?bn:void 0,onTouchStart:yr&&R?function(te){return bn(te.touches[0])}:void 0},ye.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+ge+", 0, 0, "+ge+", "+bt[0]+", "+bt[1]+")",transition:V||Z?void 0:Te,willChange:R?"transform":void 0}},r?ye.createElement(sv,qe({src:r,loaded:A,broken:le},ze,{onPhotoLoad:function(te){P(qe({},te,te.loaded&&_a(te.naturalWidth||0,te.naturalHeight||0,q)))},loadingElement:u,brokenElement:_})):n&&n({attrs:ze,scale:ge,rotate:q})))}var ud={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 lv(e){var t=e.loop,r=t===void 0?3:t,n=e.speed,i=e.easing,s=e.photoClosable,o=e.maskClosable,a=o===void 0||o,l=e.maskOpacity,h=l===void 0?1:l,w=e.pullClosable,y=w===void 0||w,v=e.bannerVisible,p=v===void 0||v,x=e.overlayRender,u=e.toolbarRender,_=e.className,c=e.maskClassName,d=e.photoClassName,g=e.photoWrapClassName,S=e.loadingElement,b=e.brokenElement,R=e.images,z=e.index,O=z===void 0?0:z,I=e.onIndexChange,P=e.visible,re=e.onClose,T=e.afterClose,H=e.portalContainer,m=xo(ud),K=m[0],oe=m[1],Q=G.useState(0),Y=Q[0],$=Q[1],J=K.x,M=K.touched,A=K.pause,le=K.lastCX,B=K.lastCY,N=K.bg,V=N===void 0?h:N,j=K.lastBg,W=K.overlay,q=K.minimal,X=K.scale,ne=K.rotate,ce=K.onScale,de=K.onRotate,f=e.hasOwnProperty("index"),F=f?O:Y,D=f?I:$,E=G.useRef(F),C=R.length,L=R[F],Z=typeof r=="boolean"?r:C>r,ee=function(ge,Ee){var Te=G.useReducer(function(be){return!be},!1)[1],ze=G.useRef(0),te=function(be){var lr=G.useRef(be);function ur(Ct){lr.current=Ct}return G.useMemo(function(){(function(Ct){ge?(Ct(ge),ze.current=1):ze.current=2})(ur)},[be]),[lr.current,ur]}(ge),pe=te[1];return[te[0],ze.current,function(){Te(),ze.current===2&&(pe(!1),Ee&&Ee()),ze.current=0}]}(P,T),U=ee[0],ie=ee[1],ue=ee[2];Nl(function(){if(U)return oe({pause:!0,x:F*-(innerWidth+In)}),void(E.current=F);oe(ud)},[U]);var ae=Jn({close:function(ge){de&&de(0),oe({overlay:!0,lastBg:V}),re(ge)},changeIndex:function(ge,Ee){Ee===void 0&&(Ee=!1);var Te=Z?E.current+(ge-F):ge,ze=C-1,te=El(Te,0,ze),pe=Z?Te:te,be=innerWidth+In;oe({touched:!1,lastCX:void 0,lastCY:void 0,x:-be*pe,pause:Ee}),E.current=pe,D&&D(Z?ge<0?ze:ge>ze?0:ge:te)}}),he=ae.close,ve=ae.changeIndex;function me(ge){return ge?he():oe({overlay:!W})}function Ve(){oe({x:-(innerWidth+In)*F,lastCX:void 0,lastCY:void 0,pause:!0}),E.current=F}function Kt(ge,Ee,Te,ze){ge==="x"?function(te){if(le!==void 0){var pe=te-le,be=pe;!Z&&(F===0&&pe>0||F===C-1&&pe<0)&&(be=pe/2),oe({touched:!0,lastCX:le,x:-(innerWidth+In)*E.current+be,pause:!1})}else oe({touched:!0,lastCX:te,x:J,pause:!1})}(Ee):ge==="y"&&function(te,pe){if(B!==void 0){var be=h===null?null:El(h,.01,h-Math.abs(te-B)/100/4);oe({touched:!0,lastCY:B,bg:pe===1?be:h,minimal:pe===1})}else oe({touched:!0,lastCY:te,bg:V,minimal:!0})}(Te,ze)}function nt(ge,Ee){var Te=ge-(le??ge),ze=Ee-(B??Ee),te=!1;if(Te<-40)ve(F+1);else if(Te>40)ve(F-1);else{var pe=-(innerWidth+In)*E.current;Math.abs(ze)>100&&q&&y&&(te=!0,he()),oe({touched:!1,x:pe,lastCX:void 0,lastCY:void 0,bg:h,overlay:!!te||W})}}Ln("keydown",function(ge){if(P)switch(ge.key){case"ArrowLeft":ve(F-1,!0);break;case"ArrowRight":ve(F+1,!0);break;case"Escape":he()}});var Yt=function(ge,Ee,Te){return G.useMemo(function(){var ze=ge.length;return Te?ge.concat(ge).concat(ge).slice(ze+Ee-1,ze+Ee+2):ge.slice(Math.max(Ee-1,0),Math.min(Ee+2,ze+1))},[ge,Ee,Te])}(R,F,Z);if(!U)return null;var xe=W&&!ie,ar=P?V:j,Zt=ce&&de&&{images:R,index:F,visible:P,onClose:he,onIndexChange:ve,overlayVisible:xe,overlay:L&&L.overlay,scale:X,rotate:ne,onScale:ce,onRotate:de},Ge=n?n(ie):400,Tr=i?i(ie):od,bn=n?n(3):600,bt=i?i(3):od;return ye.createElement(Zy,{className:"PhotoView-Portal"+(xe?"":" PhotoView-Slider__clean")+(P?"":" PhotoView-Slider__willClose")+(_?" "+_:""),role:"dialog",onClick:function(ge){return ge.stopPropagation()},container:H},P&&ye.createElement(Jy,null),ye.createElement("div",{className:"PhotoView-Slider__Backdrop"+(c?" "+c:"")+(ie===1?" PhotoView-Slider__fadeIn":ie===2?" PhotoView-Slider__fadeOut":""),style:{background:ar?"rgba(0, 0, 0, "+ar+")":void 0,transitionTimingFunction:Tr,transitionDuration:(M?0:Ge)+"ms",animationDuration:Ge+"ms"},onAnimationEnd:ue}),p&&ye.createElement("div",{className:"PhotoView-Slider__BannerWrap"},ye.createElement("div",{className:"PhotoView-Slider__Counter"},F+1," / ",C),ye.createElement("div",{className:"PhotoView-Slider__BannerRight"},u&&Zt&&u(Zt),ye.createElement(Xy,{className:"PhotoView-Slider__toolbarIcon",onClick:he}))),Yt.map(function(ge,Ee){var Te=Z||F!==0?E.current-1+Ee:F+Ee;return ye.createElement(av,{key:Z?ge.key+"/"+ge.src+"/"+Te:ge.key,item:ge,speed:Ge,easing:Tr,visible:P,onReachMove:Kt,onReachUp:nt,onPhotoTap:function(){return me(s)},onMaskTap:function(){return me(a)},wrapClassName:g,className:d,style:{left:(innerWidth+In)*Te+"px",transform:"translate3d("+J+"px, 0px, 0)",transition:M||A?void 0:"transform "+bn+"ms "+bt},loadingElement:S,brokenElement:b,onPhotoResize:Ve,isActive:E.current===Te,expose:oe})}),!yr&&p&&ye.createElement(ye.Fragment,null,(Z||F!==0)&&ye.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ve(F-1,!0)}},ye.createElement(Qy,null)),(Z||F+1-1){var c=h.slice();return c.splice(_,1,u),void a({images:c})}a(function(d){return{images:d.images.concat(u)}})},remove:function(u){a(function(_){var c=_.images.filter(function(d){return d.key!==u});return{images:c,index:Math.min(c.length-1,y)}})},show:function(u){var _=h.findIndex(function(c){return c.key===u});a({visible:!0,index:_}),n&&n(!0,_,o)}}),p=Jn({close:function(){a({visible:!1}),n&&n(!1,y,o)},changeIndex:function(u){a({index:u}),r&&r(u,o)}}),x=G.useMemo(function(){return qe({},o,v)},[o,v]);return ye.createElement(Ky.Provider,{value:x},t,ye.createElement(lv,qe({images:h,visible:w,index:y,onIndexChange:p.changeIndex,onClose:p.close},i)))}function Tl(){return Tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Sa=-1;function pd(e){if(e===void 0&&(e=!1),Sa===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Sa=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Sa}var jn=null;function md(e){if(e===void 0&&(e=!1),jn===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?jn="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?jn="negative":jn="positive-ascending"),document.body.removeChild(t),jn}return jn}var yv=150,vv=function(t,r){return t};function wv(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,l=e.initInstanceProps,h=e.shouldResetStyleCacheOnItemSizeChange,w=e.validateProps;return t=function(y){fv(v,y);function v(x){var u;return u=y.call(this,x)||this,u._instanceProps=l(u.props,cd(u)),u._outerRef=void 0,u._resetIsScrollingTimeoutId=null,u.state={instance:cd(u),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof u.props.initialScrollOffset=="number"?u.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},u._callOnItemsRendered=void 0,u._callOnItemsRendered=ka(function(_,c,d,g){return u.props.onItemsRendered({overscanStartIndex:_,overscanStopIndex:c,visibleStartIndex:d,visibleStopIndex:g})}),u._callOnScroll=void 0,u._callOnScroll=ka(function(_,c,d){return u.props.onScroll({scrollDirection:_,scrollOffset:c,scrollUpdateWasRequested:d})}),u._getItemStyle=void 0,u._getItemStyle=function(_){var c=u.props,d=c.direction,g=c.itemSize,S=c.layout,b=u._getItemStyleCache(h&&g,h&&S,h&&d),R;if(b.hasOwnProperty(_))R=b[_];else{var z=r(u.props,_,u._instanceProps),O=i(u.props,_,u._instanceProps),I=d==="horizontal"||S==="horizontal",P=d==="rtl",re=I?z:0;b[_]=R={position:"absolute",left:P?void 0:re,right:P?re:void 0,top:I?0:z,height:I?"100%":O,width:I?O:"100%"}}return R},u._getItemStyleCache=void 0,u._getItemStyleCache=ka(function(_,c,d){return{}}),u._onScrollHorizontal=function(_){var c=_.currentTarget,d=c.clientWidth,g=c.scrollLeft,S=c.scrollWidth;u.setState(function(b){if(b.scrollOffset===g)return null;var R=u.props.direction,z=g;if(R==="rtl")switch(md()){case"negative":z=-g;break;case"positive-descending":z=S-d-g;break}return z=Math.max(0,Math.min(z,S-d)),{isScrolling:!0,scrollDirection:b.scrollOffsetR.clientWidth?pd():0:b=R.scrollHeight>R.clientHeight?pd():0}this.scrollTo(s(this.props,u,_,S,this._instanceProps,b))},p.componentDidMount=function(){var u=this.props,_=u.direction,c=u.initialScrollOffset,d=u.layout;if(typeof c=="number"&&this._outerRef!=null){var g=this._outerRef;_==="horizontal"||d==="horizontal"?g.scrollLeft=c:g.scrollTop=c}this._callPropsCallbacks()},p.componentDidUpdate=function(){var u=this.props,_=u.direction,c=u.layout,d=this.state,g=d.scrollOffset,S=d.scrollUpdateWasRequested;if(S&&this._outerRef!=null){var b=this._outerRef;if(_==="horizontal"||c==="horizontal")if(_==="rtl")switch(md()){case"negative":b.scrollLeft=-g;break;case"positive-ascending":b.scrollLeft=g;break;default:var R=b.clientWidth,z=b.scrollWidth;b.scrollLeft=z-R-g;break}else b.scrollLeft=g;else b.scrollTop=g}this._callPropsCallbacks()},p.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&hd(this._resetIsScrollingTimeoutId)},p.render=function(){var u=this.props,_=u.children,c=u.className,d=u.direction,g=u.height,S=u.innerRef,b=u.innerElementType,R=u.innerTagName,z=u.itemCount,O=u.itemData,I=u.itemKey,P=I===void 0?vv:I,re=u.layout,T=u.outerElementType,H=u.outerTagName,m=u.style,K=u.useIsScrolling,oe=u.width,Q=this.state.isScrolling,Y=d==="horizontal"||re==="horizontal",$=Y?this._onScrollHorizontal:this._onScrollVertical,J=this._getRangeToRender(),M=J[0],A=J[1],le=[];if(z>0)for(var B=M;B<=A;B++)le.push(G.createElement(_,{data:O,key:P(B,O),index:B,isScrolling:K?Q:void 0,style:this._getItemStyle(B)}));var N=n(this.props,this._instanceProps);return G.createElement(T||H||"div",{className:c,onScroll:$,ref:this._outerRefSetter,style:Tl({position:"relative",height:g,width:oe,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:d},m)},G.createElement(b||R||"div",{children:le,ref:S,style:{height:Y?"100%":N,pointerEvents:Q?"none":void 0,width:Y?N:"100%"}}))},p._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var u=this.props.itemCount;if(u>0){var _=this._getRangeToRender(),c=_[0],d=_[1],g=_[2],S=_[3];this._callOnItemsRendered(c,d,g,S)}}if(typeof this.props.onScroll=="function"){var b=this.state,R=b.scrollDirection,z=b.scrollOffset,O=b.scrollUpdateWasRequested;this._callOnScroll(R,z,O)}},p._getRangeToRender=function(){var u=this.props,_=u.itemCount,c=u.overscanCount,d=this.state,g=d.isScrolling,S=d.scrollDirection,b=d.scrollOffset;if(_===0)return[0,0,0,0];var R=o(this.props,b,this._instanceProps),z=a(this.props,R,b,this._instanceProps),O=!g||S==="backward"?Math.max(1,c):1,I=!g||S==="forward"?Math.max(1,c):1;return[Math.max(0,R-O),Math.max(0,Math.min(_-1,z+I)),R,z]},v}(G.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var xv=function(t,r){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,r.instance},_v=50,qn=function(t,r,n){var i=t,s=i.itemSize,o=n.itemMetadataMap,a=n.lastMeasuredIndex;if(r>a){var l=0;if(a>=0){var h=o[a];l=h.offset+h.size}for(var w=a+1;w<=r;w++){var y=s(w);o[w]={offset:l,size:y},l+=y}n.lastMeasuredIndex=r}return o[r]},kv=function(t,r,n){var i=r.itemMetadataMap,s=r.lastMeasuredIndex,o=s>0?i[s].offset:0;return o>=n?rp(t,r,s,0,n):Sv(t,r,Math.max(0,s),n)},rp=function(t,r,n,i,s){for(;i<=n;){var o=i+Math.floor((n-i)/2),a=qn(t,o,r).offset;if(a===s)return o;as&&(n=o-1)}return i>0?i-1:0},Sv=function(t,r,n,i){for(var s=t.itemCount,o=1;n=n&&(o=n-1),o>=0){var l=i[o];a=l.offset+l.size}var h=n-o-1,w=h*s;return a+w},bv=wv({getItemOffset:function(t,r,n){return qn(t,r,n).offset},getItemSize:function(t,r,n){return n.itemMetadataMap[r].size},getEstimatedTotalSize:gd,getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,l=t.height,h=t.layout,w=t.width,y=a==="horizontal"||h==="horizontal",v=y?w:l,p=qn(t,r,s),x=gd(t,s),u=Math.max(0,Math.min(x-v,p.offset)),_=Math.max(0,p.offset-v+p.size+o);switch(n==="smart"&&(i>=_-v&&i<=u+v?n="auto":n="center"),n){case"start":return u;case"end":return _;case"center":return Math.round(_+(u-_)/2);case"auto":default:return i>=_&&i<=u?i:i<_?_:u}},getStartIndexForOffset:function(t,r,n){return kv(t,n,r)},getStopIndexForStartIndex:function(t,r,n,i){for(var s=t.direction,o=t.height,a=t.itemCount,l=t.layout,h=t.width,w=s==="horizontal"||l==="horizontal",y=w?h:o,v=qn(t,r,i),p=n+y,x=v.offset+v.size,u=r;u{try{await Le.openInExplorer(t,e.path)}catch(o){console.error("Failed to open file:",o)}};return k.jsxs("div",{className:"fixed inset-0 z-50 bg-black bg-opacity-90 flex items-center justify-center",children:[k.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:[k.jsx("div",{className:"text-white text-sm truncate max-w-md",children:e.filename}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("button",{onClick:s,className:"p-2 text-white hover:bg-white hover:bg-opacity-20 rounded transition-colors",title:"在系统默认应用中打开",children:k.jsx(jy,{className:"w-5 h-5"})}),k.jsx("button",{onClick:r,className:"p-2 text-white hover:bg-white hover:bg-opacity-20 rounded transition-colors",children:k.jsx(ep,{className:"w-6 h-6"})})]})]}),k.jsxs("div",{className:"w-full h-full flex items-center justify-center p-20",children:[n==="video"&&k.jsx("video",{src:i,controls:!0,autoPlay:!0,className:"max-w-full max-h-full rounded shadow-2xl",onError:o=>{console.error("Video load error:",o),alert("视频加载失败,请尝试在系统默认应用中打开")},children:"您的浏览器不支持视频播放"}),n==="audio"&&k.jsxs("div",{className:"flex flex-col items-center justify-center",children:[k.jsx("div",{className:"text-white text-6xl mb-8",children:"🎵"}),k.jsx("audio",{src:i,controls:!0,autoPlay:!0,className:"w-96 rounded shadow-2xl",onError:o=>{console.error("Audio load error:",o),alert("音频加载失败,请尝试在系统默认应用中打开")},children:"您的浏览器不支持音频播放"}),k.jsx("p",{className:"text-white mt-4 text-sm opacity-70",children:e.filename})]}),n==="document"&&k.jsx("div",{className:"w-full h-full bg-white rounded shadow-2xl overflow-hidden",children:e.format==="pdf"?k.jsx("iframe",{src:i,className:"w-full h-full",title:e.filename}):k.jsx("iframe",{src:i,className:"w-full h-full",title:e.filename,sandbox:"allow-same-origin"})}),(n==="design"||n==="other"||!n)&&k.jsxs("div",{className:"text-center text-white",children:[k.jsx("p",{className:"mb-4",children:"此文件类型需要在专业软件中打开"}),k.jsx("button",{onClick:s,className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 rounded-lg transition-colors",children:"在系统默认应用中打开"})]})]}),k.jsx("div",{className:"absolute inset-0 -z-10",onClick:r})]})}const Ev=100,Is={pageSize:100,preloadThreshold:300,overscanCount:4};function Nv(){const{currentLibraryId:e}=rr(),{images:t,selectedImage:r,setSelectedImage:n,selectedImages:i,setSelectedImages:s,toggleImageSelection:o,clearSelection:a,imageLoadingState:l,selectedFolder:h,searchKeywords:w,filters:y,appendImages:v,setImageLoadingState:p}=_e(),x=t,{thumbnailHeight:u,isResizingPanels:_}=yt(),c=G.useRef(null),d=G.useRef(null),[g,S]=G.useState(0),[b,R]=G.useState(0),[z,O]=G.useState(-1),[I,P]=G.useState(null),[re,T]=G.useState(null),H=G.useCallback(async()=>{var V;if(!e||!l.hasMore||l.isLoading)return;const N=jt.createRequest(rs.IMAGES);p({isLoading:!0});try{const j={offset:t.length,limit:Is.pageSize};h&&(j.folder=h),w&&(j.keywords=w),((V=y.formats)==null?void 0:V.length)>0&&(j.formats=y.formats.join(","));const W=await Le.search(e,j,{signal:N.signal});if(!jt.isValid(N.id))return;const{images:q,total:X,hasMore:ne}=W;jt.complete(N.id),v(q),p({isLoading:!1,loadedCount:t.length+q.length,totalCount:X,hasMore:ne||!1})}catch(j){if(j.name==="CanceledError"||j.name==="AbortError")return;console.error("Error loading more images:",j),jt.error(N.id),p({isLoading:!1})}},[e,l,t.length,h,w,y,v,p]);G.useEffect(()=>{let N=null,V=0;const j=10,W={current:0};let q=null;const X=(de,f)=>(Math.abs(de-W.current)<12||(W.current=de,q&&clearTimeout(q),q=setTimeout(()=>{S(de),R(f)},50)),!0),ne=()=>{if(c.current){const de=c.current.offsetWidth-32,f=c.current.offsetHeight;if(de>0)return X(de,f)}return!1},ce=()=>{ne()?c.current&&(N=new ResizeObserver(()=>{yt.getState().isResizingPanels||ne()}),N.observe(c.current)):V{N&&N.disconnect(),q&&clearTimeout(q)}},[]),G.useEffect(()=>{if(_||!c.current)return;const N=c.current.offsetWidth-32,V=c.current.offsetHeight;N>0&&(S(N),R(V),d.current&&d.current.resetAfterIndex(0))},[_]);const m=G.useMemo(()=>{if(!x.length||!g)return[];const N=16,V=u,j=[];let W=[],q=0;return x.forEach((X,ne)=>{const ce=X.width/X.height,de=V*ce;W.push({...X,originalWidth:de,aspectRatio:ce}),q+=de;const f=(W.length-1)*N,F=q+f,D=ne===x.length-1;let E=!1;if(D)E=!0;else if(F>=g*.95)E=!0;else{const C=x[ne+1];if(C){const L=C.width/C.height,Z=V*L;q+Z+W.length*N>g*1.2&&(E=!0)}}if(E){const C=(W.length-1)*N;let Z=(g-C)/q;D&&W.length<3&&(Z=Math.min(Z,1.2));const ee=V*Z;W=W.map(U=>({...U,calculatedWidth:U.originalWidth*Z,calculatedHeight:ee})),j.push(W),W=[],q=0}}),j},[x,u,g]),K=N=>{const V=N.thumbnailPath;if(!e||!V)return"";const j=V.replace(/\\/g,"/").split("/").pop();return Le.getThumbnailUrl(e,j)},oe=N=>e?Le.getOriginalUrl(e,N.path):"",Q=G.useMemo(()=>x.map(N=>({src:oe(N),key:N.id})),[x,e]),Y=x.length>Ev,$=G.useCallback(N=>{if(!m||!m[N]||m[N].length===0)return u+40;const V=m[N][0];return((V==null?void 0:V.calculatedHeight)||u)+28+32},[m,u]),J=G.useRef(0);G.useEffect(()=>{if(d.current&&Y){const N=J.current,V=m.length;if(V>N&&N>0){const j=Math.max(0,N-1);d.current.resetAfterIndex(j)}else V!==N&&d.current.resetAfterIndex(0);J.current=V}},[m,Y]);const M=G.useMemo(()=>!m||m.length===0?[]:m.flat(),[m]),A=G.useCallback((N,V,j)=>{if(V.ctrlKey||V.metaKey)V.preventDefault(),o(N),P(j);else if(V.shiftKey&&I!==null){V.preventDefault();const W=Math.min(I,j),q=Math.max(I,j),X=M.slice(W,q+1);s(X)}else a(),n(N),P(j)},[M,I,o,s,a,n]),le=(N,V)=>{const j=(r==null?void 0:r.id)===N.id,W=i.some(X=>X.id===N.id),q=j||W;return k.jsxs("div",{className:"flex-shrink-0",style:{width:`${N.calculatedWidth}px`},children:[k.jsxs("div",{className:"relative group cursor-pointer overflow-hidden rounded-lg transition-all hover:shadow-lg",style:{height:`${N.calculatedHeight}px`,backgroundColor:"#2a2a2a",border:q?"3px solid #3b82f6":"3px solid transparent"},onClick:X=>A(N,X,V),onDoubleClick:()=>{(N.fileType||"image")==="image"?O(V):T(N)},children:[k.jsx("img",{src:K(N)||'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:N.filename,className:"w-full h-full object-cover",loading:"lazy",onError:X=>{X.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',X.target.onerror=null}}),N.fileType&&N.fileType!=="image"&&k.jsxs("div",{className:`absolute top-2 right-2 rounded-md px-2 py-1 flex items-center gap-1 shadow-lg ${N.fileType==="video"?"bg-blue-500 bg-opacity-90":N.fileType==="audio"?"bg-pink-500 bg-opacity-90":N.fileType==="document"?"bg-green-500 bg-opacity-90":N.fileType==="design"?"bg-purple-500 bg-opacity-90":"bg-gray-500 bg-opacity-90"}`,children:[N.fileType==="video"&&k.jsx(By,{className:"w-4 h-4 text-white fill-white"}),N.fileType==="audio"&&k.jsx(Dy,{className:"w-4 h-4 text-white"}),N.fileType==="document"&&k.jsx(Ly,{className:"w-4 h-4 text-white"}),N.fileType==="design"&&k.jsx(Fy,{className:"w-4 h-4 text-white"}),N.fileType==="other"&&k.jsx(Oy,{className:"w-4 h-4 text-white"}),k.jsx("span",{className:"text-white text-xs font-semibold uppercase",children:N.format||N.filename.split(".").pop()})]}),k.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-all pointer-events-none"})]}),k.jsx("div",{className:"mt-1 px-1",children:k.jsx("p",{className:"text-xs truncate text-center transition-colors",style:{color:q?"#3b82f6":"#909090",fontWeight:q?"600":"400"},children:N.filename})})]},N.id)},B=({index:N,style:V})=>{var q;const j=m[N];if(!j)return null;let W=0;for(let X=0;Xle(X,W+ne))})};return!x.length&&l.isLoading?k.jsx("div",{ref:c,className:"h-full overflow-hidden"}):x.length?!g&&x.length>0?k.jsx("div",{ref:c,className:"h-full overflow-hidden"}):k.jsxs("div",{ref:c,className:"h-full overflow-hidden",children:[k.jsx(dv,{images:Q,visible:z>=0,onClose:()=>O(-1),index:z,onIndexChange:O,children:Y?k.jsx(bv,{ref:d,height:b||600,width:g+32,itemCount:m.length,itemSize:$,className:"p-4",overscanCount:Is.overscanCount,onScroll:({scrollOffset:N,scrollDirection:V})=>{if(V==="forward"&&l.hasMore&&!l.isLoading){const j=m.reduce((q,X,ne)=>q+$(ne),0),W=N+(b||600);j-W{if(l.hasMore&&!l.isLoading){const{scrollTop:V,scrollHeight:j,clientHeight:W}=N.target;j-V-W{var W;let j=0;for(let q=0;qle(q,j+X))},V)})})})}),re&&k.jsx(Cv,{file:re,libraryId:e,onClose:()=>T(null)})]}):k.jsx("div",{ref:c,className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400",children:k.jsxs("div",{className:"text-center",children:[k.jsx("p",{className:"text-lg mb-2",children:"暂无图片"}),k.jsx("p",{className:"text-sm",children:"请添加素材库或调整搜索条件"})]})})}function Rv(){const{currentLibraryId:e,getCurrentLibrary:t}=rr(),{totalImageCount:r,folders:n}=_e(),i=t(),[s,o]=G.useState(0),a=n.length,l=n.filter(w=>!w.parentPath||w.parentPath==="."||w.parentPath==="");G.useEffect(()=>{e&&Le.getStats(e).then(w=>{o(w.totalSize||0)}).catch(w=>{console.error("Failed to fetch library stats:",w)})},[e,r]);const h=w=>{if(w===0)return"0 B";const y=1024,v=["B","KB","MB","GB","TB"],p=Math.floor(Math.log(w)/Math.log(y));return Math.round(w/Math.pow(y,p)*100)/100+" "+v[p]};return k.jsx("div",{className:"flex-1 h-full overflow-y-auto bg-gray-50 dark:bg-gray-900 p-8",children:k.jsxs("div",{className:"max-w-4xl mx-auto",children:[k.jsxs("div",{className:"mb-8",children:[k.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-2",children:(i==null?void 0:i.name)||"素材库"}),k.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:i==null?void 0:i.path})]}),k.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-12",children:[k.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700",children:k.jsxs("div",{className:"flex items-center gap-4",children:[k.jsx("div",{className:"p-3 bg-blue-100 dark:bg-blue-900/30 rounded-lg text-blue-600 dark:text-blue-400",children:k.jsx(My,{className:"w-6 h-6"})}),k.jsxs("div",{children:[k.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:r.toLocaleString()}),k.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"总图片数"})]})]})}),k.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700",children:k.jsxs("div",{className:"flex items-center gap-4",children:[k.jsx("div",{className:"p-3 bg-indigo-100 dark:bg-indigo-900/30 rounded-lg text-indigo-600 dark:text-indigo-400",children:k.jsx(Di,{className:"w-6 h-6"})}),k.jsxs("div",{children:[k.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.toLocaleString()}),k.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"文件夹"})]})]})}),k.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700",children:k.jsxs("div",{className:"flex items-center gap-4",children:[k.jsx("div",{className:"p-3 bg-purple-100 dark:bg-purple-900/30 rounded-lg text-purple-600 dark:text-purple-400",children:k.jsx(Py,{className:"w-6 h-6"})}),k.jsxs("div",{children:[k.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:h(s)}),k.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"素材库大小"})]})]})})]}),l.length>0&&k.jsxs("div",{children:[k.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white mb-4",children:"根目录文件夹"}),k.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:l.map(w=>k.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-sm border border-gray-100 dark:border-gray-700 hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>_e.getState().setSelectedFolder(w.path),children:[k.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[k.jsx(Di,{className:"w-8 h-8 text-yellow-500 group-hover:text-yellow-400 transition-colors"}),k.jsx("div",{className:"flex-1 min-w-0",children:k.jsx("div",{className:"font-medium text-gray-900 dark:text-white truncate",title:w.name,children:w.name})})]}),k.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[w.imageCount||0," 张图片"]})]},w.path))})]}),l.length===0&&k.jsxs("div",{className:"text-center py-12 bg-white dark:bg-gray-800 rounded-xl border border-dashed border-gray-300 dark:border-gray-700",children:[k.jsx(Di,{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mx-auto mb-4"}),k.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"暂无文件夹"}),k.jsx("p",{className:"text-gray-500 dark:text-gray-400 max-w-sm mx-auto",children:"您的素材库似乎是空的。请将图片添加到素材库目录中,系统会自动扫描。"})]})]})})}function yd(){const{currentLibraryId:e}=rr(),{searchKeywords:t,filters:r,selectedFolder:n,setImages:i,imageLoadingState:s,images:o}=_e(),{scanProgress:a}=cn(),l=G.useRef(null),h=G.useRef(null),w=()=>{if(!a||a.current===0)return null;if(a.estimatedTimeLeft!==void 0){const p=a.estimatedTimeLeft;return p<1?"即将完成":p<60?`剩余约 ${p} 秒`:`剩余约 ${Math.floor(p/60)} 分钟`}return null},y=G.useCallback(()=>{jt.cancelAll(rs.IMAGES),l.current=null},[]),v=G.useCallback(async(p=!0)=>{var u;if(!e)return;if(!n&&!t&&r.formats.length===0){i([]),_e.getState().setImageLoadingState({isLoading:!1,loadedCount:0,totalCount:0,hasMore:!1});return}p&&sd.clear(),Cl(),y();const x=jt.createRequest(rs.IMAGES);l.current=x,_e.getState().setImageLoadingState({...s,isLoading:!0});try{const _={offset:p?0:s.loadedCount,limit:100};n&&(_.folder=n),t&&(_.keywords=t),((u=r.formats)==null?void 0:u.length)>0&&(_.formats=r.formats.join(","));const c=await Le.search(e,_,{signal:x.signal}),{images:d,total:g,hasMore:S}=c;if(!jt.isValid(x.id))return;jt.complete(x.id),p&&i(d),_e.getState().setImageLoadingState({isLoading:!1,loadedCount:d.length,totalCount:g,hasMore:S||!1}),S&&Vy(S)}catch(_){if(_.name==="CanceledError"||_.name==="AbortError")return;console.error("Error loading images:",_),jt.error(x.id)}finally{(jt.isValid(x.id)||x.status==="completed")&&(l.current=null)}},[e,t,r,n,i,y]);return G.useEffect(()=>{if(e)return h.current&&clearTimeout(h.current),y(),i([]),_e.getState().setImageLoadingState({isLoading:!0,loadedCount:0,totalCount:0,hasMore:!1}),sd.clear(),h.current=setTimeout(()=>{v(!0)},50),()=>{h.current&&clearTimeout(h.current)}},[e,t,r,n,v,y,i]),G.useEffect(()=>()=>{y(),h.current&&clearTimeout(h.current),Sl.cancelPendingLoads(),Sl.removeAllEventListeners()},[y]),k.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-gray-900",children:[a&&k.jsxs("div",{className:"p-4 border-b bg-blue-50 dark:bg-blue-900 border-blue-200 dark:border-blue-700",children:[k.jsxs("div",{className:"flex items-center justify-between mb-2",children:[k.jsx("div",{className:"text-sm font-medium text-blue-700 dark:text-blue-300",children:(a==null?void 0:a.status)==="preparing"?"正在准备扫描...":"正在扫描素材库..."}),k.jsxs("span",{className:"text-sm text-blue-600 dark:text-blue-400",children:[(a==null?void 0:a.percent)||0,"%"]})]}),k.jsx("div",{className:"w-full rounded-full h-2 mb-2 bg-blue-200 dark:bg-blue-800",children:k.jsx("div",{className:"h-2 rounded-full transition-all bg-blue-500",style:{width:`${(a==null?void 0:a.percent)||0}%`}})}),k.jsxs("div",{className:"text-xs text-blue-600 dark:text-blue-400",children:["已处理 ",(a==null?void 0:a.current)||0," / ",(a==null?void 0:a.total)||0," 张图片",w()&&` · ${w()}`]})]}),s.totalCount>0&&k.jsx("div",{className:"px-4 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:k.jsxs("div",{className:"flex items-center justify-between text-sm",children:[k.jsxs("span",{className:"text-gray-600 dark:text-gray-400",children:["已加载 ",o.length," / ",s.totalCount," 张"]}),k.jsx("div",{className:"w-32 h-1.5 bg-gray-200 rounded-full overflow-hidden",children:k.jsx("div",{className:"h-full bg-blue-500",style:{width:`${s.totalCount?o.length/s.totalCount*100:0}%`}})})]})}),k.jsx("div",{className:"flex-1 overflow-hidden",children:!n&&!t&&r.formats.length===0?k.jsx(Rv,{}):k.jsx(Nv,{})})]})}function js(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 np={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(r){e.exports=r()})(function(){return function r(n,i,s){function o(h,w){if(!i[h]){if(!n[h]){var y=typeof js=="function"&&js;if(!w&&y)return y(h,!0);if(a)return a(h,!0);var v=new Error("Cannot find module '"+h+"'");throw v.code="MODULE_NOT_FOUND",v}var p=i[h]={exports:{}};n[h][0].call(p.exports,function(x){var u=n[h][1][x];return o(u||x)},p,p.exports,r,n,i,s)}return i[h].exports}for(var a=typeof js=="function"&&js,l=0;l>2,p=(3&h)<<4|w>>4,x=1>6:64,u=2>4,w=(15&v)<<4|(p=a.indexOf(l.charAt(u++)))>>2,y=(3&p)<<6|(x=a.indexOf(l.charAt(u++))),d[_++]=h,p!==64&&(d[_++]=w),x!==64&&(d[_++]=y);return d}},{"./support":30,"./utils":32}],2:[function(r,n,i){var s=r("./external"),o=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),l=r("./stream/DataLengthProbe");function h(w,y,v,p,x){this.compressedSize=w,this.uncompressedSize=y,this.crc32=v,this.compression=p,this.compressedContent=x}h.prototype={getContentWorker:function(){var w=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),y=this;return w.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),w},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},h.createWorkerFrom=function(w,y,v){return w.pipe(new a).pipe(new l("uncompressedSize")).pipe(y.compressWorker(v)).pipe(new l("compressedSize")).withStreamInfo("compression",y)},n.exports=h},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,i){var s=r("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,i){var s=r("./utils"),o=function(){for(var a,l=[],h=0;h<256;h++){a=h;for(var w=0;w<8;w++)a=1&a?3988292384^a>>>1:a>>>1;l[h]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(h,w,y,v){var p=o,x=v+y;h^=-1;for(var u=v;u>>8^p[255&(h^w[u])];return-1^h}(0|l,a,a.length,0):function(h,w,y,v){var p=o,x=v+y;h^=-1;for(var u=v;u>>8^p[255&(h^w.charCodeAt(u))];return-1^h}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(r,n,i){var s=null;s=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:s}},{lie:37}],7:[function(r,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),a=r("./utils"),l=r("./stream/GenericWorker"),h=s?"uint8array":"array";function w(y,v){l.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=v,this.meta={}}i.magic="\b\0",a.inherits(w,l),w.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(h,y.data),!1)},w.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},w.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},w.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(v){y.push({data:v,meta:y.meta})}},i.compressWorker=function(y){return new w("Deflate",y)},i.uncompressWorker=function(){return new w("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,i){function s(p,x){var u,_="";for(u=0;u>>=8;return _}function o(p,x,u,_,c,d){var g,S,b=p.file,R=p.compression,z=d!==h.utf8encode,O=a.transformTo("string",d(b.name)),I=a.transformTo("string",h.utf8encode(b.name)),P=b.comment,re=a.transformTo("string",d(P)),T=a.transformTo("string",h.utf8encode(P)),H=I.length!==b.name.length,m=T.length!==P.length,K="",oe="",Q="",Y=b.dir,$=b.date,J={crc32:0,compressedSize:0,uncompressedSize:0};x&&!u||(J.crc32=p.crc32,J.compressedSize=p.compressedSize,J.uncompressedSize=p.uncompressedSize);var M=0;x&&(M|=8),z||!H&&!m||(M|=2048);var A=0,le=0;Y&&(A|=16),c==="UNIX"?(le=798,A|=function(N,V){var j=N;return N||(j=V?16893:33204),(65535&j)<<16}(b.unixPermissions,Y)):(le=20,A|=function(N){return 63&(N||0)}(b.dosPermissions)),g=$.getUTCHours(),g<<=6,g|=$.getUTCMinutes(),g<<=5,g|=$.getUTCSeconds()/2,S=$.getUTCFullYear()-1980,S<<=4,S|=$.getUTCMonth()+1,S<<=5,S|=$.getUTCDate(),H&&(oe=s(1,1)+s(w(O),4)+I,K+="up"+s(oe.length,2)+oe),m&&(Q=s(1,1)+s(w(re),4)+T,K+="uc"+s(Q.length,2)+Q);var B="";return B+=` -\0`,B+=s(M,2),B+=R.magic,B+=s(g,2),B+=s(S,2),B+=s(J.crc32,4),B+=s(J.compressedSize,4),B+=s(J.uncompressedSize,4),B+=s(O.length,2),B+=s(K.length,2),{fileRecord:y.LOCAL_FILE_HEADER+B+O+K,dirRecord:y.CENTRAL_FILE_HEADER+s(le,2)+B+s(re.length,2)+"\0\0\0\0"+s(A,4)+s(_,4)+O+K+re}}var a=r("../utils"),l=r("../stream/GenericWorker"),h=r("../utf8"),w=r("../crc32"),y=r("../signature");function v(p,x,u,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=u,this.encodeFileName=_,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(v,l),v.prototype.push=function(p){var x=p.meta.percent||0,u=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:u?(x+100*(u-_-1))/u:100}}))},v.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var x=this.streamFiles&&!p.file.dir;if(x){var u=o(p,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:u.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(p){this.accumulate=!1;var x=this.streamFiles&&!p.file.dir,u=o(p,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(u.dirRecord),x)this.push({data:function(_){return y.DATA_DESCRIPTOR+s(_.crc32,4)+s(_.compressedSize,4)+s(_.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:u.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var p=this.bytesWritten,x=0;x=this.index;l--)h=(h<<8)+this.byteAt(l);return this.index+=a,h},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,i){var s=r("./Uint8ArrayReader");function o(a){s.call(this,a)}r("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,i){var s=r("./DataReader");function o(a){s.call(this,a)}r("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,i){var s=r("./ArrayReader");function o(a){s.call(this,a)}r("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,i){var s=r("../utils"),o=r("../support"),a=r("./ArrayReader"),l=r("./StringReader"),h=r("./NodeBufferReader"),w=r("./Uint8ArrayReader");n.exports=function(y){var v=s.getTypeOf(y);return s.checkSupport(v),v!=="string"||o.uint8array?v==="nodebuffer"?new h(y):o.uint8array?new w(s.transformTo("uint8array",y)):new a(s.transformTo("array",y)):new l(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,i){var s=r("./GenericWorker"),o=r("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,i){var s=r("./GenericWorker"),o=r("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,i){var s=r("../utils"),o=r("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+l.data.length}o.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,i){var s=r("../utils"),o=r("./GenericWorker");function a(l){o.call(this,"DataWorker");var h=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(w){h.dataIsReady=!0,h.data=w,h.max=w&&w.length||0,h.type=s.getTypeOf(w),h.isPaused||h._tickAndRepeat()},function(w){h.error(w)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,h=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,h);break;case"uint8array":l=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":l=this.data.slice(this.index,h)}return this.index=h,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,i){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},n.exports=s},{}],29:[function(r,n,i){var s=r("../utils"),o=r("./ConvertWorker"),a=r("./GenericWorker"),l=r("../base64"),h=r("../support"),w=r("../external"),y=null;if(h.nodestream)try{y=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(x,u){return new w.Promise(function(_,c){var d=[],g=x._internalType,S=x._outputType,b=x._mimeType;x.on("data",function(R,z){d.push(R),u&&u(z)}).on("error",function(R){d=[],c(R)}).on("end",function(){try{var R=function(z,O,I){switch(z){case"blob":return s.newBlob(s.transformTo("arraybuffer",O),I);case"base64":return l.encode(O);default:return s.transformTo(z,O)}}(S,function(z,O){var I,P=0,re=null,T=0;for(I=0;I"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!r("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,i){for(var s=r("./utils"),o=r("./support"),a=r("./nodejsUtils"),l=r("./stream/GenericWorker"),h=new Array(256),w=0;w<256;w++)h[w]=252<=w?6:248<=w?5:240<=w?4:224<=w?3:192<=w?2:1;h[254]=h[254]=1;function y(){l.call(this,"utf-8 decode"),this.leftOver=null}function v(){l.call(this,"utf-8 encode")}i.utf8encode=function(p){return o.nodebuffer?a.newBufferFrom(p,"utf-8"):function(x){var u,_,c,d,g,S=x.length,b=0;for(d=0;d>>6:(_<65536?u[g++]=224|_>>>12:(u[g++]=240|_>>>18,u[g++]=128|_>>>12&63),u[g++]=128|_>>>6&63),u[g++]=128|63&_);return u}(p)},i.utf8decode=function(p){return o.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):function(x){var u,_,c,d,g=x.length,S=new Array(2*g);for(u=_=0;u>10&1023,S[_++]=56320|1023&c)}return S.length!==_&&(S.subarray?S=S.subarray(0,_):S.length=_),s.applyFromCharCode(S)}(p=s.transformTo(o.uint8array?"uint8array":"array",p))},s.inherits(y,l),y.prototype.processChunk=function(p){var x=s.transformTo(o.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var u=x;(x=new Uint8Array(u.length+this.leftOver.length)).set(this.leftOver,0),x.set(u,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(d,g){var S;for((g=g||d.length)>d.length&&(g=d.length),S=g-1;0<=S&&(192&d[S])==128;)S--;return S<0||S===0?g:S+h[d[S]]>g?S:g}(x),c=x;_!==x.length&&(o.uint8array?(c=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(c=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:i.utf8decode(c),meta:p.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=y,s.inherits(v,l),v.prototype.processChunk=function(p){this.push({data:i.utf8encode(p.data),meta:p.meta})},i.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,i){var s=r("./support"),o=r("./base64"),a=r("./nodejsUtils"),l=r("./external");function h(u){return u}function w(u,_){for(var c=0;c>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var x,u,_,c=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4>>6:(p<65536?v[_++]=224|p>>>12:(v[_++]=240|p>>>18,v[_++]=128|p>>>12&63),v[_++]=128|p>>>6&63),v[_++]=128|63&p);return v},i.buf2binstring=function(y){return w(y,y.length)},i.binstring2buf=function(y){for(var v=new s.Buf8(y.length),p=0,x=v.length;p>10&1023,d[x++]=56320|1023&u)}return w(d,x)},i.utf8border=function(y,v){var p;for((v=v||y.length)>y.length&&(v=y.length),p=v-1;0<=p&&(192&y[p])==128;)p--;return p<0||p===0?v:p+l[y[p]]>v?p:v}},{"./common":41}],43:[function(r,n,i){n.exports=function(s,o,a,l){for(var h=65535&s|0,w=s>>>16&65535|0,y=0;a!==0;){for(a-=y=2e3>>1:o>>>1;a[l]=o}return a}();n.exports=function(o,a,l,h){var w=s,y=h+l;o^=-1;for(var v=h;v>>8^w[255&(o^a[v])];return-1^o}},{}],46:[function(r,n,i){var s,o=r("../utils/common"),a=r("./trees"),l=r("./adler32"),h=r("./crc32"),w=r("./messages"),y=0,v=4,p=0,x=-2,u=-1,_=4,c=2,d=8,g=9,S=286,b=30,R=19,z=2*S+1,O=15,I=3,P=258,re=P+I+1,T=42,H=113,m=1,K=2,oe=3,Q=4;function Y(f,F){return f.msg=w[F],F}function $(f){return(f<<1)-(4f.avail_out&&(D=f.avail_out),D!==0&&(o.arraySet(f.output,F.pending_buf,F.pending_out,D,f.next_out),f.next_out+=D,F.pending_out+=D,f.total_out+=D,f.avail_out-=D,F.pending-=D,F.pending===0&&(F.pending_out=0))}function A(f,F){a._tr_flush_block(f,0<=f.block_start?f.block_start:-1,f.strstart-f.block_start,F),f.block_start=f.strstart,M(f.strm)}function le(f,F){f.pending_buf[f.pending++]=F}function B(f,F){f.pending_buf[f.pending++]=F>>>8&255,f.pending_buf[f.pending++]=255&F}function N(f,F){var D,E,C=f.max_chain_length,L=f.strstart,Z=f.prev_length,ee=f.nice_match,U=f.strstart>f.w_size-re?f.strstart-(f.w_size-re):0,ie=f.window,ue=f.w_mask,ae=f.prev,he=f.strstart+P,ve=ie[L+Z-1],me=ie[L+Z];f.prev_length>=f.good_match&&(C>>=2),ee>f.lookahead&&(ee=f.lookahead);do if(ie[(D=F)+Z]===me&&ie[D+Z-1]===ve&&ie[D]===ie[L]&&ie[++D]===ie[L+1]){L+=2,D++;do;while(ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&ie[++L]===ie[++D]&&LU&&--C!=0);return Z<=f.lookahead?Z:f.lookahead}function V(f){var F,D,E,C,L,Z,ee,U,ie,ue,ae=f.w_size;do{if(C=f.window_size-f.lookahead-f.strstart,f.strstart>=ae+(ae-re)){for(o.arraySet(f.window,f.window,ae,ae,0),f.match_start-=ae,f.strstart-=ae,f.block_start-=ae,F=D=f.hash_size;E=f.head[--F],f.head[F]=ae<=E?E-ae:0,--D;);for(F=D=ae;E=f.prev[--F],f.prev[F]=ae<=E?E-ae:0,--D;);C+=ae}if(f.strm.avail_in===0)break;if(Z=f.strm,ee=f.window,U=f.strstart+f.lookahead,ie=C,ue=void 0,ue=Z.avail_in,ie=I)for(L=f.strstart-f.insert,f.ins_h=f.window[L],f.ins_h=(f.ins_h<=I&&(f.ins_h=(f.ins_h<=I)if(E=a._tr_tally(f,f.strstart-f.match_start,f.match_length-I),f.lookahead-=f.match_length,f.match_length<=f.max_lazy_match&&f.lookahead>=I){for(f.match_length--;f.strstart++,f.ins_h=(f.ins_h<=I&&(f.ins_h=(f.ins_h<=I&&f.match_length<=f.prev_length){for(C=f.strstart+f.lookahead-I,E=a._tr_tally(f,f.strstart-1-f.prev_match,f.prev_length-I),f.lookahead-=f.prev_length-1,f.prev_length-=2;++f.strstart<=C&&(f.ins_h=(f.ins_h<f.pending_buf_size-5&&(D=f.pending_buf_size-5);;){if(f.lookahead<=1){if(V(f),f.lookahead===0&&F===y)return m;if(f.lookahead===0)break}f.strstart+=f.lookahead,f.lookahead=0;var E=f.block_start+D;if((f.strstart===0||f.strstart>=E)&&(f.lookahead=f.strstart-E,f.strstart=E,A(f,!1),f.strm.avail_out===0)||f.strstart-f.block_start>=f.w_size-re&&(A(f,!1),f.strm.avail_out===0))return m}return f.insert=0,F===v?(A(f,!0),f.strm.avail_out===0?oe:Q):(f.strstart>f.block_start&&(A(f,!1),f.strm.avail_out),m)}),new q(4,4,8,4,j),new q(4,5,16,8,j),new q(4,6,32,32,j),new q(4,4,16,16,W),new q(8,16,32,32,W),new q(8,16,128,128,W),new q(8,32,128,256,W),new q(32,128,258,1024,W),new q(32,258,258,4096,W)],i.deflateInit=function(f,F){return de(f,F,d,15,8,0)},i.deflateInit2=de,i.deflateReset=ce,i.deflateResetKeep=ne,i.deflateSetHeader=function(f,F){return f&&f.state?f.state.wrap!==2?x:(f.state.gzhead=F,p):x},i.deflate=function(f,F){var D,E,C,L;if(!f||!f.state||5>8&255),le(E,E.gzhead.time>>16&255),le(E,E.gzhead.time>>24&255),le(E,E.level===9?2:2<=E.strategy||E.level<2?4:0),le(E,255&E.gzhead.os),E.gzhead.extra&&E.gzhead.extra.length&&(le(E,255&E.gzhead.extra.length),le(E,E.gzhead.extra.length>>8&255)),E.gzhead.hcrc&&(f.adler=h(f.adler,E.pending_buf,E.pending,0)),E.gzindex=0,E.status=69):(le(E,0),le(E,0),le(E,0),le(E,0),le(E,0),le(E,E.level===9?2:2<=E.strategy||E.level<2?4:0),le(E,3),E.status=H);else{var Z=d+(E.w_bits-8<<4)<<8;Z|=(2<=E.strategy||E.level<2?0:E.level<6?1:E.level===6?2:3)<<6,E.strstart!==0&&(Z|=32),Z+=31-Z%31,E.status=H,B(E,Z),E.strstart!==0&&(B(E,f.adler>>>16),B(E,65535&f.adler)),f.adler=1}if(E.status===69)if(E.gzhead.extra){for(C=E.pending;E.gzindex<(65535&E.gzhead.extra.length)&&(E.pending!==E.pending_buf_size||(E.gzhead.hcrc&&E.pending>C&&(f.adler=h(f.adler,E.pending_buf,E.pending-C,C)),M(f),C=E.pending,E.pending!==E.pending_buf_size));)le(E,255&E.gzhead.extra[E.gzindex]),E.gzindex++;E.gzhead.hcrc&&E.pending>C&&(f.adler=h(f.adler,E.pending_buf,E.pending-C,C)),E.gzindex===E.gzhead.extra.length&&(E.gzindex=0,E.status=73)}else E.status=73;if(E.status===73)if(E.gzhead.name){C=E.pending;do{if(E.pending===E.pending_buf_size&&(E.gzhead.hcrc&&E.pending>C&&(f.adler=h(f.adler,E.pending_buf,E.pending-C,C)),M(f),C=E.pending,E.pending===E.pending_buf_size)){L=1;break}L=E.gzindexC&&(f.adler=h(f.adler,E.pending_buf,E.pending-C,C)),L===0&&(E.gzindex=0,E.status=91)}else E.status=91;if(E.status===91)if(E.gzhead.comment){C=E.pending;do{if(E.pending===E.pending_buf_size&&(E.gzhead.hcrc&&E.pending>C&&(f.adler=h(f.adler,E.pending_buf,E.pending-C,C)),M(f),C=E.pending,E.pending===E.pending_buf_size)){L=1;break}L=E.gzindexC&&(f.adler=h(f.adler,E.pending_buf,E.pending-C,C)),L===0&&(E.status=103)}else E.status=103;if(E.status===103&&(E.gzhead.hcrc?(E.pending+2>E.pending_buf_size&&M(f),E.pending+2<=E.pending_buf_size&&(le(E,255&f.adler),le(E,f.adler>>8&255),f.adler=0,E.status=H)):E.status=H),E.pending!==0){if(M(f),f.avail_out===0)return E.last_flush=-1,p}else if(f.avail_in===0&&$(F)<=$(D)&&F!==v)return Y(f,-5);if(E.status===666&&f.avail_in!==0)return Y(f,-5);if(f.avail_in!==0||E.lookahead!==0||F!==y&&E.status!==666){var ee=E.strategy===2?function(U,ie){for(var ue;;){if(U.lookahead===0&&(V(U),U.lookahead===0)){if(ie===y)return m;break}if(U.match_length=0,ue=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,ue&&(A(U,!1),U.strm.avail_out===0))return m}return U.insert=0,ie===v?(A(U,!0),U.strm.avail_out===0?oe:Q):U.last_lit&&(A(U,!1),U.strm.avail_out===0)?m:K}(E,F):E.strategy===3?function(U,ie){for(var ue,ae,he,ve,me=U.window;;){if(U.lookahead<=P){if(V(U),U.lookahead<=P&&ie===y)return m;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=I&&0U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=I?(ue=a._tr_tally(U,1,U.match_length-I),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(ue=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),ue&&(A(U,!1),U.strm.avail_out===0))return m}return U.insert=0,ie===v?(A(U,!0),U.strm.avail_out===0?oe:Q):U.last_lit&&(A(U,!1),U.strm.avail_out===0)?m:K}(E,F):s[E.level].func(E,F);if(ee!==oe&&ee!==Q||(E.status=666),ee===m||ee===oe)return f.avail_out===0&&(E.last_flush=-1),p;if(ee===K&&(F===1?a._tr_align(E):F!==5&&(a._tr_stored_block(E,0,0,!1),F===3&&(J(E.head),E.lookahead===0&&(E.strstart=0,E.block_start=0,E.insert=0))),M(f),f.avail_out===0))return E.last_flush=-1,p}return F!==v?p:E.wrap<=0?1:(E.wrap===2?(le(E,255&f.adler),le(E,f.adler>>8&255),le(E,f.adler>>16&255),le(E,f.adler>>24&255),le(E,255&f.total_in),le(E,f.total_in>>8&255),le(E,f.total_in>>16&255),le(E,f.total_in>>24&255)):(B(E,f.adler>>>16),B(E,65535&f.adler)),M(f),0=D.w_size&&(L===0&&(J(D.head),D.strstart=0,D.block_start=0,D.insert=0),ie=new o.Buf8(D.w_size),o.arraySet(ie,F,ue-D.w_size,D.w_size,0),F=ie,ue=D.w_size),Z=f.avail_in,ee=f.next_in,U=f.input,f.avail_in=ue,f.next_in=0,f.input=F,V(D);D.lookahead>=I;){for(E=D.strstart,C=D.lookahead-(I-1);D.ins_h=(D.ins_h<>>=I=O>>>24,g-=I,(I=O>>>16&255)===0)K[w++]=65535&O;else{if(!(16&I)){if(!(64&I)){O=S[(65535&O)+(d&(1<>>=I,g-=I),g<15&&(d+=m[l++]<>>=I=O>>>24,g-=I,!(16&(I=O>>>16&255))){if(!(64&I)){O=b[(65535&O)+(d&(1<>>=I,g-=I,(I=w-y)>3,d&=(1<<(g-=P<<3))-1,s.next_in=l,s.next_out=w,s.avail_in=l>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function d(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(T){var H;return T&&T.state?(H=T.state,T.total_in=T.total_out=H.total=0,T.msg="",H.wrap&&(T.adler=1&H.wrap),H.mode=x,H.last=0,H.havedict=0,H.dmax=32768,H.head=null,H.hold=0,H.bits=0,H.lencode=H.lendyn=new s.Buf32(u),H.distcode=H.distdyn=new s.Buf32(_),H.sane=1,H.back=-1,v):p}function S(T){var H;return T&&T.state?((H=T.state).wsize=0,H.whave=0,H.wnext=0,g(T)):p}function b(T,H){var m,K;return T&&T.state?(K=T.state,H<0?(m=0,H=-H):(m=1+(H>>4),H<48&&(H&=15)),H&&(H<8||15=Q.wsize?(s.arraySet(Q.window,H,m-Q.wsize,Q.wsize,0),Q.wnext=0,Q.whave=Q.wsize):(K<(oe=Q.wsize-Q.wnext)&&(oe=K),s.arraySet(Q.window,H,m-K,oe,Q.wnext),(K-=oe)?(s.arraySet(Q.window,H,m-K,K,0),Q.wnext=K,Q.whave=Q.wsize):(Q.wnext+=oe,Q.wnext===Q.wsize&&(Q.wnext=0),Q.whave>>8&255,m.check=a(m.check,L,2,0),A=M=0,m.mode=2;break}if(m.flags=0,m.head&&(m.head.done=!1),!(1&m.wrap)||(((255&M)<<8)+(M>>8))%31){T.msg="incorrect header check",m.mode=30;break}if((15&M)!=8){T.msg="unknown compression method",m.mode=30;break}if(A-=4,f=8+(15&(M>>>=4)),m.wbits===0)m.wbits=f;else if(f>m.wbits){T.msg="invalid window size",m.mode=30;break}m.dmax=1<>8&1),512&m.flags&&(L[0]=255&M,L[1]=M>>>8&255,m.check=a(m.check,L,2,0)),A=M=0,m.mode=3;case 3:for(;A<32;){if($===0)break e;$--,M+=K[Q++]<>>8&255,L[2]=M>>>16&255,L[3]=M>>>24&255,m.check=a(m.check,L,4,0)),A=M=0,m.mode=4;case 4:for(;A<16;){if($===0)break e;$--,M+=K[Q++]<>8),512&m.flags&&(L[0]=255&M,L[1]=M>>>8&255,m.check=a(m.check,L,2,0)),A=M=0,m.mode=5;case 5:if(1024&m.flags){for(;A<16;){if($===0)break e;$--,M+=K[Q++]<>>8&255,m.check=a(m.check,L,2,0)),A=M=0}else m.head&&(m.head.extra=null);m.mode=6;case 6:if(1024&m.flags&&($<(N=m.length)&&(N=$),N&&(m.head&&(f=m.head.extra_len-m.length,m.head.extra||(m.head.extra=new Array(m.head.extra_len)),s.arraySet(m.head.extra,K,Q,N,f)),512&m.flags&&(m.check=a(m.check,K,N,Q)),$-=N,Q+=N,m.length-=N),m.length))break e;m.length=0,m.mode=7;case 7:if(2048&m.flags){if($===0)break e;for(N=0;f=K[Q+N++],m.head&&f&&m.length<65536&&(m.head.name+=String.fromCharCode(f)),f&&N<$;);if(512&m.flags&&(m.check=a(m.check,K,N,Q)),$-=N,Q+=N,f)break e}else m.head&&(m.head.name=null);m.length=0,m.mode=8;case 8:if(4096&m.flags){if($===0)break e;for(N=0;f=K[Q+N++],m.head&&f&&m.length<65536&&(m.head.comment+=String.fromCharCode(f)),f&&N<$;);if(512&m.flags&&(m.check=a(m.check,K,N,Q)),$-=N,Q+=N,f)break e}else m.head&&(m.head.comment=null);m.mode=9;case 9:if(512&m.flags){for(;A<16;){if($===0)break e;$--,M+=K[Q++]<>9&1,m.head.done=!0),T.adler=m.check=0,m.mode=12;break;case 10:for(;A<32;){if($===0)break e;$--,M+=K[Q++]<>>=7&A,A-=7&A,m.mode=27;break}for(;A<3;){if($===0)break e;$--,M+=K[Q++]<>>=1)){case 0:m.mode=14;break;case 1:if(P(m),m.mode=20,H!==6)break;M>>>=2,A-=2;break e;case 2:m.mode=17;break;case 3:T.msg="invalid block type",m.mode=30}M>>>=2,A-=2;break;case 14:for(M>>>=7&A,A-=7&A;A<32;){if($===0)break e;$--,M+=K[Q++]<>>16^65535)){T.msg="invalid stored block lengths",m.mode=30;break}if(m.length=65535&M,A=M=0,m.mode=15,H===6)break e;case 15:m.mode=16;case 16:if(N=m.length){if($>>=5,A-=5,m.ndist=1+(31&M),M>>>=5,A-=5,m.ncode=4+(15&M),M>>>=4,A-=4,286>>=3,A-=3}for(;m.have<19;)m.lens[Z[m.have++]]=0;if(m.lencode=m.lendyn,m.lenbits=7,D={bits:m.lenbits},F=h(0,m.lens,0,19,m.lencode,0,m.work,D),m.lenbits=D.bits,F){T.msg="invalid code lengths set",m.mode=30;break}m.have=0,m.mode=19;case 19:for(;m.have>>16&255,X=65535&C,!((W=C>>>24)<=A);){if($===0)break e;$--,M+=K[Q++]<>>=W,A-=W,m.lens[m.have++]=X;else{if(X===16){for(E=W+2;A>>=W,A-=W,m.have===0){T.msg="invalid bit length repeat",m.mode=30;break}f=m.lens[m.have-1],N=3+(3&M),M>>>=2,A-=2}else if(X===17){for(E=W+3;A>>=W)),M>>>=3,A-=3}else{for(E=W+7;A>>=W)),M>>>=7,A-=7}if(m.have+N>m.nlen+m.ndist){T.msg="invalid bit length repeat",m.mode=30;break}for(;N--;)m.lens[m.have++]=f}}if(m.mode===30)break;if(m.lens[256]===0){T.msg="invalid code -- missing end-of-block",m.mode=30;break}if(m.lenbits=9,D={bits:m.lenbits},F=h(w,m.lens,0,m.nlen,m.lencode,0,m.work,D),m.lenbits=D.bits,F){T.msg="invalid literal/lengths set",m.mode=30;break}if(m.distbits=6,m.distcode=m.distdyn,D={bits:m.distbits},F=h(y,m.lens,m.nlen,m.ndist,m.distcode,0,m.work,D),m.distbits=D.bits,F){T.msg="invalid distances set",m.mode=30;break}if(m.mode=20,H===6)break e;case 20:m.mode=21;case 21:if(6<=$&&258<=J){T.next_out=Y,T.avail_out=J,T.next_in=Q,T.avail_in=$,m.hold=M,m.bits=A,l(T,B),Y=T.next_out,oe=T.output,J=T.avail_out,Q=T.next_in,K=T.input,$=T.avail_in,M=m.hold,A=m.bits,m.mode===12&&(m.back=-1);break}for(m.back=0;q=(C=m.lencode[M&(1<>>16&255,X=65535&C,!((W=C>>>24)<=A);){if($===0)break e;$--,M+=K[Q++]<>ne)])>>>16&255,X=65535&C,!(ne+(W=C>>>24)<=A);){if($===0)break e;$--,M+=K[Q++]<>>=ne,A-=ne,m.back+=ne}if(M>>>=W,A-=W,m.back+=W,m.length=X,q===0){m.mode=26;break}if(32&q){m.back=-1,m.mode=12;break}if(64&q){T.msg="invalid literal/length code",m.mode=30;break}m.extra=15&q,m.mode=22;case 22:if(m.extra){for(E=m.extra;A>>=m.extra,A-=m.extra,m.back+=m.extra}m.was=m.length,m.mode=23;case 23:for(;q=(C=m.distcode[M&(1<>>16&255,X=65535&C,!((W=C>>>24)<=A);){if($===0)break e;$--,M+=K[Q++]<>ne)])>>>16&255,X=65535&C,!(ne+(W=C>>>24)<=A);){if($===0)break e;$--,M+=K[Q++]<>>=ne,A-=ne,m.back+=ne}if(M>>>=W,A-=W,m.back+=W,64&q){T.msg="invalid distance code",m.mode=30;break}m.offset=X,m.extra=15&q,m.mode=24;case 24:if(m.extra){for(E=m.extra;A>>=m.extra,A-=m.extra,m.back+=m.extra}if(m.offset>m.dmax){T.msg="invalid distance too far back",m.mode=30;break}m.mode=25;case 25:if(J===0)break e;if(N=B-J,m.offset>N){if((N=m.offset-N)>m.whave&&m.sane){T.msg="invalid distance too far back",m.mode=30;break}V=N>m.wnext?(N-=m.wnext,m.wsize-N):m.wnext-N,N>m.length&&(N=m.length),j=m.window}else j=oe,V=Y-m.offset,N=m.length;for(Jz?(I=V[j+_[H]],A[le+_[H]]):(I=96,0),d=1<>Y)+(g-=d)]=O<<24|I<<16|P|0,g!==0;);for(d=1<>=1;if(d!==0?(M&=d-1,M+=d):M=0,H++,--B[T]==0){if(T===K)break;T=y[v+_[H]]}if(oe>>7)]}function le(C,L){C.pending_buf[C.pending++]=255&L,C.pending_buf[C.pending++]=L>>>8&255}function B(C,L,Z){C.bi_valid>c-Z?(C.bi_buf|=L<>c-C.bi_valid,C.bi_valid+=Z-c):(C.bi_buf|=L<>>=1,Z<<=1,0<--L;);return Z>>>1}function j(C,L,Z){var ee,U,ie=new Array(_+1),ue=0;for(ee=1;ee<=_;ee++)ie[ee]=ue=ue+Z[ee-1]<<1;for(U=0;U<=L;U++){var ae=C[2*U+1];ae!==0&&(C[2*U]=V(ie[ae]++,ae))}}function W(C){var L;for(L=0;L>1;1<=Z;Z--)ne(C,ie,Z);for(U=he;Z=C.heap[1],C.heap[1]=C.heap[C.heap_len--],ne(C,ie,1),ee=C.heap[1],C.heap[--C.heap_max]=Z,C.heap[--C.heap_max]=ee,ie[2*U]=ie[2*Z]+ie[2*ee],C.depth[U]=(C.depth[Z]>=C.depth[ee]?C.depth[Z]:C.depth[ee])+1,ie[2*Z+1]=ie[2*ee+1]=U,C.heap[1]=U++,ne(C,ie,1),2<=C.heap_len;);C.heap[--C.heap_max]=C.heap[1],function(me,Ve){var Kt,nt,Yt,xe,ar,Zt,Ge=Ve.dyn_tree,Tr=Ve.max_code,bn=Ve.stat_desc.static_tree,bt=Ve.stat_desc.has_stree,ge=Ve.stat_desc.extra_bits,Ee=Ve.stat_desc.extra_base,Te=Ve.stat_desc.max_length,ze=0;for(xe=0;xe<=_;xe++)me.bl_count[xe]=0;for(Ge[2*me.heap[me.heap_max]+1]=0,Kt=me.heap_max+1;Kt>=7;U>>=1)if(1&ve&&ae.dyn_ltree[2*he]!==0)return o;if(ae.dyn_ltree[18]!==0||ae.dyn_ltree[20]!==0||ae.dyn_ltree[26]!==0)return a;for(he=32;he>>3,(ie=C.static_len+3+7>>>3)<=U&&(U=ie)):U=ie=Z+5,Z+4<=U&&L!==-1?E(C,L,Z,ee):C.strategy===4||ie===U?(B(C,2+(ee?1:0),3),ce(C,re,T)):(B(C,4+(ee?1:0),3),function(ae,he,ve,me){var Ve;for(B(ae,he-257,5),B(ae,ve-1,5),B(ae,me-4,4),Ve=0;Ve>>8&255,C.pending_buf[C.d_buf+2*C.last_lit+1]=255&L,C.pending_buf[C.l_buf+C.last_lit]=255&Z,C.last_lit++,L===0?C.dyn_ltree[2*Z]++:(C.matches++,L--,C.dyn_ltree[2*(m[Z]+y+1)]++,C.dyn_dtree[2*A(L)]++),C.last_lit===C.lit_bufsize-1},i._tr_align=function(C){B(C,2,3),N(C,g,re),function(L){L.bi_valid===16?(le(L,L.bi_buf),L.bi_buf=0,L.bi_valid=0):8<=L.bi_valid&&(L.pending_buf[L.pending++]=255&L.bi_buf,L.bi_buf>>=8,L.bi_valid-=8)}(C)}},{"../utils/common":41}],53:[function(r,n,i){n.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(r,n,i){(function(s){(function(o,a){if(!o.setImmediate){var l,h,w,y,v=1,p={},x=!1,u=o.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(o);_=_&&_.setTimeout?_:o,l={}.toString.call(o.process)==="[object process]"?function(S){process.nextTick(function(){d(S)})}:function(){if(o.postMessage&&!o.importScripts){var S=!0,b=o.onmessage;return o.onmessage=function(){S=!1},o.postMessage("","*"),o.onmessage=b,S}}()?(y="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",g,!1):o.attachEvent("onmessage",g),function(S){o.postMessage(y+S,"*")}):o.MessageChannel?((w=new MessageChannel).port1.onmessage=function(S){d(S.data)},function(S){w.port2.postMessage(S)}):u&&"onreadystatechange"in u.createElement("script")?(h=u.documentElement,function(S){var b=u.createElement("script");b.onreadystatechange=function(){d(S),b.onreadystatechange=null,h.removeChild(b),b=null},h.appendChild(b)}):function(S){setTimeout(d,0,S)},_.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var b=new Array(arguments.length-1),R=0;R"u"?s===void 0?this:s:self)}).call(this,typeof us<"u"?us:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(np);var Tv=np.exports;const vd=Il(Tv);function wd(){const{currentLibraryId:e}=rr(),{selectedImage:t,selectedImages:r,selectedFolder:n,images:i}=_e(),{setMobileView:s,isResizingPanels:o,resizingSide:a}=yt(),[l,h]=G.useState(!1),[w,y]=G.useState(""),[v,p]=G.useState(!1),[x,u]=G.useState(!1),[_,c]=G.useState(!1),[d,g]=G.useState(0),[S,b]=G.useState(!1),[R,z]=G.useState(0),O=r.length>0?t&&!r.some(N=>N.id===t.id)?r.length+1:r.length:t?1:0,I=O>1,P=r.length>0?r[0]:t;if(G.useEffect(()=>{const N=()=>{h(window.innerWidth<768)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),G.useEffect(()=>{if(!t||!e){y("");return}const N=re();if(y(N),p(!0),o){p(!1);return}const V=T(),j=new Image;return j.onload=()=>{y(V),p(!1)},j.onerror=()=>{console.error("Failed to load original image"),p(!1)},j.src=V,()=>{j.onload=null,j.onerror=null}},[t,e,o,a]),!t&&r.length===0)return k.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:k.jsx("p",{className:"text-gray-400 dark:text-gray-500 text-sm",children:"选择图片查看详情"})});const re=()=>{if(!e||!(t!=null&&t.thumbnail_path))return"";const N=t.thumbnail_path.replace(/\\/g,"/").split("/").pop();return Le.getThumbnailUrl(e,N)},T=()=>!e||!(t!=null&&t.path)?"":Le.getOriginalUrl(e,t.path),H=()=>typeof ClipboardItem<"u"&&navigator.clipboard&&typeof navigator.clipboard.write=="function",m=async N=>new Promise(V=>{const j=document.createElement("div");j.setAttribute("contenteditable","true"),j.style.position="fixed",j.style.left="-9999px",j.style.top="-9999px",j.style.opacity="0",document.body.appendChild(j);const W=document.createElement("img");W.crossOrigin="anonymous",W.onload=()=>{j.appendChild(W);const q=document.createRange();q.selectNodeContents(j);const X=window.getSelection();X.removeAllRanges(),X.addRange(q);let ne=!1;try{ne=document.execCommand("copy")}catch(ce){console.error("execCommand copy 失败:",ce)}X.removeAllRanges(),document.body.removeChild(j),V(ne)},W.onerror=()=>{document.body.removeChild(j),V(!1)},W.src=N}),K=async N=>new Promise(async V=>{try{const W=await(await fetch(N)).blob(),q=new Image;q.crossOrigin="anonymous";const X=new Promise((L,Z)=>{q.onload=L,q.onerror=Z});q.src=URL.createObjectURL(W),await X;const ne=document.createElement("canvas");ne.width=q.width,ne.height=q.height,ne.getContext("2d").drawImage(q,0,0),URL.revokeObjectURL(q.src);const de=ne.toDataURL("image/png"),f=document.createElement("div");f.setAttribute("contenteditable","true"),f.style.position="fixed",f.style.left="-9999px",f.style.top="-9999px",f.style.opacity="0",document.body.appendChild(f);const F=document.createElement("img");F.src=de,f.appendChild(F),await new Promise(L=>setTimeout(L,50));const D=document.createRange();D.selectNodeContents(f);const E=window.getSelection();E.removeAllRanges(),E.addRange(D);let C=!1;try{C=document.execCommand("copy")}catch(L){console.error("execCommand copy 失败:",L)}E.removeAllRanges(),document.body.removeChild(f),V(C)}catch(j){console.error("Canvas 复制失败:",j),V(!1)}}),oe=N=>{const V=document.createElement("textarea");V.value=N,V.style.position="fixed",V.style.left="-9999px",V.style.top="-9999px",document.body.appendChild(V),V.focus(),V.select();try{return document.execCommand("copy"),!0}catch(j){return console.error("execCommand 复制失败:",j),!1}finally{document.body.removeChild(V)}},Q=async()=>{try{const N=Le.getOriginalUrl(e,t.path);if(H())try{const X=await(await fetch(N)).blob(),ne=new Image,ce=new Promise((E,C)=>{ne.onload=E,ne.onerror=C});ne.src=URL.createObjectURL(X),await ce;const de=document.createElement("canvas");de.width=ne.width,de.height=ne.height,de.getContext("2d").drawImage(ne,0,0),URL.revokeObjectURL(ne.src);const F=await new Promise(E=>{de.toBlob(E,"image/png")}),D=new ClipboardItem({"image/png":F});await navigator.clipboard.write([D]),u(!0),setTimeout(()=>u(!1),2e3);return}catch(q){console.warn("Clipboard API 失败,尝试备用方案:",q)}if(console.log("尝试 Canvas + execCommand 方案..."),await K(N)){u(!0),setTimeout(()=>u(!1),2e3);return}if(console.log("尝试直接图片 URL 方案..."),await m(N)){u(!0),setTimeout(()=>u(!1),2e3);return}console.warn("所有图片复制方案失败,降级为复制链接"),oe(N)?(u(!0),setTimeout(()=>u(!1),2e3),alert(`已复制图片链接到剪贴板 -(当前浏览器环境限制,无法直接复制图片)`)):alert(`复制失败,请手动复制图片链接: -`+N)}catch(N){console.error("复制图片失败:",N),alert("复制图片失败,请重试")}},Y=async N=>new Promise(async V=>{try{const j=document.createElement("div");j.setAttribute("contenteditable","true"),j.style.position="fixed",j.style.left="-9999px",j.style.top="-9999px",j.style.opacity="0",document.body.appendChild(j);for(const{url:ne,filename:ce}of N)try{const f=await(await fetch(ne)).blob(),F=new Image;F.crossOrigin="anonymous",await new Promise((Z,ee)=>{F.onload=Z,F.onerror=ee,F.src=URL.createObjectURL(f)});const D=document.createElement("canvas");D.width=F.width,D.height=F.height,D.getContext("2d").drawImage(F,0,0),URL.revokeObjectURL(F.src);const C=D.toDataURL("image/png"),L=document.createElement("img");L.src=C,L.alt=ce,L.style.display="block",L.style.marginBottom="10px",j.appendChild(L)}catch(de){console.error(`加载图片失败: ${ce}`,de)}await new Promise(ne=>setTimeout(ne,100));const W=document.createRange();W.selectNodeContents(j);const q=window.getSelection();q.removeAllRanges(),q.addRange(W);let X=!1;try{X=document.execCommand("copy")}catch(ne){console.error("execCommand copy 失败:",ne)}q.removeAllRanges(),document.body.removeChild(j),V(X)}catch(j){console.error("批量复制图片失败:",j),V(!1)}}),$=()=>r.length>0?t&&!r.some(N=>N.id===t.id)?[t,...r]:r:t?[t]:[],J=async()=>{try{const N=$();if(N.length===1){await Q();return}const V=N.map(X=>({url:Le.getOriginalUrl(e,X.path),filename:X.filename})),j=N.map(X=>X.filename).join(` -`);if(H())try{const ne=(await Promise.all(N.map(async ce=>{const de=Le.getOriginalUrl(e,ce.path),F=await(await fetch(de)).blob();return new Promise(D=>{const E=new FileReader;E.onloadend=()=>{D({dataUrl:E.result,filename:ce.filename})},E.readAsDataURL(F)})}))).map(({dataUrl:ce,filename:de})=>`${de}`).join(` -`);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([ne],{type:"text/html"}),"text/plain":new Blob([j],{type:"text/plain"})})]),u(!0),setTimeout(()=>u(!1),2e3);return}catch(X){console.warn("Clipboard API 失败,尝试备用方案:",X)}if(console.log("尝试 contenteditable 批量复制方案..."),await Y(V)){u(!0),setTimeout(()=>u(!1),2e3);return}console.warn("批量图片复制失败,降级为复制文件名"),oe(j)?(u(!0),setTimeout(()=>u(!1),2e3),alert(`已复制 ${N.length} 个文件名到剪贴板 -(当前环境限制,建议使用"导出"功能)`)):alert('复制失败,请使用"导出"功能下载图片')}catch(N){console.error("复制图片失败:",N),alert("复制图片失败,请重试")}},M=async()=>{c(!0);try{const N=$();if(N.length===1){const V=Le.getOriginalUrl(e,N[0].path),j=document.createElement("a");j.href=V,j.download=N[0].filename,j.target="_blank",document.body.appendChild(j),j.click(),document.body.removeChild(j)}else{const V=new vd,j=V.folder("images");g(0);for(let X=0;X{if(!n){alert("请先选择一个文件夹");return}b(!0),z(0);try{const N=i.filter(ne=>ne.folder&&ne.folder.startsWith(n));if(N.length===0){alert("当前文件夹没有图片");return}const V=new vd,j=n.split("/").pop()||"images",W=V.folder(j);for(let ne=0;neN<1024?N+" B":N<1024*1024?(N/1024).toFixed(2)+" KB":(N/(1024*1024)).toFixed(2)+" MB",B=N=>new Date(N).toLocaleString("zh-CN");return k.jsxs("div",{className:"w-full border-l border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 flex flex-col h-full",children:[l&&k.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex items-center",children:k.jsxs("button",{onClick:()=>s("main"),className:"flex items-center gap-2 text-gray-700 dark:text-gray-300 hover:text-blue-500",children:[k.jsx(Cy,{className:"w-5 h-5"}),k.jsx("span",{className:"text-sm font-medium",children:"返回"})]})}),k.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:k.jsxs("div",{className:"w-full aspect-square bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden relative",children:[k.jsx("img",{src:w,alt:P.filename,decoding:"async",className:`w-full h-full object-contain transition-opacity duration-300 ${v?"opacity-75":"opacity-100"}`}),v&&k.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs px-2 py-1 rounded",children:"加载原图中..."})]})}),k.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:k.jsxs("div",{children:[k.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"基本信息"}),k.jsxs("div",{className:"space-y-2 text-sm",children:[k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"文件名:"}),k.jsx("p",{className:"text-gray-900 dark:text-gray-100 break-all",children:t.filename})]}),k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"尺寸:"}),k.jsxs("p",{className:"text-gray-900 dark:text-gray-100",children:[t.width," × ",t.height]})]}),k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"大小:"}),k.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:le(t.size)})]}),k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"格式:"}),k.jsx("p",{className:"text-gray-900 dark:text-gray-100 uppercase",children:t.format})]}),k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"创建时间:"}),k.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:B(t.created_at)})]}),k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"修改时间:"}),k.jsx("p",{className:"text-gray-900 dark:text-gray-100",children:B(t.modified_at)})]}),k.jsxs("div",{children:[k.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"路径:"}),k.jsx("p",{className:"text-gray-900 dark:text-gray-100 text-xs break-all",children:t.path})]})]})]})}),!l&&k.jsxs("div",{className:"p-4 border-t border-gray-200 dark:border-gray-700 space-y-2 flex-shrink-0",children:[k.jsx("button",{onClick:J,className:`w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all ${x?"bg-green-500 text-white":"bg-blue-500 text-white hover:bg-blue-600"}`,children:x?k.jsxs(k.Fragment,{children:[k.jsx(Ey,{className:"w-4 h-4"}),k.jsxs("span",{children:["已复制",I?` ${O} 张`:""]})]}):k.jsxs(k.Fragment,{children:[k.jsx(zy,{className:"w-4 h-4"}),k.jsxs("span",{children:["复制图片",I?` (${O})`:""]})]})}),k.jsxs("button",{onClick:M,disabled:_,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:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(Iy,{className:"w-4 h-4"}),k.jsx("span",{children:_?`打包中... ${d}%`:`导出图片${I?` (${O})`:""}`})]}),_&&I&&k.jsx("div",{className:"w-full bg-gray-300 dark:bg-gray-600 rounded-full h-1.5 mt-1",children:k.jsx("div",{className:"bg-blue-500 h-1.5 rounded-full transition-all duration-300",style:{width:`${d}%`}})})]}),n&&k.jsxs("button",{onClick:A,disabled:S,className:"w-full flex flex-col items-center justify-center gap-2 px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(Ay,{className:"w-4 h-4"}),k.jsx("span",{children:S?`打包文件夹... ${R}%`:"导出当前文件夹"})]}),S&&k.jsx("div",{className:"w-full bg-purple-300 rounded-full h-1.5 mt-1",children:k.jsx("div",{className:"bg-white h-1.5 rounded-full transition-all duration-300",style:{width:`${R}%`}})})]})]})]})}function xd(){const{currentLibraryId:e}=rr(),{searchKeywords:t,images:r,selectedFolder:n,setSearchKeywords:i}=_e(),{theme:s,toggleTheme:o,thumbnailHeight:a,setThumbnailHeight:l,mobileView:h}=yt(),[w,y]=G.useState(!1),[v,p]=G.useState([]),[x,u]=G.useState([]),[_,c]=G.useState(""),[d,g]=G.useState(!1),[S,b]=G.useState(!1),[R,z]=G.useState(!1),[O,I]=G.useState(t),P=G.useRef(null);G.useEffect(()=>{const j=()=>{b(window.innerWidth<768)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]),G.useEffect(()=>{p([]),u([]),c("")},[n]);const re=j=>{I(j),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{i(j)},300)};G.useEffect(()=>{I(t)},[t]),G.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);const T=j=>{if(j.length===0)return[];const W=[...j].sort((D,E)=>D-E),q=W[0],X=W[W.length-1];if(X-q<10)return[H(q,X)];const ne=5,ce=[],de=Math.log10(q||1),F=(Math.log10(X)-de)/ne;for(let D=0;DZ>=E&&ZD)},H=(j,W,q=!1)=>{const X=ne=>{const ce=de=>de<10?Math.round(de):de<100?Math.round(de/5)*5:de<1e3?Math.round(de/10)*10:Math.round(de/50)*50;return ne<1?`${ce(ne*1024)}B`:ne<1024?`${ce(ne)}KB`:ne<1048576?`${ce(ne/1024)}MB`:`${ce(ne/1048576)}GB`};return q?`> ${X(j)}`:`${X(j)} - ${X(W)}`},m=j=>{const W=j.match(/^(\d+(?:\.\d+)?)(B|KB|MB|GB)$/);if(!W)return 0;const q=parseFloat(W[1]);switch(W[2]){case"B":return q/1024;case"KB":return q;case"MB":return q*1024;case"GB":return q*1024*1024;default:return 0}},K=(j,W)=>{if(W.startsWith(">")){const q=W.substring(1).trim(),X=m(q);return j>=X}else if(W.includes(" - ")){const[q,X]=W.split(" - ").map(de=>de.trim()),ne=m(q),ce=m(X);return j>=ne&&j{if(r.length===0)return{formats:[],sizes:[],hasHorizontal:!1,hasVertical:!1};const j=new Set,W=[];let q=!1,X=!1;r.forEach(ce=>{ce.format&&j.add(ce.format.toLowerCase()),W.push(ce.size/1024),ce.width>ce.height&&(q=!0),ce.height>ce.width&&(X=!0)});const ne=T(W);return{formats:Array.from(j).sort(),sizes:ne,hasHorizontal:q,hasVertical:X}},[r]);G.useMemo(()=>{if(v.length===0&&x.length===0&&!_)return r;const j=new Set(v),W=new Set(x);return r.filter(q=>{var X;if(j.size>0&&!j.has((X=q.format)==null?void 0:X.toLowerCase()))return!1;if(W.size>0){const ne=q.size/1024;let ce=!1;for(const de of W)if(K(ne,de)){ce=!0;break}if(!ce)return!1}if(_==="horizontal"){if(q.width<=q.height)return!1}else if(_==="vertical"&&q.height<=q.width)return!1;return!0})},[r,v,x,_]);const Q=j=>{p(W=>W.includes(j)?W.filter(q=>q!==j):[...W,j])},Y=j=>{u(W=>W.includes(j)?W.filter(q=>q!==j):[...W,j])},$=j=>{c(W=>W===j?"":j)},J=()=>{p([]),u([]),c("")},M=async()=>{o();try{await xr.updateTheme(s==="light"?"dark":"light")}catch(j){console.error("Error saving theme:",j)}},A=async j=>{l(j);try{await xr.updatePreferences({thumbnailHeight:j})}catch(W){console.error("Error saving preferences:",W)}},le=async()=>{if(!(!e||d)){g(!0);try{await li.sync(e)}catch(j){console.error("Error refreshing:",j),alert("刷新失败: "+j.message)}finally{g(!1)}}},B=oe.formats,N=oe.sizes.map(j=>({label:j})),V=[{value:"horizontal",label:"横图"},{value:"vertical",label:"竖图"}].filter(j=>j.value==="horizontal"&&oe.hasHorizontal||j.value==="vertical"&&oe.hasVertical);if(S){const j=h!=="sidebar";return k.jsxs("header",{className:"border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[k.jsxs("div",{className:"h-14 flex items-center justify-between px-4",children:[k.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white",children:"FlyPic"}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("button",{onClick:le,disabled:!e||d,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50",children:k.jsx(ed,{className:`w-5 h-5 text-gray-700 dark:text-gray-300 ${d?"animate-spin":""}`})}),k.jsx("button",{onClick:()=>z(!R),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:k.jsx(td,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})}),k.jsx("button",{onClick:M,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:s==="light"?k.jsx(Jc,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}):k.jsx(rd,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})})]})]}),j&&k.jsx("div",{className:"px-4 pb-3",children:k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsxs("div",{className:"flex-1 relative",children:[k.jsx(bl,{className:"absolute left-3 top-2.5 w-5 h-5 text-gray-400"}),k.jsx("input",{type:"text",placeholder:"搜索图片...",value:t,onChange:W=>re(W.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"})]}),k.jsx("button",{onClick:()=>y(!w),className:`p-2 border rounded-lg ${v.length>0||x.length>0||_?"border-blue-500 bg-blue-50 dark:bg-blue-500/20":"border-gray-300 dark:border-gray-600"}`,children:k.jsx(Gc,{className:`w-5 h-5 ${v.length>0||x.length>0||_?"text-blue-600 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`})})]})}),R&&k.jsx("div",{className:"px-4 pb-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:k.jsxs("div",{className:"flex flex-col gap-3",children:[k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:"缩略图大小"}),k.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[a,"px"]})]}),k.jsx("input",{type:"range",min:"150",max:"300",value:a,onChange:W=>A(parseInt(W.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 ${(a-150)/150*100}%, #e5e7eb ${(a-150)/150*100}%, #e5e7eb 100%)`}})]})}),j&&w&&k.jsxs("div",{className:"px-4 pb-3 border-t border-gray-200 dark:border-gray-700 pt-3",children:[k.jsxs("div",{className:"flex items-center justify-between mb-3",children:[k.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"筛选条件"}),k.jsx("button",{onClick:J,className:"text-xs text-blue-500",children:"清除全部"})]}),k.jsxs("div",{className:"mb-3",children:[k.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"格式"}),k.jsx("div",{className:"flex flex-wrap gap-2",children:B.map(W=>k.jsx("button",{onClick:()=>Q(W),className:`px-3 py-1 text-xs rounded-full ${v.includes(W)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:W.toUpperCase()},W))})]}),k.jsxs("div",{className:"mb-3",children:[k.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"尺寸"}),k.jsx("div",{className:"flex flex-wrap gap-2",children:N.map(W=>k.jsx("button",{onClick:()=>Y(W.label),className:`px-3 py-1 text-xs rounded-full ${x.includes(W.label)?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:W.label},W.label))})]}),k.jsxs("div",{children:[k.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:"方向"}),k.jsx("div",{className:"flex flex-wrap gap-2",children:V.map(W=>k.jsx("button",{onClick:()=>$(W.value),className:`px-3 py-1 text-xs rounded-full ${_===W.value?"bg-blue-500 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:W.label},W.value))})]})]})]})}return k.jsxs("header",{className:"border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[k.jsxs("div",{className:"h-14 flex items-center justify-between px-6",children:[k.jsxs("div",{className:"flex-shrink-0",children:[k.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"FlyPic"}),k.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"轻量快速的图片素材库管理"})]}),k.jsxs("div",{className:"flex-1 max-w-2xl mx-6 flex items-center gap-3",children:[k.jsxs("div",{className:"flex-1 relative",children:[k.jsx(bl,{className:"absolute left-3 top-2.5 w-5 h-5 text-gray-400"}),k.jsx("input",{type:"text",placeholder:"搜索图片... (多个关键词用空格分隔,即时搜索)",value:O,onChange:j=>re(j.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"})]}),k.jsxs("button",{onClick:()=>y(!w),className:`relative p-2 border rounded-lg transition-colors ${v.length>0||x.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:v.length>0||x.length>0||_?"筛选(已启用)":"筛选",children:[k.jsx(Gc,{className:`w-5 h-5 ${v.length>0||x.length>0||_?"text-blue-600 dark:text-blue-300":"text-gray-600 dark:text-gray-400"}`}),(v.length>0||x.length>0||_)&&k.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full",style:{backgroundColor:"#3b82f6"}})]})]}),k.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[k.jsx(td,{className:"w-4 h-4 text-gray-500"}),k.jsx("input",{type:"range",min:"150",max:"300",value:a,onChange:j=>A(parseInt(j.target.value)),className:"w-32"}),k.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400 w-12",children:[a,"px"]}),k.jsx("button",{onClick:le,disabled:!e||d,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:k.jsx(ed,{className:`w-5 h-5 text-gray-700 dark:text-gray-300 ${d?"animate-spin":""}`})}),k.jsx("button",{onClick:M,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:s==="light"?"切换到暗色模式":"切换到亮色模式",children:s==="light"?k.jsx(Jc,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}):k.jsx(rd,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"})})]})]}),w&&k.jsx("div",{className:"px-6 pb-3",children:k.jsxs("div",{className:"p-4 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[k.jsxs("div",{className:"flex items-center justify-between mb-3",children:[k.jsx("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"筛选条件(实时生效)"}),k.jsx("button",{onClick:J,className:"text-xs text-blue-500 hover:text-blue-600 dark:hover:text-blue-400",children:"清除全部"})]}),k.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[k.jsxs("div",{children:[k.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"格式"}),k.jsx("div",{className:"flex flex-col gap-1.5",children:oe.formats.length>0?oe.formats.map(j=>k.jsx("button",{onClick:()=>Q(j),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${v.includes(j)?"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:j.toUpperCase()},j)):k.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无格式数据"})})]}),k.jsxs("div",{children:[k.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"文件大小"}),k.jsx("div",{className:"flex flex-col gap-1.5",children:oe.sizes.length>0?oe.sizes.map(j=>k.jsx("button",{onClick:()=>Y(j),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${x.includes(j)?"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:j},j)):k.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无大小数据"})})]}),k.jsxs("div",{children:[k.jsx("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"图片方向"}),k.jsxs("div",{className:"flex flex-col gap-1.5",children:[oe.hasHorizontal&&k.jsx("button",{onClick:()=>$("horizontal"),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${_==="horizontal"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500"}`,children:"横图"}),oe.hasVertical&&k.jsx("button",{onClick:()=>$("vertical"),className:`px-3 py-1.5 text-xs rounded transition-colors text-left ${_==="vertical"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-500"}`,children:"竖图"}),!oe.hasHorizontal&&!oe.hasVertical&&k.jsx("span",{className:"text-xs text-gray-400 py-2",children:"暂无方向数据"})]})]})]})]})})]})}function zv(){const{theme:e,mobileView:t,setMobileView:r}=yt(),{setLibraries:n,setCurrentLibrary:i}=rr(),{selectedImage:s}=_e(),{setScanProgress:o}=cn(),[a,l]=G.useState(256),[h,w]=G.useState(320),[y,v]=G.useState(!1),[p,x]=G.useState(!1),[u,_]=G.useState(!1),c=G.useRef(null);G.useEffect(()=>{e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")},[e]),G.useEffect(()=>{const S=()=>{const b=window.innerWidth<768;_(b)};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]),G.useEffect(()=>{u&&s&&r("detail")},[s,u,r]),G.useEffect(()=>{const S=window.location.origin,b=Ys(S,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:5});return b.on("connect",()=>{const R=(z=5,O=1e3)=>{const I=rr.getState().currentLibraryId;I&&li.getStatus(I).then(P=>{const re=P.data||P;re&&re.status==="scanning"&&re.progress?o(re.progress):z>0&&setTimeout(()=>R(z-1,O),O)}).catch(P=>{z>0&&setTimeout(()=>R(z-1,O),O)})};R(5,1e3)}),b.on("connect_error",R=>{console.error("❌ 连接错误:",R.message)}),b.on("scanProgress",R=>{const z=rr.getState().currentLibraryId;R.libraryId===z&&o(R)}),b.on("scanComplete",({libraryId:R,results:z})=>{const O=rr.getState().currentLibraryId;if(R===O){const I=_e.getState(),P={keywords:I.searchKeywords,...I.filters};I.selectedFolder&&(P.folder=I.selectedFolder),Promise.all([Le.getFolders(R),I.selectedFolder||I.searchKeywords||I.filters.formats.length>0?Le.search(R,P):Promise.resolve({images:[]}),Le.getCount(R)]).then(([re,T,H])=>{_e.getState().setFolders(re.folders),_e.getState().setImages(T.images),_e.getState().setTotalImageCount(H.count)}).catch(re=>{console.error("❌ 加载数据失败:",re.message)}).finally(()=>{o(null)})}else o(null)}),b.on("scanError",({libraryId:R,error:z})=>{o(null),console.error("❌ 扫描错误:",z)}),d(),()=>{b.disconnect(),Sl.cleanup()}},[]);const d=async()=>{try{const S=await xr.getAll(),b=S.data||S;n(b.libraries||[]),i(b.currentLibraryId);const R=b.currentLibraryId;if(b.theme&&yt.getState().setTheme(b.theme),b.preferences){const{thumbnailHeight:z,leftPanelWidth:O,rightPanelWidth:I}=b.preferences;z&&yt.getState().setThumbnailHeight(z),O&&l(O),I&&w(I)}if(R){const[z]=await Promise.all([Le.getFolders(R)]);_e.getState().setFolders(z.folders);try{const O=await Le.getCount(R);_e.getState().setTotalImageCount(O.count)}catch(O){console.error("❌ 获取图片总数失败:",O.message)}li.getStatus(R).then(O=>{const{status:I,progress:P}=O;I==="scanning"&&o(P)}).catch(()=>{})}}catch(S){console.error("❌ 加载素材库失败:",S.message)}},g=async(S,b)=>{try{await xr.updatePreferences({leftPanelWidth:S,rightPanelWidth:b})}catch(R){console.error("❌ 保存面板宽度失败:",R.message)}};return G.useEffect(()=>{if(!y&&!p)return;const S=document.getElementById("left-panel"),b=document.getElementById("right-panel");let R=a,z=h;const O=c.current.getBoundingClientRect(),I=O.left,P=O.right;let re=null,T=null,H=null;const m=()=>{S&&T!=null&&(S.style.width=`${T}px`,R=T),b&&H!=null&&(b.style.width=`${H}px`,z=H),re=null,T=null,H=null},K=Q=>{let Y=!1;if(y&&S){const $=Q.clientX-I;$>=200&&$<=400&&(T=$,Y=!0)}if(p&&b){const $=P-Q.clientX;$>=280&&$<=500&&(H=$,Y=!0)}Y&&re==null&&(re=requestAnimationFrame(m))},oe=()=>{re&&(cancelAnimationFrame(re),m()),l(R),w(z),g(R,z),v(!1),x(!1),yt.getState().setIsResizingPanels(!1),yt.getState().setResizingSide(null)};return document.addEventListener("mousemove",K,{passive:!0}),document.addEventListener("mouseup",oe),document.body.style.userSelect="none",document.body.style.cursor="col-resize",S&&(S.style.transition="none"),b&&(b.style.transition="none"),()=>{re&&(cancelAnimationFrame(re),re=null),document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",oe),document.body.style.userSelect="",document.body.style.cursor="",S&&(S.style.transition=""),b&&(b.style.transition="")}},[y,p]),u?k.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[k.jsx(xd,{}),k.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[k.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${t==="sidebar"?"translate-x-0":"-translate-x-full"}`,children:k.jsx(id,{})}),k.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${t==="main"?"translate-x-0":t==="sidebar"?"translate-x-full":"-translate-x-full"}`,children:k.jsx(yd,{})}),k.jsx("div",{className:`absolute inset-0 transition-transform duration-300 ${t==="detail"?"translate-x-0":"translate-x-full"}`,children:k.jsx(wd,{})})]}),k.jsxs("div",{className:"flex border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",children:[k.jsxs("button",{onClick:()=>r("sidebar"),className:`flex-1 flex flex-col items-center py-2 ${t==="sidebar"?"text-blue-500":"text-gray-500"}`,children:[k.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:k.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"})}),k.jsx("span",{className:"text-xs mt-1",children:"文件夹"})]}),k.jsxs("button",{onClick:()=>r("main"),className:`flex-1 flex flex-col items-center py-2 ${t==="main"?"text-blue-500":"text-gray-500"}`,children:[k.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:k.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"})}),k.jsx("span",{className:"text-xs mt-1",children:"图片"})]}),k.jsxs("button",{onClick:()=>r("detail"),disabled:!s,className:`flex-1 flex flex-col items-center py-2 ${t==="detail"?"text-blue-500":"text-gray-500"} disabled:opacity-30`,children:[k.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:k.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"})}),k.jsx("span",{className:"text-xs mt-1",children:"详情"})]})]})]}):k.jsxs("div",{className:"flex flex-col h-screen bg-gray-50 dark:bg-gray-900",children:[k.jsx(xd,{}),k.jsxs("div",{ref:c,className:"flex flex-1 overflow-hidden",children:[k.jsx("div",{id:"left-panel",style:{width:`${a}px`},className:"flex-shrink-0 h-full",children:k.jsx(id,{})}),k.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:S=>{S.preventDefault(),yt.getState().setIsResizingPanels(!0),yt.getState().setResizingSide("left"),v(!0)},children:k.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 w-5"})}),k.jsx("div",{className:"flex-1 min-w-0 h-full",children:k.jsx(yd,{})}),k.jsx("div",{className:`group relative w-1 h-full cursor-col-resize flex-shrink-0 transition-colors ${p?"bg-blue-500":"bg-gray-200 dark:bg-gray-700 hover:bg-blue-400"}`,onMouseDown:S=>{S.preventDefault(),yt.getState().setIsResizingPanels(!0),yt.getState().setResizingSide("right"),x(!0)},children:k.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2 w-5"})}),k.jsx("div",{id:"right-panel",style:{width:`${h}px`},className:"flex-shrink-0 h-full",children:k.jsx(wd,{})})]})]})}ba.createRoot(document.getElementById("root")).render(k.jsx(ye.StrictMode,{children:k.jsx(zv,{})})); diff --git a/flypic/app/server/public/index.html b/flypic/app/server/public/index.html index 4befc22..eefa7a5 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/src/routes/library.js b/flypic/app/server/src/routes/library.js index 11d6007..6919901 100644 --- a/flypic/app/server/src/routes/library.js +++ b/flypic/app/server/src/routes/library.js @@ -41,6 +41,30 @@ router.post('/', }) ); +/** + * 更新偏好设置(必须在 /:id 之前,否则会被 /:id 匹配) + * PUT /api/library/preferences + * Body: { preferences } + */ +router.put('/preferences', asyncHandler(async (req, res) => { + const result = libraryService.updatePreferences(req.body); + res.json({ success: true, data: result }); +})); + +/** + * 更新主题(必须在 /:id 之前) + * PUT /api/library/theme + * Body: { theme } + */ +router.put('/theme', + validateRequired(['theme']), + asyncHandler(async (req, res) => { + const { theme } = req.body; + const result = libraryService.updateTheme(theme); + res.json({ success: true, data: result }); + }) +); + /** * 更新素材库 * PUT /api/library/:id @@ -72,30 +96,6 @@ router.post('/:id/set-current', asyncHandler(async (req, res) => { res.json({ success: true, data: result }); })); -/** - * 更新偏好设置 - * PUT /api/library/preferences - * Body: { preferences } - */ -router.put('/preferences', asyncHandler(async (req, res) => { - const result = libraryService.updatePreferences(req.body); - res.json({ success: true, data: result }); -})); - -/** - * 更新主题 - * PUT /api/library/theme - * Body: { theme } - */ -router.put('/theme', - validateRequired(['theme']), - asyncHandler(async (req, res) => { - const { theme } = req.body; - const result = libraryService.updateTheme(theme); - res.json({ success: true, data: result }); - }) -); - /** * 获取素材库统计 * GET /api/library/:id/stats diff --git a/flypic/app/server/src/services/LibraryService.js b/flypic/app/server/src/services/LibraryService.js index 3cc5524..06097f2 100644 --- a/flypic/app/server/src/services/LibraryService.js +++ b/flypic/app/server/src/services/LibraryService.js @@ -61,7 +61,7 @@ class LibraryService { } catch (writeError) { console.log(`[LibraryService] No write permission: ${normalizedPath}`); throw new ValidationError( - '无法访问该文件夹。将此文件夹添加到 FlyPic 应用的访问权限。', + '无法访问该文件夹。请在飞牛 fnOS 的"数据共享"中将此文件夹添加到 FlyPic 应用的访问权限。', 'permission' ); } @@ -69,7 +69,7 @@ class LibraryService { if (readError.code === 'EACCES' || readError.code === 'EPERM') { console.log(`[LibraryService] No access permission: ${normalizedPath}`); throw new ValidationError( - '无法访问该文件夹。将此文件夹添加到 FlyPic 应用的访问权限。', + '无法访问该文件夹。请在飞牛 fnOS 的"数据共享"中将此文件夹添加到 FlyPic 应用的访问权限。', 'permission' ); } diff --git a/flypic/app/server/utils/scanner.js b/flypic/app/server/utils/scanner.js index ec00be1..c360ba9 100644 --- a/flypic/app/server/utils/scanner.js +++ b/flypic/app/server/utils/scanner.js @@ -6,7 +6,8 @@ const { getFileType, calculateFileHash, getImageMetadata, - generateImageThumbnails + generateImageThumbnails, + clearSharpCache } = require('./thumbnail'); const scanManager = require('./scanManager'); @@ -489,6 +490,15 @@ async function scanLibrary(libraryPath, db, onProgress, libraryId = null, resume // Update folder image counts db.updateAllFolderCounts(); + // 🎯 关键:扫描完成后清理 Sharp 缓存,释放内存 + clearSharpCache(); + + // 强制 GC(如果可用) + if (global.gc) { + global.gc(); + console.log('🧹 内存已清理'); + } + // 标记扫描完成 if (libraryId) { scanManager.completeScan(libraryId); @@ -640,6 +650,9 @@ async function syncLibrary(libraryPath, db, forceRebuildFolders = false, onProgr const totalTime = (Date.now() - startTime) / 1000; console.log(`✅ 同步完成 (${totalTime.toFixed(1)}秒)`); + // 清理 Sharp 缓存 + clearSharpCache(); + return { added: toAdd.length, modified: modifiedCount, @@ -647,6 +660,7 @@ async function syncLibrary(libraryPath, db, forceRebuildFolders = false, onProgr }; } catch (error) { console.error('❌ 同步失败:', error.message); + clearSharpCache(); throw error; } } @@ -712,6 +726,8 @@ async function quickSync(libraryPath, db) { const elapsed = Date.now() - startTime; if (toAdd.length > 0 || toDelete.length > 0) { console.log(`⚡ 快速同步: +${toAdd.length} -${toDelete.length} (${elapsed}ms)`); + // 有变化时清理 Sharp 缓存 + clearSharpCache(); } return { added: toAdd.length, deleted: toDelete.length }; diff --git a/flypic/app/server/utils/thumbnail.js b/flypic/app/server/utils/thumbnail.js index 45d4b98..530f49e 100644 --- a/flypic/app/server/utils/thumbnail.js +++ b/flypic/app/server/utils/thumbnail.js @@ -5,14 +5,24 @@ const crypto = require('crypto'); // 配置 Sharp 内存限制(防止内存泄漏) sharp.cache({ - memory: 50, // 最大缓存 50MB(默认 50MB) - files: 0, // 禁用文件缓存 - items: 20 // 最多缓存 20 个操作 + memory: 20, // 最大缓存 20MB(更激进) + files: 0, // 禁用文件缓存 + items: 10 // 最多缓存 10 个操作 }); // 设置并发限制 sharp.concurrency(1); // 一次只处理 1 张图片 +// 清理 Sharp 缓存的函数(扫描完成后调用) +function clearSharpCache() { + sharp.cache(false); // 完全禁用缓存 + sharp.cache({ // 重新启用最小缓存 + memory: 20, + files: 0, + items: 10 + }); +} + // 支持的文件格式(确定可以生成缩略图的) const IMAGE_FORMATS = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'tif', 'avif', 'heif', 'heic', 'svg']; @@ -89,17 +99,20 @@ function isImageFile(filename) { /** * Calculate file hash for change detection + * 优化:使用文件大小+修改时间作为快速哈希,避免读取整个文件 */ function calculateFileHash(filePath) { - let fileBuffer = fs.readFileSync(filePath); - const hashSum = crypto.createHash('md5'); - hashSum.update(fileBuffer); - const hash = hashSum.digest('hex'); - - // 显式释放 Buffer - fileBuffer = null; - - return hash; + try { + const stats = fs.statSync(filePath); + // 使用文件大小 + 修改时间作为快速哈希(足够检测变化) + const quickHash = `${stats.size}-${stats.mtimeMs}`; + const hashSum = crypto.createHash('md5'); + hashSum.update(quickHash); + return hashSum.digest('hex'); + } catch (error) { + // 回退到空哈希 + return crypto.createHash('md5').update(filePath).digest('hex'); + } } /** @@ -366,37 +379,54 @@ async function generateImageThumbnails(imagePath, libraryPath) { /** * 从 PSD 文件提取嵌入的缩略图 + * 优化:使用部分读取,避免加载整个 PSD 文件到内存 */ async function extractPSDThumbnail(psdPath, outputPath) { + let fd = null; try { - const buffer = fs.readFileSync(psdPath); + fd = fs.openSync(psdPath, 'r'); + + // 读取头部(前 100 字节足够获取基本信息) + const headerBuffer = Buffer.alloc(100); + fs.readSync(fd, headerBuffer, 0, 100, 0); - // PSD 文件格式: - // 前 4 字节: "8BPS" (签名) - // 偏移 26: Image Resources Section - // 查找 Resource ID 1036 (缩略图资源) - - if (buffer.toString('utf8', 0, 4) !== '8BPS') { + // PSD 文件格式:前 4 字节: "8BPS" (签名) + if (headerBuffer.toString('utf8', 0, 4) !== '8BPS') { throw new Error('Not a valid PSD file'); } - // 读取 Image Resources Section 长度 - const colorModeLength = buffer.readUInt32BE(26); + // 读取 Color Mode Data 长度(偏移 26) + const colorModeLength = headerBuffer.readUInt32BE(26); const imageResourcesOffset = 26 + 4 + colorModeLength; - const imageResourcesLength = buffer.readUInt32BE(imageResourcesOffset); - let offset = imageResourcesOffset + 4; - const endOffset = offset + imageResourcesLength; + // 读取 Image Resources Section 长度 + const irLengthBuffer = Buffer.alloc(4); + fs.readSync(fd, irLengthBuffer, 0, 4, imageResourcesOffset); + const imageResourcesLength = irLengthBuffer.readUInt32BE(0); + + // 限制读取大小(最多 2MB,缩略图通常在前面) + const maxReadSize = Math.min(imageResourcesLength, 2 * 1024 * 1024); + const resourcesBuffer = Buffer.alloc(maxReadSize); + fs.readSync(fd, resourcesBuffer, 0, maxReadSize, imageResourcesOffset + 4); + + fs.closeSync(fd); + fd = null; + + let offset = 0; + const endOffset = maxReadSize; // 查找缩略图资源 (ID 1033 或 1036) - while (offset < endOffset) { - const signature = buffer.toString('utf8', offset, offset + 4); + while (offset < endOffset - 12) { + const signature = resourcesBuffer.toString('utf8', offset, offset + 4); if (signature !== '8BIM') break; - const resourceId = buffer.readUInt16BE(offset + 4); - const nameLength = buffer.readUInt8(offset + 6); + const resourceId = resourcesBuffer.readUInt16BE(offset + 4); + const nameLength = resourcesBuffer.readUInt8(offset + 6); const namePadding = nameLength % 2 === 0 ? nameLength + 2 : nameLength + 1; - const dataSize = buffer.readUInt32BE(offset + 6 + namePadding); + + if (offset + 6 + namePadding + 4 > endOffset) break; + + const dataSize = resourcesBuffer.readUInt32BE(offset + 6 + namePadding); const dataPadding = dataSize % 2 === 0 ? dataSize : dataSize + 1; // 1033 = 缩略图 (旧格式), 1036 = 缩略图 (新格式) @@ -405,7 +435,13 @@ async function extractPSDThumbnail(psdPath, outputPath) { // 跳过前 28 字节的头部信息 const jpegOffset = dataOffset + 28; - const jpegData = buffer.slice(jpegOffset, jpegOffset + dataSize - 28); + const jpegSize = dataSize - 28; + + if (jpegOffset + jpegSize > endOffset) { + throw new Error('Thumbnail data exceeds buffer'); + } + + const jpegData = resourcesBuffer.slice(jpegOffset, jpegOffset + jpegSize); // 先获取原始缩略图尺寸 const metadata = await sharp(jpegData).metadata(); @@ -415,43 +451,16 @@ async function extractPSDThumbnail(psdPath, outputPath) { const targetHeight = 480; const targetWidth = Math.round(targetHeight * aspectRatio); - // 根据原始尺寸调整处理策略 - let resizeOptions, sharpenOptions, webpQuality; - - if (metadata.width >= 1000 || metadata.height >= 1000) { - // 高分辨率缩略图(≥1000px):正常缩放 - resizeOptions = { - fit: 'inside', - kernel: 'lanczos3', - withoutEnlargement: true - }; - sharpenOptions = { sigma: 0.8, m1: 0.5, m2: 1.0 }; - webpQuality = 95; - } else if (metadata.width >= 500 || metadata.height >= 500) { - // 中等分辨率(500-1000px):轻微放大 + 强锐化 - resizeOptions = { - fit: 'inside', - kernel: 'lanczos3', - withoutEnlargement: false // 允许放大 - }; - sharpenOptions = { sigma: 1.2, m1: 1.0, m2: 2.0 }; // 强锐化 - webpQuality = 96; - } else { - // 低分辨率(<500px):放大 + 超强锐化 - resizeOptions = { - fit: 'inside', - kernel: 'lanczos3', - withoutEnlargement: false - }; - sharpenOptions = { sigma: 1.5, m1: 1.2, m2: 2.5 }; // 超强锐化 - webpQuality = 98; // 最高质量 - } - + // 简化处理策略 await sharp(jpegData) - .resize(targetWidth, targetHeight, resizeOptions) - .sharpen(sharpenOptions) + .resize(targetWidth, targetHeight, { + fit: 'inside', + kernel: 'lanczos3', + withoutEnlargement: metadata.width >= 500 + }) + .sharpen({ sigma: 1.0, m1: 0.8, m2: 1.5 }) .webp({ - quality: webpQuality, + quality: 95, effort: 4, smartSubsample: false }) @@ -471,6 +480,9 @@ async function extractPSDThumbnail(psdPath, outputPath) { throw new Error('No thumbnail found in PSD'); } catch (error) { + if (fd !== null) { + try { fs.closeSync(fd); } catch (e) {} + } console.warn(`Failed to extract PSD thumbnail: ${error.message}`); return null; } @@ -631,6 +643,7 @@ module.exports = { generateThumbnail, getImageMetadata, generateImageThumbnails, + clearSharpCache, SUPPORTED_FORMATS, ALL_FORMATS }; diff --git a/flypic/app/ui/config b/flypic/app/ui/config index 8576c6d..31390b2 100644 --- a/flypic/app/ui/config +++ b/flypic/app/ui/config @@ -6,7 +6,7 @@ "type": "url", "protocol": "http", "port": "15002", - "allUsers": true, + "allUsers": false, "control": { "portPerm": "editable" } diff --git a/flypic/manifest b/flypic/manifest index e283a3c..0bb1c3c 100644 --- a/flypic/manifest +++ b/flypic/manifest @@ -1,5 +1,5 @@ appname=flypic -version=1.0.0 +version=1.0.5 desc=飞图 - 专为飞牛 fnOS 设计的轻量、快速、稳定的图像素材检索浏览应用,支持数十万级别图片流畅浏览,非侵入式设计,100% 开源免费 arch=x86_64 display_name=FlyPic diff --git a/frontend/package.json b/frontend/package.json index 5e81feb..fadca27 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "flypic-frontend", - "version": "1.0.0", + "version": "1.0.5", "private": true, "type": "module", "scripts": {