PennyJX commited on
Commit
b173115
1 Parent(s): a9658c4

Upload 160 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. extensions/sd-webui-infinite-image-browsing/.env.example +33 -0
  2. extensions/sd-webui-infinite-image-browsing/.github/FUNDING.yml +3 -0
  3. extensions/sd-webui-infinite-image-browsing/.github/workflows/tauri_app_build.yml +130 -0
  4. extensions/sd-webui-infinite-image-browsing/.gitignore +17 -0
  5. extensions/sd-webui-infinite-image-browsing/.vscode/settings.json +6 -0
  6. extensions/sd-webui-infinite-image-browsing/LICENSE +21 -0
  7. extensions/sd-webui-infinite-image-browsing/README-zh.md +147 -0
  8. extensions/sd-webui-infinite-image-browsing/README.md +142 -0
  9. extensions/sd-webui-infinite-image-browsing/app.py +221 -0
  10. extensions/sd-webui-infinite-image-browsing/install.py +28 -0
  11. extensions/sd-webui-infinite-image-browsing/javascript/index.js +176 -0
  12. extensions/sd-webui-infinite-image-browsing/log.log +0 -0
  13. extensions/sd-webui-infinite-image-browsing/requirements.txt +6 -0
  14. extensions/sd-webui-infinite-image-browsing/scripts/__pycache__/iib_setup.cpython-310.pyc +0 -0
  15. extensions/sd-webui-infinite-image-browsing/scripts/iib/__pycache__/api.cpython-310.pyc +0 -0
  16. extensions/sd-webui-infinite-image-browsing/scripts/iib/__pycache__/logger.cpython-310.pyc +0 -0
  17. extensions/sd-webui-infinite-image-browsing/scripts/iib/__pycache__/tool.cpython-310.pyc +0 -0
  18. extensions/sd-webui-infinite-image-browsing/scripts/iib/api.py +887 -0
  19. extensions/sd-webui-infinite-image-browsing/scripts/iib/db/__pycache__/datamodel.cpython-310.pyc +0 -0
  20. extensions/sd-webui-infinite-image-browsing/scripts/iib/db/__pycache__/update_image_data.cpython-310.pyc +0 -0
  21. extensions/sd-webui-infinite-image-browsing/scripts/iib/db/datamodel.py +685 -0
  22. extensions/sd-webui-infinite-image-browsing/scripts/iib/db/update_image_data.py +153 -0
  23. extensions/sd-webui-infinite-image-browsing/scripts/iib/logger.py +20 -0
  24. extensions/sd-webui-infinite-image-browsing/scripts/iib/tool.py +523 -0
  25. extensions/sd-webui-infinite-image-browsing/scripts/iib_setup.py +78 -0
  26. extensions/sd-webui-infinite-image-browsing/style.css +3 -0
  27. extensions/sd-webui-infinite-image-browsing/vue/.eslintrc.cjs +26 -0
  28. extensions/sd-webui-infinite-image-browsing/vue/.gitignore +22 -0
  29. extensions/sd-webui-infinite-image-browsing/vue/.prettierrc.json +8 -0
  30. extensions/sd-webui-infinite-image-browsing/vue/.vscode/extensions.json +3 -0
  31. extensions/sd-webui-infinite-image-browsing/vue/README.md +47 -0
  32. extensions/sd-webui-infinite-image-browsing/vue/build.ts +27 -0
  33. extensions/sd-webui-infinite-image-browsing/vue/components.d.ts +48 -0
  34. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/FileItem-39204ab7.js +4 -0
  35. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/FileItem-d1784052.css +1 -0
  36. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/ImgSliPagePane-b56f571f.js +1 -0
  37. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/MatchedImageGrid-337d7e1f.css +1 -0
  38. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/MatchedImageGrid-623cc422.js +1 -0
  39. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/SubstrSearch-86e8fce9.css +1 -0
  40. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/SubstrSearch-ac08db9a.js +1 -0
  41. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/TagSearch-4d1b002e.js +1 -0
  42. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/TagSearch-8cc2caef.css +1 -0
  43. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/antd.dark-35e9b327.js +0 -0
  44. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/batchDownload-08be3fc5.css +1 -0
  45. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/batchDownload-651b3fe2.js +1 -0
  46. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/db-90de1b1b.js +1 -0
  47. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/emptyStartup-28b35346.js +1 -0
  48. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/emptyStartup-3df6ad3a.css +1 -0
  49. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/fullScreenContextMenu-5ccd83b3.css +1 -0
  50. extensions/sd-webui-infinite-image-browsing/vue/dist/assets/fullScreenContextMenu-780774ab.js +2 -0
extensions/sd-webui-infinite-image-browsing/.env.example ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This document is used for additional control over the security and privacy of IIB. By default, IIB is already sufficiently secure, and you do not need to take any additional actions.
2
+ # Copy this file and rename it to ".env" . Then, fill in the necessary values for your specific use case.
3
+ # Remember to never share your .env file with anyone else as it may contain sensitive information.
4
+
5
+ # This attribute is used for authentication. If you input a key here, it will be validated for authentication purposes.
6
+ # It will be prompted to enter your key when you open the extension. If the authentication fails, all your requests will be rejected.
7
+ IIB_SECRET_KEY=
8
+
9
+ # Configuring the server-side language for this extension,
10
+ # including the tab title and most of the server-side error messages returned. Options are 'zh', 'en', or 'auto'.
11
+ # If you want to configure the language for the front-end pages, please set it on the extension's global settings page.
12
+ IIB_SERVER_LANG=auto
13
+
14
+
15
+ # ---------------------------- ACCESS_CONTROL ----------------------------
16
+
17
+ # Used to configure whether to enable access control to the file system.
18
+ # If enabled, only access to the provided pre-set folders (including those provided by sd-webui and manually \
19
+ # added to Quick Move or specified via IIB_ACCESS_CONTROL_ALLOWED_PATHS) will be allowed.
20
+ # The available options are 'enable', 'disable', and 'auto'.
21
+ # The default value is 'auto', which will be determined based on the command-line parameters used to start sd-webui (such as --server-name, --share, --listen).
22
+ IIB_ACCESS_CONTROL=auto
23
+
24
+ # This variable is used to define a list of allowed paths for the application to access when access control mode is enabled.
25
+ # It can be set to a comma-separated string of file paths or directory paths, representing the resources that are allowed to be accessed by the application.
26
+ # In addition, if sd_webui_config or sd_webui_dir has been configured, or if you're running this repository as an extension of sd-webui,
27
+ # you can use the following shortcuts (txt2img, img2img, extra, save) as values for the ALLOWED_PATHS variable.
28
+ # IIB_ACCESS_CONTROL_ALLOWED_PATHS=save,extra,/output ...etc
29
+
30
+ # This variable is used to control fine-grained access control for different types of requests, but only if access control mode is enabled.
31
+ # It can be set to a string value that represents a specific permission or set of permissions, such as "read-only", "write-only", "read-write", or "no-access".
32
+ # This variable can be used to restrict access to certain API endpoints or data sources based on the permissions required by the user.
33
+ # IIB_ACCESS_CONTROL_PERMISSION=read-write
extensions/sd-webui-infinite-image-browsing/.github/FUNDING.yml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ ko_fi: zanllp
extensions/sd-webui-infinite-image-browsing/.github/workflows/tauri_app_build.yml ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: tauri_app_build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'releases/**'
7
+
8
+ jobs:
9
+ build:
10
+ strategy:
11
+ matrix:
12
+ os: [windows-latest,ubuntu-20.04]
13
+
14
+ runs-on: ${{ matrix.os }}
15
+
16
+ permissions:
17
+ contents: write
18
+ steps:
19
+ - name: Check-out repository
20
+ uses: actions/checkout@v3
21
+
22
+ - run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> "$GITHUB_ENV"
23
+ if: matrix.os == 'ubuntu-20.04'
24
+ - run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> $env:GITHUB_ENV
25
+ if: matrix.os == 'windows-latest'
26
+
27
+ - name: Setup Python
28
+ uses: actions/setup-python@v4
29
+ with:
30
+ python-version: '3.10'
31
+ cache: 'pip'
32
+ cache-dependency-path: |
33
+ **/requirements*.txt
34
+
35
+ - name: Install Dependencies
36
+ run: |
37
+ pip install -r requirements.txt
38
+
39
+ - name: Build Executable
40
+ uses: Nuitka/Nuitka-Action@main
41
+ with:
42
+ nuitka-version: main
43
+ script-name: app.py
44
+ output-file: iib_api_server
45
+ output-dir: out
46
+
47
+ - name: Upload Server Artifacts
48
+ uses: actions/upload-artifact@v3
49
+ with:
50
+ name: iib_api_server-${{ env.VERSION }}-${{ runner.os }}
51
+ path: |
52
+ out/iib_api_server.exe
53
+ out/iib_api_server
54
+
55
+ - run: mv out/iib_api_server.exe vue/src-tauri/iib_api_server-x86_64-pc-windows-msvc.exe
56
+ if: matrix.os == 'windows-latest'
57
+
58
+ - run: mv out/iib_api_server vue/src-tauri/iib_api_server-x86_64-unknown-linux-gnu
59
+ if: matrix.os == 'ubuntu-20.04'
60
+
61
+ - name: Install frontend dependencies
62
+ run: yarn install
63
+ working-directory: vue
64
+
65
+ - name: Rust setup
66
+ uses: dtolnay/rust-toolchain@stable
67
+
68
+ - name: Use Node.js
69
+ uses: actions/setup-node@v3
70
+ with:
71
+ node-version: 18
72
+
73
+ - name: Rust cache
74
+ uses: swatinem/rust-cache@v2
75
+ with:
76
+ workspaces: './vue/src-tauri -> target'
77
+
78
+ - name: Install dependencies (ubuntu only)
79
+ if: matrix.os == 'ubuntu-20.04'
80
+ run: |
81
+ sudo apt-get update
82
+ sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
83
+
84
+ - name: Build the app
85
+ run: |
86
+ yarn tauri-build
87
+ working-directory: vue
88
+
89
+
90
+ - name: Upload Artifacts
91
+ uses: actions/upload-artifact@v3
92
+ with:
93
+ name: bundle-${{ env.VERSION }}-${{ runner.os }}
94
+ path: |
95
+ vue/src-tauri/target/release/bundle/nsis/Infinite Image Browsing_${{ env.VERSION }}_x64-setup.exe
96
+ vue/src-tauri/target/release/bundle/deb/infinite-image-browsing_${{ env.VERSION }}_amd64.deb
97
+
98
+ release:
99
+ needs: build
100
+ runs-on: ubuntu-latest
101
+
102
+ permissions:
103
+ contents: write
104
+ steps:
105
+ - name: Check-out repository
106
+ uses: actions/checkout@v3
107
+ - run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> "$GITHUB_ENV"
108
+
109
+ - name: Delete drafts
110
+ uses: hugo19941994/[email protected]
111
+ env:
112
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113
+
114
+ - uses: actions/download-artifact@v3
115
+ with:
116
+ name: bundle-${{ env.VERSION }}-Windows
117
+ path: artifacts
118
+
119
+ - uses: actions/download-artifact@v3
120
+ with:
121
+ name: bundle-${{ env.VERSION }}-Linux
122
+ path: artifacts
123
+
124
+ - name: Release
125
+ uses: softprops/action-gh-release@v1
126
+ with:
127
+ draft: true
128
+ tag_name: v${{ env.VERSION }}
129
+ files: artifacts/**/*
130
+
extensions/sd-webui-infinite-image-browsing/.gitignore ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ *.log
3
+ __pycache__
4
+ iib.db
5
+ tags-translate.csv
6
+ launch.sh
7
+ conf.json
8
+ iib.db-journal
9
+ .env
10
+ standalone.cmd
11
+ .vscode
12
+ build/**/*
13
+ dist/**/*
14
+ *.spec
15
+ out/**/*
16
+ venv/**/*
17
+ zip_temp/*.zip
extensions/sd-webui-infinite-image-browsing/.vscode/settings.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "ms-python.black-formatter"
4
+ },
5
+ "python.formatting.provider": "none"
6
+ }
extensions/sd-webui-infinite-image-browsing/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 zanllp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
extensions/sd-webui-infinite-image-browsing/README-zh.md ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ # Stable-Diffusion-WebUI无边图像浏览
4
+
5
+ > 百度云部分已独立,如果你有需要请[点此单独安装](https://github.com/zanllp/sd-webui-baidu-netdisk)
6
+
7
+ [查看近期更新](https://github.com/zanllp/sd-webui-infinite-image-browsing/wiki/Change-log)
8
+
9
+ <p style="text-align:center;margin:0 32px">不仅仅是图像浏览器,更是一个强大的图像管理器。精确的图像搜索配合多选操作进行筛选/归档/打包,成倍提高效率。更是支持以独立模式运行,无需SD-Webui</p>
10
+
11
+
12
+
13
+ https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/807b890b-7be8-4816-abba-f3ad340a2232
14
+
15
+
16
+ ## 主要特性
17
+
18
+ ### 🔥 极佳性能
19
+ - 存在缓存的情况下后,图像可以在几毫秒内显示。
20
+ - 默认使用缩略图显示图像,默认大小为512像素,您可以在全局设置页中调整缩略图分辨率。
21
+ - 你还可以控制网格图像的宽度,允许以64px到1024px的宽度范围进行显示
22
+
23
+ ### 🔍 图像搜索和收藏
24
+ - 将会把Prompt、Model、Lora等信息转成标签,将根据使用频率排序以供进行精确的搜索。
25
+ - 支持标签自动完成、[翻译](https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/39)和自定义。
26
+ - 可通过在右键菜单切换自定义标签来实现图像收藏。
27
+ - 支持类似谷歌的高级搜索。
28
+ - 同样支持模糊搜索,您可以使用文件名或生成信息的一部分进行搜索。
29
+ - 支持添加自定义搜索路径,方便管理自己创建的文件夹集合。
30
+
31
+ ### 🖼️ 查看图像/视频和“发送到”
32
+ - 支持查看图像生成信息。全屏预览下同样支持。
33
+ - 支持将图像发送到其他选项卡和其他插件,例如 ControlNet, openOutpaint。
34
+ - 支持全屏预览,并且支持在全屏预览下使用自定义快捷键进行操作
35
+ - 支持在全屏预览模式下通过按下方向键或点击按钮移动到前一个或后一个图像。
36
+ - 支持播放远程服务器上的视频文件
37
+
38
+ ### 💻 多种使用方法
39
+ - 您可以将其作为 SD-webui 的扩展安装。
40
+ - 您可以使用 Python 独立运行它。
41
+ - 还提供桌面应用程序版本。
42
+
43
+ ### 🚶‍♀️ Walk模式
44
+ - 自动加载下一个文件夹 `(类似于 os.walk)`,可让您无需分页浏览所有图像。
45
+ - 已测试可正常处理超过 27,000 个文件。
46
+
47
+ ### 🌳 基于文件树结构的预览和文件操作
48
+ - 支持基于文件树结构的预览。
49
+ - 支持自动刷新。
50
+ - 支持基本文件操作以及多选删除/移动/复制,新建文件夹等。
51
+ - 按住 Ctrl、Shift 或 Cmd 键可选择多个项目。
52
+
53
+ ### 🆚 图像对比 (类似ImgSli)
54
+ - 提供两张图片的并排比较
55
+
56
+ ### 🌐 多语言支持
57
+ - 目前支持简体中文/繁体中文/英文/德语。
58
+ - 如果您希望添加新的语言,请参考 [i18n.ts](https://github.com/zanllp/sd-webui-infinite-image-browsing/blob/main/vue/src/i18n/zh-hans.ts) 并提交相关的代码。
59
+
60
+
61
+ ### 🔐 隐私和安全
62
+ - 支持自定义secret key来进行身份验证
63
+ - 支持配置对文件系统的访问控制,默认将在服务允许公开访问时启用
64
+ - 支持自定义访问控制允许的路径。
65
+ - 支持控制访问权限。你可以让IIB以只读模式运行
66
+ - [点击这里查看详情](.env.example)
67
+
68
+ ### ⌨️ 快捷键
69
+ - 支持删除和添加/移除Tag,在全局设置页进行自定义触发按钮
70
+
71
+ ### 📦 打包 / 批量下载
72
+ - 允许你一次性打包下载多个图像
73
+ - 数据来源可以是搜索结果/普通的图像网格查看页面/walk模式等。使用拖拽或者“发送到”都可将图片添加待处理列表
74
+
75
+
76
+ 如果您喜欢这个项目并且觉得它对您有帮助,请考虑给我点个⭐️。这将对我持续开发和维护这个项目非常重要。如果您有任何建议或者想法,请随时在issue中提出,我会尽快回复。再次感谢您的支持!
77
+
78
+
79
+ <a href='https://ko-fi.com/zanllp' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' />
80
+
81
+
82
+ [视频演示可以在Bilibili上观看](https://space.bilibili.com/27227392/channel/series)
83
+ # 安装/运行
84
+
85
+ ## 作为SD-webui的扩展程序:
86
+ 1. 在SD-webui中打开`扩展`选项卡。
87
+ 2. 选择`从URL安装`选项。
88
+ 3. 输入 `https://github.com/zanllp/sd-webui-infinite-image-browsing`。
89
+ 4. 点击`安装`按钮。
90
+ 5. 等待安装完成,然后点击`应用并重启UI`。
91
+
92
+ ## 作为使用Python运行的独立程序(不需要SD-webui):
93
+ 请参考[Can the extension function without the web UI?](https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/47)
94
+
95
+ 如果需要查看ComfyUI生成的图片相关,请先参考 https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/202
96
+
97
+ 如果你需要dockerfile 参考 https://github.com/zanllp/sd-webui-infinite-image-browsing/discussions/366
98
+
99
+ ## 作为桌面应用程序(不需要SD-webui和Python):
100
+
101
+ 从仓库页面右侧的`releases`部分下载并���装程序。如果提升检测到病毒忽略即可这是误报。
102
+ # 预览
103
+
104
+ <img width="1920" alt="image" src="https://user-images.githubusercontent.com/25872019/230064374-47ba209e-562b-47b8-a2ce-d867e3afe204.png">
105
+
106
+ ## 图像搜索
107
+
108
+ 在第一次使用时,你需要点击等待索引的生成,我2万张图像的情况下大概需要15秒(配置是amd 5600x和pcie ssd)。后续使用他会检查文件夹是否发生变化,如果发生变化则需要重新生成索引,通常这个过程极快。
109
+
110
+ 图像搜索支持翻译,具体看这个 https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/39 。
111
+ <img width="1109" alt="image" src="https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/62d1ffe3-2d1f-4449-803a-970273753855">
112
+ <img width="620" alt="image" src="https://user-images.githubusercontent.com/25872019/234639759-2d270fe5-b24b-4542-b75a-a025ba78ec89.png">
113
+ ## 图像比较
114
+
115
+ ![ezgif com-video-to-gif](https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/4023317b-0b2d-41a3-8155-c4862eb43846)
116
+
117
+ ## 全屏预览
118
+ <img width="1024" alt="image" src="https://user-images.githubusercontent.com/25872019/232167416-32a8b19d-b766-4f98-88f6-a1d48eaebec0.png">
119
+
120
+ 在全屏预览下同样可以查看图片信息和进行上下文菜单上的的操作,支持拖拽/调整/展开收起
121
+
122
+ https://user-images.githubusercontent.com/25872019/235327735-bfb50ea7-7682-4e50-b303-38159456e527.mp4
123
+
124
+
125
+ 如果你和我一样不需要查看生成信息,你可以选择直接缩小这个面板,所有上下文操作仍然可用
126
+
127
+ <img width="599" alt="image" src="https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/f26abe8c-7a76-45c3-9d7f-18ae8b6b6a91">
128
+
129
+ ### 右键菜单
130
+ <img width="1024" alt="image" src="https://user-images.githubusercontent.com/25872019/230896820-26344b09-2297-4a2f-a6a7-4c2f0edb8a2c.png">
131
+
132
+ 也可以通过右上角的图标来触发
133
+ <img width="227" alt="image" src="https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/f2005ad3-2d3b-4fa7-b3e5-bc17f26f7e19">
134
+
135
+ ### Walk模式
136
+
137
+
138
+ https://user-images.githubusercontent.com/25872019/230768207-daab786b-d4ab-489f-ba6a-e9656bd530b8.mp4
139
+
140
+
141
+
142
+
143
+ ### 深色模式
144
+
145
+ <img width="768" alt="image" src="https://user-images.githubusercontent.com/25872019/230064879-c95866ac-999d-4d4b-87ea-3e38c8479415.png">
146
+
147
+
extensions/sd-webui-infinite-image-browsing/README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [中文文档](./README-zh.md)
2
+
3
+ [View recent updates (Change log)](https://github.com/zanllp/sd-webui-infinite-image-browsing/wiki/Change-log)
4
+
5
+ # Stable Diffusion webui Infinite Image Browsing
6
+
7
+ <p style="text-align:center;margin:0 32px;">It's not just an image browser, but also a powerful image manager. Precise image search combined with multi-selection operations allows for filtering/archiving/packaging, greatly increasing efficiency. It also supports running in standalone mode, without the need for SD-Webui.</p>
8
+
9
+ https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/807b890b-7be8-4816-abba-f3ad340a2232
10
+ ## Key Features
11
+
12
+ ### 🔥 Excellent Performance
13
+ - Once caching is generated, images can be displayed in just a few milliseconds.
14
+ - Images are displayed with thumbnails by default, with a default size of 512 pixels. You can adjust the thumbnail resolution on the global settings page.
15
+ - You can also control the width of the grid images, allowing them to be displayed in widths ranging from 64px to 1024px.
16
+
17
+ ### 🔍 Image Search & Favorite
18
+ - The prompt, model, Lora, and other information will be converted into tags and sorted by frequency of use for precise searching.
19
+ - Supports tag autocomplete, [auto-translation](https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/39), and customization.
20
+ - Image favorite can be achieved by toggling custom tags for images in the right-click menu.
21
+ - Support for advanced search similar to Google
22
+ - Also supports fuzzy search, you can search by a part of the filename or generated information.
23
+ - Support adding custom search paths for easy management of folders created by the user.
24
+
25
+ ### 🖼️ View Images/Videos & `Send To`
26
+ - Supports viewing image generation information. Also supported in full-screen preview mode.
27
+ - Supports sending images to other tabs and third-party extensions such as ControlNet , openOutpaint.
28
+ - Support full-screen preview and enable custom shortcut key operations while in full-screen preview mode.
29
+ - Support navigating to the previous or next image in full-screen preview mode by pressing arrow keys or clicking buttons.
30
+ - Support playing video files from a remote server.
31
+
32
+ ### 💻 Multiple Usage Methods
33
+ - You can install it as an extension on SD-webui.
34
+ - You can run it independently using Python.
35
+ - The desktop app version is also available.
36
+
37
+
38
+ ### 🚶‍♀️ Walk Mode
39
+ - Automatically load the next folder `(similar to os.walk)`, allowing you to browse all images without paging.
40
+ - Tested to work properly with over 27,000 files.
41
+
42
+ ### 🌳 Preview based on File Tree Structure & File operations
43
+ - Supports file tree-based preview.
44
+ - Supports automatic refreshing.
45
+ - Supports basic file operations, such as multiple selection for deleting/moving/copying, and creating new folders.
46
+ - Hold down the Ctrl, Shift, or Cmd key to select multiple items.
47
+
48
+ ### 🆚 image comparison (similar to Imgsli)
49
+ - Provides a side-by-side comparison of two images.
50
+
51
+ ### 🌐 Multilingual Support
52
+ - Currently supports Simplified Chinese/Traditional Chinese/English/German.
53
+ - If you would like to add a new language, please refer to [i18n.ts](https://github.com/zanllp/sd-webui-infinite-image-browsing/blob/main/vue/src/i18n/zh-hans.ts) and submit the relevant code.
54
+
55
+ ### 🔐 Privacy and Security
56
+ - Supports custom secret key for authentication.
57
+ - Supports configuring access control for the file system, which will be enabled by default when the service allows public access.
58
+ - Supports customizing the allowed paths for access control.
59
+ - Supports controlling access permissions. You can run IIB in read-only mode.
60
+ - [Click here to see details](.env.example)
61
+
62
+
63
+ ### 📦 Packaging/Batch Download
64
+ - Allows you to download multiple images at once.
65
+ - The data source can be search results, a regular image grid view page, walk mode, etc. Images can be added to the processing list through drag-and-drop or "Send To".
66
+ ### ⌨️ Keyboard Shortcuts
67
+ - Allows for deleting and adding/removing tags, with customizable trigger buttons in the global settings page.
68
+
69
+
70
+ If you like this project and find it helpful, please consider giving it a ⭐️. This would be very important for me to continue developing and maintaining this project. If you have any suggestions or ideas, please feel free to raise them in the issue section, and I will respond as soon as possible. Thank you again for your support!
71
+
72
+
73
+ <a href='https://ko-fi.com/zanllp' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' />
74
+
75
+
76
+
77
+ # Installation / Running
78
+ ## As an extension for SD-webui:
79
+ 1. Open the `Extensions` tab in SD-webui.
80
+ 2. Select the `Install from URL` option.
81
+ 3. Enter `https://github.com/zanllp/sd-webui-infinite-image-browsing`.
82
+ 4. Click on the `Install` button.
83
+ 5. Wait for the installation to complete and click on `Apply and restart UI`.
84
+
85
+ ## As a standalone program that runs using Python. (without SD-webui):
86
+
87
+ Refer to [Can the extension function without the web UI?](https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/47)
88
+
89
+ If you need to view images generated by ComfyUI, please refer to https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/202.
90
+
91
+ If you need a Dockerfile, you can refer to this link. https://github.com/zanllp/sd-webui-infinite-image-browsing/discussions/366
92
+
93
+ ## As a desktop application (without SD-webui and Python):
94
+ Download and install the program from the `releases` section on the right-hand side of the repository page.
95
+ If the antivirus detects a virus, it can be ignored as a false positive.
96
+ # Preview
97
+
98
+ <img width="1920" alt="image" src="https://user-images.githubusercontent.com/25872019/232167682-67f83b00-4391-4394-a7f6-6e4c9d11f252.png">
99
+
100
+ ## Image Search
101
+
102
+ During the first use, you need to click and wait for the index generation. For my case with 20,000 images, it took about 15 seconds (with an AMD 5600X CPU and PCIe SSD). For subsequent uses, it will check whether there are changes in the folder, and if so, it needs to regenerate the index. Usually, this process is very fast.
103
+
104
+ Image search supports translation, see https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/39 for more detail. Feel free to share files for other languages to facilitate everyone's use.
105
+ <img width="1109" alt="image" src="https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/62d1ffe3-2d1f-4449-803a-970273753855">
106
+ <img width="620" alt="image" src="https://user-images.githubusercontent.com/25872019/234639759-2d270fe5-b24b-4542-b75a-a025ba78ec89.png">
107
+
108
+ ## Full Screen Preview
109
+
110
+ <img width="1024" alt="image" src="https://user-images.githubusercontent.com/25872019/232167416-32a8b19d-b766-4f98-88f6-a1d48eaebec0.png">
111
+
112
+ In full-screen preview mode, you can also view image information and perform operations on the context menu. It supports dragging, resizing and expanding/collapsing .
113
+
114
+ https://user-images.githubusercontent.com/25872019/235327735-bfb50ea7-7682-4e50-b303-38159456e527.mp4
115
+
116
+ If you, like me, don't need to view the generation information, you can choose to simply minimize this panel, and all contextual operations will still be available.
117
+
118
+ <img width="599" alt="image" src="https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/f26abe8c-7a76-45c3-9d7f-18ae8b6b6a91">
119
+
120
+ ## Image comparison
121
+
122
+ ![ezgif com-video-to-gif](https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/4023317b-0b2d-41a3-8155-c4862eb43846)
123
+ ## Transfer files between different tab panes.
124
+ https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/e631e3c3-1cbf-49bc-8577-f2963a6c9e4d
125
+ ### Right-click menu
126
+ <img width="536" alt="image" src="https://user-images.githubusercontent.com/25872019/232162244-e728d510-b6c6-45e6-afb3-872bd67db05b.png">
127
+
128
+ You can also trigger it by hovering your mouse over the icon in the top right corner.
129
+
130
+ <img width="227" alt="image" src="https://github.com/zanllp/sd-webui-infinite-image-browsing/assets/25872019/f2005ad3-2d3b-4fa7-b3e5-bc17f26f7e19">
131
+
132
+ ### Walk mode
133
+
134
+
135
+ https://user-images.githubusercontent.com/25872019/230768207-daab786b-d4ab-489f-ba6a-e9656bd530b8.mp4
136
+
137
+
138
+
139
+
140
+ ### Dark mode
141
+
142
+ <img width="768" alt="image" src="https://user-images.githubusercontent.com/25872019/230064879-c95866ac-999d-4d4b-87ea-3e38c8479415.png">
extensions/sd-webui-infinite-image-browsing/app.py ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+ from fastapi import FastAPI
3
+ from fastapi.responses import FileResponse
4
+ import uvicorn
5
+ import os
6
+ from scripts.iib.api import infinite_image_browsing_api, index_html_path
7
+ from scripts.iib.tool import get_sd_webui_conf, get_valid_img_dirs, sd_img_dirs, normalize_paths
8
+ from scripts.iib.db.datamodel import DataBase, Image
9
+ from scripts.iib.db.update_image_data import update_image_data
10
+ import argparse
11
+ from typing import Optional, Coroutine
12
+ import json
13
+
14
+ tag = "\033[31m[warn]\033[0m"
15
+
16
+ default_port = 8000
17
+ default_host = "127.0.0.1"
18
+
19
+
20
+ def sd_webui_paths_check(sd_webui_config: str, relative_to_config: bool):
21
+ conf = {}
22
+ with open(sd_webui_config, "r") as f:
23
+ conf = json.loads(f.read())
24
+ if relative_to_config:
25
+ for dir in sd_img_dirs:
26
+ if not os.path.isabs(conf[dir]):
27
+ conf[dir] = os.path.normpath(
28
+ os.path.join(sd_webui_config, "../", conf[dir])
29
+ )
30
+ paths = [conf.get(key) for key in sd_img_dirs]
31
+ paths_check(paths)
32
+
33
+
34
+ def paths_check(paths):
35
+ for path in paths:
36
+ if not path or len(path.strip()) == 0:
37
+ continue
38
+ if os.path.isabs(path):
39
+ abs_path = path
40
+ else:
41
+ abs_path = os.path.join(os.getcwd(), path)
42
+ if not os.path.exists(abs_path):
43
+ print(f"{tag} The path '{abs_path}' will be ignored (value: {path}).")
44
+
45
+
46
+ def do_update_image_index(sd_webui_config: str, relative_to_config=False):
47
+ dirs = get_valid_img_dirs(
48
+ get_sd_webui_conf(
49
+ sd_webui_config=sd_webui_config,
50
+ sd_webui_path_relative_to_config=relative_to_config,
51
+ )
52
+ )
53
+ if not len(dirs):
54
+ return print(f"{tag} no valid image directories, skipped")
55
+ conn = DataBase.get_conn()
56
+ update_image_data(dirs)
57
+ if Image.count(conn=conn) == 0:
58
+ return print(f"{tag} it appears that there is some issue")
59
+ print("update image index completed. ✨")
60
+
61
+
62
+ class AppUtils:
63
+ def __init__(
64
+ self,
65
+ sd_webui_config: Optional[str] = None,
66
+ update_image_index: bool = False,
67
+ extra_paths: List[str] = [],
68
+ sd_webui_path_relative_to_config=False,
69
+ allow_cors=False,
70
+ enable_shutdown=False,
71
+ sd_webui_dir: Optional[str] = None,
72
+ ):
73
+ """
74
+ Parameter definitions can be found by running the `python app.py -h `command or by examining the setup_parser() function.
75
+ """
76
+ self.sd_webui_config = sd_webui_config
77
+ self.update_image_index = update_image_index
78
+ self.extra_paths = extra_paths
79
+ self.sd_webui_path_relative_to_config = sd_webui_path_relative_to_config
80
+ self.allow_cors = allow_cors
81
+ self.enable_shutdown = enable_shutdown
82
+ self.sd_webui_dir = sd_webui_dir
83
+ if sd_webui_dir:
84
+ DataBase.path = os.path.join(
85
+ sd_webui_dir, "extensions/sd-webui-infinite-image-browsing/iib.db"
86
+ )
87
+ self.sd_webui_config = os.path.join(sd_webui_dir, "config.json")
88
+ self.sd_webui_path_relative_to_config = True
89
+
90
+ def set_params(self, *args, **kwargs) -> None:
91
+ """改变参数,与__init__的行为一致"""
92
+ self.__init__(*args, **kwargs)
93
+
94
+ @staticmethod
95
+ def async_run(app: FastAPI, port: int = default_port, host = default_host) -> Coroutine:
96
+ """
97
+ 用于从异步运行的 FastAPI,在 Jupyter Notebook 环境中非常有用
98
+ """
99
+ # 不建议改成 async def,并且用 await 替换 return,
100
+ # 因为这样会失去对 server.serve() 的控制。
101
+ config = uvicorn.Config(app, host=host, port=port)
102
+ server = uvicorn.Server(config)
103
+ return server.serve()
104
+
105
+ def wrap_app(self, app: FastAPI) -> None:
106
+ """
107
+ 为传递的app挂载上infinite_image_browsing后端
108
+ """
109
+ sd_webui_config = self.sd_webui_config
110
+ update_image_index = self.update_image_index
111
+ extra_paths = self.extra_paths
112
+
113
+ if sd_webui_config:
114
+ sd_webui_paths_check(sd_webui_config, self.sd_webui_path_relative_to_config)
115
+ if update_image_index:
116
+ do_update_image_index(
117
+ sd_webui_config, self.sd_webui_path_relative_to_config
118
+ )
119
+ paths_check(extra_paths)
120
+
121
+ infinite_image_browsing_api(
122
+ app,
123
+ sd_webui_config=sd_webui_config,
124
+ extra_paths_cli=normalize_paths(extra_paths, os.getcwd()),
125
+ sd_webui_path_relative_to_config=self.sd_webui_path_relative_to_config,
126
+ allow_cors=self.allow_cors,
127
+ enable_shutdown=self.enable_shutdown,
128
+ launch_mode="server",
129
+ )
130
+
131
+ def get_root_browser_app(self) -> FastAPI:
132
+ """
133
+ 获取首页挂载在"/"上的infinite_image_browsing FastAPI实例
134
+ """
135
+ app = FastAPI()
136
+
137
+ # 用于在首页显示
138
+ @app.get("/")
139
+ def index():
140
+ return FileResponse(index_html_path)
141
+
142
+ self.wrap_app(app)
143
+ return app
144
+
145
+
146
+ def setup_parser() -> argparse.ArgumentParser:
147
+ parser = argparse.ArgumentParser(
148
+ description="A fast and powerful image browser for Stable Diffusion webui."
149
+ )
150
+ parser.add_argument(
151
+ "--host", type=str, default=default_host, help="The host to use"
152
+ )
153
+ parser.add_argument(
154
+ "--port", type=int, help="The port to use", default=default_port
155
+ )
156
+ parser.add_argument(
157
+ "--sd_webui_config", type=str, default=None, help="The path to the config file"
158
+ )
159
+ parser.add_argument(
160
+ "--update_image_index", action="store_true", help="Update the image index"
161
+ )
162
+ parser.add_argument(
163
+ "--extra_paths",
164
+ nargs="+",
165
+ help="Extra paths to use, will be added to Quick Move.",
166
+ default=[],
167
+ )
168
+ parser.add_argument(
169
+ "--sd_webui_path_relative_to_config",
170
+ action="store_true",
171
+ help="Use the file path of the sd_webui_config file as the base for all relative paths provided within the sd_webui_config file.",
172
+ )
173
+ parser.add_argument(
174
+ "--allow_cors",
175
+ action="store_true",
176
+ help="Allow Cross-Origin Resource Sharing (CORS) for the API.",
177
+ )
178
+ parser.add_argument(
179
+ "--enable_shutdown",
180
+ action="store_true",
181
+ help="Enable the shutdown endpoint.",
182
+ )
183
+ parser.add_argument(
184
+ "--sd_webui_dir",
185
+ type=str,
186
+ default=None,
187
+ help="The path to the sd_webui folder. When specified, the sd_webui's configuration will be used and the extension must be installed within the sd_webui. Data will be shared between the two.",
188
+ )
189
+ return parser
190
+
191
+
192
+ def launch_app(port: int = default_port, host: str = default_host, *args, **kwargs: dict) -> None:
193
+ """
194
+ Launches the application on the specified port.
195
+
196
+ Args:
197
+ **kwargs (dict): Optional keyword arguments that can be used to configure the application.
198
+ These can be viewed by running 'python app.py -h' or by checking the setup_parser() function.
199
+ """
200
+ app_utils = AppUtils(*args, **kwargs)
201
+ app = app_utils.get_root_browser_app()
202
+ uvicorn.run(app, host=host, port=port)
203
+
204
+
205
+ async def async_launch_app(port: int = default_port, host: str = default_host, *args, **kwargs: dict) -> None:
206
+ """
207
+ Asynchronously launches the application on the specified port.
208
+
209
+ Args:
210
+ **kwargs (dict): Optional keyword arguments that can be used to configure the application.
211
+ These can be viewed by running 'python app.py -h' or by checking the setup_parser() function.
212
+ """
213
+ app_utils = AppUtils(*args, **kwargs)
214
+ app = app_utils.get_root_browser_app()
215
+ await app_utils.async_run(app, host=host, port=port)
216
+
217
+
218
+ if __name__ == "__main__":
219
+ parser = setup_parser()
220
+ args = parser.parse_args()
221
+ launch_app(**vars(args))
extensions/sd-webui-infinite-image-browsing/install.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import launch
2
+ import os
3
+ import pkg_resources
4
+
5
+ req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
6
+
7
+ def dist2package(dist: str):
8
+ return ({
9
+ "pyfunctional": "functional",
10
+ "python-dotenv": "dotenv",
11
+ "Pillow": "PIL"
12
+ }).get(dist, dist)
13
+
14
+ # copy from controlnet, thanks
15
+ with open(req_file) as file:
16
+ for package in file:
17
+ try:
18
+ package = package.strip()
19
+ if '==' in package:
20
+ package_name, package_version = package.split('==')
21
+ installed_version = pkg_resources.get_distribution(package_name).version
22
+ if installed_version != package_version:
23
+ launch.run_pip(f"install {package}", f"sd-webui-infinite-image-browsing requirement: changing {package_name} version from {installed_version} to {package_version}")
24
+ elif not launch.is_installed(dist2package(package)):
25
+ launch.run_pip(f"install {package}", f"sd-webui-infinite-image-browsing requirement: {package}")
26
+ except Exception as e:
27
+ print(e)
28
+ print(f'Warning: Failed to install {package}, something may not work.')
extensions/sd-webui-infinite-image-browsing/javascript/index.js ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Promise.resolve().then(async () => {
2
+ /**
3
+ * This is a file generated using `yarn build`.
4
+ * If you want to make changes, please modify `index.tpl.js` and run the command to generate it again.
5
+ */
6
+ const html = `<!DOCTYPE html>
7
+ <html lang="en">
8
+ <head>
9
+ <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
10
+ <meta http-equiv="Expires" content="0" />
11
+ <meta charset="UTF-8" />
12
+ <link rel="icon" href="/favicon.ico" />
13
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
14
+ <title>Infinite Image Browsing</title>
15
+ <script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-7c0f3f3a.js"></script>
16
+ <link rel="stylesheet" href="/infinite_image_browsing/fe-static/assets/index-896679b3.css">
17
+ </head>
18
+
19
+ <body>
20
+ <div id="zanllp_dev_gradio_fe">
21
+ It seems to have failed to load. You can try refreshing the page. <br> If that doesn't work, click on <a href="https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/90" target="_blank" >FAQ</a> for help</div>
22
+ </div>
23
+
24
+ </body>
25
+ </html>
26
+ `
27
+ let containerSelector = '#infinite_image_browsing_container_wrapper'
28
+ let shouldMaximize = true
29
+
30
+ try {
31
+ containerSelector = __iib_root_container__
32
+ shouldMaximize = __iib_should_maximize__
33
+ } catch (e) {}
34
+
35
+ const delay = (timeout = 0) => new Promise((resolve) => setTimeout(resolve, timeout))
36
+ const asyncCheck = async (getter, checkSize = 100, timeout = 1000) => {
37
+ let target = getter()
38
+ let num = 0
39
+ while (checkSize * num < timeout && (target === undefined || target === null)) {
40
+ await delay(checkSize)
41
+ target = getter()
42
+ num++
43
+ }
44
+ return target
45
+ }
46
+ const getTabIdxById = (id) => {
47
+ const tabList = gradioApp().querySelectorAll('#tabs > .tabitem[id^=tab_]')
48
+ return Array.from(tabList).findIndex((v) => v.id.includes(id))
49
+ }
50
+
51
+ const switch2targetTab = (idx) => {
52
+ try {
53
+ gradioApp().querySelector('#tabs').querySelectorAll('button')[idx].click()
54
+ } catch (error) {
55
+ console.error(error)
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @type {HTMLDivElement}
61
+ */
62
+ const wrap = await asyncCheck(() => gradioApp().querySelector(containerSelector), 500, Infinity)
63
+ wrap.childNodes.forEach((v) => wrap.removeChild(v))
64
+ const iframe = document.createElement('iframe')
65
+ iframe.srcdoc = html
66
+ iframe.style = `width: 100%;height:100vh`
67
+ wrap.appendChild(iframe)
68
+
69
+ if (shouldMaximize) {
70
+ onUiTabChange(() => {
71
+ const el = get_uiCurrentTabContent()
72
+ if (el?.id.includes('infinite-image-browsing')) {
73
+ try {
74
+ const iibTop = gradioApp().querySelector('#iib_top')
75
+ if (!iibTop) {
76
+ throw new Error("element '#iib_top' is not found")
77
+ }
78
+ const topRect = iibTop.getBoundingClientRect()
79
+ wrap.style = `
80
+ top:${Math.max(48, topRect.top) - 10}px;
81
+ position: fixed;
82
+ left: 10px;
83
+ right: 10px;
84
+ z-index: 100;
85
+ width: unset;
86
+ bottom: 10px;`
87
+ iframe.style = `width: 100%;height:100%`
88
+ } catch (error) {
89
+ console.error('Error mounting IIB. Running fallback.', error)
90
+ wrap.style = ''
91
+ iframe.style = `width: 100%;height:100vh`
92
+ }
93
+ }
94
+ })
95
+ }
96
+
97
+ const IIB_container_id = [Date.now(), Math.random()].join()
98
+ window.IIB_container_id = IIB_container_id
99
+ const imgTransferBus = new BroadcastChannel('iib-image-transfer-bus')
100
+ imgTransferBus.addEventListener('message', async (ev) => {
101
+ const data = ev.data
102
+ if (
103
+ typeof data !== 'object' ||
104
+ (typeof data.IIB_container_id === 'string' && data.IIB_container_id !== IIB_container_id)
105
+ ) {
106
+ return
107
+ }
108
+ console.log(`iib-message:`, data)
109
+ const appDoc = gradioApp()
110
+ switch (data.event) {
111
+ case 'click_hidden_button': {
112
+ const btn = gradioApp().querySelector(`#${data.btnEleId}`)
113
+ btn.click()
114
+ break
115
+ }
116
+ case 'send_to_control_net': {
117
+ data.type === 'img2img' ? window.switch_to_img2img() : window.switch_to_txt2img()
118
+ await delay(100)
119
+ const cn = appDoc.querySelector(`#${data.type}_controlnet`)
120
+ const wrap = cn.querySelector('.label-wrap')
121
+ if (!wrap.className.includes('open')) {
122
+ wrap.click()
123
+ await delay(100)
124
+ }
125
+ wrap.scrollIntoView()
126
+ wrap.dispatchEvent(await createPasteEvent(data.url))
127
+ break
128
+ }
129
+ case 'send_to_outpaint': {
130
+ switch2targetTab(getTabIdxById('openOutpaint'))
131
+ await delay(100)
132
+ const iframe = appDoc.querySelector('#openoutpaint-iframe')
133
+ openoutpaint_send_image(await imgUrl2DataUrl(data.url))
134
+ iframe.contentWindow.postMessage({
135
+ key: appDoc.querySelector('#openoutpaint-key').value,
136
+ type: 'openoutpaint/set-prompt',
137
+ prompt: data.prompt,
138
+ negPrompt: data.negPrompt
139
+ })
140
+ break
141
+ }
142
+ }
143
+
144
+ function imgUrl2DataUrl(imgUrl) {
145
+ return new Promise((resolve, reject) => {
146
+ fetch(imgUrl)
147
+ .then((response) => response.blob())
148
+ .then((blob) => {
149
+ const reader = new FileReader()
150
+ reader.readAsDataURL(blob)
151
+ reader.onloadend = function () {
152
+ const dataURL = reader.result
153
+ resolve(dataURL)
154
+ }
155
+ })
156
+ .catch((error) => reject(error))
157
+ })
158
+ }
159
+
160
+ async function createPasteEvent(imgUrl) {
161
+ const response = await fetch(imgUrl)
162
+ const imageBlob = await response.blob()
163
+ const imageFile = new File([imageBlob], 'image.jpg', {
164
+ type: imageBlob.type,
165
+ lastModified: Date.now()
166
+ })
167
+ const dataTransfer = new DataTransfer()
168
+ dataTransfer.items.add(imageFile)
169
+ const pasteEvent = new ClipboardEvent('paste', {
170
+ clipboardData: dataTransfer,
171
+ bubbles: true
172
+ })
173
+ return pasteEvent
174
+ }
175
+ })
176
+ })
extensions/sd-webui-infinite-image-browsing/log.log ADDED
File without changes
extensions/sd-webui-infinite-image-browsing/requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn
3
+ piexif
4
+ python-dotenv
5
+ Pillow
6
+ pyfunctional
extensions/sd-webui-infinite-image-browsing/scripts/__pycache__/iib_setup.cpython-310.pyc ADDED
Binary file (2.38 kB). View file
 
extensions/sd-webui-infinite-image-browsing/scripts/iib/__pycache__/api.cpython-310.pyc ADDED
Binary file (28.6 kB). View file
 
extensions/sd-webui-infinite-image-browsing/scripts/iib/__pycache__/logger.cpython-310.pyc ADDED
Binary file (649 Bytes). View file
 
extensions/sd-webui-infinite-image-browsing/scripts/iib/__pycache__/tool.cpython-310.pyc ADDED
Binary file (14.6 kB). View file
 
extensions/sd-webui-infinite-image-browsing/scripts/iib/api.py ADDED
@@ -0,0 +1,887 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime, timedelta
2
+ import os
3
+ import shutil
4
+ import sqlite3
5
+ from scripts.iib.tool import (
6
+ comfyui_exif_data_to_str,
7
+ get_comfyui_exif_data,
8
+ human_readable_size,
9
+ is_img_created_by_comfyui,
10
+ is_img_created_by_comfyui_with_webui_gen_info,
11
+ is_valid_image_path,
12
+ temp_path,
13
+ read_sd_webui_gen_info_from_image,
14
+ get_formatted_date,
15
+ is_win,
16
+ cwd,
17
+ locale,
18
+ enable_access_control,
19
+ get_windows_drives,
20
+ get_sd_webui_conf,
21
+ get_valid_img_dirs,
22
+ open_folder,
23
+ get_img_geninfo_txt_path,
24
+ unique_by,
25
+ create_zip_file,
26
+ normalize_paths,
27
+ to_abs_path,
28
+ is_secret_key_required
29
+ )
30
+ from fastapi import FastAPI, HTTPException
31
+ from fastapi.staticfiles import StaticFiles
32
+ import asyncio
33
+ from typing import List, Optional
34
+ from pydantic import BaseModel
35
+ from fastapi.responses import FileResponse, JSONResponse
36
+ from PIL import Image
37
+ from fastapi import Depends, FastAPI, HTTPException, Request
38
+ from fastapi.middleware.cors import CORSMiddleware
39
+ import hashlib
40
+ from scripts.iib.db.datamodel import (
41
+ DataBase,
42
+ ExtraPathType,
43
+ Image as DbImg,
44
+ Tag,
45
+ Folder,
46
+ ImageTag,
47
+ ExtraPath,
48
+ FileInfoDict,
49
+ Cursor
50
+ )
51
+ from scripts.iib.db.update_image_data import update_image_data, rebuild_image_index
52
+ from scripts.iib.logger import logger
53
+ from functional import seq
54
+ import urllib.parse
55
+
56
+ index_html_path = os.path.join(cwd, "vue/dist/index.html") # 在app.py也被使用
57
+
58
+
59
+ send_img_path = {"value": ""}
60
+ mem = {"secret_key_hash": None, "extra_paths": [], "all_scanned_paths": []}
61
+ secret_key = os.getenv("IIB_SECRET_KEY")
62
+ if secret_key:
63
+ print("Secret key loaded successfully. ")
64
+
65
+ WRITEABLE_PERMISSIONS = ["read-write", "write-only"]
66
+
67
+ is_api_writeable = not (os.getenv("IIB_ACCESS_CONTROL_PERMISSION")) or (
68
+ os.getenv("IIB_ACCESS_CONTROL_PERMISSION") in WRITEABLE_PERMISSIONS
69
+ )
70
+ IIB_DEBUG=False
71
+
72
+
73
+ async def write_permission_required():
74
+ if not is_api_writeable:
75
+ error_msg = (
76
+ "User is not authorized to perform this action. Required permission: "
77
+ + ", ".join(WRITEABLE_PERMISSIONS)
78
+ )
79
+ raise HTTPException(status_code=403, detail=error_msg)
80
+
81
+
82
+ async def verify_secret(request: Request):
83
+ if not secret_key:
84
+ if is_secret_key_required:
85
+ raise HTTPException(status_code=400, detail={"type": "secret_key_required"})
86
+ return
87
+ token = request.cookies.get("IIB_S")
88
+ if not token:
89
+ raise HTTPException(status_code=401, detail="Unauthorized")
90
+ if not mem["secret_key_hash"]:
91
+ mem["secret_key_hash"] = hashlib.sha256(
92
+ (secret_key + "_ciallo").encode("utf-8")
93
+ ).hexdigest()
94
+ if mem["secret_key_hash"] != token:
95
+ raise HTTPException(status_code=401, detail="Unauthorized")
96
+
97
+
98
+ def infinite_image_browsing_api(app: FastAPI, **kwargs):
99
+ pre = "/infinite_image_browsing"
100
+
101
+ if IIB_DEBUG:
102
+ @app.exception_handler(Exception)
103
+ async def exception_handler(request: Request, exc: Exception):
104
+ error_msg = f"An exception occurred while processing {request.method} {request.url}: {exc}"
105
+ logger.error(error_msg)
106
+
107
+ return JSONResponse(
108
+ status_code=500, content={"message": "Internal Server Error"}
109
+ )
110
+ @app.middleware("http")
111
+ async def log_requests(request: Request, call_next):
112
+ path = request.url.path
113
+ if (
114
+ path.find("infinite_image_browsing/image-thumbnail") == -1
115
+ and path.find("infinite_image_browsing/file") == -1
116
+ and path.find("infinite_image_browsing/fe-static") == -1
117
+ ):
118
+ logger.info(f"Received request: {request.method} {request.url}")
119
+ if request.query_params:
120
+ logger.debug(f"Query Params: {request.query_params}")
121
+ if request.path_params:
122
+ logger.debug(f"Path Params: {request.path_params}")
123
+
124
+ try:
125
+ return await call_next(request)
126
+ except HTTPException as http_exc:
127
+ logger.warning(
128
+ f"HTTPException occurred while processing {request.method} {request.url}: {http_exc}"
129
+ )
130
+ raise http_exc
131
+ except Exception as exc:
132
+ logger.error(
133
+ f"An exception occurred while processing {request.method} {request.url}: {exc}"
134
+ )
135
+
136
+ if kwargs.get("allow_cors"):
137
+ app.add_middleware(
138
+ CORSMiddleware,
139
+ allow_origin_regex="^[\w./:-]+$",
140
+ allow_methods=["*"],
141
+ allow_headers=["*"],
142
+ )
143
+
144
+ def get_img_search_dirs():
145
+ try:
146
+ return get_valid_img_dirs(get_sd_webui_conf(**kwargs))
147
+ except Exception as e:
148
+ print(e)
149
+ return []
150
+
151
+ def update_all_scanned_paths():
152
+ allowed_paths = os.getenv("IIB_ACCESS_CONTROL_ALLOWED_PATHS")
153
+ if allowed_paths:
154
+ sd_webui_conf = get_sd_webui_conf(**kwargs)
155
+ path_config_key_map = {
156
+ "save": "outdir_save",
157
+ "extra": "outdir_extras_samples",
158
+ "txt2img": "outdir_txt2img_samples",
159
+ "img2img": "outdir_img2img_samples",
160
+ }
161
+
162
+ def path_map(path: str):
163
+ path = path.strip()
164
+ if path in path_config_key_map:
165
+ return sd_webui_conf.get(path_config_key_map.get(path))
166
+ return path
167
+
168
+ paths = normalize_paths(
169
+ seq(allowed_paths.split(","))
170
+ .map(path_map)
171
+ .filter(lambda x: x)
172
+ .to_list(),
173
+ os.getcwd()
174
+ )
175
+ else:
176
+ paths = (
177
+ get_img_search_dirs() + mem["extra_paths"] + kwargs.get("extra_paths_cli", [])
178
+ )
179
+ mem["all_scanned_paths"] = unique_by(paths)
180
+
181
+ update_all_scanned_paths()
182
+
183
+ def update_extra_paths(conn: sqlite3.Connection):
184
+ r = ExtraPath.get_extra_paths(conn)
185
+ mem["extra_paths"] = [x.path for x in r]
186
+ update_all_scanned_paths()
187
+
188
+ def safe_commonpath(seq):
189
+ try:
190
+ return os.path.commonpath(seq)
191
+ except Exception as e:
192
+ # logger.error(e)
193
+ return ""
194
+
195
+ def is_path_under_parents(path, parent_paths: List[str] = []):
196
+ """
197
+ Check if the given path is under one of the specified parent paths.
198
+ :param path: The path to check.
199
+ :param parent_paths: By default, all scanned paths are included in the list of parent paths
200
+ :return: True if the path is under one of the parent paths, False otherwise.
201
+ """
202
+ try:
203
+ if not parent_paths:
204
+ parent_paths = mem["all_scanned_paths"]
205
+ path = to_abs_path(path)
206
+ for parent_path in parent_paths:
207
+ if safe_commonpath([path, parent_path]) == parent_path:
208
+ return True
209
+ except Exception as e:
210
+ logger.error(e)
211
+ return False
212
+
213
+ def is_path_trusted(path: str):
214
+ if not enable_access_control:
215
+ return True
216
+ try:
217
+ parent_paths = mem["all_scanned_paths"]
218
+ path = to_abs_path(path)
219
+ for parent_path in parent_paths:
220
+ if len(path) <= len(parent_path):
221
+ if parent_path.startswith(path):
222
+ return True
223
+ else:
224
+ if path.startswith(parent_path):
225
+ return True
226
+ except:
227
+ pass
228
+ return False
229
+
230
+ def check_path_trust(path: str):
231
+ if not is_path_trusted(path):
232
+ raise HTTPException(status_code=403)
233
+
234
+ def filter_allowed_files(files: List[FileInfoDict]):
235
+ return [x for x in files if is_path_trusted(x["fullpath"])]
236
+
237
+ static_dir = f"{cwd}/vue/dist"
238
+ if os.path.exists(static_dir):
239
+ app.mount(
240
+ f"{pre}/fe-static",
241
+ StaticFiles(directory=static_dir),
242
+ name="infinite_image_browsing-fe-static",
243
+ )
244
+
245
+ @app.get(f"{pre}/hello")
246
+ async def greeting():
247
+ return "hello"
248
+
249
+ @app.get(f"{pre}/global_setting", dependencies=[Depends(verify_secret)])
250
+ async def global_setting():
251
+ all_custom_tags = []
252
+
253
+ extra_paths = []
254
+ try:
255
+ conn = DataBase.get_conn()
256
+ all_custom_tags = Tag.get_all_custom_tag(conn)
257
+ extra_paths = ExtraPath.get_extra_paths(conn) + [
258
+ ExtraPath(path, ExtraPathType.cli_only)
259
+ for path in kwargs.get("extra_paths_cli", [])
260
+ ]
261
+ update_extra_paths(conn)
262
+ except Exception as e:
263
+ print(e)
264
+ return {
265
+ "global_setting": get_sd_webui_conf(**kwargs),
266
+ "cwd": cwd,
267
+ "is_win": is_win,
268
+ "home": os.environ.get("USERPROFILE") if is_win else os.environ.get("HOME"),
269
+ "sd_cwd": os.getcwd(),
270
+ "all_custom_tags": all_custom_tags,
271
+ "extra_paths": extra_paths,
272
+ "enable_access_control": enable_access_control,
273
+ "launch_mode": kwargs.get("launch_mode", "sd"),
274
+ }
275
+
276
+ class DeleteFilesReq(BaseModel):
277
+ file_paths: List[str]
278
+
279
+ @app.post(
280
+ pre + "/delete_files",
281
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
282
+ )
283
+ async def delete_files(req: DeleteFilesReq):
284
+ conn = DataBase.get_conn()
285
+ for path in req.file_paths:
286
+ check_path_trust(path)
287
+ try:
288
+ if os.path.isdir(path):
289
+ if len(os.listdir(path)):
290
+ error_msg = (
291
+ "When a folder is not empty, it is not allowed to be deleted."
292
+ if locale == "en"
293
+ else "文件夹不为空时不允许删除。"
294
+ )
295
+ raise HTTPException(400, detail=error_msg)
296
+ shutil.rmtree(path)
297
+ else:
298
+ os.remove(path)
299
+ txt_path = get_img_geninfo_txt_path(path)
300
+ if txt_path:
301
+ os.remove(txt_path)
302
+ img = DbImg.get(conn, os.path.normpath(path))
303
+ if img:
304
+ logger.info("delete file: %s", path)
305
+ ImageTag.remove(conn, img.id)
306
+ DbImg.remove(conn, img.id)
307
+ except OSError as e:
308
+ # 处理删除失败的情况
309
+ logger.error("delete failed")
310
+ error_msg = (
311
+ f"Error deleting file {path}: {e}"
312
+ if locale == "en"
313
+ else f"删除文件 {path} 时出错:{e}"
314
+ )
315
+ raise HTTPException(400, detail=error_msg)
316
+
317
+ class CreateFoldersReq(BaseModel):
318
+ dest_folder: str
319
+
320
+ @app.post(
321
+ pre + "/mkdirs",
322
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
323
+ )
324
+ async def create_folders(req: CreateFoldersReq):
325
+ if enable_access_control:
326
+ if not is_path_under_parents(req.dest_folder):
327
+ raise HTTPException(status_code=403)
328
+ os.makedirs(req.dest_folder, exist_ok=True)
329
+
330
+ class MoveFilesReq(BaseModel):
331
+ file_paths: List[str]
332
+ dest: str
333
+ create_dest_folder: Optional[bool] = False
334
+
335
+ @app.post(
336
+ pre + "/copy_files",
337
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
338
+ )
339
+ async def copy_files(req: MoveFilesReq):
340
+ for path in req.file_paths:
341
+ check_path_trust(path)
342
+ try:
343
+ shutil.copy(path, req.dest)
344
+ txt_path = get_img_geninfo_txt_path(path)
345
+ if txt_path:
346
+ shutil.copy(txt_path, req.dest)
347
+ except OSError as e:
348
+ error_msg = (
349
+ f"Error copying file {path} to {req.dest}: {e}"
350
+ if locale == "en"
351
+ else f"复制文件 {path} 到 {req.dest} 时出错:{e}"
352
+ )
353
+ raise HTTPException(400, detail=error_msg)
354
+
355
+ @app.post(
356
+ pre + "/move_files",
357
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
358
+ )
359
+ async def move_files(req: MoveFilesReq):
360
+ if req.create_dest_folder:
361
+ os.makedirs(req.dest, exist_ok=True)
362
+ elif not os.path.isdir(req.dest):
363
+ error_msg = (
364
+ f"Destination folder {req.dest} does not exist."
365
+ if locale == "en"
366
+ else f"目标文件夹 {req.dest} 不存在。"
367
+ )
368
+ raise HTTPException(400, detail=error_msg)
369
+
370
+ conn = DataBase.get_conn()
371
+ for path in req.file_paths:
372
+ check_path_trust(path)
373
+ try:
374
+ ret_path = shutil.move(path, req.dest)
375
+ txt_path = get_img_geninfo_txt_path(path)
376
+ if txt_path:
377
+ shutil.move(txt_path, req.dest)
378
+ img = DbImg.get(conn, os.path.normpath(path))
379
+ if img:
380
+ img.update_path(conn, ret_path)
381
+ conn.commit()
382
+ except OSError as e:
383
+ error_msg = (
384
+ f"Error moving file {path} to {req.dest}: {e}"
385
+ if locale == "en"
386
+ else f"移动文件 {path} 到 {req.dest} 时出错:{e}"
387
+ )
388
+ raise HTTPException(400, detail=error_msg)
389
+
390
+ @app.get(pre + "/files", dependencies=[Depends(verify_secret)])
391
+ async def get_target_folder_files(folder_path: str):
392
+ files: List[FileInfoDict] = []
393
+ try:
394
+ if is_win and folder_path == "/":
395
+ for item in get_windows_drives():
396
+ files.append(
397
+ {"type": "dir", "size": "-", "name": item, "fullpath": item}
398
+ )
399
+ else:
400
+ if not os.path.exists(folder_path):
401
+ return {"files": []}
402
+ folder_path = to_abs_path(folder_path)
403
+ check_path_trust(folder_path)
404
+ folder_listing: List[os.DirEntry] = os.scandir(folder_path)
405
+ is_under_scanned_path = is_path_under_parents(folder_path)
406
+ for item in folder_listing:
407
+ if not os.path.exists(item.path):
408
+ continue
409
+ fullpath = os.path.normpath(item.path)
410
+ name = os.path.basename(item.path)
411
+ date = get_formatted_date(item.stat().st_mtime)
412
+ created_time = get_formatted_date(item.stat().st_ctime)
413
+ if item.is_file():
414
+ bytes = item.stat().st_size
415
+ size = human_readable_size(bytes)
416
+ files.append(
417
+ {
418
+ "type": "file",
419
+ "date": date,
420
+ "size": size,
421
+ "name": name,
422
+ "bytes": bytes,
423
+ "created_time": created_time,
424
+ "fullpath": fullpath,
425
+ "is_under_scanned_path": is_under_scanned_path,
426
+ }
427
+ )
428
+ elif item.is_dir():
429
+ files.append(
430
+ {
431
+ "type": "dir",
432
+ "date": date,
433
+ "created_time": created_time,
434
+ "size": "-",
435
+ "name": name,
436
+ "is_under_scanned_path": is_under_scanned_path,
437
+ "fullpath": fullpath,
438
+ }
439
+ )
440
+ except Exception as e:
441
+ # logger.error(e)
442
+ raise HTTPException(status_code=400, detail=str(e))
443
+
444
+ return {"files": filter_allowed_files(files)}
445
+
446
+ @app.get(pre + "/image-thumbnail", dependencies=[Depends(verify_secret)])
447
+ async def thumbnail(path: str, t: str, size: str = "256x256"):
448
+ check_path_trust(path)
449
+ if not temp_path:
450
+ return
451
+ # 生成缓存文件的路径
452
+ hash_dir = hashlib.md5((path + t).encode("utf-8")).hexdigest()
453
+ hash = hash_dir + size
454
+ cache_dir = os.path.join(temp_path, "iib_cache", hash_dir)
455
+ cache_path = os.path.join(cache_dir, f"{size}.webp")
456
+
457
+ # 如果缓存文件存在,则直接返回该文件
458
+ if os.path.exists(cache_path):
459
+ return FileResponse(
460
+ cache_path,
461
+ media_type="image/webp",
462
+ headers={"Cache-Control": "max-age=31536000", "ETag": hash},
463
+ )
464
+
465
+ # 如果缓存文件不存在,则生成缩略图并保存
466
+ with Image.open(path) as img:
467
+ w, h = size.split("x")
468
+ img.thumbnail((int(w), int(h)))
469
+ os.makedirs(cache_dir, exist_ok=True)
470
+ img.save(cache_path, "webp")
471
+
472
+ # 返回缓存文件
473
+ return FileResponse(
474
+ cache_path,
475
+ media_type="image/webp",
476
+ headers={"Cache-Control": "max-age=31536000", "ETag": hash},
477
+ )
478
+
479
+ @app.get(pre + "/file", dependencies=[Depends(verify_secret)])
480
+ async def get_file(path: str, t: str, disposition: Optional[str] = None):
481
+ filename = path
482
+ import mimetypes
483
+
484
+ check_path_trust(path)
485
+ if not os.path.exists(filename):
486
+ raise HTTPException(status_code=404)
487
+ if not os.path.isfile(filename):
488
+ raise HTTPException(status_code=400, detail=f"{filename} is not a file")
489
+ # 根据文件后缀名获取媒体类型
490
+ media_type, _ = mimetypes.guess_type(filename)
491
+ headers = {}
492
+ if disposition:
493
+ encoded_filename = urllib.parse.quote(disposition.encode('utf-8'))
494
+ headers['Content-Disposition'] = f"attachment; filename*=UTF-8''{encoded_filename}"
495
+
496
+ if is_path_under_parents(filename) and is_valid_image_path(
497
+ filename
498
+ ): # 认为永远不变,不要协商缓存了试试
499
+ headers[
500
+ "Cache-Control"
501
+ ] = "public, max-age=31536000" # 针对同样名字文件但实际上不同内容的文件要求必须传入创建时间来避免浏览器缓存
502
+ headers["Expires"] = (datetime.now() + timedelta(days=365)).strftime(
503
+ "%a, %d %b %Y %H:%M:%S GMT"
504
+ )
505
+
506
+ return FileResponse(
507
+ filename,
508
+ media_type=media_type,
509
+ headers=headers,
510
+ )
511
+
512
+ @app.post(pre + "/send_img_path", dependencies=[Depends(verify_secret)])
513
+ async def api_set_send_img_path(path: str):
514
+ send_img_path["value"] = path
515
+
516
+ # 等待图片信息生成完成
517
+ @app.get(pre + "/gen_info_completed", dependencies=[Depends(verify_secret)])
518
+ async def api_set_send_img_path():
519
+ for _ in range(30): # timeout 3s
520
+ if send_img_path["value"] == "": # 等待setup里面生成完成
521
+ return True
522
+ v = send_img_path["value"]
523
+ # is_dev and logger.info("gen_info_completed %s %s", _, v)
524
+ await asyncio.sleep(0.1)
525
+ return send_img_path["value"] == ""
526
+
527
+ @app.get(pre + "/image_geninfo", dependencies=[Depends(verify_secret)])
528
+ async def image_geninfo(path: str):
529
+ with Image.open(path) as img:
530
+ if is_img_created_by_comfyui(img):
531
+ if is_img_created_by_comfyui_with_webui_gen_info(img):
532
+ return read_sd_webui_gen_info_from_image(img, path)
533
+ else:
534
+ try:
535
+ params = get_comfyui_exif_data(img)
536
+ return comfyui_exif_data_to_str(params)
537
+ except:
538
+ logger.error('parse comfyui image failed. prompt:')
539
+ logger.error(img.info.get('prompt'))
540
+ return ''
541
+ else:
542
+ return read_sd_webui_gen_info_from_image(img, path)
543
+
544
+ class CheckPathExistsReq(BaseModel):
545
+ paths: List[str]
546
+
547
+ @app.post(pre + "/check_path_exists", dependencies=[Depends(verify_secret)])
548
+ async def check_path_exists(req: CheckPathExistsReq):
549
+ update_all_scanned_paths()
550
+ res = {}
551
+ for path in req.paths:
552
+ res[path] = os.path.exists(path) and is_path_trusted(path)
553
+ return res
554
+
555
+ @app.get(pre)
556
+ def index_bd():
557
+ return FileResponse(index_html_path)
558
+
559
+ class PathsReq(BaseModel):
560
+ paths: List[str]
561
+
562
+ class OpenFolderReq(BaseModel):
563
+ path: str
564
+
565
+ @app.post(
566
+ pre + "/open_folder",
567
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
568
+ )
569
+ def open_folder_using_explore(req: OpenFolderReq):
570
+ if not is_path_trusted(req.path):
571
+ raise HTTPException(status_code=403)
572
+ open_folder(*os.path.split(req.path))
573
+
574
+ @app.post(pre + "/shutdown")
575
+ async def shutdown_app():
576
+ # This API endpoint is mainly used as a sidecar in Tauri applications to shut down the application
577
+ if not kwargs.get("enable_shutdown"):
578
+ raise HTTPException(status_code=403, detail="Shutdown is disabled.")
579
+ os.kill(os.getpid(), 9)
580
+ return {"message": "Application is shutting down."}
581
+
582
+ @app.post(
583
+ pre + "/zip",
584
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
585
+ )
586
+ def zip_files(req: PathsReq):
587
+ now = datetime.now()
588
+ timestamp = now.strftime("%Y-%m-%d-%H-%M-%S")
589
+ zip_temp_dir = os.path.join(cwd, "zip_temp")
590
+ os.makedirs(zip_temp_dir, exist_ok=True)
591
+ file_path = os.path.join(zip_temp_dir, f"iib_batch_download_{timestamp}.zip")
592
+ create_zip_file(req.paths, file_path)
593
+ return FileResponse(file_path, media_type="application/zip")
594
+
595
+ db_pre = pre + "/db"
596
+
597
+ @app.get(db_pre + "/basic_info", dependencies=[Depends(verify_secret)])
598
+ async def get_db_basic_info():
599
+ conn = DataBase.get_conn()
600
+ img_count = DbImg.count(conn)
601
+ tags = Tag.get_all(conn)
602
+ expired_dirs = Folder.get_expired_dirs(conn)
603
+ return {
604
+ "img_count": img_count,
605
+ "tags": tags,
606
+ "expired": len(expired_dirs) != 0,
607
+ "expired_dirs": expired_dirs,
608
+ }
609
+
610
+ @app.get(db_pre + "/expired_dirs", dependencies=[Depends(verify_secret)])
611
+ async def get_db_expired():
612
+ conn = DataBase.get_conn()
613
+ expired_dirs = Folder.get_expired_dirs(conn)
614
+ return {
615
+ "expired": len(expired_dirs) != 0,
616
+ "expired_dirs": expired_dirs,
617
+ }
618
+
619
+ @app.post(
620
+ db_pre + "/update_image_data",
621
+ dependencies=[Depends(verify_secret)],
622
+ )
623
+ async def update_image_db_data():
624
+ try:
625
+ DataBase._initing = True
626
+ conn = DataBase.get_conn()
627
+ img_count = DbImg.count(conn)
628
+ update_extra_paths(conn)
629
+ dirs = (
630
+ get_img_search_dirs() if img_count == 0 else Folder.get_expired_dirs(conn)
631
+ ) + mem["extra_paths"]
632
+
633
+ update_image_data(dirs)
634
+ finally:
635
+ DataBase._initing = False
636
+
637
+ class SearchBySubstrReq(BaseModel):
638
+ surstr: str
639
+ cursor: str
640
+ regexp: str
641
+ folder_paths: List[str] = None
642
+ size: Optional[int] = 200
643
+
644
+ @app.post(db_pre + "/search_by_substr", dependencies=[Depends(verify_secret)])
645
+ async def search_by_substr(req: SearchBySubstrReq):
646
+ if IIB_DEBUG:
647
+ logger.info(req)
648
+ conn = DataBase.get_conn()
649
+ folder_paths=normalize_paths(req.folder_paths, os.getcwd())
650
+ if(not folder_paths and req.folder_paths):
651
+ return { "files": [], "cursor": Cursor(has_next=False) }
652
+ imgs, next_cursor = DbImg.find_by_substring(
653
+ conn=conn,
654
+ substring=req.surstr,
655
+ cursor=req.cursor,
656
+ limit=req.size,
657
+ regexp=req.regexp,
658
+ folder_paths=folder_paths
659
+ )
660
+ return {
661
+ "files": filter_allowed_files([x.to_file_info() for x in imgs]),
662
+ "cursor": next_cursor
663
+ }
664
+
665
+ class MatchImagesByTagsReq(BaseModel):
666
+ and_tags: List[int]
667
+ or_tags: List[int]
668
+ not_tags: List[int]
669
+ cursor: str
670
+ folder_paths: List[str] = None
671
+ size: Optional[int] = 200
672
+
673
+ @app.post(db_pre + "/match_images_by_tags", dependencies=[Depends(verify_secret)])
674
+ async def match_image_by_tags(req: MatchImagesByTagsReq):
675
+ if IIB_DEBUG:
676
+ logger.info(req)
677
+ conn = DataBase.get_conn()
678
+ folder_paths=normalize_paths(req.folder_paths, os.getcwd())
679
+ if(not folder_paths and req.folder_paths):
680
+ return { "files": [], "cursor": Cursor(has_next=False) }
681
+ imgs, next_cursor = ImageTag.get_images_by_tags(
682
+ conn=conn,
683
+ tag_dict={"and": req.and_tags, "or": req.or_tags, "not": req.not_tags},
684
+ cursor=req.cursor,
685
+ folder_paths=folder_paths,
686
+ limit=req.size
687
+ )
688
+ return {
689
+ "files": filter_allowed_files([x.to_file_info() for x in imgs]),
690
+ "cursor": next_cursor
691
+ }
692
+
693
+ @app.get(db_pre + "/img_selected_custom_tag", dependencies=[Depends(verify_secret)])
694
+ async def get_img_selected_custom_tag(path: str):
695
+ path = os.path.normpath(path)
696
+ if not is_valid_image_path(path):
697
+ return []
698
+ conn = DataBase.get_conn()
699
+ update_extra_paths(conn)
700
+ if not is_path_under_parents(path):
701
+ return []
702
+ img = DbImg.get(conn, path)
703
+ if not img:
704
+ if DbImg.count(conn) == 0:
705
+ return []
706
+ update_image_data([os.path.dirname(path)])
707
+ img = DbImg.get(conn, path)
708
+ assert img
709
+ # tags = Tag.get_all_custom_tag()
710
+ return ImageTag.get_tags_for_image(conn, img.id, type="custom")
711
+
712
+ @app.post(db_pre + "/get_image_tags", dependencies=[Depends(verify_secret)])
713
+ async def get_img_tags(req: PathsReq):
714
+ conn = DataBase.get_conn()
715
+ return ImageTag.batch_get_tags_by_path(conn, req.paths)
716
+
717
+ class ToggleCustomTagToImgReq(BaseModel):
718
+ img_path: str
719
+ tag_id: int
720
+
721
+ @app.post(
722
+ db_pre + "/toggle_custom_tag_to_img",
723
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
724
+ )
725
+ async def toggle_custom_tag_to_img(req: ToggleCustomTagToImgReq):
726
+ conn = DataBase.get_conn()
727
+ path = os.path.normpath(req.img_path)
728
+ update_extra_paths(conn)
729
+ if not is_path_under_parents(path):
730
+ raise HTTPException(
731
+ 400,
732
+ '当前文件不在搜索路径内,你可以将它添加到扫描路径再尝试。在右上角的"更多"里面'
733
+ if locale == "zh"
734
+ else 'The current file is not within the scan path. You can add it to the scan path and try again. In the top right corner, click on "More".',
735
+ )
736
+ img = DbImg.get(conn, path)
737
+ if not img:
738
+ if DbImg.count(conn):
739
+ update_image_data([os.path.dirname(path)])
740
+ img = DbImg.get(conn, path)
741
+ else:
742
+ raise HTTPException(
743
+ 400,
744
+ "你需要先通过图像搜索页生成索引"
745
+ if locale == "zh"
746
+ else "You need to generate an index through the image search page first.",
747
+ )
748
+ tags = ImageTag.get_tags_for_image(
749
+ conn=conn, image_id=img.id, type="custom", tag_id=req.tag_id
750
+ )
751
+ is_remove = len(tags)
752
+ if is_remove:
753
+ ImageTag.remove(conn, img.id, tags[0].id)
754
+ else:
755
+ ImageTag(img.id, req.tag_id).save(conn)
756
+ conn.commit()
757
+ return {"is_remove": is_remove}
758
+
759
+ class BatchUpdateImageReq(BaseModel):
760
+ img_paths: List[str]
761
+ action: str
762
+ tag_id: int
763
+
764
+ @app.post(
765
+ db_pre + "/batch_update_image_tag",
766
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
767
+ )
768
+ async def batch_update_image_tag(req: BatchUpdateImageReq):
769
+ assert req.action in ["add", "remove"]
770
+ conn = DataBase.get_conn()
771
+ paths: List[str] = seq(req.img_paths).map(os.path.normpath).to_list()
772
+ update_extra_paths(conn)
773
+ for path in paths:
774
+ if not is_path_under_parents(path):
775
+ raise HTTPException(
776
+ 400,
777
+ '当前文件不在搜索路径内,你可以将它添加到扫描路径再尝试。在右上角的"更多"里面'
778
+ if locale == "zh"
779
+ else 'The current file is not within the scan path. You can add it to the scan path and try again. In the top right corner, click on "More".',
780
+ )
781
+ img = DbImg.get(conn, path)
782
+ if not img:
783
+ if DbImg.count(conn):
784
+ update_image_data([os.path.dirname(path)])
785
+ img = DbImg.get(conn, path)
786
+ else:
787
+ raise HTTPException(
788
+ 400,
789
+ "你需要先通过图像搜索页生成索引"
790
+ if locale == "zh"
791
+ else "You need to generate an index through the image search page first.",
792
+ )
793
+ try:
794
+ for path in paths:
795
+ img = DbImg.get(conn, path)
796
+ if req.action == "add":
797
+ ImageTag(img.id, req.tag_id).save_or_ignore(conn)
798
+ else:
799
+ ImageTag.remove(conn, img.id, req.tag_id)
800
+ finally:
801
+ conn.commit()
802
+
803
+ class AddCustomTagReq(BaseModel):
804
+ tag_name: str
805
+
806
+ @app.post(
807
+ db_pre + "/add_custom_tag",
808
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
809
+ )
810
+ async def add_custom_tag(req: AddCustomTagReq):
811
+ conn = DataBase.get_conn()
812
+ tag = Tag.get_or_create(conn, name=req.tag_name, type="custom")
813
+ conn.commit()
814
+ return tag
815
+
816
+ class RemoveCustomTagReq(BaseModel):
817
+ tag_id: str
818
+
819
+ @app.post(
820
+ db_pre + "/remove_custom_tag",
821
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
822
+ )
823
+ async def remove_custom_tag(req: RemoveCustomTagReq):
824
+ conn = DataBase.get_conn()
825
+ ImageTag.remove(conn, tag_id=req.tag_id)
826
+ Tag.remove(conn, req.tag_id)
827
+
828
+ class RemoveCustomTagFromReq(BaseModel):
829
+ img_id: int
830
+ tag_id: str
831
+
832
+ @app.post(
833
+ db_pre + "/remove_custom_tag_from_img",
834
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
835
+ )
836
+ async def remove_custom_tag_from_img(req: RemoveCustomTagFromReq):
837
+ conn = DataBase.get_conn()
838
+ ImageTag.remove(conn, image_id=req.img_id, tag_id=req.tag_id)
839
+
840
+
841
+
842
+
843
+ class ExtraPathModel(BaseModel):
844
+ path: str
845
+ type: Optional[ExtraPathType]
846
+
847
+ @app.post(
848
+ f"{db_pre}/extra_paths",
849
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
850
+ )
851
+ async def create_extra_path(extra_path: ExtraPathModel):
852
+ if enable_access_control:
853
+ if not is_path_under_parents(extra_path.path):
854
+ raise HTTPException(status_code=403)
855
+ conn = DataBase.get_conn()
856
+ path = ExtraPath(extra_path.path, extra_path.type)
857
+ try:
858
+ path.save(conn)
859
+ finally:
860
+ conn.commit()
861
+
862
+ @app.get(
863
+ f"{db_pre}/extra_paths",
864
+ dependencies=[Depends(verify_secret)],
865
+ )
866
+ async def read_extra_paths():
867
+ conn = DataBase.get_conn()
868
+ return ExtraPath.get_extra_paths(conn)
869
+
870
+ @app.delete(
871
+ f"{db_pre}/extra_paths",
872
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
873
+ )
874
+ async def delete_extra_path(extra_path: ExtraPathModel):
875
+ path = to_abs_path(extra_path.path)
876
+ conn = DataBase.get_conn()
877
+ ExtraPath.remove(conn, path, extra_path.type, img_search_dirs=get_img_search_dirs())
878
+
879
+
880
+ @app.post(
881
+ f"{db_pre}/rebuild_index",
882
+ dependencies=[Depends(verify_secret), Depends(write_permission_required)],
883
+ )
884
+ async def rebuild_index():
885
+ update_extra_paths(conn = DataBase.get_conn())
886
+ rebuild_image_index(search_dirs = get_img_search_dirs() + mem["extra_paths"])
887
+
extensions/sd-webui-infinite-image-browsing/scripts/iib/db/__pycache__/datamodel.cpython-310.pyc ADDED
Binary file (21.1 kB). View file
 
extensions/sd-webui-infinite-image-browsing/scripts/iib/db/__pycache__/update_image_data.cpython-310.pyc ADDED
Binary file (4.02 kB). View file
 
extensions/sd-webui-infinite-image-browsing/scripts/iib/db/datamodel.py ADDED
@@ -0,0 +1,685 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sqlite3 import Connection, connect
2
+ from enum import Enum
3
+ from typing import Dict, List, Optional, TypedDict
4
+ from scripts.iib.tool import (
5
+ cwd,
6
+ get_modified_date,
7
+ human_readable_size,
8
+ tags_translate,
9
+ is_dev,
10
+ find,
11
+ unique_by,
12
+ )
13
+ from contextlib import closing
14
+ import os
15
+ import threading
16
+ import re
17
+
18
+
19
+ class FileInfoDict(TypedDict):
20
+ type: str
21
+ date: float
22
+ size: int
23
+ name: str
24
+ bytes: bytes
25
+ created_time: float
26
+ fullpath: str
27
+
28
+
29
+ class Cursor:
30
+ def __init__(self, has_next=True, next=""):
31
+ self.has_next = has_next
32
+ self.next = next
33
+
34
+
35
+ class DataBase:
36
+ local = threading.local()
37
+
38
+ _initing = False
39
+
40
+ num = 0
41
+
42
+ path = "iib.db"
43
+
44
+ @classmethod
45
+ def get_conn(clz) -> Connection:
46
+ # for : sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread
47
+ if hasattr(clz.local, "conn"):
48
+ return clz.local.conn
49
+ else:
50
+ conn = clz.init()
51
+ clz.local.conn = conn
52
+
53
+ return conn
54
+
55
+ @classmethod
56
+ def init(clz):
57
+ # 创建连接并打开数据库
58
+ conn = connect(
59
+ clz.path if os.path.isabs(clz.path) else os.path.join(cwd, clz.path)
60
+ )
61
+
62
+ def regexp(expr, item):
63
+ if not isinstance(item, str):
64
+ return False
65
+ reg = re.compile(expr, flags=re.IGNORECASE | re.MULTILINE | re.DOTALL)
66
+ return reg.search(item) is not None
67
+
68
+ conn.create_function("regexp", 2, regexp)
69
+ try:
70
+ Folder.create_table(conn)
71
+ ImageTag.create_table(conn)
72
+ Tag.create_table(conn)
73
+ Image.create_table(conn)
74
+ ExtraPath.create_table(conn)
75
+ finally:
76
+ conn.commit()
77
+ clz.num += 1
78
+ if is_dev:
79
+ print(f"当前连接数{clz.num}")
80
+ return conn
81
+
82
+
83
+ class Image:
84
+ def __init__(self, path, exif=None, size=0, date="", id=None):
85
+ self.path = path
86
+ self.exif = exif
87
+ self.id = id
88
+ self.size = size
89
+ self.date = date
90
+
91
+ def to_file_info(self) -> FileInfoDict:
92
+ return {
93
+ "type": "file",
94
+ "id": self.id,
95
+ "date": self.date,
96
+ "created_date": self.date,
97
+ "size": human_readable_size(self.size),
98
+ "is_under_scanned_path": True,
99
+ "bytes": self.size,
100
+ "name": os.path.basename(self.path),
101
+ "fullpath": self.path,
102
+ }
103
+
104
+ def save(self, conn):
105
+ with closing(conn.cursor()) as cur:
106
+ cur.execute(
107
+ "INSERT OR REPLACE INTO image (path, exif, size, date) VALUES (?, ?, ?, ?)",
108
+ (self.path, self.exif, self.size, self.date),
109
+ )
110
+ self.id = cur.lastrowid
111
+
112
+ def update_path(self, conn: Connection, new_path: str):
113
+ self.path = os.path.normpath(new_path)
114
+ with closing(conn.cursor()) as cur:
115
+ cur.execute("UPDATE image SET path = ? WHERE id = ?", (self.path, self.id))
116
+
117
+ @classmethod
118
+ def get(cls, conn: Connection, id_or_path):
119
+ with closing(conn.cursor()) as cur:
120
+ cur.execute(
121
+ "SELECT * FROM image WHERE id = ? OR path = ?", (id_or_path, id_or_path)
122
+ )
123
+ row = cur.fetchone()
124
+ if row is None:
125
+ return None
126
+ else:
127
+ return cls.from_row(row)
128
+
129
+ @classmethod
130
+ def get_by_ids(cls, conn: Connection, ids: List[int]) -> List["Image"]:
131
+ if not ids:
132
+ return []
133
+
134
+ query = """
135
+ SELECT * FROM image
136
+ WHERE id IN ({})
137
+ """.format(
138
+ ",".join("?" * len(ids))
139
+ )
140
+
141
+ with closing(conn.cursor()) as cur:
142
+ cur.execute(query, ids)
143
+ rows = cur.fetchall()
144
+
145
+ images = []
146
+ for row in rows:
147
+ images.append(cls.from_row(row))
148
+ return images
149
+
150
+ @classmethod
151
+ def create_table(cls, conn):
152
+ with closing(conn.cursor()) as cur:
153
+ cur.execute(
154
+ """CREATE TABLE IF NOT EXISTS image (
155
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
156
+ path TEXT UNIQUE,
157
+ exif TEXT,
158
+ size INTEGER,
159
+ date TEXT
160
+ )"""
161
+ )
162
+ cur.execute("CREATE INDEX IF NOT EXISTS image_idx_path ON image(path)")
163
+
164
+ @classmethod
165
+ def count(cls, conn):
166
+ with closing(conn.cursor()) as cur:
167
+ cur.execute("SELECT COUNT(*) FROM image")
168
+ count = cur.fetchone()[0]
169
+ return count
170
+
171
+ @classmethod
172
+ def from_row(cls, row: tuple):
173
+ image = cls(path=row[1], exif=row[2], size=row[3], date=row[4])
174
+ image.id = row[0]
175
+ return image
176
+
177
+ @classmethod
178
+ def remove(cls, conn: Connection, image_id: int) -> None:
179
+ with closing(conn.cursor()) as cur:
180
+ cur.execute("DELETE FROM image WHERE id = ?", (image_id,))
181
+ conn.commit()
182
+
183
+ @classmethod
184
+ def safe_batch_remove(cls, conn: Connection, image_ids: List[int]) -> None:
185
+ if not (image_ids):
186
+ return
187
+ with closing(conn.cursor()) as cur:
188
+ try:
189
+ placeholders = ",".join("?" * len(image_ids))
190
+ cur.execute(
191
+ f"DELETE FROM image_tag WHERE image_id IN ({placeholders})",
192
+ image_ids,
193
+ )
194
+ cur.execute(
195
+ f"DELETE FROM image WHERE id IN ({placeholders})", image_ids
196
+ )
197
+ except BaseException as e:
198
+ print(e)
199
+ finally:
200
+ conn.commit()
201
+
202
+ @classmethod
203
+ def find_by_substring(
204
+ cls, conn: Connection, substring: str, limit: int = 500, cursor="", regexp="",
205
+ folder_paths: List[str] = []
206
+ ) -> tuple[List["Image"], Cursor]:
207
+ api_cur = Cursor()
208
+ with closing(conn.cursor()) as cur:
209
+ params = []
210
+ where_clauses = []
211
+ if regexp:
212
+ where_clauses.append("(exif REGEXP ?)")
213
+ params.append(regexp)
214
+ else:
215
+ where_clauses.append("(path LIKE ? OR exif LIKE ?)")
216
+ params.extend((f"%{substring}%", f"%{substring}%"))
217
+ if cursor:
218
+ where_clauses.append("(date < ?)")
219
+ params.append(cursor)
220
+ if folder_paths:
221
+ folder_clauses = []
222
+ for folder_path in folder_paths:
223
+ folder_clauses.append("(image.path LIKE ?)")
224
+ params.append(os.path.join(folder_path, "%"))
225
+ where_clauses.append("(" + " OR ".join(folder_clauses) + ")")
226
+ sql = "SELECT * FROM image"
227
+ if where_clauses:
228
+ sql += " WHERE "
229
+ sql += " AND ".join(where_clauses)
230
+ sql += " ORDER BY date DESC LIMIT ? "
231
+ params.append(limit)
232
+ cur.execute(sql, params)
233
+ rows = cur.fetchall()
234
+
235
+ api_cur.has_next = len(rows) >= limit
236
+ images = []
237
+ deleted_ids = []
238
+ for row in rows:
239
+ img = cls.from_row(row)
240
+ if os.path.exists(img.path):
241
+ images.append(img)
242
+ else:
243
+ deleted_ids.append(img.id)
244
+ cls.safe_batch_remove(conn, deleted_ids)
245
+ if images:
246
+ api_cur.next = str(images[-1].date)
247
+ return images, api_cur
248
+
249
+
250
+ class Tag:
251
+ def __init__(self, name: str, score: int, type: str, count=0):
252
+ self.name = name
253
+ self.score = score
254
+ self.type = type
255
+ self.count = count
256
+ self.id = None
257
+ self.display_name = tags_translate.get(name)
258
+
259
+ def save(self, conn):
260
+ with closing(conn.cursor()) as cur:
261
+ cur.execute(
262
+ "INSERT OR REPLACE INTO tag (id, name, score, type, count) VALUES (?, ?, ?, ?, ?)",
263
+ (self.id, self.name, self.score, self.type, self.count),
264
+ )
265
+ self.id = cur.lastrowid
266
+
267
+ @classmethod
268
+ def remove(cls, conn, tag_id):
269
+ with closing(conn.cursor()) as cur:
270
+ cur.execute("DELETE FROM tag WHERE id = ?", (tag_id,))
271
+ conn.commit()
272
+
273
+ @classmethod
274
+ def get(cls, conn: Connection, id):
275
+ with closing(conn.cursor()) as cur:
276
+ cur.execute("SELECT * FROM tag WHERE id = ?", (id,))
277
+ row = cur.fetchone()
278
+ if row is None:
279
+ return None
280
+ else:
281
+ return cls.from_row(row)
282
+
283
+ @classmethod
284
+ def get_all_custom_tag(cls, conn):
285
+ with closing(conn.cursor()) as cur:
286
+ cur.execute("SELECT * FROM tag where type = 'custom'")
287
+ rows = cur.fetchall()
288
+ tags: list[Tag] = []
289
+ for row in rows:
290
+ tags.append(cls.from_row(row))
291
+ return tags
292
+
293
+ @classmethod
294
+ def get_all(cls, conn):
295
+ with closing(conn.cursor()) as cur:
296
+ cur.execute("SELECT * FROM tag")
297
+ rows = cur.fetchall()
298
+ tags: list[Tag] = []
299
+ for row in rows:
300
+ tags.append(cls.from_row(row))
301
+ return tags
302
+
303
+ @classmethod
304
+ def get_or_create(cls, conn: Connection, name: str, type: str):
305
+ assert name and type
306
+ with closing(conn.cursor()) as cur:
307
+ cur.execute(
308
+ "SELECT tag.* FROM tag WHERE name = ? and type = ?", (name, type)
309
+ )
310
+ row = cur.fetchone()
311
+ if row is None:
312
+ tag = cls(name=name, score=0, type=type)
313
+ tag.save(conn)
314
+ return tag
315
+ else:
316
+ return cls.from_row(row)
317
+
318
+ @classmethod
319
+ def from_row(cls, row: tuple):
320
+ tag = cls(name=row[1], score=row[2], type=row[3], count=row[4])
321
+ tag.id = row[0]
322
+ return tag
323
+
324
+ @classmethod
325
+ def create_table(cls, conn):
326
+ with closing(conn.cursor()) as cur:
327
+ cur.execute(
328
+ """CREATE TABLE IF NOT EXISTS tag (
329
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
330
+ name TEXT,
331
+ score INTEGER,
332
+ type TEXT,
333
+ count INTEGER,
334
+ UNIQUE(name, type) ON CONFLICT REPLACE
335
+ );
336
+ """
337
+ )
338
+ cur.execute("CREATE INDEX IF NOT EXISTS tag_idx_name ON tag(name)")
339
+ cur.execute(
340
+ """INSERT OR IGNORE INTO tag(name, score, type, count)
341
+ VALUES ("like", 0, "custom", 0);
342
+ """
343
+ )
344
+
345
+
346
+ class ImageTag:
347
+ def __init__(self, image_id: int, tag_id: int):
348
+ assert tag_id and image_id
349
+ self.image_id = image_id
350
+ self.tag_id = tag_id
351
+
352
+ def save(self, conn):
353
+ with closing(conn.cursor()) as cur:
354
+ cur.execute(
355
+ "INSERT INTO image_tag (image_id, tag_id) VALUES (?, ?)",
356
+ (self.image_id, self.tag_id),
357
+ )
358
+
359
+ def save_or_ignore(self, conn):
360
+ with closing(conn.cursor()) as cur:
361
+ cur.execute(
362
+ "INSERT OR IGNORE INTO image_tag (image_id, tag_id) VALUES (?, ?)",
363
+ (self.image_id, self.tag_id),
364
+ )
365
+
366
+ @classmethod
367
+ def get_tags_for_image(
368
+ cls,
369
+ conn: Connection,
370
+ image_id: int,
371
+ tag_id: Optional[int] = None,
372
+ type: Optional[str] = None,
373
+ ):
374
+ with closing(conn.cursor()) as cur:
375
+ query = "SELECT tag.* FROM tag INNER JOIN image_tag ON tag.id = image_tag.tag_id WHERE image_tag.image_id = ?"
376
+ params = [image_id]
377
+ if tag_id:
378
+ query += " AND image_tag.tag_id = ?"
379
+ params.append(tag_id)
380
+ if type:
381
+ query += " AND tag.type = ?"
382
+ params.append(type)
383
+ cur.execute(query, tuple(params))
384
+ rows = cur.fetchall()
385
+ return [Tag.from_row(x) for x in rows]
386
+
387
+ @classmethod
388
+ def get_images_for_tag(cls, conn: Connection, tag_id):
389
+ with closing(conn.cursor()) as cur:
390
+ cur.execute(
391
+ "SELECT image.* FROM image INNER JOIN image_tag ON image.id = image_tag.image_id WHERE image_tag.tag_id = ?",
392
+ (tag_id,),
393
+ )
394
+ rows = cur.fetchall()
395
+ images = []
396
+ for row in rows:
397
+ images.append(Image.from_row(row))
398
+ return images
399
+
400
+ @classmethod
401
+ def create_table(cls, conn):
402
+ with closing(conn.cursor()) as cur:
403
+ cur.execute(
404
+ """CREATE TABLE IF NOT EXISTS image_tag (
405
+ image_id INTEGER,
406
+ tag_id INTEGER,
407
+ FOREIGN KEY (image_id) REFERENCES image(id),
408
+ FOREIGN KEY (tag_id) REFERENCES tag(id),
409
+ PRIMARY KEY (image_id, tag_id)
410
+ )"""
411
+ )
412
+
413
+ @classmethod
414
+ def get_images_by_tags(
415
+ cls,
416
+ conn: Connection,
417
+ tag_dict: Dict[str, List[int]],
418
+ limit: int = 500,
419
+ cursor="",
420
+ folder_paths: List[str] = None,
421
+ ) -> tuple[List[Image], Cursor]:
422
+ query = """
423
+ SELECT image.id, image.path, image.size,image.date
424
+ FROM image
425
+ INNER JOIN image_tag ON image.id = image_tag.image_id
426
+ """
427
+
428
+ where_clauses = []
429
+ params = []
430
+
431
+ for operator, tag_ids in tag_dict.items():
432
+ if operator == "and" and tag_dict["and"]:
433
+ where_clauses.append(
434
+ "tag_id IN ({})".format(",".join("?" * len(tag_ids)))
435
+ )
436
+ params.extend(tag_ids)
437
+ elif operator == "not" and tag_dict["not"]:
438
+ where_clauses.append(
439
+ """(image_id NOT IN (
440
+ SELECT image_id
441
+ FROM image_tag
442
+ WHERE tag_id IN ({})
443
+ ))""".format(
444
+ ",".join("?" * len(tag_ids))
445
+ )
446
+ )
447
+ params.extend(tag_ids)
448
+ elif operator == "or" and tag_dict["or"]:
449
+ where_clauses.append(
450
+ """(image_id IN (
451
+ SELECT image_id
452
+ FROM image_tag
453
+ WHERE tag_id IN ({})
454
+ GROUP BY image_id
455
+ HAVING COUNT(DISTINCT tag_id) >= 1
456
+ )
457
+ )""".format(
458
+ ",".join("?" * len(tag_ids))
459
+ )
460
+ )
461
+ params.extend(tag_ids)
462
+
463
+ if folder_paths:
464
+ folder_clauses = []
465
+ for folder_path in folder_paths:
466
+ folder_clauses.append("(image.path LIKE ?)")
467
+ params.append(os.path.join(folder_path, "%"))
468
+ print(folder_path)
469
+ where_clauses.append("(" + " OR ".join(folder_clauses) + ")")
470
+
471
+ if cursor:
472
+ where_clauses.append("(image.date < ?)")
473
+ params.append(cursor)
474
+ if where_clauses:
475
+ query += " WHERE " + " AND ".join(where_clauses)
476
+ query += " GROUP BY image.id"
477
+ if "and" in tag_dict and tag_dict['and']:
478
+ query += " HAVING COUNT(DISTINCT tag_id) = ?"
479
+ params.append(len(tag_dict["and"]))
480
+
481
+ query += " ORDER BY date DESC LIMIT ?"
482
+ params.append(limit)
483
+ api_cur = Cursor()
484
+ with closing(conn.cursor()) as cur:
485
+ cur.execute(query, params)
486
+ rows = cur.fetchall()
487
+ images = []
488
+ deleted_ids = []
489
+ for row in rows:
490
+ img = Image(id=row[0], path=row[1], size=row[2], date=row[3])
491
+ if os.path.exists(img.path):
492
+ images.append(img)
493
+ else:
494
+ deleted_ids.append(img.id)
495
+ Image.safe_batch_remove(conn, deleted_ids)
496
+ api_cur.has_next = len(rows) >= limit
497
+ if images:
498
+ api_cur.next = str(images[-1].date)
499
+ return images, api_cur
500
+
501
+ @classmethod
502
+ def batch_get_tags_by_path(
503
+ cls, conn: Connection, paths: List[str], type="custom"
504
+ ) -> Dict[str, List[Tag]]:
505
+ if not paths:
506
+ return {}
507
+ tag_dict = {}
508
+ with closing(conn.cursor()) as cur:
509
+ placeholders = ",".join("?" * len(paths))
510
+ query = f"""
511
+ SELECT image.path, tag.* FROM image_tag
512
+ INNER JOIN image ON image_tag.image_id = image.id
513
+ INNER JOIN tag ON image_tag.tag_id = tag.id
514
+ WHERE tag.type = '{type}' AND image.path IN ({placeholders})
515
+ """
516
+ cur.execute(query, paths)
517
+ rows = cur.fetchall()
518
+ for row in rows:
519
+ path = row[0]
520
+ tag = Tag.from_row(row[1:])
521
+ if path in tag_dict:
522
+ tag_dict[path].append(tag)
523
+ else:
524
+ tag_dict[path] = [tag]
525
+ return tag_dict
526
+
527
+ @classmethod
528
+ def remove(
529
+ cls,
530
+ conn: Connection,
531
+ image_id: Optional[int] = None,
532
+ tag_id: Optional[int] = None,
533
+ ) -> None:
534
+ assert image_id or tag_id
535
+ with closing(conn.cursor()) as cur:
536
+ if tag_id and image_id:
537
+ cur.execute(
538
+ "DELETE FROM image_tag WHERE image_id = ? and tag_id = ?",
539
+ (image_id, tag_id),
540
+ )
541
+ elif tag_id:
542
+ cur.execute("DELETE FROM image_tag WHERE tag_id = ?", (tag_id,))
543
+ else:
544
+ cur.execute("DELETE FROM image_tag WHERE image_id = ?", (image_id,))
545
+ conn.commit()
546
+
547
+
548
+ class Folder:
549
+ def __init__(self, id: int, path: str, modified_date: str):
550
+ self.id = id
551
+ self.path = path
552
+ self.modified_date = modified_date
553
+
554
+ @classmethod
555
+ def create_table(cls, conn):
556
+ with closing(conn.cursor()) as cur:
557
+ cur.execute(
558
+ """CREATE TABLE IF NOT EXISTS folders
559
+ (id INTEGER PRIMARY KEY AUTOINCREMENT,
560
+ path TEXT,
561
+ modified_date TEXT)"""
562
+ )
563
+ cur.execute("CREATE INDEX IF NOT EXISTS folders_idx_path ON folders(path)")
564
+
565
+ @classmethod
566
+ def check_need_update(cls, conn: Connection, folder_path: str):
567
+ folder_path = os.path.normpath(folder_path)
568
+ with closing(conn.cursor()) as cur:
569
+ if not os.path.exists(folder_path):
570
+ return False
571
+ cur.execute("SELECT * FROM folders WHERE path=?", (folder_path,))
572
+ folder_record = cur.fetchone() # 如果这个文件夹没有记录,或者修改时间与数据库不同,则需要修改
573
+ return not folder_record or (
574
+ folder_record[2] != get_modified_date(folder_path)
575
+ )
576
+
577
+ @classmethod
578
+ def update_modified_date_or_create(cls, conn: Connection, folder_path: str):
579
+ folder_path = os.path.normpath(folder_path)
580
+ with closing(conn.cursor()) as cur:
581
+ cur.execute("SELECT * FROM folders WHERE path = ?", (folder_path,))
582
+ row = cur.fetchone()
583
+ if row:
584
+ cur.execute(
585
+ "UPDATE folders SET modified_date = ? WHERE path = ?",
586
+ (get_modified_date(folder_path), folder_path),
587
+ )
588
+ else:
589
+ cur.execute(
590
+ "INSERT INTO folders (path, modified_date) VALUES (?, ?)",
591
+ (folder_path, get_modified_date(folder_path)),
592
+ )
593
+
594
+ @classmethod
595
+ def get_expired_dirs(cls, conn: Connection):
596
+ dirs: List[str] = []
597
+ with closing(conn.cursor()) as cur:
598
+ cur.execute("SELECT * FROM folders")
599
+ result_set = cur.fetchall()
600
+ extra_paths = ExtraPath.get_extra_paths(conn)
601
+ for ep in extra_paths:
602
+ if not find(result_set, lambda x: x[1] == ep.path):
603
+ dirs.append(ep.path)
604
+ for row in result_set:
605
+ folder_path = row[1]
606
+ if (
607
+ os.path.exists(folder_path)
608
+ and get_modified_date(folder_path) != row[2]
609
+ ):
610
+ dirs.append(folder_path)
611
+ return unique_by(dirs, os.path.normpath)
612
+
613
+ @classmethod
614
+ def remove_folder(cls, conn: Connection, folder_path: str):
615
+ folder_path = os.path.normpath(folder_path)
616
+ with closing(conn.cursor()) as cur:
617
+ cur.execute("DELETE FROM folders WHERE path = ?", (folder_path,))
618
+
619
+
620
+ class ExtraPathType(Enum):
621
+ scanned = "scanned"
622
+ walk = "walk"
623
+ cli_only = "cli_access_only"
624
+
625
+
626
+ class ExtraPath:
627
+ def __init__(self, path: str, type: Optional[ExtraPathType] = None):
628
+ assert type
629
+ self.path = os.path.normpath(path)
630
+ self.type = type
631
+
632
+ def save(self, conn):
633
+ assert self.type in [ExtraPathType.walk, ExtraPathType.scanned]
634
+ with closing(conn.cursor()) as cur:
635
+ cur.execute(
636
+ "INSERT INTO extra_path (path, type) VALUES (?, ?) ON CONFLICT (path) DO UPDATE SET type = ?",
637
+ (self.path, self.type.value, self.type.value),
638
+ )
639
+
640
+ @classmethod
641
+ def get_extra_paths(
642
+ cls, conn, type: Optional[ExtraPathType] = None
643
+ ) -> List["ExtraPath"]:
644
+ query = "SELECT * FROM extra_path"
645
+ params = ()
646
+ if type:
647
+ query += " WHERE type = ?"
648
+ params = (type.value,)
649
+ with closing(conn.cursor()) as cur:
650
+ cur.execute(query, params)
651
+ rows = cur.fetchall()
652
+ paths: List[ExtraPath] = []
653
+ for row in rows:
654
+ path = row[0]
655
+ if os.path.exists(path):
656
+ paths.append(ExtraPath(path, ExtraPathType(row[1])))
657
+ else:
658
+ cls.remove(conn, path)
659
+ return paths
660
+
661
+ @classmethod
662
+ def remove(
663
+ cls,
664
+ conn,
665
+ path: str,
666
+ type: Optional[ExtraPathType] = None,
667
+ img_search_dirs: Optional[List[str]] = [],
668
+ ):
669
+ with closing(conn.cursor()) as cur:
670
+ sql = "DELETE FROM extra_path WHERE path = ?"
671
+ path = os.path.normpath(path)
672
+ cur.execute(sql, (path,))
673
+ if path not in img_search_dirs:
674
+ Folder.remove_folder(conn, path)
675
+ conn.commit()
676
+
677
+ @classmethod
678
+ def create_table(cls, conn):
679
+ with closing(conn.cursor()) as cur:
680
+ cur.execute(
681
+ """CREATE TABLE IF NOT EXISTS extra_path (
682
+ path TEXT PRIMARY KEY,
683
+ type TEXT NOT NULL
684
+ )"""
685
+ )
extensions/sd-webui-infinite-image-browsing/scripts/iib/db/update_image_data.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from contextlib import closing
2
+ from typing import Dict, List
3
+ from scripts.iib.db.datamodel import Image as DbImg, Tag, ImageTag, DataBase, Folder
4
+ import os
5
+ from PIL import Image
6
+ from scripts.iib.tool import (
7
+ read_sd_webui_gen_info_from_image,
8
+ parse_generation_parameters,
9
+ is_valid_image_path,
10
+ get_modified_date,
11
+ is_dev,
12
+ get_comfyui_exif_data,
13
+ comfyui_exif_data_to_str,
14
+ is_img_created_by_comfyui,
15
+ is_img_created_by_comfyui_with_webui_gen_info
16
+ )
17
+
18
+ from scripts.iib.logger import logger
19
+
20
+
21
+ # 定义一个函数来获取图片文件的EXIF数据
22
+ def get_exif_data(file_path):
23
+ info = ''
24
+ params = None
25
+ try:
26
+ with Image.open(file_path) as img:
27
+ if is_img_created_by_comfyui(img):
28
+ if is_img_created_by_comfyui_with_webui_gen_info(img):
29
+ info = read_sd_webui_gen_info_from_image(img, file_path)
30
+ params = parse_generation_parameters(info)
31
+ else:
32
+ params = get_comfyui_exif_data(img)
33
+ info = comfyui_exif_data_to_str(params)
34
+ else:
35
+ info = read_sd_webui_gen_info_from_image(img, file_path)
36
+ params = parse_generation_parameters(info)
37
+ except Exception as e:
38
+ if is_dev:
39
+ logger.error("get_exif_data %s", e)
40
+ return params, info
41
+
42
+
43
+ def update_image_data(search_dirs: List[str], is_rebuild = False):
44
+ conn = DataBase.get_conn()
45
+ tag_incr_count_rec: Dict[int, int] = {}
46
+
47
+ def safe_save_img_tag(img_tag: ImageTag):
48
+ tag_incr_count_rec[img_tag.tag_id] = (
49
+ tag_incr_count_rec.get(img_tag.tag_id, 0) + 1
50
+ )
51
+ img_tag.save_or_ignore(conn) # 原先用来处理一些意外,但是写的正确完全没问题,去掉了try catch
52
+
53
+ # 递归处理每个文件夹
54
+ def process_folder(folder_path: str):
55
+ if not is_rebuild and not Folder.check_need_update(conn, folder_path):
56
+ return
57
+ print(f"Processing folder: {folder_path}")
58
+ for filename in os.listdir(folder_path):
59
+ file_path = os.path.normpath(os.path.join(folder_path, filename))
60
+ try:
61
+
62
+ if os.path.isdir(file_path):
63
+ process_folder(file_path)
64
+
65
+ elif is_valid_image_path(file_path):
66
+ img = DbImg.get(conn, file_path)
67
+ if is_rebuild:
68
+ parsed_params, info = get_exif_data(file_path)
69
+ if not img:
70
+ img = DbImg(
71
+ file_path,
72
+ info,
73
+ os.path.getsize(file_path),
74
+ get_modified_date(file_path),
75
+ )
76
+ img.save(conn)
77
+ else:
78
+ if img: # 已存在的跳过
79
+ if img.date == get_modified_date(img.path):
80
+ continue
81
+ else:
82
+ DbImg.safe_batch_remove(conn=conn, image_ids=[img.id])
83
+ parsed_params, info = get_exif_data(file_path)
84
+ img = DbImg(
85
+ file_path,
86
+ info,
87
+ os.path.getsize(file_path),
88
+ get_modified_date(file_path),
89
+ )
90
+ img.save(conn)
91
+
92
+ if not parsed_params:
93
+ continue
94
+ meta = parsed_params.get("meta", {})
95
+ lora = parsed_params.get("lora", [])
96
+ lyco = parsed_params.get("lyco", [])
97
+ pos = parsed_params["pos_prompt"]
98
+ size_tag = Tag.get_or_create(
99
+ conn,
100
+ str(meta.get("Size-1", 0)) + " * " + str(meta.get("Size-2", 0)),
101
+ type="size",
102
+ )
103
+ safe_save_img_tag(ImageTag(img.id, size_tag.id))
104
+
105
+ for k in [
106
+ "Model",
107
+ "Sampler",
108
+ "Postprocess upscale by",
109
+ "Postprocess upscaler",
110
+ ]:
111
+ v = meta.get(k)
112
+ if not v:
113
+ continue
114
+ tag = Tag.get_or_create(conn, str(v), k)
115
+ safe_save_img_tag(ImageTag(img.id, tag.id))
116
+ for i in lora:
117
+ tag = Tag.get_or_create(conn, i["name"], "lora")
118
+ safe_save_img_tag(ImageTag(img.id, tag.id))
119
+ for i in lyco:
120
+ tag = Tag.get_or_create(conn, i["name"], "lyco")
121
+ safe_save_img_tag(ImageTag(img.id, tag.id))
122
+ for k in pos:
123
+ tag = Tag.get_or_create(conn, k, "pos")
124
+ safe_save_img_tag(ImageTag(img.id, tag.id))
125
+ # neg暂时跳过感觉个没人会搜索这个
126
+ except Exception as e:
127
+ logger.error("Tag generation failed. Skipping this file. file:%s error: %s", file_path, e)
128
+ # 提交对数据库的更改
129
+ Folder.update_modified_date_or_create(conn, folder_path)
130
+ conn.commit()
131
+
132
+ for dir in search_dirs:
133
+ process_folder(dir)
134
+ conn.commit()
135
+ for tag_id in tag_incr_count_rec:
136
+ tag = Tag.get(conn, tag_id)
137
+ tag.count += tag_incr_count_rec[tag_id]
138
+ tag.save(conn)
139
+ conn.commit()
140
+
141
+ def rebuild_image_index(search_dirs: List[str]):
142
+ conn = DataBase.get_conn()
143
+ with closing(conn.cursor()) as cur:
144
+ cur.execute(
145
+ """DELETE FROM image_tag
146
+ WHERE image_tag.tag_id IN (
147
+ SELECT tag.id FROM tag WHERE tag.type <> 'custom'
148
+ )
149
+ """
150
+ )
151
+ cur.execute("""DELETE FROM tag WHERE tag.type <> 'custom'""")
152
+ conn.commit()
153
+ update_image_data(search_dirs=search_dirs, is_rebuild=True)
extensions/sd-webui-infinite-image-browsing/scripts/iib/logger.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from scripts.iib.tool import is_dev,cwd
3
+
4
+ import logging
5
+ logger = logging.getLogger(__name__)
6
+ logger.setLevel(logging.DEBUG)
7
+
8
+ console_handler = logging.StreamHandler()
9
+ console_handler.setLevel(logging.INFO)
10
+
11
+ file_handler = logging.FileHandler(f"{cwd}/log.log")
12
+ file_handler.setLevel(logging.DEBUG)
13
+
14
+ formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
15
+ console_handler.setFormatter(formatter)
16
+ file_handler.setFormatter(formatter)
17
+
18
+ logger.addHandler(file_handler)
19
+ if is_dev:
20
+ logger.addHandler(console_handler)
extensions/sd-webui-infinite-image-browsing/scripts/iib/tool.py ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime
2
+ import os
3
+ import platform
4
+ import re
5
+ import tempfile
6
+ import imghdr
7
+ import subprocess
8
+ from typing import Dict, List
9
+ import sys
10
+ import piexif
11
+ import piexif.helper
12
+ import json
13
+ import zipfile
14
+ from PIL import Image
15
+
16
+ sd_img_dirs = [
17
+ "outdir_txt2img_samples",
18
+ "outdir_img2img_samples",
19
+ "outdir_save",
20
+ "outdir_extras_samples",
21
+ "outdir_grids",
22
+ "outdir_img2img_grids",
23
+ "outdir_samples",
24
+ "outdir_txt2img_grids",
25
+ ]
26
+
27
+
28
+ is_dev = os.getenv("APP_ENV") == "dev"
29
+ is_nuitka = "__compiled__" in globals()
30
+ cwd = os.getcwd() if is_nuitka else os.path.normpath(os.path.join(__file__, "../../../"))
31
+ is_win = platform.system().lower().find("windows") != -1
32
+
33
+
34
+
35
+
36
+ try:
37
+ from dotenv import load_dotenv
38
+
39
+ load_dotenv(os.path.join(cwd, ".env"))
40
+ except Exception as e:
41
+ print(e)
42
+
43
+
44
+ def get_sd_webui_conf(**kwargs):
45
+ try:
46
+ from modules.shared import opts
47
+
48
+ return opts.data
49
+ except:
50
+ pass
51
+ try:
52
+ sd_conf_path = kwargs.get("sd_webui_config")
53
+ with open(sd_conf_path, "r") as f:
54
+ obj = json.loads(f.read())
55
+ if kwargs.get("sd_webui_path_relative_to_config"):
56
+ for dir in sd_img_dirs:
57
+ if obj[dir] and not os.path.isabs(obj[dir]):
58
+ obj[dir] = os.path.normpath(
59
+ os.path.join(sd_conf_path, "../", obj[dir])
60
+ )
61
+ return obj
62
+ except:
63
+ pass
64
+ return {}
65
+
66
+ def normalize_paths(paths: List[str], base = cwd):
67
+ """
68
+ Normalize a list of paths, ensuring that each path is an absolute path with no redundant components.
69
+
70
+ Args:
71
+ paths (List[str]): A list of paths to be normalized.
72
+
73
+ Returns:
74
+ List[str]: A list of normalized paths.
75
+ """
76
+ res: List[str] = []
77
+ for path in paths:
78
+ # Skip empty or blank paths
79
+ if not path or len(path.strip()) == 0:
80
+ continue
81
+ # If the path is already an absolute path, use it as is
82
+ if os.path.isabs(path):
83
+ abs_path = path
84
+ # Otherwise, make the path absolute by joining it with the current working directory
85
+ else:
86
+ abs_path = os.path.join(base, path)
87
+ # If the absolute path exists, add it to the result after normalizing it
88
+ if os.path.exists(abs_path):
89
+ res.append(os.path.normpath(abs_path))
90
+ return res
91
+
92
+ def to_abs_path(path):
93
+ if not os.path.isabs(path):
94
+ path = os.path.join(os.getcwd(), path)
95
+ return os.path.normpath(path)
96
+
97
+
98
+ def get_valid_img_dirs(
99
+ conf,
100
+ keys=sd_img_dirs,
101
+ ):
102
+ # 获取配置项
103
+ paths = [conf.get(key) for key in keys]
104
+
105
+ # 判断路径是否有效并转为绝对路径
106
+ abs_paths = []
107
+ for path in paths:
108
+ if not path or len(path.strip()) == 0:
109
+ continue
110
+ if os.path.isabs(path): # 已经是绝对路径
111
+ abs_path = path
112
+ else: # 转为绝对路径
113
+ abs_path = os.path.join(os.getcwd(), path)
114
+ if os.path.exists(abs_path): # 判断路径是否存在
115
+ abs_paths.append(os.path.normpath(abs_path))
116
+
117
+ return abs_paths
118
+
119
+
120
+ def human_readable_size(size_bytes):
121
+ """
122
+ Converts bytes to a human-readable format.
123
+ """
124
+ # define the size units
125
+ units = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
126
+ # calculate the logarithm of the input value with base 1024
127
+ size = int(size_bytes)
128
+ if size == 0:
129
+ return "0B"
130
+ i = 0
131
+ while size >= 1024 and i < len(units) - 1:
132
+ size /= 1024
133
+ i += 1
134
+ # round the result to two decimal points and return as a string
135
+ return "{:.2f} {}".format(size, units[i])
136
+
137
+
138
+ def get_windows_drives():
139
+ drives = []
140
+ for drive in range(ord("A"), ord("Z") + 1):
141
+ drive_name = chr(drive) + ":/"
142
+ if os.path.exists(drive_name):
143
+ drives.append(drive_name)
144
+ return drives
145
+
146
+
147
+ pattern = re.compile(r"(\d+\.?\d*)([KMGT]?B)", re.IGNORECASE)
148
+
149
+
150
+ def convert_to_bytes(file_size_str):
151
+ match = re.match(pattern, file_size_str)
152
+ if match:
153
+ size_str, unit_str = match.groups()
154
+ size = float(size_str)
155
+ unit = unit_str.upper()
156
+ if unit == "KB":
157
+ size *= 1024
158
+ elif unit == "MB":
159
+ size *= 1024**2
160
+ elif unit == "GB":
161
+ size *= 1024**3
162
+ elif unit == "TB":
163
+ size *= 1024**4
164
+ return int(size)
165
+ else:
166
+ raise ValueError(f"Invalid file size string '{file_size_str}'")
167
+
168
+
169
+ def is_valid_image_path(path):
170
+ """
171
+ 判断给定的路径是否是图像文件
172
+ """
173
+ abs_path = os.path.abspath(path) # 转为绝对路径
174
+ if not os.path.exists(abs_path): # 判断路径是否存在
175
+ return False
176
+ if not os.path.isfile(abs_path): # 判断是否是文件
177
+ return False
178
+ if not imghdr.what(abs_path): # 判断是否是图像文件
179
+ return False
180
+ return True
181
+
182
+
183
+
184
+ def create_zip_file(file_paths: List[str], zip_file_name: str):
185
+ """
186
+ 将文件打包成一个压缩包
187
+
188
+ Args:
189
+ file_paths: 文件路径的列表
190
+ zip_file_name: 压缩包的文件名
191
+
192
+ Returns:
193
+ 无返回值
194
+ """
195
+ with zipfile.ZipFile(zip_file_name, 'w', zipfile.ZIP_DEFLATED) as zip_file:
196
+ for file_path in file_paths:
197
+ if os.path.isfile(file_path):
198
+ zip_file.write(file_path, os.path.basename(file_path))
199
+ elif os.path.isdir(file_path):
200
+ for root, _, files in os.walk(file_path):
201
+ for file in files:
202
+ full_path = os.path.join(root, file)
203
+ zip_file.write(full_path, os.path.relpath(full_path, file_path))
204
+
205
+ def get_temp_path():
206
+ """获取跨平台的临时文件目录路径"""
207
+ temp_path = None
208
+ try:
209
+ # 尝试获取系统环境变量中的临时文件目录路径
210
+ temp_path = (
211
+ os.environ.get("TMPDIR") or os.environ.get("TMP") or os.environ.get("TEMP")
212
+ )
213
+ except Exception as e:
214
+ print("获取系统环境变量临时文件目录路径失败,错误信息:", e)
215
+
216
+ # 如果系统环境变量中没有设置临时文件目录路径,则使用 Python 的 tempfile 模块创建临时文件目录
217
+ if not temp_path:
218
+ try:
219
+ temp_path = tempfile.gettempdir()
220
+ except Exception as e:
221
+ print("使用 Python 的 tempfile 模块创建临时文件目录失败,错误信息:", e)
222
+
223
+ # 确保临时文件目录存在
224
+ if not os.path.exists(temp_path):
225
+ try:
226
+ os.makedirs(temp_path)
227
+ except Exception as e:
228
+ print("创建临时文件目录失败,错误信息:", e)
229
+
230
+ return temp_path
231
+
232
+
233
+ temp_path = get_temp_path()
234
+
235
+ def get_secret_key_required():
236
+ try:
237
+ from modules.shared import cmd_opts
238
+ return bool(cmd_opts.gradio_auth)
239
+ except:
240
+ return False
241
+
242
+ is_secret_key_required = get_secret_key_required()
243
+
244
+ def get_enable_access_control():
245
+ ctrl = os.getenv("IIB_ACCESS_CONTROL")
246
+ if ctrl == "enable":
247
+ return True
248
+ if ctrl == "disable":
249
+ return False
250
+ try:
251
+ from modules.shared import cmd_opts
252
+
253
+ return (
254
+ cmd_opts.share or cmd_opts.ngrok or cmd_opts.listen or cmd_opts.server_name
255
+ )
256
+ except:
257
+ pass
258
+ return False
259
+
260
+
261
+ enable_access_control = get_enable_access_control()
262
+
263
+
264
+ def get_locale():
265
+ import locale
266
+
267
+ env_lang = os.getenv("IIB_SERVER_LANG")
268
+ if env_lang in ["zh", "en"]:
269
+ return env_lang
270
+ lang, _ = locale.getdefaultlocale()
271
+ return "zh" if lang and lang.startswith("zh") else "en"
272
+
273
+
274
+ locale = get_locale()
275
+
276
+
277
+ def get_formatted_date(timestamp: float) -> str:
278
+ return datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
279
+
280
+
281
+ def get_modified_date(folder_path: str):
282
+ return get_formatted_date(os.path.getmtime(folder_path))
283
+
284
+
285
+ def get_created_date(folder_path: str):
286
+ return get_formatted_date(os.path.getctime(folder_path))
287
+
288
+
289
+ def unique_by(seq, key_func=lambda x: x):
290
+ seen = set()
291
+ return [x for x in seq if not (key := key_func(x)) in seen and not seen.add(key)]
292
+
293
+
294
+ def find(lst, comparator):
295
+ return next((item for item in lst if comparator(item)), None)
296
+
297
+
298
+ def findIndex(lst, comparator):
299
+ return next((i for i, item in enumerate(lst) if comparator(item)), -1)
300
+
301
+
302
+ def get_img_geninfo_txt_path(path: str):
303
+ txt_path = re.sub(r"\.\w+$", ".txt", path)
304
+ if os.path.exists(txt_path):
305
+ return txt_path
306
+
307
+ def is_img_created_by_comfyui(img: Image):
308
+ return img.info.get('prompt') and img.info.get('workflow')
309
+
310
+ def is_img_created_by_comfyui_with_webui_gen_info(img: Image):
311
+ return img.info.get('parameters')
312
+
313
+ def get_comfyui_exif_data(img: Image):
314
+ prompt = img.info.get('prompt')
315
+ if not prompt:
316
+ return {}
317
+ meta_key = '3'
318
+ data: Dict[str, any] = json.loads(prompt)
319
+ for i in range(3, 32):
320
+ try:
321
+ i = str(i)
322
+ if data[i]["class_type"].startswith("KSampler"):
323
+ meta_key = i
324
+ break
325
+ except:
326
+ pass
327
+ meta = {}
328
+ KSampler_entry = data[meta_key]["inputs"]
329
+ meta["Sampler"] = KSampler_entry["sampler_name"]
330
+ meta["Model"] = data[KSampler_entry["model"][0]]["inputs"]["ckpt_name"]
331
+ def get_text_from_clip(idx: str) :
332
+ text = data[idx]["inputs"]["text"]
333
+ if isinstance(text, list): # type:CLIPTextEncode (NSP) mode:Wildcards
334
+ text = data[text[0]]["inputs"]["text"]
335
+ return text.strip()
336
+ pos_prompt = get_text_from_clip(KSampler_entry["positive"][0])
337
+ neg_prompt = get_text_from_clip(KSampler_entry["negative"][0])
338
+ pos_prompt_arr = unique_by(parse_prompt(pos_prompt)["pos_prompt"])
339
+ return {
340
+ "meta": meta,
341
+ "pos_prompt": pos_prompt_arr,
342
+ "pos_prompt_raw": pos_prompt,
343
+ "neg_prompt_raw" : neg_prompt
344
+ }
345
+
346
+ def comfyui_exif_data_to_str(data):
347
+ res = data["pos_prompt_raw"] + "\nNegative prompt: " + data["neg_prompt_raw"] + "\n"
348
+ meta_arr = []
349
+ for k,v in data["meta"].items():
350
+ meta_arr.append(f'{k}: {v}')
351
+ return res + ", ".join(meta_arr)
352
+
353
+ def read_sd_webui_gen_info_from_image(image: Image, path="") -> str:
354
+ """
355
+ Reads metadata from an image file.
356
+
357
+ Args:
358
+ image (PIL.Image.Image): The image object to read metadata from.
359
+ path (str): Optional. The path to the image file. Used to look for a .txt file with additional metadata.
360
+
361
+ Returns:
362
+ str: The metadata as a string.
363
+ """
364
+ items = image.info or {}
365
+ geninfo = items.pop("parameters", None)
366
+
367
+ if "exif" in items:
368
+ exif = piexif.load(items["exif"])
369
+ exif_comment = (exif or {}).get("Exif", {}).get(piexif.ExifIFD.UserComment, b"")
370
+
371
+ try:
372
+ exif_comment = piexif.helper.UserComment.load(exif_comment)
373
+ except ValueError:
374
+ exif_comment = exif_comment.decode("utf8", errors="ignore")
375
+
376
+ if exif_comment:
377
+ items["exif comment"] = exif_comment
378
+ geninfo = exif_comment
379
+
380
+ if not geninfo and path:
381
+ try:
382
+ txt_path = get_img_geninfo_txt_path(path)
383
+ if txt_path:
384
+ with open(txt_path) as f:
385
+ geninfo = f.read()
386
+ except Exception as e:
387
+ pass
388
+
389
+ return geninfo
390
+
391
+
392
+ re_param_code = r'\s*([\w ]+):\s*("(?:\\"[^,]|\\"|\\|[^\"])+"|[^,]*)(?:,|$)'
393
+ re_param = re.compile(re_param_code)
394
+ re_imagesize = re.compile(r"^(\d+)x(\d+)$")
395
+ re_lora_prompt = re.compile("<lora:([\w_\s.]+):([\d.]+)>", re.IGNORECASE)
396
+ re_lora_extract = re.compile(r"([\w_\s.]+)(?:\d+)?")
397
+ re_lyco_prompt = re.compile("<lyco:([\w_\s.]+):([\d.]+)>", re.IGNORECASE)
398
+ re_parens = re.compile(r"[\\/\[\](){}]+")
399
+
400
+
401
+ def lora_extract(lora: str):
402
+ """
403
+ 提取yoshino yoshino(2a79aa5adc4a)
404
+ """
405
+ res = re_lora_extract.match(lora)
406
+ return res.group(1) if res else lora
407
+
408
+
409
+ def parse_prompt(x: str):
410
+ x = re.sub(
411
+ re_parens, "", x.replace(",", ",").replace("-", " ").replace("_", " ")
412
+ )
413
+ tag_list = [x.strip() for x in x.split(",")]
414
+ res = []
415
+ lora_list = []
416
+ lyco_list = []
417
+ for tag in tag_list:
418
+ if len(tag) == 0:
419
+ continue
420
+ idx_colon = tag.find(":")
421
+ if idx_colon != -1:
422
+ if re.search(re_lora_prompt, tag):
423
+ lora_res = re.search(re_lora_prompt, tag)
424
+ lora_list.append(
425
+ {"name": lora_res.group(1), "value": float(lora_res.group(2))}
426
+ )
427
+ elif re.search(re_lyco_prompt, tag):
428
+ lyco_res = re.search(re_lyco_prompt, tag)
429
+ lyco_list.append(
430
+ {"name": lyco_res.group(1), "value": float(lyco_res.group(2))}
431
+ )
432
+ else:
433
+ tag = tag[0:idx_colon]
434
+ if len(tag):
435
+ res.append(tag.lower())
436
+ else:
437
+ res.append(tag.lower())
438
+ return {"pos_prompt": res, "lora": lora_list, "lyco": lyco_list}
439
+
440
+
441
+ def parse_generation_parameters(x: str):
442
+ res = {}
443
+ prompt = ""
444
+ negative_prompt = ""
445
+ done_with_prompt = False
446
+ if not x:
447
+ return {"meta": {}, "pos_prompt": [], "lora": [], "lyco": []}
448
+ *lines, lastline = x.strip().split("\n")
449
+ if len(re_param.findall(lastline)) < 3:
450
+ lines.append(lastline)
451
+ lastline = ""
452
+ if len(lines) == 1 and lines[0].startswith("Postprocess"): # 把上面改成<2应该也可以,当时不敢动
453
+ lastline = lines[
454
+ 0
455
+ ] # 把Postprocess upscale by: 4, Postprocess upscaler: R-ESRGAN 4x+ Anime6B 推到res解析
456
+ lines = []
457
+ for i, line in enumerate(lines):
458
+ line = line.strip()
459
+ if line.startswith("Negative prompt:"):
460
+ done_with_prompt = True
461
+ line = line[16:].strip()
462
+
463
+ if done_with_prompt:
464
+ negative_prompt += ("" if negative_prompt == "" else "\n") + line
465
+ else:
466
+ prompt += ("" if prompt == "" else "\n") + line
467
+
468
+ for k, v in re_param.findall(lastline):
469
+ v = v[1:-1] if v[0] == '"' and v[-1] == '"' else v
470
+ m = re_imagesize.match(v)
471
+ if m is not None:
472
+ res[k + "-1"] = m.group(1)
473
+ res[k + "-2"] = m.group(2)
474
+ else:
475
+ res[k] = v
476
+ prompt_parse_res = parse_prompt(prompt)
477
+ lora = prompt_parse_res["lora"]
478
+ for k in res:
479
+ k_s = str(k)
480
+ if k_s.startswith("AddNet Module") and str(res[k]).lower() == "lora":
481
+ model = res[k_s.replace("Module", "Model")]
482
+ value = res.get(k_s.replace("Module", "Weight A"), "1")
483
+ lora.append({"name": lora_extract(model), "value": float(value)})
484
+ return {
485
+ "meta": res,
486
+ "pos_prompt": unique_by(prompt_parse_res["pos_prompt"]),
487
+ "lora": unique_by(lora, lambda x: x["name"].lower()),
488
+ "lyco": unique_by(prompt_parse_res["lyco"], lambda x: x["name"].lower()),
489
+ }
490
+
491
+
492
+ tags_translate: Dict[str, str] = {}
493
+ try:
494
+ import codecs
495
+
496
+ with codecs.open(os.path.join(cwd, "tags-translate.csv"), "r", "utf-8") as tag:
497
+ tags_translate_str = tag.read()
498
+ for line in tags_translate_str.splitlines():
499
+ en, mapping = line.split(",")
500
+ tags_translate[en.strip()] = mapping.strip()
501
+ except Exception as e:
502
+ pass
503
+
504
+
505
+ def open_folder(folder_path, file_path=None):
506
+ folder = os.path.realpath(folder_path)
507
+ if file_path:
508
+ file = os.path.join(folder, file_path)
509
+ if os.name == "nt":
510
+ subprocess.run(["explorer", "/select,", file])
511
+ elif sys.platform == "darwin":
512
+ subprocess.run(["open", "-R", file])
513
+ elif os.name == "posix":
514
+ subprocess.run(["xdg-open", file])
515
+ else:
516
+ if os.name == "nt":
517
+ subprocess.run(["explorer", folder])
518
+ elif sys.platform == "darwin":
519
+ subprocess.run(["open", folder])
520
+ elif os.name == "posix":
521
+ subprocess.run(["xdg-open", folder])
522
+
523
+
extensions/sd-webui-infinite-image-browsing/scripts/iib_setup.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from scripts.iib.api import infinite_image_browsing_api, send_img_path
2
+ from modules import script_callbacks, generation_parameters_copypaste as send
3
+ from scripts.iib.tool import locale
4
+ from scripts.iib.tool import read_sd_webui_gen_info_from_image
5
+ from PIL import Image
6
+ from scripts.iib.logger import logger
7
+
8
+ from fastapi import FastAPI
9
+ import gradio as gr
10
+
11
+ """
12
+ api函数声明和启动分离方便另外一边被外部调用
13
+ """
14
+
15
+
16
+ def on_ui_tabs():
17
+
18
+ with gr.Blocks(analytics_enabled=False) as view:
19
+ with gr.Row():
20
+ with gr.Column():
21
+ gr.HTML("", elem_id="iib_top")
22
+ gr.HTML("error", elem_id="infinite_image_browsing_container_wrapper")
23
+ # 以下是使用2个组件模拟粘贴过程
24
+ img = gr.Image(
25
+ type="pil",
26
+ elem_id="iib_hidden_img",
27
+ )
28
+
29
+ def on_img_change():
30
+ send_img_path["value"] = "" # 真正收到图片改变才允许放行
31
+
32
+ img.change(on_img_change)
33
+
34
+ img_update_trigger = gr.Button(
35
+ "button", elem_id="iib_hidden_img_update_trigger"
36
+ )
37
+
38
+ # 修改文本和图像,等待修改完成后前端触发粘贴按钮
39
+ # 有时在触发后收不到回调,可能是在解析params。txt时除了问题删除掉就行了
40
+ def img_update_func():
41
+ try:
42
+ path = send_img_path.get("value")
43
+ # logger.info("img_update_func %s", path)
44
+ img = Image.open(path)
45
+ info = read_sd_webui_gen_info_from_image(img, path)
46
+ return img, info
47
+ except Exception as e:
48
+ logger.error("img_update_func err %s",e)
49
+
50
+ img_file_info = gr.Textbox(elem_id="iib_hidden_img_file_info")
51
+ img_update_trigger.click(img_update_func, outputs=[img, img_file_info])
52
+ for tab in ["txt2img", "img2img", "inpaint", "extras"]:
53
+ btn = gr.Button(f"Send to {tab}", elem_id=f"iib_hidden_tab_{tab}")
54
+ # 注册粘贴
55
+ send.register_paste_params_button(
56
+ send.ParamBinding(
57
+ paste_button=btn,
58
+ tabname=tab,
59
+ source_image_component=img,
60
+ source_text_component=img_file_info,
61
+ )
62
+ )
63
+
64
+ return (
65
+ (
66
+ view,
67
+ "无边图像浏览" if locale == "zh" else "Infinite image browsing",
68
+ "infinite-image-browsing",
69
+ ),
70
+ )
71
+
72
+ def on_app_started(_: gr.Blocks, app: FastAPI) -> None:
73
+ # 第一个参数是SD-WebUI传进来的gr.Blocks,但是不需要使用
74
+ infinite_image_browsing_api(app)
75
+
76
+
77
+ script_callbacks.on_ui_tabs(on_ui_tabs)
78
+ script_callbacks.on_app_started(on_app_started)
extensions/sd-webui-infinite-image-browsing/style.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [id^="iib_hidden_"] {
2
+ display: none !important;
3
+ }
extensions/sd-webui-infinite-image-browsing/vue/.eslintrc.cjs ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* eslint-env node */
2
+ require('@rushstack/eslint-patch/modern-module-resolution')
3
+
4
+ module.exports = {
5
+ root: true,
6
+ extends: [
7
+ 'plugin:vue/vue3-essential',
8
+ 'eslint:recommended',
9
+ '@vue/eslint-config-typescript',
10
+ ],
11
+ parserOptions: {
12
+ ecmaVersion: 'latest'
13
+ },
14
+ rules: {
15
+ 'vue/multi-word-component-names': ['error', { ignores: ['index', 'index.vue'] }],
16
+ 'no-console': 'off',
17
+ 'quote-props': ['error', 'as-needed'],
18
+ quotes: ['error', 'single'],
19
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
20
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
21
+ '@typescript-eslint/no-non-null-assertion': 'off',
22
+ '@typescript-eslint/no-explicit-any': 'off',
23
+ indent: 'off',
24
+ '@typescript-eslint/indent': ['error', 2]
25
+ }
26
+ }
extensions/sd-webui-infinite-image-browsing/vue/.gitignore ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ *.local
12
+
13
+ # Editor directories and files
14
+ .vscode/*
15
+ !.vscode/extensions.json
16
+ .idea
17
+ .DS_Store
18
+ *.suo
19
+ *.ntvs*
20
+ *.njsproj
21
+ *.sln
22
+ *.sw?
extensions/sd-webui-infinite-image-browsing/vue/.prettierrc.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "semi": false,
4
+ "tabWidth": 2,
5
+ "singleQuote": true,
6
+ "printWidth": 100,
7
+ "trailingComma": "none"
8
+ }
extensions/sd-webui-infinite-image-browsing/vue/.vscode/extensions.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3
+ }
extensions/sd-webui-infinite-image-browsing/vue/README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # vue
2
+
3
+ This template should help get you started developing with Vue 3 in Vite.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8
+
9
+ ## Type Support for `.vue` Imports in TS
10
+
11
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12
+
13
+ If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14
+
15
+ 1. Disable the built-in TypeScript Extension
16
+ 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
+ 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
+ 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19
+
20
+ ## Customize configuration
21
+
22
+ See [Vite Configuration Reference](https://vitejs.dev/config/).
23
+
24
+ ## Project Setup
25
+
26
+ ```sh
27
+ yarn
28
+ ```
29
+
30
+ ### Compile and Hot-Reload for Development
31
+
32
+ ```sh
33
+ yarn dev
34
+ ```
35
+
36
+
37
+ ### Compile and Minify for Production, Deliver to Production Mode Resources
38
+
39
+ ```sh
40
+ yarn build
41
+ ```
42
+
43
+ ### Lint with [ESLint](https://eslint.org/)
44
+
45
+ ```sh
46
+ yarn lint
47
+ ```
extensions/sd-webui-infinite-image-browsing/vue/build.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { execSync } from 'child_process'
2
+ import { readFile, rm, writeFile } from 'fs/promises'
3
+ import { exit } from 'process'
4
+
5
+ const main = async () => {
6
+ try {
7
+ console.log(execSync('vue-tsc && vite build').toString('utf8'))
8
+ } catch (error: any) {
9
+ if (error.stdout && error.stderr) {
10
+ console.log(error.stdout.toString('utf8'))
11
+ console.error(error.stderr.toString('utf8'))
12
+ exit(2)
13
+ } else {
14
+ throw error
15
+ }
16
+ }
17
+ try {
18
+ await rm('../javascript/index.js')
19
+ // eslint-disable-next-line no-empty
20
+ } catch (error) {
21
+
22
+ }
23
+ const html = (await readFile('dist/index.html')).toString()
24
+ const js = (await readFile('index.tpl.js')).toString().replace('__built_html__', html)
25
+ await writeFile('../javascript/index.js', js)
26
+ }
27
+ main()
extensions/sd-webui-infinite-image-browsing/vue/components.d.ts ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // Generated by unplugin-vue-components
5
+ // Read more: https://github.com/vuejs/core/pull/3399
6
+ import '@vue/runtime-core'
7
+
8
+ export {}
9
+
10
+ declare module '@vue/runtime-core' {
11
+ export interface GlobalComponents {
12
+ AAlert: typeof import('ant-design-vue/es')['Alert']
13
+ ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
14
+ ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
15
+ AButton: typeof import('ant-design-vue/es')['Button']
16
+ ACheckbox: typeof import('ant-design-vue/es')['Checkbox']
17
+ ACollapse: typeof import('ant-design-vue/es')['Collapse']
18
+ ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
19
+ ADrawer: typeof import('ant-design-vue/es')['Drawer']
20
+ ADropdown: typeof import('ant-design-vue/es')['Dropdown']
21
+ AForm: typeof import('ant-design-vue/es')['Form']
22
+ AFormItem: typeof import('ant-design-vue/es')['FormItem']
23
+ AImage: typeof import('ant-design-vue/es')['Image']
24
+ AInput: typeof import('ant-design-vue/es')['Input']
25
+ AInputGroup: typeof import('ant-design-vue/es')['InputGroup']
26
+ AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
27
+ AMenu: typeof import('ant-design-vue/es')['Menu']
28
+ AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider']
29
+ AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
30
+ AModal: typeof import('ant-design-vue/es')['Modal']
31
+ ASelect: typeof import('ant-design-vue/es')['Select']
32
+ ASkeleton: typeof import('ant-design-vue/es')['Skeleton']
33
+ ASlider: typeof import('ant-design-vue/es')['Slider']
34
+ ASpin: typeof import('ant-design-vue/es')['Spin']
35
+ ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
36
+ ASwitch: typeof import('ant-design-vue/es')['Switch']
37
+ ATabPane: typeof import('ant-design-vue/es')['TabPane']
38
+ ATabs: typeof import('ant-design-vue/es')['Tabs']
39
+ ATag: typeof import('ant-design-vue/es')['Tag']
40
+ ATextarea: typeof import('ant-design-vue/es')['Textarea']
41
+ ATooltip: typeof import('ant-design-vue/es')['Tooltip']
42
+ ContextMenu: typeof import('./src/components/ContextMenu.vue')['default']
43
+ FileItem: typeof import('./src/components/FileItem.vue')['default']
44
+ NumInput: typeof import('./src/components/numInput.vue')['default']
45
+ RouterLink: typeof import('vue-router')['RouterLink']
46
+ RouterView: typeof import('vue-router')['RouterView']
47
+ }
48
+ }
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/FileItem-39204ab7.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ var Zt=Object.defineProperty;var Xt=(e,n,t)=>n in e?Zt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var Fe=(e,n,t)=>(Xt(e,typeof n!="symbol"?n+"":n,t),t);import{d as Me,u as _t,ap as J,a0 as Ot,h as oe,c as A,c7 as en,c8 as tn,$ as V,b1 as nn,z as X,aB as an,P as at,a1 as rn,ag as re,c9 as sn,aS as ln,ca as on,cb as cn,aN as Pt,as as Oe,bo as We,cc as un,cd as dn,ce as fn,cf as hn,cg as Mt,ch as rt,ci as vn,cj as pn,ck as Tt,cl as Ft,k as Ke,ao as mn,cm as zt,al as ee,ai as R,cn as qe,l as fe,aD as Pe,ax as gn,aj as ze,co as yn,cp as xt,cq as st,at as Bt,bR as lt,bQ as bn,cr as Se,cs as wn,aE as An,ct as Z,bP as Qt,cu as kn,cv as Sn,t as Ne,am as ot,ar as ce,cw as ct,c5 as In,R as he,V as xe,L as se,x as L,J as En,b$ as ut,cx as Cn,cy as _n,b_ as On,cz as Pn,cA as Mn,au as Tn,av as Fn,ay as $t,o as I,m as H,cB as zn,cC as xn,cD as Bn,cE as Qn,cF as $n,a5 as Nn,y as j,an as we,C as q,n as F,A as le,cG as dt,bH as Ln,cH as Dn,B as Rn,N as ue,v as D,r as U,W as Nt,cI as jn,c2 as Hn,M as Lt,cJ as Vn,cK as Un,p as ie,ae as Jn,c1 as Wn,cL as Kn,cM as qn,X as Gn}from"./index-7c0f3f3a.js";import{t as Be,a as ve,l as de,b as Yn,M as Dt,C as Zn,m as Rt,g as Xn,c as ei,d as ti,e as ni}from"./functionalCallableComp-6d05295c.js";import{h as ii,r as ai,a as ri,t as si,i as li}from"./db-90de1b1b.js";import{D as pe,a as Le}from"./index-00c5caf5.js";/* empty css */var oi=function(){return{prefixCls:String,checked:{type:Boolean,default:void 0},onChange:{type:Function},onClick:{type:Function},"onUpdate:checked":Function}},ci=Me({compatConfig:{MODE:3},name:"ACheckableTag",props:oi(),setup:function(n,t){var i=t.slots,a=t.emit,r=_t("tag",n),f=r.prefixCls,o=function(c){var m=n.checked;a("update:checked",!m),a("change",!m),a("click",c)},h=J(function(){var g;return Ot(f.value,(g={},oe(g,"".concat(f.value,"-checkable"),!0),oe(g,"".concat(f.value,"-checkable-checked"),n.checked),g))});return function(){var g;return A("span",{class:h.value,onClick:o},[(g=i.default)===null||g===void 0?void 0:g.call(i)])}}});const De=ci;var ui=new RegExp("^(".concat(en.join("|"),")(-inverse)?$")),di=new RegExp("^(".concat(tn.join("|"),")$")),fi=function(){return{prefixCls:String,color:{type:String},closable:{type:Boolean,default:!1},closeIcon:at.any,visible:{type:Boolean,default:void 0},onClose:{type:Function},"onUpdate:visible":Function,icon:at.any}},me=Me({compatConfig:{MODE:3},name:"ATag",props:fi(),slots:["closeIcon","icon"],setup:function(n,t){var i=t.slots,a=t.emit,r=t.attrs,f=_t("tag",n),o=f.prefixCls,h=f.direction,g=V(!0);nn(function(){n.visible!==void 0&&(g.value=n.visible)});var c=function(s){s.stopPropagation(),a("update:visible",!1),a("close",s),!s.defaultPrevented&&n.visible===void 0&&(g.value=!1)},m=J(function(){var b=n.color;return b?ui.test(b)||di.test(b):!1}),k=J(function(){var b;return Ot(o.value,(b={},oe(b,"".concat(o.value,"-").concat(n.color),m.value),oe(b,"".concat(o.value,"-has-color"),n.color&&!m.value),oe(b,"".concat(o.value,"-hidden"),!g.value),oe(b,"".concat(o.value,"-rtl"),h.value==="rtl"),b))});return function(){var b,s,l,d=n.icon,v=d===void 0?(b=i.icon)===null||b===void 0?void 0:b.call(i):d,w=n.color,y=n.closeIcon,u=y===void 0?(s=i.closeIcon)===null||s===void 0?void 0:s.call(i):y,O=n.closable,C=O===void 0?!1:O,E=function(){return C?u?A("span",{class:"".concat(o.value,"-close-icon"),onClick:c},[u]):A(rn,{class:"".concat(o.value,"-close-icon"),onClick:c},null):null},P={backgroundColor:w&&!m.value?w:void 0},z=v||null,S=(l=i.default)===null||l===void 0?void 0:l.call(i),Q=z?A(X,null,[z,A("span",null,[S])]):S,$="onClick"in r,N=A("span",{class:k.value,style:P},[Q,E()]);return $?A(an,null,{default:function(){return[N]}}):N}}});me.CheckableTag=De;me.install=function(e){return e.component(me.name,me),e.component(De.name,De),e};const hi=me;pe.Button=Le;pe.install=function(e){return e.component(pe.name,pe),e.component(Le.name,Le),e};var vi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z"}}]},name:"star",theme:"filled"};const pi=vi;function ft(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){mi(e,a,t[a])})}return e}function mi(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var Ge=function(n,t){var i=ft({},n,t.attrs);return A(re,ft({},i,{icon:pi}),null)};Ge.displayName="StarFilled";Ge.inheritAttrs=!1;const jt=Ge;var gi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"};const yi=gi;function ht(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){bi(e,a,t[a])})}return e}function bi(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var Ye=function(n,t){var i=ht({},n,t.attrs);return A(re,ht({},i,{icon:yi}),null)};Ye.displayName="FileOutlined";Ye.inheritAttrs=!1;const wi=Ye;var Ai={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"};const ki=Ai;function vt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){Si(e,a,t[a])})}return e}function Si(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var Ze=function(n,t){var i=vt({},n,t.attrs);return A(re,vt({},i,{icon:ki}),null)};Ze.displayName="FolderOpenOutlined";Ze.inheritAttrs=!1;const Ii=Ze;function Ei(e,n,t){if(!sn(t))return!1;var i=typeof n;return(i=="number"?ln(t)&&on(n,t.length):i=="string"&&n in t)?cn(t[n],e):!1}function Ci(e){return e&&e.length?e[0]:void 0}var _i=Math.ceil,Oi=Math.max;function Pi(e,n,t,i){for(var a=-1,r=Oi(_i((n-e)/(t||1)),0),f=Array(r);r--;)f[i?r:++a]=e,e+=t;return f}function Mi(e){return function(n,t,i){return i&&typeof i!="number"&&Ei(n,t,i)&&(t=i=void 0),n=Be(n),t===void 0?(t=n,n=0):t=Be(t),i=i===void 0?n<t?1:-1:Be(i),Pi(n,t,i,e)}}var Ti=Mi();const Ht=Ti,ge=(...e)=>{document.addEventListener(...e),Pt(()=>document.removeEventListener(...e))},Fi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==",Ae=new WeakMap;function zi(e,n){return{useHookShareState:i=>{const a=dn();Oe(a),Ae.has(a)||(Ae.set(a,We(e(a,i??(n==null?void 0:n())))),Pt(()=>{Ae.delete(a)}));const r=Ae.get(a);return Oe(r),{state:r,toRefs(){return un(r)}}}}}var xi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"};const Bi=xi;function pt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){Qi(e,a,t[a])})}return e}function Qi(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var Xe=function(n,t){var i=pt({},n,t.attrs);return A(re,pt({},i,{icon:Bi}),null)};Xe.displayName="DatabaseOutlined";Xe.inheritAttrs=!1;const $i=Xe;var Ni={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M923 283.6a260.04 260.04 0 00-56.9-82.8 264.4 264.4 0 00-84-55.5A265.34 265.34 0 00679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 00-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9z"}}]},name:"heart",theme:"filled"};const Li=Ni;function mt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){Di(e,a,t[a])})}return e}function Di(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var et=function(n,t){var i=mt({},n,t.attrs);return A(re,mt({},i,{icon:Li}),null)};et.displayName="HeartFilled";et.inheritAttrs=!1;const Ri=et;var ji={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M923 283.6a260.04 260.04 0 00-56.9-82.8 264.4 264.4 0 00-84-55.5A265.34 265.34 0 00679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 00-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9zM512 814.8S156 586.7 156 385.5C156 283.6 240.3 201 344.3 201c73.1 0 136.5 40.8 167.7 100.4C543.2 241.8 606.6 201 679.7 201c104 0 188.3 82.6 188.3 184.5 0 201.2-356 429.3-356 429.3z"}}]},name:"heart",theme:"outlined"};const Hi=ji;function gt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){Vi(e,a,t[a])})}return e}function Vi(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var tt=function(n,t){var i=gt({},n,t.attrs);return A(re,gt({},i,{icon:Hi}),null)};tt.displayName="HeartOutlined";tt.inheritAttrs=!1;const Ui=tt;var Ji={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm144.1 454.9L437.7 677.8a8.02 8.02 0 01-12.7-6.5V353.7a8 8 0 0112.7-6.5L656.1 506a7.9 7.9 0 010 12.9z"}}]},name:"play-circle",theme:"filled"};const Wi=Ji;function yt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){Ki(e,a,t[a])})}return e}function Ki(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var nt=function(n,t){var i=yt({},n,t.attrs);return A(re,yt({},i,{icon:Wi}),null)};nt.displayName="PlayCircleFilled";nt.inheritAttrs=!1;const qi=nt;var Gi={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z"}}]},name:"star",theme:"outlined"};const Yi=Gi;function bt(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?Object(arguments[n]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),i.forEach(function(a){Zi(e,a,t[a])})}return e}function Zi(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var it=function(n,t){var i=bt({},n,t.attrs);return A(re,bt({},i,{icon:Yi}),null)};it.displayName="StarOutlined";it.inheritAttrs=!1;const Vt=it;var Ut={exports:{}};/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
2
+ * @license MIT */(function(e,n){(function(t,i){e.exports=i})(fn,function(){var t={};t.version="0.3.5";var i=t.settings={minimum:.08,easing:"linear",positionUsing:"",speed:200,trickle:!0,trickleSpeed:200,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};t.configure=function(s){var l,d;for(l in s)d=s[l],d!==void 0&&s.hasOwnProperty(l)&&(i[l]=d);return this},t.status=null,t.set=function(s){var l=t.isStarted();s=a(s,i.minimum,1),t.status=s===1?null:s;var d=t.render(!l),v=d.querySelector(i.barSelector),w=i.speed,y=i.easing;return d.offsetWidth,o(function(u){i.positionUsing===""&&(i.positionUsing=t.getPositioningCSS()),h(v,f(s,w,y)),s===1?(h(d,{transition:"none",opacity:1}),d.offsetWidth,setTimeout(function(){h(d,{transition:"all "+w+"ms linear",opacity:0}),setTimeout(function(){t.remove(),u()},w)},w)):setTimeout(u,w)}),this},t.isStarted=function(){return typeof t.status=="number"},t.start=function(){t.status||t.set(0);var s=function(){setTimeout(function(){t.status&&(t.trickle(),s())},i.trickleSpeed)};return i.trickle&&s(),this},t.done=function(s){return!s&&!t.status?this:t.inc(.3+.5*Math.random()).set(1)},t.inc=function(s){var l=t.status;return l?l>1?void 0:(typeof s!="number"&&(l>=0&&l<.2?s=.1:l>=.2&&l<.5?s=.04:l>=.5&&l<.8?s=.02:l>=.8&&l<.99?s=.005:s=0),l=a(l+s,0,.994),t.set(l)):t.start()},t.trickle=function(){return t.inc()},function(){var s=0,l=0;t.promise=function(d){return!d||d.state()==="resolved"?this:(l===0&&t.start(),s++,l++,d.always(function(){l--,l===0?(s=0,t.done()):t.set((s-l)/s)}),this)}}(),t.getElement=function(){var s=t.getParent();if(s){var l=Array.prototype.slice.call(s.querySelectorAll(".nprogress")).filter(function(d){return d.parentElement===s});if(l.length>0)return l[0]}return null},t.getParent=function(){if(i.parent instanceof HTMLElement)return i.parent;if(typeof i.parent=="string")return document.querySelector(i.parent)},t.render=function(s){if(t.isRendered())return t.getElement();c(document.documentElement,"nprogress-busy");var l=document.createElement("div");l.id="nprogress",l.className="nprogress",l.innerHTML=i.template;var d=l.querySelector(i.barSelector),v=s?"-100":r(t.status||0),w=t.getParent(),y;return h(d,{transition:"all 0 linear",transform:"translate3d("+v+"%,0,0)"}),i.showSpinner||(y=l.querySelector(i.spinnerSelector),y&&b(y)),w!=document.body&&c(w,"nprogress-custom-parent"),w.appendChild(l),l},t.remove=function(){t.status=null,m(document.documentElement,"nprogress-busy"),m(t.getParent(),"nprogress-custom-parent");var s=t.getElement();s&&b(s)},t.isRendered=function(){return!!t.getElement()},t.getPositioningCSS=function(){var s=document.body.style,l="WebkitTransform"in s?"Webkit":"MozTransform"in s?"Moz":"msTransform"in s?"ms":"OTransform"in s?"O":"";return l+"Perspective"in s?"translate3d":l+"Transform"in s?"translate":"margin"};function a(s,l,d){return s<l?l:s>d?d:s}function r(s){return(-1+s)*100}function f(s,l,d){var v;return i.positionUsing==="translate3d"?v={transform:"translate3d("+r(s)+"%,0,0)"}:i.positionUsing==="translate"?v={transform:"translate("+r(s)+"%,0)"}:v={"margin-left":r(s)+"%"},v.transition="all "+l+"ms "+d,v}var o=function(){var s=[];function l(){var d=s.shift();d&&d(l)}return function(d){s.push(d),s.length==1&&l()}}(),h=function(){var s=["Webkit","O","Moz","ms"],l={};function d(u){return u.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(O,C){return C.toUpperCase()})}function v(u){var O=document.body.style;if(u in O)return u;for(var C=s.length,E=u.charAt(0).toUpperCase()+u.slice(1),P;C--;)if(P=s[C]+E,P in O)return P;return u}function w(u){return u=d(u),l[u]||(l[u]=v(u))}function y(u,O,C){O=w(O),u.style[O]=C}return function(u,O){var C=arguments,E,P;if(C.length==2)for(E in O)P=O[E],P!==void 0&&O.hasOwnProperty(E)&&y(u,E,P);else y(u,C[1],C[2])}}();function g(s,l){var d=typeof s=="string"?s:k(s);return d.indexOf(" "+l+" ")>=0}function c(s,l){var d=k(s),v=d+l;g(d,l)||(s.className=v.substring(1))}function m(s,l){var d=k(s),v;g(s,l)&&(v=d.replace(" "+l+" "," "),s.className=v.substring(1,v.length-1))}function k(s){return(" "+(s&&s.className||"")+" ").replace(/\s+/gi," ")}function b(s){s&&s.parentNode&&s.parentNode.removeChild(s)}return t})})(Ut);var Xi=Ut.exports;const ea=hn(Xi);function ta(){const e=[];for(let a=0;a<72;a++){const f=`hsl(${a*7.2}, 90%, 35%)`;e.push(f)}return e}const wt=ta(),Jt=Mt("useTagStore",()=>{const e=We(new Map),n=async r=>{if(r=r.filter(f=>!e.has(f)),!!r.length)try{r.forEach(o=>e.set(o,[]));const f=await ii(r);for(const o in f)e.set(o,f[o])}catch{r.forEach(f=>e.delete(f))}},t=new Map;return{tagMap:e,getColor:r=>{let f=t.get(r);if(!f){const o=rt.hash.sha256.hash(r),h=parseInt(rt.codec.hex.fromBits(o),16)%wt.length;f=wt[h],t.set(r,f)}return f},fetchImageTags:n,refreshTags:async r=>{r.forEach(f=>e.delete(f)),await n(r)}}}),na=Mt("useBatchDownloadStore",()=>{const e=V([]);return{selectdFiles:e,addFiles:t=>{e.value=vn([...e.value,...t])}}});class At{constructor(n,t=pn.CREATED_TIME_DESC){Fe(this,"root");Fe(this,"execQueue",[]);this.sortMethod=t,this.root={children:[],info:{name:n,size:"-",bytes:0,created_time:"",is_under_scanned_path:!0,date:"",type:"dir",fullpath:n}},this.fetchChildren(this.root)}reset(){return this.root.children=[],this.fetchChildren(this.root)}get images(){const n=t=>t.children.map(i=>{if(i.info.type==="dir")return n(i);if(Ft(i.info.name))return i.info}).filter(i=>i).flat(1);return n(this.root)}get isCompleted(){return this.execQueue.length===0}async fetchChildren(n){const{files:t}=await ve(n.info.fullpath);return n.children=Tt(t,this.sortMethod).map(i=>({info:i,children:[]})),this.execQueue.shift(),this.execQueue.unshift(...n.children.filter(i=>i.info.type==="dir").map(i=>({fn:()=>this.fetchChildren(i),...i}))),n}async next(){const n=Ci(this.execQueue);if(!n)return null;const t=await n.fn();return this.execQueue=this.execQueue.slice(),this.root={...this.root},t}}function Qe(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!On(e)}const Ie=new Map,B=Ke(),ia=na(),Re=Jt(),kt=mn(),ke=new BroadcastChannel("iib-image-transfer-bus"),{eventEmitter:Ee,useEventListen:je}=zt(),{useHookShareState:ae}=zi((e,{images:n})=>{const t=V({tabIdx:-1,paneIdx:-1}),i=J(()=>de(a.value)),a=V([]),r=J(()=>{var w;return a.value.map(y=>y.curr).slice((w=B.conf)!=null&&w.is_win?1:0)}),f=J(()=>xt(...r.value)),o=V(B.defaultSortingMethod),h=V(t.value.walkModePath?new At(t.value.walkModePath,o.value):void 0);fe([()=>t.value.walkModePath,o],()=>{h.value=t.value.walkModePath?new At(t.value.walkModePath,o.value):void 0});const g=We(new Set);fe(i,()=>g.clear());const c=J(()=>{var O;if(n.value)return n.value;if(h.value)return h.value.images.filter(C=>!g.has(C.fullpath));if(!i.value)return[];const w=((O=i.value)==null?void 0:O.files)??[],y=o.value;return Tt((C=>B.onlyFoldersAndImages?C.filter(E=>E.type==="dir"||Ft(E.name)):C)(w),y).filter(C=>!g.has(C.fullpath))}),m=V([]),k=V(-1),b=J(()=>h.value?!h.value.isCompleted:!1),s=V(!1),l=V(!1),d=()=>{var w,y,u;return(u=(y=(w=B.tabList)==null?void 0:w[t.value.tabIdx])==null?void 0:y.panes)==null?void 0:u[t.value.paneIdx]},v=zt();return v.useEventListen("selectAll",()=>{console.log(`select all 0 -> ${c.value.length}`),m.value=Ht(0,c.value.length)}),{previewing:l,spinning:s,canLoadNext:b,multiSelectedIdxs:m,previewIdx:k,basePath:r,currLocation:f,currPage:i,stack:a,sortMethod:o,sortedFiles:c,scroller:V(),stackViewEl:V(),props:t,getPane:d,walker:h,deletedFiles:g,...v}},()=>({images:V()}));function Wa(){const{previewIdx:e,eventEmitter:n,canLoadNext:t,previewing:i,sortedFiles:a,scroller:r,props:f}=ae().toRefs(),{state:o}=ae();let h=null;const g=(b,s)=>{var l;i.value=b,h!=null&&!b&&s&&((l=r.value)==null||l.scrollToItem(h),h=null)},c=()=>{f.value.walkModePath&&!k("next")&&t&&(ee.info(R("loadingNextFolder")),n.value.emit("loadNextDir",!0))};ge("keydown",b=>{var s;if(i.value){let l=e.value;if(["ArrowDown","ArrowRight"].includes(b.key))for(l++;a.value[l]&&!Z(a.value[l].name);)l++;else if(["ArrowUp","ArrowLeft"].includes(b.key))for(l--;a.value[l]&&!Z(a.value[l].name);)l--;if(Z((s=a.value[l])==null?void 0:s.name)??""){e.value=l;const d=r.value;d&&!(l>=d.$_startIndex&&l<=d.$_endIndex)&&(h=l)}c()}});const m=b=>{var l;let s=e.value;if(b==="next")for(s++;a.value[s]&&!Z(a.value[s].name);)s++;else if(b==="prev")for(s--;a.value[s]&&!Z(a.value[s].name);)s--;if(Z((l=a.value[s])==null?void 0:l.name)??""){e.value=s;const d=r.value;d&&!(s>=d.$_startIndex&&s<=d.$_endIndex)&&(h=s)}c()},k=b=>{var l;let s=e.value;if(b==="next")for(s++;a.value[s]&&!Z(a.value[s].name);)s++;else if(b==="prev")for(s--;a.value[s]&&!Z(a.value[s].name);)s--;return Z((l=a.value[s])==null?void 0:l.name)??""};return je("removeFiles",async()=>{var b;i.value&&!o.sortedFiles[e.value]&&(ee.info(R("manualExitFullScreen"),5),await qe(500),(b=document.querySelector(".ant-image-preview-operations-operation .anticon-close"))==null||b.click(),e.value=-1)}),{previewIdx:e,onPreviewVisibleChange:g,previewing:i,previewImgMove:m,canPreview:k}}function Ka(){const e=V(),{scroller:n,stackViewEl:t,stack:i,currPage:a,currLocation:r,useEventListen:f,eventEmitter:o,getPane:h,props:g,deletedFiles:c,walker:m,sortedFiles:k}=ae().toRefs();fe(()=>i.value.length,Pe((p,M)=>{var x;p!==M&&((x=n.value)==null||x.scrollToItem(0))},300));const b=async p=>{var M;await w(p),g.value.walkModePath&&(await qe(),await((M=m.value)==null?void 0:M.reset()),o.value.emit("loadNextDir"))};gn(async()=>{var p;if(!i.value.length){const M=await ve("/");i.value.push({files:M.files,curr:"/"})}e.value=new ea,e.value.configure({parent:t.value}),g.value.path&&g.value.path!=="/"?await b(g.value.walkModePath??g.value.path):(p=B.conf)!=null&&p.home&&w(B.conf.home)}),fe(r,Pe(p=>{const M=h.value();if(!M)return;M.path=p;const x=M.path.split("/").pop(),K=(()=>{var ne;if(!g.value.walkModePath){const Y=Se(p);for(const[ye,be]of Object.entries(B.pathAliasMap))if(Y.startsWith(be))return Y.replace(be,ye);return x}return"Walk: "+(((ne=B.quickMovePaths.find(Y=>Y.dir===M.walkModePath))==null?void 0:ne.zh)??x)})();M.name=ze("div",{style:"display:flex;align-items:center"},[ze($i),ze("span",{class:"line-clamp-1",style:"max-width: 256px"},K)]),M.nameFallbackStr=K,B.recent=B.recent.filter(ne=>ne.key!==M.key),B.recent.unshift({path:p,key:M.key}),B.recent.length>20&&(B.recent=B.recent.slice(0,20))},300));const s=()=>Ne(r.value),l=async p=>{var M,x;if(p.type==="dir")try{(M=e.value)==null||M.start();const{files:G}=await ve(p.fullpath);i.value.push({files:G,curr:p.name})}finally{(x=e.value)==null||x.done()}},d=p=>{for(;p<i.value.length-1;)i.value.pop()},v=(p,M)=>(Oe(B.conf,"global.conf load failed"),B.conf.is_win?p.toLowerCase()==M.toLowerCase():p==M),w=async p=>{var x,G;const M=i.value.slice();try{yn(p)||(p=xt(((x=B.conf)==null?void 0:x.sd_cwd)??"/",p));const K=st(p),ne=i.value.map(Y=>Y.curr);for(ne.shift();ne[0]&&K[0]&&v(ne[0],K[0]);)ne.shift(),K.shift();for(let Y=0;Y<ne.length;Y++)i.value.pop();if(!K.length)return y();for(const Y of K){const ye=(G=a.value)==null?void 0:G.files.find(be=>v(be.name,Y));if(!ye)throw console.error({frags:K,frag:Y,stack:Bt(i.value)}),new Error(`${Y} not found`);await l(ye)}}catch(K){throw ee.error(R("moveFailedCheckPath")+(K instanceof Error?K.message:"")),console.error(p,st(p),a.value),i.value=M,K}},y=lt(async()=>{var p,M,x;try{if((p=e.value)==null||p.start(),m.value)await m.value.reset(),o.value.emit("loadNextDir");else{const{files:G}=await ve(i.value.length===1?"/":r.value);de(i.value).files=G}c.value.clear(),(M=n.value)==null||M.scrollToItem(0),ee.success(R("refreshCompleted"))}finally{(x=e.value)==null||x.done()}});bn("returnToIIB",lt(async()=>{var p,M;if(!g.value.walkModePath)try{(p=e.value)==null||p.start();const{files:x}=await ve(i.value.length===1?"/":r.value);de(i.value).files.map(K=>K.date).join()!==x.map(K=>K.date).join()&&(de(i.value).files=x,ee.success(R("autoUpdate")))}finally{(M=e.value)==null||M.done()}})),f.value("refresh",y);const u=p=>{g.value.walkModePath&&(h.value().walkModePath=p),b(p)},O=J(()=>B.quickMovePaths.map(p=>({...p,path:Se(p.dir)}))),C=J(()=>{const p=Se(r.value);return O.value.find(x=>x.path===p)}),E=async()=>{const p=C.value;if(p){if(!p.can_delete)return;await ai({path:r.value,type:"scanned"}),ee.success(R("removeCompleted"))}else await ri({path:r.value,type:"scanned"}),ee.success(R("addCompleted"));ot.emit("searchIndexExpired"),ot.emit("updateGlobalSetting")},P=V(!1),z=V(r.value),S=()=>{P.value=!0,z.value=r.value},Q=async()=>{await w(z.value),P.value=!1};ge("click",p=>{var M,x,G;(G=(x=(M=p.target)==null?void 0:M.className)==null?void 0:x.includes)!=null&&G.call(x,"ant-input")||(P.value=!1)});const $=()=>{const p=parent.location,M=p.href.substring(0,p.href.length-p.search.length),x=new URLSearchParams(p.search);x.set("action","open"),m.value&&x.set("walk","1"),x.set("path",r.value);const G=`${M}?${x.toString()}`;Ne(G,R("copyLocationUrlSuccessMsg"))},N=(p="tag-search")=>{const M=B.tabList[g.value.tabIdx],x={type:p,key:ce(),searchScope:r.value,name:R(p==="tag-search"?"imgSearch":"fuzzy-search")};M.panes.push(x),M.key=x.key},te=()=>o.value.emit("selectAll"),T=async()=>{await Yn(r.value),await y()},_=()=>{const p=r.value;Ie.set(p,i.value);const M=B.tabList[g.value.tabIdx],x={type:"local",key:ce(),path:p,name:R("local"),stackKey:p,walkModePath:p};M.panes.push(x),M.key=x.key},W=J(()=>!m.value&&k.value.some(p=>p.type==="dir"));return{locInputValue:z,isLocationEditing:P,onLocEditEnter:Q,onEditBtnClick:S,addToSearchScanPathAndQuickMove:E,searchPathInfo:C,refresh:y,copyLocation:s,back:d,openNext:l,currPage:a,currLocation:r,to:w,stack:i,scroller:n,share:$,selectAll:te,quickMoveTo:u,onCreateFloderBtnClick:T,onWalkBtnClick:_,showWalkButton:W,searchInCurrentDir:N}}function qa({fetchNext:e}={}){const{scroller:n,sortedFiles:t,sortMethod:i,currLocation:a,stackViewEl:r,canLoadNext:f,previewIdx:o,props:h,walker:g}=ae().toRefs(),{state:c}=ae(),m=V(!1),k=V(B.defaultGridCellWidth),b=J(()=>k.value+16),s=44,{width:l}=wn(r),d=J(()=>~~(l.value/b.value)),v=J(()=>{const E=b.value;return{first:E+(k.value<=160?0:s),second:E}}),w=V(!1),y=async()=>{var E;if(!(w.value||!h.value.walkModePath||!f.value))try{w.value=!0,await((E=g.value)==null?void 0:E.next())}finally{w.value=!1}},u=async(E=!1)=>{const P=n.value,z=()=>E?o.value:(P==null?void 0:P.$_endIndex)??0,S=()=>{const Q=t.value.length,$=50;return Q?e?z()>Q-$:z()>Q-$&&f.value:!0};for(;S();){await qe(30);const Q=await(e??y)();if(typeof Q=="boolean"&&!Q)return}};c.useEventListen("loadNextDir",u);const O=()=>{const E=n.value;if(E){const P=t.value.slice(Math.max(E.$_startIndex-10,0),E.$_endIndex+10).filter(z=>z.is_under_scanned_path&&Z(z.name)).map(z=>z.fullpath);Re.fetchImageTags(P)}};fe(a,Pe(O,150));const C=Pe(async()=>{await u(),O()},150);return{gridItems:d,sortedFiles:t,sortMethodConv:An,moreActionsDropdownShow:m,gridSize:b,sortMethod:i,onScroll:C,loadNextDir:y,loadNextDirLoading:w,canLoadNext:f,itemSize:v,cellWidth:k}}function Ga(){const{currLocation:e,sortedFiles:n,currPage:t,multiSelectedIdxs:i,eventEmitter:a,walker:r}=ae().toRefs(),f=()=>{i.value=[]};return ge("click",f),ge("blur",f),fe(t,f),{onFileDragStart:(c,m)=>{const k=Bt(n.value[m]);kt.fileDragging=!0,console.log("onFileDragStart set drag file ",c,m,k);const b=[k];let s=k.type==="dir";if(i.value.includes(m)){const d=i.value.map(v=>n.value[v]);b.push(...d),s=d.some(v=>v.type==="dir")}const l={includeDir:s,loc:e.value||"search-result",path:ct(b,"fullpath").map(d=>d.fullpath),nodes:ct(b,"fullpath"),__id:"FileTransferData"};c.dataTransfer.setData("text/plain",JSON.stringify(l))},onDrop:async c=>{if(r.value)return;const m=In(c);if(!m)return;const k=e.value;if(m.loc===k)return;const b=Qt(),s=async()=>b.pushAction(async()=>{await ei(m.path,k),a.value.emit("refresh"),he.destroyAll()}),l=()=>b.pushAction(async()=>{await Rt(m.path,k),Ee.emit("removeFiles",{paths:m.path,loc:m.loc}),a.value.emit("refresh"),he.destroyAll()});he.confirm({title:R("confirm")+"?",width:"60vw",content:()=>{let d,v,w;return A("div",null,[A("div",null,[`${R("moveSelectedFilesTo")} ${k}`,A("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[m.path.map(y=>A("li",null,[y.split(/[/\\]/).pop()]))])]),A(Dt,null,null),A("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end"},class:"actions"},[A(xe,{onClick:he.destroyAll},Qe(d=R("cancel"))?d:{default:()=>[d]}),A(xe,{type:"primary",loading:!b.isIdle,onClick:s},Qe(v=R("copy"))?v:{default:()=>[v]}),A(xe,{type:"primary",loading:!b.isIdle,onClick:l},Qe(w=R("move"))?w:{default:()=>[w]})])])},maskClosable:!0,wrapClassName:"hidden-antd-btns-modal"})},multiSelectedIdxs:i,onFileDragEnd:()=>{kt.fileDragging=!1}}}function Ya({openNext:e}){const n=V(!1),t=V(""),{sortedFiles:i,previewIdx:a,multiSelectedIdxs:r,stack:f,currLocation:o,spinning:h,previewing:g,stackViewEl:c,eventEmitter:m,props:k,deletedFiles:b}=ae().toRefs(),s=Se;je("removeFiles",({paths:y,loc:u})=>{s(u)!==s(o.value)||!de(f.value)||(y.forEach(C=>b.value.add(C)),y.filter(Z).forEach(C=>b.value.add(C.replace(/\.\w+$/,".txt"))))}),je("addFiles",({files:y,loc:u})=>{if(s(u)!==s(o.value))return;const O=de(f.value);O&&O.files.unshift(...y)});const l=Qt(),d=async(y,u,O)=>{a.value=O,B.fullscreenPreviewInitialUrl=se(u);const C=r.value.indexOf(O);if(y.shiftKey){if(C!==-1)r.value.splice(C,1);else{r.value.push(O),r.value.sort((z,S)=>z-S);const E=r.value[0],P=r.value[r.value.length-1];r.value=Ht(E,P+1)}y.stopPropagation()}else y.ctrlKey||y.metaKey?(C!==-1?r.value.splice(C,1):r.value.push(O),y.stopPropagation()):await e(u)},v=async(y,u,O)=>{var $,N,te;const C=se(u),E=o.value,P={IIB_container_id:parent.IIB_container_id},z=()=>{let T=[];return r.value.includes(O)?T=r.value.map(_=>i.value[_]):T.push(u),T},S=async T=>{if(!h.value)try{h.value=!0,await Pn(u.fullpath),ke.postMessage({...P,event:"click_hidden_button",btnEleId:"iib_hidden_img_update_trigger"}),await Mn(),ke.postMessage({...P,event:"click_hidden_button",btnEleId:`iib_hidden_tab_${T}`})}catch(_){console.error(_),ee.error("发送图像失败,请携带console的错误消息找开发者")}finally{h.value=!1}},Q=`${y.key}`;if(Q.startsWith("toggle-tag-")){const T=+Q.split("toggle-tag-")[1],{is_remove:_}=await si({tag_id:T,img_path:u.fullpath}),W=(N=($=B.conf)==null?void 0:$.all_custom_tags.find(p=>p.id===T))==null?void 0:N.name;await Re.refreshTags([u.fullpath]),ee.success(R(_?"removedTagFromImage":"addedTagToImage",{tag:W}));return}else if(Q.startsWith("batch-add-tag-")||Q.startsWith("batch-remove-tag-")){const T=+Q.split("-tag-")[1],_=Q.includes("add")?"add":"remove",W=z().map(p=>p.fullpath);await li({tag_id:T,img_paths:W,action:_}),await Re.refreshTags(W),ee.success(R(_==="add"?"addCompleted":"removeCompleted"));return}switch(y.key){case"previewInNewWindow":return window.open(C);case"download":{const T=z();_n(T.map(_=>se(_,!0)));break}case"copyPreviewUrl":return Ne(parent.document.location.origin+C);case"send2txt2img":return S("txt2img");case"send2img2img":return S("img2img");case"send2inpaint":return S("inpaint");case"send2extras":return S("extras");case"send2savedDir":{const T=B.quickMovePaths.find(p=>p.key==="outdir_save");if(!T)return ee.error(R("unknownSavedDir"));const _=Cn(T.dir,(te=B.conf)==null?void 0:te.sd_cwd),W=z();await Rt(W.map(p=>p.fullpath),_,!0),Ee.emit("removeFiles",{paths:W.map(p=>p.fullpath),loc:o.value}),Ee.emit("addFiles",{files:W,loc:_});break}case"send2controlnet-img2img":case"send2controlnet-txt2img":{const T=y.key.split("-")[1];ke.postMessage({...P,event:"send_to_control_net",type:T,url:se(u)});break}case"send2outpaint":{t.value=await l.pushAction(()=>ut(u.fullpath)).res;const[T,_]=(t.value||"").split(`
3
+ `);ke.postMessage({...P,event:"send_to_outpaint",url:se(u),prompt:T,negPrompt:_.slice(17)});break}case"openWithWalkMode":{Ie.set(E,f.value);const T=B.tabList[k.value.tabIdx],_={type:"local",key:ce(),path:u.fullpath,name:R("local"),stackKey:E,walkModePath:u.fullpath};T.panes.push(_),T.key=_.key;break}case"openInNewTab":{Ie.set(E,f.value);const T=B.tabList[k.value.tabIdx],_={type:"local",key:ce(),path:u.fullpath,name:R("local"),stackKey:E};T.panes.push(_),T.key=_.key;break}case"openOnTheRight":{Ie.set(E,f.value);let T=B.tabList[k.value.tabIdx+1];T||(T={panes:[],key:"",id:ce()},B.tabList[k.value.tabIdx+1]=T);const _={type:"local",key:ce(),path:u.fullpath,name:R("local"),stackKey:E};T.panes.push(_),T.key=_.key;break}case"send2BatchDownload":{ia.addFiles(z());break}case"viewGenInfo":{n.value=!0,t.value=await l.pushAction(()=>ut(u.fullpath)).res;break}case"openWithLocalFileBrowser":{await En(u.fullpath);break}case"deleteFiles":{const T=z(),_=async()=>{const W=T.map(p=>p.fullpath);await ti(W),ee.success(R("deleteSuccess")),Ee.emit("removeFiles",{paths:W,loc:o.value})};if(T.length===1&&B.ignoredConfirmActions.deleteOneOnly)return _();await new Promise(W=>{he.confirm({title:R("confirmDelete"),maskClosable:!0,width:"60vw",content:()=>A("div",null,[A("ol",{style:{maxHeight:"50vh",overflow:"auto"}},[T.map(p=>A("li",null,[p.fullpath.split(/[/\\]/).pop()]))]),A(Dt,null,null),A(Zn,{checked:B.ignoredConfirmActions.deleteOneOnly,"onUpdate:checked":p=>B.ignoredConfirmActions.deleteOneOnly=p},{default:()=>[R("deleteOneOnlySkipConfirm"),L(" ("),R("resetOnGlobalSettingsPage"),L(")")]})]),async onOk(){await _(),W()}})});break}}return{}},{isOutside:w}=kn(c);return ge("keydown",y=>{var O,C,E;const u=Xn(y);if(g.value){const P=(O=Object.entries(B.shortcut).find(z=>z[1]===u&&z[1]))==null?void 0:O[0];if(P){y.stopPropagation(),y.preventDefault();const z=a.value,S=i.value[z];switch(P){case"delete":return se(S)===B.fullscreenPreviewInitialUrl?ee.warn(R("fullscreenRestriction")):v({key:"deleteFiles"},S,z);case"download":return v({key:"download"},S,z);default:{const Q=(C=/^toggle_tag_(.*)$/.exec(P))==null?void 0:C[1],$=(E=B.conf)==null?void 0:E.all_custom_tags.find(N=>N.name===Q);return $?v({key:`toggle-tag-${$.id}`},S,z):void 0}}}}else!w.value&&["Ctrl + KeyA","Cmd + KeyA"].includes(u)&&(y.preventDefault(),y.stopPropagation(),m.value.emit("selectAll"))}),{onFileItemClick:d,onContextMenuClick:v,showGenInfo:n,imageGenInfo:t,q:l}}const Za=()=>{const{stackViewEl:e}=ae().toRefs(),n=V(-1);return Sn(e,t=>{var a;let i=t.target;for(;i.parentElement;)if(i=i.parentElement,i.tagName.toLowerCase()==="li"&&i.classList.contains("file-item-trigger")){const r=(a=i.dataset)==null?void 0:a.idx;r&&Number.isSafeInteger(+r)&&(n.value=+r);return}}),{showMenuIdx:n}};function aa(){var e=window.navigator.userAgent,n=e.indexOf("MSIE ");if(n>0)return parseInt(e.substring(n+5,e.indexOf(".",n)),10);var t=e.indexOf("Trident/");if(t>0){var i=e.indexOf("rv:");return parseInt(e.substring(i+3,e.indexOf(".",i)),10)}var a=e.indexOf("Edge/");return a>0?parseInt(e.substring(a+5,e.indexOf(".",a)),10):-1}let Ce;function He(){He.init||(He.init=!0,Ce=aa()!==-1)}var Te={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:["notify"],mounted(){He(),$t(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const e=document.createElement("object");this._resizeObject=e,e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex",-1),e.onload=this.addResizeHandlers,e.type="text/html",Ce&&this.$el.appendChild(e),e.data="about:blank",Ce||this.$el.appendChild(e)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!Ce&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const ra=zn();Tn("data-v-b329ee4c");const sa={class:"resize-observer",tabindex:"-1"};Fn();const la=ra((e,n,t,i,a,r)=>(I(),H("div",sa)));Te.render=la;Te.__scopeId="data-v-b329ee4c";Te.__file="src/components/ResizeObserver.vue";function _e(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_e=function(n){return typeof n}:_e=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_e(e)}function oa(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function St(e,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ca(e,n,t){return n&&St(e.prototype,n),t&&St(e,t),e}function It(e){return ua(e)||da(e)||fa(e)||ha()}function ua(e){if(Array.isArray(e))return Ve(e)}function da(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function fa(e,n){if(e){if(typeof e=="string")return Ve(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ve(e,n)}}function Ve(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,i=new Array(n);t<n;t++)i[t]=e[t];return i}function ha(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function va(e){var n;return typeof e=="function"?n={callback:e}:n=e,n}function pa(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,a,r,f=function(h){for(var g=arguments.length,c=new Array(g>1?g-1:0),m=1;m<g;m++)c[m-1]=arguments[m];if(r=c,!(i&&h===a)){var k=t.leading;typeof k=="function"&&(k=k(h,a)),(!i||h!==a)&&k&&e.apply(void 0,[h].concat(It(r))),a=h,clearTimeout(i),i=setTimeout(function(){e.apply(void 0,[h].concat(It(r))),i=0},n)}};return f._clear=function(){clearTimeout(i),i=null},f}function Wt(e,n){if(e===n)return!0;if(_e(e)==="object"){for(var t in e)if(!Wt(e[t],n[t]))return!1;return!0}return!1}var ma=function(){function e(n,t,i){oa(this,e),this.el=n,this.observer=null,this.frozen=!1,this.createObserver(t,i)}return ca(e,[{key:"createObserver",value:function(t,i){var a=this;if(this.observer&&this.destroyObserver(),!this.frozen){if(this.options=va(t),this.callback=function(o,h){a.options.callback(o,h),o&&a.options.once&&(a.frozen=!0,a.destroyObserver())},this.callback&&this.options.throttle){var r=this.options.throttleOptions||{},f=r.leading;this.callback=pa(this.callback,this.options.throttle,{leading:function(h){return f==="both"||f==="visible"&&h||f==="hidden"&&!h}})}this.oldResult=void 0,this.observer=new IntersectionObserver(function(o){var h=o[0];if(o.length>1){var g=o.find(function(m){return m.isIntersecting});g&&(h=g)}if(a.callback){var c=h.isIntersecting&&h.intersectionRatio>=a.threshold;if(c===a.oldResult)return;a.oldResult=c,a.callback(c,h)}},this.options.intersection),$t(function(){a.observer&&a.observer.observe(a.el)})}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&typeof this.options.intersection.threshold=="number"?this.options.intersection.threshold:0}}]),e}();function Kt(e,n,t){var i=n.value;if(i)if(typeof IntersectionObserver>"u")console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var a=new ma(e,i,t);e._vue_visibilityState=a}}function ga(e,n,t){var i=n.value,a=n.oldValue;if(!Wt(i,a)){var r=e._vue_visibilityState;if(!i){qt(e);return}r?r.createObserver(i,t):Kt(e,{value:i},t)}}function qt(e){var n=e._vue_visibilityState;n&&(n.destroyObserver(),delete e._vue_visibilityState)}var ya={beforeMount:Kt,updated:ga,unmounted:qt},ba={itemsLimit:1e3},wa=/(auto|scroll)/;function Gt(e,n){return e.parentNode===null?n:Gt(e.parentNode,n.concat([e]))}var $e=function(n,t){return getComputedStyle(n,null).getPropertyValue(t)},Aa=function(n){return $e(n,"overflow")+$e(n,"overflow-y")+$e(n,"overflow-x")},ka=function(n){return wa.test(Aa(n))};function Et(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var n=Gt(e.parentNode,[]),t=0;t<n.length;t+=1)if(ka(n[t]))return n[t];return document.scrollingElement||document.documentElement}}function Ue(e){"@babel/helpers - typeof";return Ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ue(e)}var Sa={items:{type:Array,required:!0},keyField:{type:String,default:"id"},direction:{type:String,default:"vertical",validator:function(n){return["vertical","horizontal"].includes(n)}},listTag:{type:String,default:"div"},itemTag:{type:String,default:"div"}};function Ia(){return this.items.length&&Ue(this.items[0])!=="object"}var Je=!1;if(typeof window<"u"){Je=!1;try{var Ea=Object.defineProperty({},"passive",{get:function(){Je=!0}});window.addEventListener("test",null,Ea)}catch{}}let Ca=0;var Yt={name:"RecycleScroller",components:{ResizeObserver:Te},directives:{ObserveVisibility:ya},props:{...Sa,itemSize:{type:Number,default:null},gridItems:{type:Number,default:void 0},itemSecondarySize:{type:Number,default:void 0},minItemSize:{type:[Number,String],default:null},sizeField:{type:String,default:"size"},typeField:{type:String,default:"type"},buffer:{type:Number,default:200},pageMode:{type:Boolean,default:!1},prerender:{type:Number,default:0},emitUpdate:{type:Boolean,default:!1},updateInterval:{type:Number,default:0},skipHover:{type:Boolean,default:!1},listTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},listClass:{type:[String,Object,Array],default:""},itemClass:{type:[String,Object,Array],default:""}},emits:["resize","visible","hidden","update","scroll-start","scroll-end"],data(){return{pool:[],totalSize:0,ready:!1,hoverKey:null}},computed:{sizes(){if(this.itemSize===null){const e={"-1":{accumulator:0}},n=this.items,t=this.sizeField,i=this.minItemSize;let a=1e4,r=0,f;for(let o=0,h=n.length;o<h;o++)f=n[o][t]||i,f<a&&(a=f),r+=f,e[o]={accumulator:r,size:f};return this.$_computedMinItemSize=a,e}return[]},simpleArray:Ia,itemIndexByKey(){const{keyField:e,items:n}=this,t={};for(let i=0,a=n.length;i<a;i++)t[n[i][e]]=i;return t}},watch:{items(){this.updateVisibleItems(!0)},pageMode(){this.applyPageMode(),this.updateVisibleItems(!1)},sizes:{handler(){this.updateVisibleItems(!1)},deep:!0},gridItems(){this.updateVisibleItems(!0)},itemSecondarySize(){this.updateVisibleItems(!0)}},created(){this.$_startIndex=0,this.$_endIndex=0,this.$_views=new Map,this.$_unusedViews=new Map,this.$_scrollDirty=!1,this.$_lastUpdateScrollPosition=0,this.prerender&&(this.$_prerender=!0,this.updateVisibleItems(!1)),this.gridItems&&!this.itemSize&&console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems")},mounted(){this.applyPageMode(),this.$nextTick(()=>{this.$_prerender=!1,this.updateVisibleItems(!0),this.ready=!0})},activated(){const e=this.$_lastUpdateScrollPosition;typeof e=="number"&&this.$nextTick(()=>{this.scrollToPosition(e)})},beforeUnmount(){this.removeListeners()},methods:{addView(e,n,t,i,a){const r=xn({id:Ca++,index:n,used:!0,key:i,type:a}),f=Bn({item:t,position:0,nr:r});return e.push(f),f},unuseView(e,n=!1){const t=this.$_unusedViews,i=e.nr.type;let a=t.get(i);a||(a=[],t.set(i,a)),a.push(e),n||(e.nr.used=!1,e.position=-9999)},handleResize(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll(e){if(!this.$_scrollDirty){if(this.$_scrollDirty=!0,this.$_updateTimeout)return;const n=()=>requestAnimationFrame(()=>{this.$_scrollDirty=!1;const{continuous:t}=this.updateVisibleItems(!1,!0);t||(clearTimeout(this.$_refreshTimout),this.$_refreshTimout=setTimeout(this.handleScroll,this.updateInterval+100))});n(),this.updateInterval&&(this.$_updateTimeout=setTimeout(()=>{this.$_updateTimeout=0,this.$_scrollDirty&&n()},this.updateInterval))}},handleVisibilityChange(e,n){this.ready&&(e||n.boundingClientRect.width!==0||n.boundingClientRect.height!==0?(this.$emit("visible"),requestAnimationFrame(()=>{this.updateVisibleItems(!1)})):this.$emit("hidden"))},updateVisibleItems(e,n=!1){const t=this.itemSize,i=this.gridItems||1,a=this.itemSecondarySize||t,r=this.$_computedMinItemSize,f=this.typeField,o=this.simpleArray?null:this.keyField,h=this.items,g=h.length,c=this.sizes,m=this.$_views,k=this.$_unusedViews,b=this.pool,s=this.itemIndexByKey;let l,d,v,w,y;if(!g)l=d=w=y=v=0;else if(this.$_prerender)l=w=0,d=y=Math.min(this.prerender,h.length),v=null;else{const S=this.getScroll();if(n){let N=S.start-this.$_lastUpdateScrollPosition;if(N<0&&(N=-N),t===null&&N<r||N<t)return{continuous:!0}}this.$_lastUpdateScrollPosition=S.start;const Q=this.buffer;S.start-=Q,S.end+=Q;let $=0;if(this.$refs.before&&($=this.$refs.before.scrollHeight,S.start-=$),this.$refs.after){const N=this.$refs.after.scrollHeight;S.end+=N}if(t===null){let N,te=0,T=g-1,_=~~(g/2),W;do W=_,N=c[_].accumulator,N<S.start?te=_:_<g-1&&c[_+1].accumulator>S.start&&(T=_),_=~~((te+T)/2);while(_!==W);for(_<0&&(_=0),l=_,v=c[g-1].accumulator,d=_;d<g&&c[d].accumulator<S.end;d++);for(d===-1?d=h.length-1:(d++,d>g&&(d=g)),w=l;w<g&&$+c[w].accumulator<S.start;w++);for(y=w;y<g&&$+c[y].accumulator<S.end;y++);}else{l=~~(S.start/t*i);const N=l%i;l-=N,d=Math.ceil(S.end/t*i),w=Math.max(0,Math.floor((S.start-$)/t*i)),y=Math.floor((S.end-$)/t*i),l<0&&(l=0),d>g&&(d=g),w<0&&(w=0),y>g&&(y=g),v=Math.ceil(g/i)*t}}d-l>ba.itemsLimit&&this.itemsLimitError(),this.totalSize=v;let u;const O=l<=this.$_endIndex&&d>=this.$_startIndex;if(O)for(let S=0,Q=b.length;S<Q;S++)u=b[S],u.nr.used&&(e&&(u.nr.index=s[u.item[o]]),(u.nr.index==null||u.nr.index<l||u.nr.index>=d)&&this.unuseView(u));const C=O?null:new Map;let E,P,z;for(let S=l;S<d;S++){E=h[S];const Q=o?E[o]:E;if(Q==null)throw new Error(`Key is ${Q} on item (keyField is '${o}')`);if(u=m.get(Q),!t&&!c[S].size){u&&this.unuseView(u);continue}P=E[f];let $=k.get(P),N=!1;if(!u)O?$&&$.length?u=$.pop():u=this.addView(b,S,E,Q,P):(z=C.get(P)||0,(!$||z>=$.length)&&(u=this.addView(b,S,E,Q,P),this.unuseView(u,!0),$=k.get(P)),u=$[z],C.set(P,z+1)),m.delete(u.nr.key),u.nr.used=!0,u.nr.index=S,u.nr.key=Q,u.nr.type=P,m.set(Q,u),N=!0;else if(!u.nr.used&&(u.nr.used=!0,u.nr.index=S,N=!0,$)){const te=$.indexOf(u);te!==-1&&$.splice(te,1)}u.item=E,N&&(S===h.length-1&&this.$emit("scroll-end"),S===0&&this.$emit("scroll-start")),t===null?(u.position=c[S-1].accumulator,u.offset=0):(u.position=Math.floor(S/i)*t,u.offset=S%i*a)}return this.$_startIndex=l,this.$_endIndex=d,this.emitUpdate&&this.$emit("update",l,d,w,y),clearTimeout(this.$_sortTimer),this.$_sortTimer=setTimeout(this.sortViews,this.updateInterval+300),{continuous:O}},getListenerTarget(){let e=Et(this.$el);return window.document&&(e===window.document.documentElement||e===window.document.body)&&(e=window),e},getScroll(){const{$el:e,direction:n}=this,t=n==="vertical";let i;if(this.pageMode){const a=e.getBoundingClientRect(),r=t?a.height:a.width;let f=-(t?a.top:a.left),o=t?window.innerHeight:window.innerWidth;f<0&&(o+=f,f=0),f+o>r&&(o=r-f),i={start:f,end:f+o}}else t?i={start:e.scrollTop,end:e.scrollTop+e.clientHeight}:i={start:e.scrollLeft,end:e.scrollLeft+e.clientWidth};return i},applyPageMode(){this.pageMode?this.addListeners():this.removeListeners()},addListeners(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,Je?{passive:!0}:!1),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem(e){let n;const t=this.gridItems||1;this.itemSize===null?n=e>0?this.sizes[e-1].accumulator:0:n=Math.floor(e/t)*this.itemSize,this.scrollToPosition(n)},scrollToPosition(e){const n=this.direction==="vertical"?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};let t,i,a;if(this.pageMode){const r=Et(this.$el),f=r.tagName==="HTML"?0:r[n.scroll],o=r.getBoundingClientRect(),g=this.$el.getBoundingClientRect()[n.start]-o[n.start];t=r,i=n.scroll,a=e+f+g}else t=this.$el,i=n.scroll,a=e;t[i]=a},itemsLimitError(){throw setTimeout(()=>{console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",this.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")}),new Error("Rendered items limit reached")},sortViews(){this.pool.sort((e,n)=>e.nr.index-n.nr.index)}}};const _a={key:0,ref:"before",class:"vue-recycle-scroller__slot"},Oa={key:1,ref:"after",class:"vue-recycle-scroller__slot"};function Pa(e,n,t,i,a,r){const f=Qn("ResizeObserver"),o=$n("observe-visibility");return Nn((I(),j("div",{class:ue(["vue-recycle-scroller",{ready:a.ready,"page-mode":t.pageMode,[`direction-${e.direction}`]:!0}]),onScrollPassive:n[0]||(n[0]=(...h)=>r.handleScroll&&r.handleScroll(...h))},[e.$slots.before?(I(),j("div",_a,[we(e.$slots,"before")],512)):q("v-if",!0),(I(),H(dt(t.listTag),{ref:"wrapper",style:Rn({[e.direction==="vertical"?"minHeight":"minWidth"]:a.totalSize+"px"}),class:ue(["vue-recycle-scroller__item-wrapper",t.listClass])},{default:F(()=>[(I(!0),j(X,null,le(a.pool,h=>(I(),H(dt(t.itemTag),Ln({key:h.nr.id,style:a.ready?{transform:`translate${e.direction==="vertical"?"Y":"X"}(${h.position}px) translate${e.direction==="vertical"?"X":"Y"}(${h.offset}px)`,width:t.gridItems?`${e.direction==="vertical"&&t.itemSecondarySize||t.itemSize}px`:void 0,height:t.gridItems?`${e.direction==="horizontal"&&t.itemSecondarySize||t.itemSize}px`:void 0}:null,class:["vue-recycle-scroller__item-view",[t.itemClass,{hover:!t.skipHover&&a.hoverKey===h.nr.key}]]},Dn(t.skipHover?{}:{mouseenter:()=>{a.hoverKey=h.nr.key},mouseleave:()=>{a.hoverKey=null}})),{default:F(()=>[we(e.$slots,"default",{item:h.item,index:h.nr.index,active:h.nr.used})]),_:2},1040,["style","class"]))),128)),we(e.$slots,"empty")]),_:3},8,["style","class"])),e.$slots.after?(I(),j("div",Oa,[we(e.$slots,"after")],512)):q("v-if",!0),A(f,{onNotify:r.handleResize},null,8,["onNotify"])],34)),[[o,r.handleVisibilityChange]])}Yt.render=Pa;Yt.__file="src/components/RecycleScroller.vue";const Ct=Me({__name:"ContextMenu",props:{file:{},idx:{},selectedTag:{},disableDelete:{type:Boolean},isSelectedMutilFiles:{type:Boolean}},emits:["contextMenuClick"],setup(e,{emit:n}){const t=e,i=Ke(),a=J(()=>{var r;return(((r=i.conf)==null?void 0:r.all_custom_tags)??[]).reduce((f,o)=>[...f,{...o,selected:!!t.selectedTag.find(h=>h.id===o.id)}],[])});return(r,f)=>{const o=Nt,h=jn,g=Hn,c=Lt;return I(),H(c,{onClick:f[0]||(f[0]=m=>n("contextMenuClick",m,r.file,r.idx))},{default:F(()=>{var m;return[A(o,{key:"deleteFiles",disabled:r.disableDelete},{default:F(()=>[L(D(r.$t("deleteSelected")),1)]),_:1},8,["disabled"]),r.file.type==="dir"?(I(),j(X,{key:0},[A(o,{key:"openInNewTab"},{default:F(()=>[L(D(r.$t("openInNewTab")),1)]),_:1}),A(o,{key:"openOnTheRight"},{default:F(()=>[L(D(r.$t("openOnTheRight")),1)]),_:1}),A(o,{key:"openWithWalkMode"},{default:F(()=>[L(D(r.$t("openWithWalkMode")),1)]),_:1})],64)):q("",!0),r.file.type==="file"?(I(),j(X,{key:1},[U(Z)(r.file.name)?(I(),j(X,{key:0},[A(o,{key:"viewGenInfo"},{default:F(()=>[L(D(r.$t("viewGenerationInfo")),1)]),_:1}),A(h),((m=U(i).conf)==null?void 0:m.launch_mode)!=="server"?(I(),j(X,{key:0},[A(o,{key:"send2txt2img"},{default:F(()=>[L(D(r.$t("sendToTxt2img")),1)]),_:1}),A(o,{key:"send2img2img"},{default:F(()=>[L(D(r.$t("sendToImg2img")),1)]),_:1}),A(o,{key:"send2inpaint"},{default:F(()=>[L(D(r.$t("sendToInpaint")),1)]),_:1}),A(o,{key:"send2extras"},{default:F(()=>[L(D(r.$t("sendToExtraFeatures")),1)]),_:1}),A(g,{key:"sendToThirdPartyExtension",title:r.$t("sendToThirdPartyExtension")},{default:F(()=>[A(o,{key:"send2controlnet-txt2img"},{default:F(()=>[L("ControlNet - "+D(r.$t("t2i")),1)]),_:1}),A(o,{key:"send2controlnet-img2img"},{default:F(()=>[L("ControlNet - "+D(r.$t("i2i")),1)]),_:1}),A(o,{key:"send2outpaint"},{default:F(()=>[L("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):q("",!0),A(o,{key:"send2BatchDownload"},{default:F(()=>[L(D(r.$t("sendToBatchDownload")),1)]),_:1}),A(o,{key:"send2savedDir"},{default:F(()=>[L(D(r.$t("send2savedDir")),1)]),_:1}),A(h),r.isSelectedMutilFiles?(I(),j(X,{key:1},[A(g,{key:"batch-add-tag",title:r.$t("batchAddTag")},{default:F(()=>[(I(!0),j(X,null,le(a.value,k=>(I(),H(o,{key:`batch-add-tag-${k.id}`},{default:F(()=>[L(D(k.name),1)]),_:2},1024))),128))]),_:1},8,["title"]),A(g,{key:"batch-remove-tag",title:r.$t("batchRemoveTag")},{default:F(()=>[(I(!0),j(X,null,le(a.value,k=>(I(),H(o,{key:`batch-remove-tag-${k.id}`},{default:F(()=>[L(D(k.name),1)]),_:2},1024))),128))]),_:1},8,["title"])],64)):(I(),H(g,{key:"toggle-tag",title:r.$t("toggleTag")},{default:F(()=>[(I(!0),j(X,null,le(a.value,k=>(I(),H(o,{key:`toggle-tag-${k.id}`},{default:F(()=>[L(D(k.name)+" ",1),k.selected?(I(),H(U(jt),{key:0})):(I(),H(U(Vt),{key:1}))]),_:2},1024))),128))]),_:1},8,["title"])),A(o,{key:"openWithLocalFileBrowser"},{default:F(()=>[L(D(r.$t("openWithLocalFileBrowser")),1)]),_:1})],64)):q("",!0),A(o,{key:"previewInNewWindow"},{default:F(()=>[L(D(r.$t("previewInNewWindow")),1)]),_:1}),A(o,{key:"download"},{default:F(()=>[L(D(r.$t("download")),1)]),_:1}),A(o,{key:"copyPreviewUrl"},{default:F(()=>[L(D(r.$t("copySourceFilePreviewLink")),1)]),_:1})],64)):q("",!0)]}),_:1})}}}),Ma=["data-idx"],Ta={key:1,class:"more"},Fa={class:"float-btn-wrap"},za={key:0,class:"tags-container"},xa={class:"play-icon"},Ba={key:0,class:"tags-container"},Qa={key:4,class:"preview-icon-wrap"},$a={key:5,class:"profile"},Na={class:"name line-clamp-1"},La={class:"basic-info"},Da=Me({__name:"FileItem",props:{file:{},idx:{},selected:{type:Boolean,default:!1},showMenuIdx:{},cellWidth:{},fullScreenPreviewImageUrl:{},enableRightClickMenu:{type:Boolean,default:!0},enableCloseIcon:{type:Boolean,default:!1},isSelectedMutilFiles:{type:Boolean}},emits:["update:showMenuIdx","fileItemClick","dragstart","dragend","previewVisibleChange","contextMenuClick","close-icon-click"],setup(e,{emit:n}){const t=e;Vn(c=>({"6b5a16d0":c.$props.cellWidth+"px"}));const i=Ke(),a=Jt(),r=J(()=>a.tagMap.get(t.file.fullpath)??[]),f=J(()=>{const c=i.gridThumbnailResolution;return i.enableThumbnail?Un(t.file,[c,c].join("x")):se(t.file)}),o=J(()=>{var c;return(((c=i.conf)==null?void 0:c.all_custom_tags)??[]).reduce((m,k)=>[...m,{...k,selected:!!r.value.find(b=>b.id===k.id)}],[])}),h=J(()=>o.value.find(c=>c.type==="custom"&&c.name==="like")),g=()=>{Oe(h.value),n("contextMenuClick",{key:`toggle-tag-${h.value.id}`},t.file,t.idx)};return(c,m)=>{const k=pe,b=Nt,s=Lt,l=qn,d=hi;return I(),H(k,{trigger:["contextmenu"],visible:U(i).longPressOpenContextMenu?typeof c.idx=="number"&&c.showMenuIdx===c.idx:void 0,"onUpdate:visible":m[8]||(m[8]=v=>typeof c.idx=="number"&&n("update:showMenuIdx",v?c.idx:-1))},{overlay:F(()=>[c.enableRightClickMenu?(I(),H(Ct,{key:0,file:c.file,idx:c.idx,"selected-tag":r.value,onContextMenuClick:m[7]||(m[7]=(v,w,y)=>n("contextMenuClick",v,w,y)),"is-selected-mutil-files":c.isSelectedMutilFiles},null,8,["file","idx","selected-tag","is-selected-mutil-files"])):q("",!0)]),default:F(()=>[(I(),j("li",{class:ue(["file file-item-trigger grid",{clickable:c.file.type==="dir",selected:c.selected}]),"data-idx":c.idx,key:c.file.name,draggable:"true",onDragstart:m[4]||(m[4]=v=>n("dragstart",v,c.idx)),onDragend:m[5]||(m[5]=v=>n("dragend",v,c.idx)),onClickCapture:m[6]||(m[6]=v=>n("fileItemClick",v,c.file,c.idx))},[ie("div",null,[c.enableCloseIcon?(I(),j("div",{key:0,class:"close-icon",onClick:m[0]||(m[0]=v=>n("close-icon-click"))},[A(U(Jn))])):q("",!0),c.enableRightClickMenu?(I(),j("div",Ta,[A(k,null,{overlay:F(()=>[A(Ct,{file:c.file,idx:c.idx,"selected-tag":r.value,onContextMenuClick:m[1]||(m[1]=(v,w,y)=>n("contextMenuClick",v,w,y)),"is-selected-mutil-files":c.isSelectedMutilFiles},null,8,["file","idx","selected-tag","is-selected-mutil-files"])]),default:F(()=>[ie("div",Fa,[A(U(Wn))])]),_:1}),c.file.type==="file"?(I(),H(k,{key:0},{overlay:F(()=>[o.value.length>1?(I(),H(s,{key:0,onClick:m[2]||(m[2]=v=>n("contextMenuClick",v,c.file,c.idx))},{default:F(()=>[(I(!0),j(X,null,le(o.value,v=>(I(),H(b,{key:`toggle-tag-${v.id}`},{default:F(()=>[L(D(v.name)+" ",1),v.selected?(I(),H(U(jt),{key:0})):(I(),H(U(Vt),{key:1}))]),_:2},1024))),128))]),_:1})):q("",!0)]),default:F(()=>{var v,w;return[ie("div",{class:ue(["float-btn-wrap",{"like-selected":(v=h.value)==null?void 0:v.selected}]),onClick:g},[(w=h.value)!=null&&w.selected?(I(),H(U(Ri),{key:0})):(I(),H(U(Ui),{key:1}))],2)]}),_:1})):q("",!0)])):q("",!0),U(Z)(c.file.name)?(I(),j("div",{key:c.file.fullpath,class:ue(`idx-${c.idx} item-content`)},[A(l,{src:f.value,fallback:U(Fi),preview:{src:c.fullScreenPreviewImageUrl,onVisibleChange:(v,w)=>n("previewVisibleChange",v,w)}},null,8,["src","fallback","preview"]),r.value&&c.cellWidth>128?(I(),j("div",za,[(I(!0),j(X,null,le(r.value,v=>(I(),H(d,{key:v.id,color:U(a).getColor(v.name)},{default:F(()=>[L(D(v.name),1)]),_:2},1032,["color"]))),128))])):q("",!0)],2)):U(Kn)(c.file.name)?(I(),j("div",{key:3,class:ue(`idx-${c.idx} item-content video`),onClick:m[3]||(m[3]=v=>U(ni)(c.file))},[ie("div",xa,[A(U(qi))]),r.value&&c.cellWidth>128?(I(),j("div",Ba,[(I(!0),j(X,null,le(r.value,v=>(I(),H(d,{key:v.id,color:U(a).getColor(v.name)},{default:F(()=>[L(D(v.name),1)]),_:2},1032,["color"]))),128))])):q("",!0)],2)):(I(),j("div",Qa,[c.file.type==="file"?(I(),H(U(wi),{key:0,class:"icon center"})):(I(),H(U(Ii),{key:1,class:"icon center"}))])),c.cellWidth>128?(I(),j("div",$a,[ie("div",Na,D(c.file.name),1),ie("div",La,[ie("div",null,D(c.file.size),1),ie("div",null,D(c.file.date),1)])])):q("",!0)])],42,Ma))]),_:1},8,["visible"])}}});const Xa=Gn(Da,[["__scopeId","data-v-8b135d68"]]);export{Xa as F,Ct as _,Ka as a,qa as b,Ga as c,Ya as d,Wa as e,Za as f,Yt as g,je as h,Jt as i,ge as j,na as k,Ie as s,ae as u};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/FileItem-d1784052.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .vue-recycle-scroller{position:relative}.vue-recycle-scroller.direction-vertical:not(.page-mode){overflow-y:auto}.vue-recycle-scroller.direction-horizontal:not(.page-mode){overflow-x:auto}.vue-recycle-scroller.direction-horizontal{display:flex}.vue-recycle-scroller__slot{flex:auto 0 0}.vue-recycle-scroller__item-wrapper{flex:1;box-sizing:border-box;overflow:hidden;position:relative}.vue-recycle-scroller.ready .vue-recycle-scroller__item-view{position:absolute;top:0;left:0;will-change:transform}.vue-recycle-scroller.direction-vertical .vue-recycle-scroller__item-wrapper{width:100%}.vue-recycle-scroller.direction-horizontal .vue-recycle-scroller__item-wrapper{height:100%}.vue-recycle-scroller.ready.direction-vertical .vue-recycle-scroller__item-view{width:100%}.vue-recycle-scroller.ready.direction-horizontal .vue-recycle-scroller__item-view{height:100%}.resize-observer[data-v-b329ee4c]{position:absolute;top:0;left:0;z-index:-1;width:100%;height:100%;border:none;background-color:transparent;pointer-events:none;display:block;overflow:hidden;opacity:0}.resize-observer[data-v-b329ee4c] object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1}.ant-tag{box-sizing:border-box;margin:0 8px 0 0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum";display:inline-block;height:auto;padding:0 7px;font-size:12px;line-height:20px;white-space:nowrap;background:#fafafa;border:1px solid #d9d9d9;border-radius:2px;opacity:1;transition:all .3s}.ant-tag,.ant-tag a,.ant-tag a:hover{color:#000000d9}.ant-tag>a:first-child:last-child{display:inline-block;margin:0 -8px;padding:0 8px}.ant-tag-close-icon{margin-left:3px;color:#00000073;font-size:10px;cursor:pointer;transition:all .3s}.ant-tag-close-icon:hover{color:#000000d9}.ant-tag-has-color{border-color:transparent}.ant-tag-has-color,.ant-tag-has-color a,.ant-tag-has-color a:hover,.ant-tag-has-color .anticon-close,.ant-tag-has-color .anticon-close:hover{color:#fff}.ant-tag-checkable{background-color:transparent;border-color:transparent;cursor:pointer}.ant-tag-checkable:not(.ant-tag-checkable-checked):hover{color:#d03f0a}.ant-tag-checkable:active,.ant-tag-checkable-checked{color:#fff}.ant-tag-checkable-checked{background-color:#d03f0a}.ant-tag-checkable:active{background-color:#ab2800}.ant-tag-hidden{display:none}.ant-tag-pink{color:#c41d7f;background:#fff0f6;border-color:#ffadd2}.ant-tag-pink-inverse{color:#fff;background:#eb2f96;border-color:#eb2f96}.ant-tag-magenta{color:#c41d7f;background:#fff0f6;border-color:#ffadd2}.ant-tag-magenta-inverse{color:#fff;background:#eb2f96;border-color:#eb2f96}.ant-tag-red{color:#cf1322;background:#fff1f0;border-color:#ffa39e}.ant-tag-red-inverse{color:#fff;background:#f5222d;border-color:#f5222d}.ant-tag-volcano{color:#d4380d;background:#fff2e8;border-color:#ffbb96}.ant-tag-volcano-inverse{color:#fff;background:#fa541c;border-color:#fa541c}.ant-tag-orange{color:#d46b08;background:#fff7e6;border-color:#ffd591}.ant-tag-orange-inverse{color:#fff;background:#fa8c16;border-color:#fa8c16}.ant-tag-yellow{color:#d4b106;background:#feffe6;border-color:#fffb8f}.ant-tag-yellow-inverse{color:#fff;background:#fadb14;border-color:#fadb14}.ant-tag-gold{color:#d48806;background:#fffbe6;border-color:#ffe58f}.ant-tag-gold-inverse{color:#fff;background:#faad14;border-color:#faad14}.ant-tag-cyan{color:#08979c;background:#e6fffb;border-color:#87e8de}.ant-tag-cyan-inverse{color:#fff;background:#13c2c2;border-color:#13c2c2}.ant-tag-lime{color:#7cb305;background:#fcffe6;border-color:#eaff8f}.ant-tag-lime-inverse{color:#fff;background:#a0d911;border-color:#a0d911}.ant-tag-green{color:#389e0d;background:#f6ffed;border-color:#b7eb8f}.ant-tag-green-inverse{color:#fff;background:#52c41a;border-color:#52c41a}.ant-tag-blue{color:#096dd9;background:#e6f7ff;border-color:#91d5ff}.ant-tag-blue-inverse{color:#fff;background:#1890ff;border-color:#1890ff}.ant-tag-geekblue{color:#1d39c4;background:#f0f5ff;border-color:#adc6ff}.ant-tag-geekblue-inverse{color:#fff;background:#2f54eb;border-color:#2f54eb}.ant-tag-purple{color:#531dab;background:#f9f0ff;border-color:#d3adf7}.ant-tag-purple-inverse{color:#fff;background:#722ed1;border-color:#722ed1}.ant-tag-success{color:#52c41a;background:#f6ffed;border-color:#b7eb8f}.ant-tag-processing{color:#d03f0a;background:#fff1e6;border-color:#f7ae83}.ant-tag-error{color:#ff4d4f;background:#fff2f0;border-color:#ffccc7}.ant-tag-warning{color:#faad14;background:#fffbe6;border-color:#ffe58f}.ant-tag>.anticon+span,.ant-tag>span+.anticon{margin-left:7px}.ant-tag.ant-tag-rtl{margin-right:0;margin-left:8px;direction:rtl;text-align:right}.ant-tag-rtl .ant-tag-close-icon{margin-right:3px;margin-left:0}.ant-tag-rtl.ant-tag>.anticon+span,.ant-tag-rtl.ant-tag>span+.anticon{margin-right:7px;margin-left:0}.center[data-v-8b135d68]{display:flex;justify-content:center;align-items:center}.item-content[data-v-8b135d68]{position:relative}.item-content.video[data-v-8b135d68]{background-color:var(--zp-border);border-radius:8px;overflow:hidden;width:var(--6b5a16d0);height:var(--6b5a16d0);cursor:pointer}.item-content .play-icon[data-v-8b135d68]{position:absolute;top:50%;left:50%;font-size:3em;transform:translate(-50%,-50%)}.item-content .tags-container[data-v-8b135d68]{position:absolute;right:8px;bottom:8px;display:flex;width:calc(100% - 16px);flex-wrap:wrap-reverse;flex-direction:row-reverse}.item-content .tags-container>*[data-v-8b135d68]{margin:0 0 4px 4px;font-size:14px;line-height:1.6}.close-icon[data-v-8b135d68]{position:absolute;top:0;right:0;transform:translate(50%,-50%) scale(1.5);cursor:pointer;z-index:100;border-radius:100%;overflow:hidden;line-height:1;background-color:var(--zp-primary-background)}.file[data-v-8b135d68]{padding:8px 16px;margin:8px;display:flex;align-items:center;background:var(--zp-primary-background);border-radius:8px;box-shadow:0 0 4px var(--zp-secondary-variant-background);position:relative}.file:hover .more[data-v-8b135d68]{opacity:1}.file .more[data-v-8b135d68]{opacity:0;transition:all .3s ease;position:absolute;top:4px;right:4px;z-index:100;display:flex;align-items:center;justify-content:center;flex-direction:column;line-height:1em}.file .more .float-btn-wrap[data-v-8b135d68]{font-size:1.5em;cursor:pointer;font-size:500;padding:4px;border-radius:100vh;color:#fff;background:var(--zp-icon-bg);margin-bottom:4px}.file .more .float-btn-wrap.like-selected[data-v-8b135d68]{color:#df0505}.file.grid[data-v-8b135d68]{padding:0;display:inline-block;box-sizing:content-box;box-shadow:unset;background-color:var(--zp-secondary-background)}.file.grid[data-v-8b135d68] .icon{font-size:8em}.file.grid[data-v-8b135d68] .profile{padding:0 4px}.file.grid[data-v-8b135d68] .profile .name{font-weight:500;padding:0}.file.grid[data-v-8b135d68] .profile .basic-info{display:flex;justify-content:space-between;flex-direction:row;margin:0;font-size:.7em}.file.grid[data-v-8b135d68] .ant-image,.file.grid[data-v-8b135d68] .preview-icon-wrap{border:1px solid var(--zp-secondary);background-color:var(--zp-secondary-variant-background);border-radius:8px;overflow:hidden}.file.grid[data-v-8b135d68] img,.file.grid[data-v-8b135d68] .preview-icon-wrap>[role=img]{height:var(--6b5a16d0);width:var(--6b5a16d0);object-fit:contain}.file.clickable[data-v-8b135d68]{cursor:pointer}.file.selected[data-v-8b135d68]{outline:#0084ff solid 2px}.file .name[data-v-8b135d68]{flex:1;padding:8px;word-break:break-all}.file .basic-info[data-v-8b135d68]{overflow:hidden;display:flex;flex-direction:column;align-items:flex-end}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/ImgSliPagePane-b56f571f.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as t,o as a,m as r,c3 as n}from"./index-7c0f3f3a.js";const p=t({__name:"ImgSliPagePane",props:{paneIdx:{},tabIdx:{},left:{},right:{}},setup(o){return(e,s)=>(a(),r(n,{left:e.left,right:e.right},null,8,["left","right"]))}});export{p as default};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/MatchedImageGrid-337d7e1f.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .preview-switch[data-v-c4827cd4]{position:fixed;top:0;bottom:0;left:0;right:0;display:flex;align-items:center;justify-content:space-between;z-index:11111;pointer-events:none}.preview-switch>*[data-v-c4827cd4]{color:#fff;margin:16px;font-size:4em;pointer-events:all;cursor:pointer}.preview-switch>*.disable[data-v-c4827cd4]{opacity:0;pointer-events:none;cursor:none}.container[data-v-c4827cd4]{background:var(--zp-secondary-background)}.container .file-list[data-v-c4827cd4]{list-style:none;padding:8px;height:100%;overflow:auto;height:var(--pane-max-height);width:100%}.container .no-res-hint[data-v-c4827cd4]{height:var(--pane-max-height);display:flex;align-items:center;flex-direction:column;justify-content:center}.container .no-res-hint .hint[data-v-c4827cd4]{font-size:1.6em;margin-bottom:2em;text-align:center}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/MatchedImageGrid-623cc422.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as j,l as H,ay as J,o as r,y as g,c as n,n as o,r as e,s as V,p as c,t as K,v as m,x as $,m as D,L as Y,C as f,N as F,Q as Z,R as ee,V as te,X as se}from"./index-7c0f3f3a.js";import{L as ie,R as le,f as ne,S as oe}from"./fullScreenContextMenu-780774ab.js";import{g as ae,F as re}from"./FileItem-39204ab7.js";import{g as de}from"./db-90de1b1b.js";import{c as ce,u as me}from"./hook-32698bdc.js";import{o as ue}from"./functionalCallableComp-6d05295c.js";import"./index-00c5caf5.js";/* empty css */const pe={class:"hint"},ge={key:1},fe={class:"no-res-hint"},ve={class:"hint"},Ie={key:2,class:"preview-switch"},ke=j({__name:"MatchedImageGrid",props:{tabIdx:{},paneIdx:{},selectedTagIds:{},id:{}},setup(z){const v=z,u=ce(s=>de(v.selectedTagIds,s)),{queue:B,images:l,onContextMenuClickU:I,stackViewEl:R,previewIdx:a,previewing:k,onPreviewVisibleChange:N,previewImgMove:w,canPreview:C,itemSize:_,gridItems:G,showGenInfo:d,imageGenInfo:h,q:A,multiSelectedIdxs:x,onFileItemClick:E,scroller:y,showMenuIdx:p,onFileDragStart:P,onFileDragEnd:U,cellWidth:L,onScroll:b}=me(u);return H(()=>v.selectedTagIds,async()=>{var s;await u.reset(),await J(),(s=y.value)==null||s.scrollToItem(0),b()},{immediate:!0}),(s,t)=>{const O=Z,q=ee,Q=te,W=oe;return r(),g("div",{class:"container",ref_key:"stackViewEl",ref:R},[n(W,{size:"large",spinning:!e(B).isIdle},{default:o(()=>{var M,S;return[n(q,{visible:e(d),"onUpdate:visible":t[1]||(t[1]=i=>V(d)?d.value=i:null),width:"70vw","mask-closable":"",onOk:t[2]||(t[2]=i=>d.value=!1)},{cancelText:o(()=>[]),default:o(()=>[n(O,{active:"",loading:!e(A).isIdle},{default:o(()=>[c("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:t[0]||(t[0]=i=>e(K)(e(h)))},[c("div",pe,m(s.$t("doubleClickToCopy")),1),$(" "+m(e(h)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),(M=e(l))!=null&&M.length?(r(),D(e(ae),{key:0,ref_key:"scroller",ref:y,class:"file-list",items:e(l),"item-size":e(_).first,"key-field":"fullpath","item-secondary-size":e(_).second,gridItems:e(G),onScroll:e(b)},{default:o(({item:i,index:T})=>[n(re,{idx:T,file:i,"cell-width":e(L),"show-menu-idx":e(p),"onUpdate:showMenuIdx":t[3]||(t[3]=X=>V(p)?p.value=X:null),onDragstart:e(P),onDragend:e(U),onFileItemClick:e(E),"full-screen-preview-image-url":e(l)[e(a)]?e(Y)(e(l)[e(a)]):"",selected:e(x).includes(T),onContextMenuClick:e(I),onPreviewVisibleChange:e(N),"is-selected-mutil-files":e(x).length>1},null,8,["idx","file","cell-width","show-menu-idx","onDragstart","onDragend","onFileItemClick","full-screen-preview-image-url","selected","onContextMenuClick","onPreviewVisibleChange","is-selected-mutil-files"])]),_:1},8,["items","item-size","item-secondary-size","gridItems","onScroll"])):e(u).load&&s.selectedTagIds.and_tags.length===1&&!((S=s.selectedTagIds.folder_paths_str)!=null&&S.trim())?(r(),g("div",ge,[c("div",fe,[c("p",ve,m(s.$t("tagSearchNoResultsMessage")),1),n(Q,{onClick:t[4]||(t[4]=i=>e(ue)()),type:"primary"},{default:o(()=>[$(m(s.$t("rebuildImageIndex")),1)]),_:1})])])):f("",!0),e(k)?(r(),g("div",Ie,[n(e(ie),{onClick:t[5]||(t[5]=i=>e(w)("prev")),class:F({disable:!e(C)("prev")})},null,8,["class"]),n(e(le),{onClick:t[6]||(t[6]=i=>e(w)("next")),class:F({disable:!e(C)("next")})},null,8,["class"])])):f("",!0)]}),_:1},8,["spinning"]),e(k)&&e(l)&&e(l)[e(a)]?(r(),D(ne,{key:0,file:e(l)[e(a)],idx:e(a),onContextMenuClick:e(I)},null,8,["file","idx","onContextMenuClick"])):f("",!0)],512)}}});const Se=se(ke,[["__scopeId","data-v-c4827cd4"]]);export{Se as default};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/SubstrSearch-86e8fce9.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .regex-icon[data-v-7afef8c2]{user-select:none;padding:4px;margin:0 4px;cursor:pointer;border:1px solid var(--zp-border);border-radius:4px}.regex-icon img[data-v-7afef8c2]{height:1.5em}.regex-icon[data-v-7afef8c2]:hover{background:var(--zp-border)}.regex-icon.selected[data-v-7afef8c2]{background:var(--primary-color-1);border:1px solid var(--primary-color)}.search-bar[data-v-7afef8c2]{padding:8px 8px 0;display:flex}.search-bar.last[data-v-7afef8c2]{padding-bottom:8px}.search-bar .form-name[data-v-7afef8c2]{flex-shrink:0;padding:4px 8px}.preview-switch[data-v-7afef8c2]{position:fixed;top:0;bottom:0;left:0;right:0;display:flex;align-items:center;justify-content:space-between;z-index:11111;pointer-events:none}.preview-switch>*[data-v-7afef8c2]{color:#fff;margin:16px;font-size:4em;pointer-events:all;cursor:pointer}.preview-switch>*.disable[data-v-7afef8c2]{opacity:0;pointer-events:none;cursor:none}.container[data-v-7afef8c2]{background:var(--zp-secondary-background)}.container .file-list[data-v-7afef8c2]{list-style:none;padding:8px;height:100%;overflow:auto;height:var(--pane-max-height);width:100%}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/SubstrSearch-ac08db9a.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as ne,$ as x,ax as ie,bR as oe,ay as re,al as ue,ai as de,bQ as K,o,y as C,q as N,c as i,r as e,bV as ce,p as d,N as _,m as k,n as r,x as S,v as f,C as h,s as L,t as pe,L as me,U as ve,V as fe,bT as ge,Q as we,R as xe,X as ke}from"./index-7c0f3f3a.js";import{L as he,R as ye,f as Ie,S as be}from"./fullScreenContextMenu-780774ab.js";/* empty css */import{g as Ce,F as _e}from"./FileItem-39204ab7.js";import{b as P,c as Se,f as $e,u as Me}from"./db-90de1b1b.js";import{c as ze,u as De}from"./hook-32698bdc.js";import"./index-00c5caf5.js";/* empty css */import"./functionalCallableComp-6d05295c.js";const Re="/infinite_image_browsing/fe-static/assets/regex-a447f877.svg",Ve=["src"],Be={class:"search-bar last"},Fe={class:"form-name"},Ue={class:"hint"},Ee={key:1,class:"preview-switch"},Ae=ne({__name:"SubstrSearch",props:{tabIdx:{},paneIdx:{},searchScope:{}},setup(G){const $=G,c=x(!1),p=x(""),g=x($.searchScope??""),y=ze(a=>{const s={cursor:a,regexp:c.value?p.value:"",surstr:c.value?"":p.value,folder_paths:(g.value??"").split(/,|\n/).map(v=>v.trim()).filter(v=>v)};return $e(s)}),{queue:u,images:n,onContextMenuClickU:M,stackViewEl:O,previewIdx:m,previewing:z,onPreviewVisibleChange:Q,previewImgMove:D,canPreview:R,itemSize:V,gridItems:H,showGenInfo:w,imageGenInfo:B,q:W,multiSelectedIdxs:F,onFileItemClick:X,scroller:U,showMenuIdx:I,onFileDragStart:j,onFileDragEnd:J,cellWidth:Y,onScroll:E}=De(y),t=x();ie(async()=>{t.value=await P(),t.value.img_count&&t.value.expired&&await A(),$.searchScope&&await b()});const A=oe(()=>u.pushAction(async()=>(await Me(),t.value=await P(),t.value)).res),b=async()=>{await y.reset({refetch:!0}),await re(),E(),U.value.scrollToItem(0),n.value.length||ue.info(de("fuzzy-search-noResults"))};K("returnToIIB",async()=>{const a=await u.pushAction(Se).res;t.value.expired=a.expired}),K("searchIndexExpired",()=>t.value&&(t.value.expired=!0));const Z=()=>{c.value=!c.value};return(a,s)=>{const v=ve,T=fe,ee=ge,se=we,te=xe,ae=be;return o(),C("div",{class:"container",ref_key:"stackViewEl",ref:O},[t.value?(o(),C("div",{key:0,class:"search-bar",onKeydown:s[2]||(s[2]=N(()=>{},["stop"]))},[i(v,{value:p.value,"onUpdate:value":s[0]||(s[0]=l=>p.value=l),placeholder:a.$t("fuzzy-search-placeholder")+" "+a.$t("regexSearchEnabledHint"),disabled:!e(u).isIdle,onKeydown:ce(b,["enter"]),"allow-clear":""},null,8,["value","placeholder","disabled","onKeydown"]),d("div",{class:_(["regex-icon",{selected:c.value}]),onKeydown:s[1]||(s[1]=N(()=>{},["stop"])),onClick:Z,title:"Use Regular Expression"},[d("img",{src:e(Re)},null,8,Ve)],34),t.value.expired||!t.value.img_count?(o(),k(T,{key:0,onClick:e(A),loading:!e(u).isIdle,type:"primary"},{default:r(()=>[S(f(t.value.img_count===0?a.$t("generateIndexHint"):a.$t("UpdateIndex")),1)]),_:1},8,["onClick","loading"])):(o(),k(T,{key:1,type:"primary",onClick:b,loading:!e(u).isIdle||e(y).loading,disabled:!p.value&&!g.value},{default:r(()=>[S(f(a.$t("search")),1)]),_:1},8,["loading","disabled"]))],32)):h("",!0),d("div",Be,[d("div",Fe,f(a.$t("searchScope")),1),i(ee,{"auto-size":{maxRows:8},value:g.value,"onUpdate:value":s[3]||(s[3]=l=>g.value=l),placeholder:a.$t("specifiedSearchFolder")},null,8,["value","placeholder"])]),i(ae,{size:"large",spinning:!e(u).isIdle},{default:r(()=>[i(te,{visible:e(w),"onUpdate:visible":s[5]||(s[5]=l=>L(w)?w.value=l:null),width:"70vw","mask-closable":"",onOk:s[6]||(s[6]=l=>w.value=!1)},{cancelText:r(()=>[]),default:r(()=>[i(se,{active:"",loading:!e(W).isIdle},{default:r(()=>[d("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:s[4]||(s[4]=l=>e(pe)(e(B)))},[d("div",Ue,f(a.$t("doubleClickToCopy")),1),S(" "+f(e(B)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),e(n)?(o(),k(e(Ce),{key:0,ref_key:"scroller",ref:U,class:"file-list",items:e(n),"item-size":e(V).first,"key-field":"fullpath","item-secondary-size":e(V).second,gridItems:e(H),onScroll:e(E)},{default:r(({item:l,index:q})=>[i(_e,{idx:q,file:l,"show-menu-idx":e(I),"onUpdate:showMenuIdx":s[7]||(s[7]=le=>L(I)?I.value=le:null),onFileItemClick:e(X),"full-screen-preview-image-url":e(n)[e(m)]?e(me)(e(n)[e(m)]):"","cell-width":e(Y),selected:e(F).includes(q),onContextMenuClick:e(M),onDragstart:e(j),onDragend:e(J),"is-selected-mutil-files":e(F).length>1,onPreviewVisibleChange:e(Q)},null,8,["idx","file","show-menu-idx","onFileItemClick","full-screen-preview-image-url","cell-width","selected","onContextMenuClick","onDragstart","onDragend","is-selected-mutil-files","onPreviewVisibleChange"])]),_:1},8,["items","item-size","item-secondary-size","gridItems","onScroll"])):h("",!0),e(z)?(o(),C("div",Ee,[i(e(he),{onClick:s[8]||(s[8]=l=>e(D)("prev")),class:_({disable:!e(R)("prev")})},null,8,["class"]),i(e(ye),{onClick:s[9]||(s[9]=l=>e(D)("next")),class:_({disable:!e(R)("next")})},null,8,["class"])])):h("",!0)]),_:1},8,["spinning"]),e(z)&&e(n)&&e(n)[e(m)]?(o(),k(Ie,{key:1,file:e(n)[e(m)],idx:e(m),onContextMenuClick:e(M)},null,8,["file","idx","onContextMenuClick"])):h("",!0)],512)}}});const He=ke(Ae,[["__scopeId","data-v-7afef8c2"]]);export{He as default};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/TagSearch-4d1b002e.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{P as j,Z as _e,d as ae,br as he,aZ as be,$ as F,bI as Ce,l as xe,u as ge,ap as Z,a0 as Y,h as x,c as p,a as J,bJ as Ae,b as Ie,f as we,bK as ke,a3 as se,bL as Pe,a2 as $e,i as Oe,b1 as Se,bM as Be,a5 as Te,a6 as Ke,a7 as Ee,ag as Ne,aU as Re,aS as Me,bN as De,aT as Ue,bO as je,k as Fe,bP as Ve,ar as Le,ax as ze,bQ as oe,bR as qe,o as C,y as T,C as q,z as X,p as S,v as B,r as K,S as te,m as Q,n as z,x as G,A as ie,N as re,bS as Ge,q as ce,a1 as He,aq as Qe,al as de,ai as ne,R as Ze,V as ue,bT as Je,U as We,bU as Xe,X as Ye}from"./index-7c0f3f3a.js";/* empty css *//* empty css */import{b as ve,c as ea,d as aa,e as ta,u as na}from"./db-90de1b1b.js";var la=function(){return{prefixCls:String,activeKey:{type:[Array,Number,String]},defaultActiveKey:{type:[Array,Number,String]},accordion:{type:Boolean,default:void 0},destroyInactivePanel:{type:Boolean,default:void 0},bordered:{type:Boolean,default:void 0},expandIcon:Function,openAnimation:j.object,expandIconPosition:j.oneOf(_e("left","right")),collapsible:{type:String},ghost:{type:Boolean,default:void 0},onChange:Function,"onUpdate:activeKey":Function}},me=function(){return{openAnimation:j.object,prefixCls:String,header:j.any,headerClass:String,showArrow:{type:Boolean,default:void 0},isActive:{type:Boolean,default:void 0},destroyInactivePanel:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},accordion:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},expandIcon:Function,extra:j.any,panelKey:j.oneOfType([j.string,j.number]),collapsible:{type:String},role:String,onItemClick:{type:Function}}};function pe(l){var e=l;if(!Array.isArray(e)){var t=Ie(e);e=t==="number"||t==="string"?[e]:[]}return e.map(function(s){return String(s)})}const W=ae({compatConfig:{MODE:3},name:"ACollapse",inheritAttrs:!1,props:he(la(),{accordion:!1,destroyInactivePanel:!1,bordered:!0,openAnimation:be("ant-motion-collapse",!1),expandIconPosition:"left"}),slots:["expandIcon"],setup:function(e,t){var s=t.attrs,c=t.slots,n=t.emit,o=F(pe(Ce([e.activeKey,e.defaultActiveKey])));xe(function(){return e.activeKey},function(){o.value=pe(e.activeKey)},{deep:!0});var f=ge("collapse",e),h=f.prefixCls,$=f.direction,E=Z(function(){var d=e.expandIconPosition;return d!==void 0?d:$.value==="rtl"?"right":"left"}),g=function(r){var u=e.expandIcon,m=u===void 0?c.expandIcon:u,y=m?m(r):p(Pe,{rotate:r.isActive?90:void 0},null);return p("div",null,[$e(Array.isArray(m)?y[0]:y)?se(y,{class:"".concat(h.value,"-arrow")},!1):y])},N=function(r){e.activeKey===void 0&&(o.value=r);var u=e.accordion?r[0]:r;n("update:activeKey",u),n("change",u)},k=function(r){var u=o.value;if(e.accordion)u=u[0]===r?[]:[r];else{u=Oe(u);var m=u.indexOf(r),y=m>-1;y?u.splice(m,1):u.push(r)}N(u)},D=function(r,u){var m,y,M;if(!ke(r)){var a=o.value,i=e.accordion,b=e.destroyInactivePanel,P=e.collapsible,O=e.openAnimation,A=String((m=r.key)!==null&&m!==void 0?m:u),w=r.props||{},I=w.header,H=I===void 0?(y=r.children)===null||y===void 0||(M=y.header)===null||M===void 0?void 0:M.call(y):I,v=w.headerClass,U=w.collapsible,_=w.disabled,V=!1;i?V=a[0]===A:V=a.indexOf(A)>-1;var L=U??P;(_||_==="")&&(L="disabled");var ye={key:A,panelKey:A,header:H,headerClass:v,isActive:V,prefixCls:h.value,destroyInactivePanel:b,openAnimation:O,accordion:i,onItemClick:L==="disabled"?null:k,expandIcon:g,collapsible:L};return se(r,ye)}},R=function(){var r;return we((r=c.default)===null||r===void 0?void 0:r.call(c)).map(D)};return function(){var d,r=e.accordion,u=e.bordered,m=e.ghost,y=Y((d={},x(d,h.value,!0),x(d,"".concat(h.value,"-borderless"),!u),x(d,"".concat(h.value,"-icon-position-").concat(E.value),!0),x(d,"".concat(h.value,"-rtl"),$.value==="rtl"),x(d,"".concat(h.value,"-ghost"),!!m),x(d,s.class,!!s.class),d));return p("div",J(J({class:y},Ae(s)),{},{style:s.style,role:r?"tablist":null}),[R()])}}}),sa=ae({compatConfig:{MODE:3},name:"PanelContent",props:me(),setup:function(e,t){var s=t.slots,c=F(!1);return Se(function(){(e.isActive||e.forceRender)&&(c.value=!0)}),function(){var n,o;if(!c.value)return null;var f=e.prefixCls,h=e.isActive,$=e.role;return p("div",{ref:F,class:Y("".concat(f,"-content"),(n={},x(n,"".concat(f,"-content-active"),h),x(n,"".concat(f,"-content-inactive"),!h),n)),role:$},[p("div",{class:"".concat(f,"-content-box")},[(o=s.default)===null||o===void 0?void 0:o.call(s)])])}}}),ee=ae({compatConfig:{MODE:3},name:"ACollapsePanel",inheritAttrs:!1,props:he(me(),{showArrow:!0,isActive:!1,onItemClick:function(){},headerClass:"",forceRender:!1}),slots:["expandIcon","extra","header"],setup:function(e,t){var s=t.slots,c=t.emit,n=t.attrs;Be(e.disabled===void 0,"Collapse.Panel",'`disabled` is deprecated. Please use `collapsible="disabled"` instead.');var o=ge("collapse",e),f=o.prefixCls,h=function(){c("itemClick",e.panelKey)},$=function(g){(g.key==="Enter"||g.keyCode===13||g.which===13)&&h()};return function(){var E,g,N,k,D=e.header,R=D===void 0?(E=s.header)===null||E===void 0?void 0:E.call(s):D,d=e.headerClass,r=e.isActive,u=e.showArrow,m=e.destroyInactivePanel,y=e.accordion,M=e.forceRender,a=e.openAnimation,i=e.expandIcon,b=i===void 0?s.expandIcon:i,P=e.extra,O=P===void 0?(g=s.extra)===null||g===void 0?void 0:g.call(s):P,A=e.collapsible,w=A==="disabled",I=f.value,H=Y("".concat(I,"-header"),(N={},x(N,d,d),x(N,"".concat(I,"-header-collapsible-only"),A==="header"),N)),v=Y((k={},x(k,"".concat(I,"-item"),!0),x(k,"".concat(I,"-item-active"),r),x(k,"".concat(I,"-item-disabled"),w),x(k,"".concat(I,"-no-arrow"),!u),x(k,"".concat(n.class),!!n.class),k)),U=p("i",{class:"arrow"},null);u&&typeof b=="function"&&(U=b(e));var _=Te(p(sa,{prefixCls:I,isActive:r,forceRender:M,role:y?"tabpanel":null},{default:s.default}),[[Ke,r]]),V=J({appear:!1,css:!1},a);return p("div",J(J({},n),{},{class:v}),[p("div",{class:H,onClick:function(){return A!=="header"&&h()},role:y?"tab":"button",tabindex:w?-1:0,"aria-expanded":r,onKeypress:$},[u&&U,A==="header"?p("span",{onClick:h,class:"".concat(I,"-header-text")},[R]):R,O&&p("div",{class:"".concat(I,"-extra")},[O])]),p(Ee,V,{default:function(){return[!m||r?_:null]}})])}}});W.Panel=ee;W.install=function(l){return l.component(W.name,W),l.component(ee.name,ee),l};var oa={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"};const ia=oa;function fe(l){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?Object(arguments[e]):{},s=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(c){return Object.getOwnPropertyDescriptor(t,c).enumerable}))),s.forEach(function(c){ra(l,c,t[c])})}return l}function ra(l,e,t){return e in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}var le=function(e,t){var s=fe({},e,t.attrs);return p(Ne,fe({},s,{icon:ia}),null)};le.displayName="ArrowRightOutlined";le.inheritAttrs=!1;const ca=le;function da(l,e,t,s){for(var c=-1,n=l==null?0:l.length;++c<n;){var o=l[c];e(s,o,t(o),l)}return s}function ua(l){return function(e,t,s){for(var c=-1,n=Object(e),o=s(e),f=o.length;f--;){var h=o[l?f:++c];if(t(n[h],h,n)===!1)break}return e}}var va=ua();const pa=va;function fa(l,e){return l&&pa(l,e,Re)}function ha(l,e){return function(t,s){if(t==null)return t;if(!Me(t))return l(t,s);for(var c=t.length,n=e?c:-1,o=Object(t);(e?n--:++n<c)&&s(o[n],n,o)!==!1;);return t}}var ga=ha(fa);const ma=ga;function ya(l,e,t,s){return ma(l,function(c,n,o){e(s,c,t(c),o)}),s}function _a(l,e){return function(t,s){var c=De(t)?da:ya,n=e?e():{};return c(t,l,Ue(s),n)}}var ba=Object.prototype,Ca=ba.hasOwnProperty,xa=_a(function(l,e,t){Ca.call(l,t)?l[t].push(e):je(l,t,[e])});const Aa=xa;const Ia={class:"container"},wa={class:"search-bar"},ka={class:"form-name"},Pa={class:"search-bar"},$a={class:"form-name"},Oa={class:"search-bar"},Sa={class:"form-name"},Ba={class:"search-bar"},Ta={class:"form-name"},Ka={key:0,class:"generate-idx-hint"},Ea={class:"list-container"},Na=["onClick"],Ra=["onClick"],Ma=["onClickCapture"],Da=ae({__name:"TagSearch",props:{tabIdx:{},paneIdx:{},searchScope:{}},setup(l){const e=l,t=Fe(),s=Ve(),c=Z(()=>!s.isIdle),n=F(),o=F({and_tags:[],or_tags:[],not_tags:[],folder_paths_str:e.searchScope}),f=Z(()=>n.value?n.value.tags.slice().sort((a,i)=>i.count-a.count):[]),h=["custom","Model","lora","lyco","pos","size","Postprocess upscaler","Postprocess upscale by","Sampler"].reduce((a,i,b)=>(a[i]=b,a),{}),$=Z(()=>Object.entries(Aa(f.value,a=>a.type)).sort((a,i)=>h[a[0]]-h[i[0]])),E=Le(),g=F($.value.map(a=>a[0]));ze(async()=>{n.value=await ve(),g.value=$.value.map(a=>a[0]),n.value.img_count&&n.value.expired&&await N(),e.searchScope&&k()}),oe("searchIndexExpired",()=>n.value&&(n.value.expired=!0));const N=qe(()=>s.pushAction(async()=>(await na(),n.value=await ve(),g.value=$.value.map(a=>a[0]),n.value)).res),k=()=>{t.openTagSearchMatchedImageGridInRight(e.tabIdx,E,o.value)};oe("returnToIIB",async()=>{const a=await s.pushAction(ea).res;n.value.expired=a.expired});const D=(a,i=!1)=>(i?`[${a.type}] `:"")+(a.display_name?`${a.display_name} : ${a.name}`:a.name),R=F(!1),d=F(""),r=async()=>{var i,b,P;if(!d.value){R.value=!1;return}const a=await s.pushAction(()=>aa({tag_name:d.value})).res;a.type!=="custom"&&de.error(ne("existInOtherType")),(i=n.value)!=null&&i.tags.find(O=>O.id===a.id)?de.error(ne("alreadyExists")):((b=n.value)==null||b.tags.push(a),(P=t.conf)==null||P.all_custom_tags.push(a)),d.value="",R.value=!1},u=a=>{Ze.confirm({title:ne("confirmDelete"),async onOk(){var b,P,O,A;await ta({tag_id:a});const i=((b=n.value)==null?void 0:b.tags.findIndex(w=>w.id===a))??-1;(P=n.value)==null||P.tags.splice(i,1),(A=t.conf)==null||A.all_custom_tags.splice((O=t.conf)==null?void 0:O.all_custom_tags.findIndex(w=>w.id===a),1)}})},m=Z(()=>new Set([o.value.and_tags,o.value.or_tags,o.value.not_tags].flat())),y=a=>{m.value.has(a.id)?(o.value.and_tags=o.value.and_tags.filter(i=>i!==a.id),o.value.or_tags=o.value.or_tags.filter(i=>i!==a.id),o.value.not_tags=o.value.not_tags.filter(i=>i!==a.id)):o.value.and_tags.push(a.id)},M={value:a=>a.id,text:D,optionText:a=>D(a,!0)};return(a,i)=>{const b=ue,P=Je,O=We,A=ue,w=Xe,I=ee,H=W;return C(),T("div",Ia,[q("",!0),n.value?(C(),T(X,{key:1},[S("div",null,[S("div",wa,[S("div",ka,B(a.$t("exactMatch")),1),p(K(te),{conv:M,mode:"multiple",style:{width:"100%"},options:f.value,value:o.value.and_tags,"onUpdate:value":i[0]||(i[0]=v=>o.value.and_tags=v),disabled:!f.value.length,placeholder:a.$t("selectExactMatchTag")},null,8,["options","value","disabled","placeholder"]),n.value.expired||!n.value.img_count?(C(),Q(b,{key:0,onClick:K(N),loading:!K(s).isIdle,type:"primary"},{default:z(()=>[G(B(n.value.img_count===0?a.$t("generateIndexHint"):a.$t("UpdateIndex")),1)]),_:1},8,["onClick","loading"])):(C(),Q(b,{key:1,type:"primary",onClick:k,loading:!K(s).isIdle},{default:z(()=>[G(B(a.$t("search")),1)]),_:1},8,["loading"]))]),S("div",Pa,[S("div",$a,B(a.$t("anyMatch")),1),p(K(te),{conv:M,mode:"multiple",style:{width:"100%"},options:f.value,value:o.value.or_tags,"onUpdate:value":i[1]||(i[1]=v=>o.value.or_tags=v),disabled:!f.value.length,placeholder:a.$t("selectAnyMatchTag")},null,8,["options","value","disabled","placeholder"])]),S("div",Oa,[S("div",Sa,B(a.$t("exclude")),1),p(K(te),{conv:M,mode:"multiple",style:{width:"100%"},options:f.value,value:o.value.not_tags,"onUpdate:value":i[2]||(i[2]=v=>o.value.not_tags=v),disabled:!f.value.length,placeholder:a.$t("selectExcludeTag")},null,8,["options","value","disabled","placeholder"])]),S("div",Ba,[S("div",Ta,B(a.$t("searchScope")),1),p(P,{"auto-size":{maxRows:8},value:o.value.folder_paths_str,"onUpdate:value":i[3]||(i[3]=v=>o.value.folder_paths_str=v),placeholder:a.$t("specifiedSearchFolder")},null,8,["value","placeholder"])])]),f.value.filter(v=>v.type!=="custom").length?q("",!0):(C(),T("p",Ka,B(a.$t("needGenerateIdx")),1)),S("div",Ea,[(C(!0),T(X,null,ie($.value,([v,U])=>(C(),T("ul",{class:"tag-list",key:v},[S("h3",{class:"cat-name",onClick:_=>g.value.includes(v)?g.value.splice(g.value.indexOf(v),1):g.value.push(v)},[p(K(ca),{class:re(["arrow",{down:g.value.includes(v)}])},null,8,["class"]),G(" "+B(a.$t(v)),1)],8,Na),p(H,{ghost:"",activeKey:g.value,"onUpdate:activeKey":i[6]||(i[6]=_=>g.value=_)},{expandIcon:z(()=>[]),default:z(()=>[(C(),Q(I,{key:v},{default:z(()=>[(C(!0),T(X,null,ie(U,(_,V)=>(C(),T("li",{key:_.id,class:re(["tag",{selected:m.value.has(_.id)}]),onClick:L=>y(_)},[m.value.has(_.id)?(C(),Q(K(Ge),{key:0})):q("",!0),G(" "+B(D(_))+" ",1),v==="custom"&&V!==0?(C(),T("span",{key:1,class:"remove",onClickCapture:ce(L=>u(_.id),["stop"])},[p(K(He))],40,Ma)):q("",!0)],10,Ra))),128)),v==="custom"?(C(),T("li",{key:0,class:"tag",onClick:i[5]||(i[5]=_=>R.value=!0)},[R.value?(C(),Q(w,{key:0,compact:""},{default:z(()=>[p(O,{value:d.value,"onUpdate:value":i[4]||(i[4]=_=>d.value=_),style:{width:"128px"},loading:c.value,"allow-clear":"",size:"small"},null,8,["value","loading"]),p(A,{size:"small",type:"primary",onClickCapture:ce(r,["stop"]),loading:c.value},{default:z(()=>[G(B(d.value?a.$t("submit"):a.$t("cancel")),1)]),_:1},8,["onClickCapture","loading"])]),_:1})):(C(),T(X,{key:1},[p(K(Qe)),G(" "+B(a.$t("add")),1)],64))])):q("",!0)]),_:2},1024))]),_:2},1032,["activeKey"])]))),128))])],64)):q("",!0)])}}});const La=Ye(Da,[["__scopeId","data-v-5d427604"]]);export{La as default};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/TagSearch-8cc2caef.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .ant-collapse{box-sizing:border-box;margin:0;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum";background-color:#fafafa;border:1px solid #d9d9d9;border-bottom:0;border-radius:2px}.ant-collapse>.ant-collapse-item{border-bottom:1px solid #d9d9d9}.ant-collapse>.ant-collapse-item:last-child,.ant-collapse>.ant-collapse-item:last-child>.ant-collapse-header{border-radius:0 0 2px 2px}.ant-collapse>.ant-collapse-item>.ant-collapse-header{position:relative;display:flex;flex-wrap:nowrap;align-items:flex-start;padding:12px 16px;color:#000000d9;line-height:1.5715;cursor:pointer;transition:all .3s,visibility 0s}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{display:inline-block;margin-right:12px;font-size:12px;vertical-align:-1px}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow svg{transition:transform .24s}.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-extra{margin-left:auto}.ant-collapse>.ant-collapse-item>.ant-collapse-header:focus{outline:none}.ant-collapse>.ant-collapse-item .ant-collapse-header-collapsible-only{cursor:default}.ant-collapse>.ant-collapse-item .ant-collapse-header-collapsible-only .ant-collapse-header-text{cursor:pointer}.ant-collapse>.ant-collapse-item.ant-collapse-no-arrow>.ant-collapse-header{padding-left:12px}.ant-collapse-icon-position-right>.ant-collapse-item>.ant-collapse-header{position:relative;padding:12px 40px 12px 16px}.ant-collapse-icon-position-right>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{position:absolute;top:50%;right:16px;left:auto;margin:0;transform:translateY(-50%)}.ant-collapse-content{color:#000000d9;background-color:#fff;border-top:1px solid #d9d9d9}.ant-collapse-content>.ant-collapse-content-box{padding:16px}.ant-collapse-content-hidden{display:none}.ant-collapse-item:last-child>.ant-collapse-content{border-radius:0 0 2px 2px}.ant-collapse-borderless{background-color:#fafafa;border:0}.ant-collapse-borderless>.ant-collapse-item{border-bottom:1px solid #d9d9d9}.ant-collapse-borderless>.ant-collapse-item:last-child,.ant-collapse-borderless>.ant-collapse-item:last-child .ant-collapse-header{border-radius:0}.ant-collapse-borderless>.ant-collapse-item>.ant-collapse-content{background-color:transparent;border-top:0}.ant-collapse-borderless>.ant-collapse-item>.ant-collapse-content>.ant-collapse-content-box{padding-top:4px}.ant-collapse-ghost{background-color:transparent;border:0}.ant-collapse-ghost>.ant-collapse-item{border-bottom:0}.ant-collapse-ghost>.ant-collapse-item>.ant-collapse-content{background-color:transparent;border-top:0}.ant-collapse-ghost>.ant-collapse-item>.ant-collapse-content>.ant-collapse-content-box{padding-top:12px;padding-bottom:12px}.ant-collapse .ant-collapse-item-disabled>.ant-collapse-header,.ant-collapse .ant-collapse-item-disabled>.ant-collapse-header>.arrow{color:#00000040;cursor:not-allowed}.ant-collapse-rtl{direction:rtl}.ant-collapse-rtl .ant-collapse>.ant-collapse-item>.ant-collapse-header{padding:12px 40px 12px 16px}.ant-collapse-rtl.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow{margin-right:0;margin-left:12px}.ant-collapse-rtl.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-arrow svg{transform:rotate(180deg)}.ant-collapse-rtl.ant-collapse>.ant-collapse-item>.ant-collapse-header .ant-collapse-extra{margin-right:auto;margin-left:0}.ant-collapse-rtl.ant-collapse>.ant-collapse-item.ant-collapse-no-arrow>.ant-collapse-header{padding-right:12px;padding-left:0}[data-v-5d427604] .ant-collapse>.ant-collapse-item>.ant-collapse-header{padding:0}.container[data-v-5d427604]{height:var(--pane-max-height);overflow:auto;display:flex;flex-direction:column;align-items:stretch}.container .generate-idx-hint[data-v-5d427604]{margin:64px;padding:64px;font-size:2em;text-align:center;background-color:var(--zp-secondary-background);white-space:pre-line;line-height:2.5em;border-radius:16px}.container .remove[data-v-5d427604]{padding:4px;position:cursor;border-radius:2px}.container .remove[data-v-5d427604]:hover{background-color:var(--zp-secondary-background)}.container .select[data-v-5d427604]{padding:8px}.container .search-bar[data-v-5d427604]{padding:8px;display:flex}.container .search-bar .form-name[data-v-5d427604]{flex-shrink:0;padding:4px 8px;width:128px}.container .list-container[data-v-5d427604]{background-color:var(--zp-secondary-background);overflow:scroll}.container .cat-name[data-v-5d427604]{user-select:none;position:sticky;top:0;padding:4px 16px;background:var(--zp-primary-background);margin:4px;transition:all .3s ease;border-left:4px solid var(--primary-color);cursor:pointer}.container .cat-name[data-v-5d427604]:hover{border-radius:4px;background-color:var(--zp-secondary-background)}.container .cat-name .arrow[data-v-5d427604]{color:var(--primary-color);transition:all .3s ease;margin-right:16px}.container .cat-name .arrow.down[data-v-5d427604]{transform:rotate(90deg)}.container .tag-list[data-v-5d427604]{list-style:none;margin:16px;border-radius:16px;background:var(--zp-primary-background);padding:8px}.container .tag-list .tag[data-v-5d427604]{border:2px solid var(--zp-secondary);color:var(--zp-primary);border-radius:999px;padding:4px 16px;margin:4px;display:inline-block;cursor:pointer;max-width:256px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.container .tag-list .tag.selected[data-v-5d427604]{color:var(--primary-color);border:2px solid var(--primary-color)}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/antd.dark-35e9b327.js ADDED
The diff for this file is too large to render. See raw diff
 
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/batchDownload-08be3fc5.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .container[data-v-aab31da2]{background:var(--zp-secondary-background);height:100%;overflow:auto;display:flex;flex-direction:column}.container .actions-panel[data-v-aab31da2]{padding:8px;background-color:var(--zp-primary-background)}.container .file-list[data-v-aab31da2]{flex:1;list-style:none;padding:8px;height:var(--pane-max-height);width:100%}.container .file-list .hint[data-v-aab31da2]{text-align:center;font-size:2em;padding:30vh 128px 0}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/batchDownload-651b3fe2.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as v,c4 as C,bP as I,o as l,y as _,p as f,c,n as r,x as h,v as d,r as e,m as F,L as x,c5 as z,c6 as B,V as $,X as R}from"./index-7c0f3f3a.js";import{u as S,b as V,k as E,F as A,g as L}from"./FileItem-39204ab7.js";import"./functionalCallableComp-6d05295c.js";import"./db-90de1b1b.js";import"./index-00c5caf5.js";/* empty css */const T={class:"actions-panel actions"},N={key:0,class:"file-list"},U={class:"hint"},H=v({__name:"batchDownload",props:{tabIdx:{},paneIdx:{},id:{}},setup(j){const{stackViewEl:w}=S().toRefs(),{itemSize:p,gridItems:k,cellWidth:b}=V(),i=E(),{selectdFiles:n}=C(i),m=I(),y=async t=>{const s=z(t);s&&i.addFiles(s.nodes)},D=async()=>{m.pushAction(async()=>{const t=await B.value.post("/zip",{paths:n.value.map(o=>o.fullpath)},{responseType:"blob"}),s=window.URL.createObjectURL(new Blob([t.data])),a=document.createElement("a");a.href=s,a.setAttribute("download",`iib_${new Date().toLocaleString()}.zip`),document.body.appendChild(a),a.click()})},g=t=>{n.value.splice(t,1)};return(t,s)=>{const a=$;return l(),_("div",{class:"container",ref_key:"stackViewEl",ref:w,onDrop:y},[f("div",T,[c(a,{onClick:s[0]||(s[0]=o=>e(i).selectdFiles=[])},{default:r(()=>[h(d(t.$t("clear")),1)]),_:1}),c(a,{onClick:D,type:"primary",loading:!e(m).isIdle},{default:r(()=>[h(d(t.$t("zipDownload")),1)]),_:1},8,["loading"])]),e(n).length?(l(),F(e(L),{key:1,ref:"scroller",class:"file-list",items:e(n).slice(),"item-size":e(p).first,"key-field":"fullpath","item-secondary-size":e(p).second,gridItems:e(k)},{default:r(({item:o,index:u})=>[c(A,{idx:u,file:o,"cell-width":e(b),"enable-close-icon":"",onCloseIconClick:q=>g(u),"full-screen-preview-image-url":e(x)(o),"enable-right-click-menu":!1},null,8,["idx","file","cell-width","onCloseIconClick","full-screen-preview-image-url"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):(l(),_("div",N,[f("p",U,d(t.$t("batchDownloaDDragAndDropHint")),1)]))],544)}}});const J=R(H,[["__scopeId","data-v-aab31da2"]]);export{J as default};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/db-90de1b1b.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{c6 as t}from"./index-7c0f3f3a.js";const c=async()=>(await t.value.get("/db/basic_info")).data,d=async()=>(await t.value.get("/db/expired_dirs")).data,p=async()=>{await t.value.post("/db/update_image_data",{},{timeout:1/0})},u=async(a,s)=>(await t.value.post("/db/match_images_by_tags",{...a,folder_paths:(a.folder_paths_str??"").split(/,|\n/).map(e=>e.trim()).filter(e=>e),cursor:s})).data,g=async a=>(await t.value.post("/db/add_custom_tag",a)).data,i=async a=>(await t.value.post("/db/toggle_custom_tag_to_img",a)).data,_=async a=>{await t.value.post("/db/remove_custom_tag",a)},m=async a=>(await t.value.post("/db/search_by_substr",a)).data,r="/db/extra_paths",b=async a=>{await t.value.post(r,a)},l=async a=>{await t.value.delete(r,{data:a})},y=async a=>(await t.value.post("/db/get_image_tags",{paths:a})).data,v=()=>t.value.post("/db/rebuild_index"),h=a=>t.value.post("/db/batch_update_image_tag",a);export{b as a,c as b,d as c,g as d,_ as e,m as f,u as g,y as h,h as i,v as j,l as r,i as t,p as u};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/emptyStartup-28b35346.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{Y as _e,Z as be,d as J,u as we,$ as D,g as B,a0 as ke,h as x,c as h,a1 as ye,a2 as Ce,a3 as Oe,a4 as $e,a5 as Ie,a6 as xe,a as ae,a7 as Se,P,a8 as Te,a9 as Pe,aa as Ne,ab as ze,ac as Me,ad as Ae,ae as De,af as Ee,ag as pe,ah as Le,R as Y,ai as w,aj as Re,U as Fe,ak as He,al as Z,am as G,o as m,m as S,n as _,x as T,v as c,an as je,W as Be,M as Ve,k as qe,ao as Ge,ap as oe,y as b,p as a,r as d,C as y,q as O,aq as se,z as V,A as q,ar as X,as as Ue,at as We,V as Qe,au as Xe,av as Ye,X as Ze}from"./index-7c0f3f3a.js";import{a as Je,r as Ke}from"./db-90de1b1b.js";import{D as et}from"./index-00c5caf5.js";/* empty css */var tt={success:Te,info:Pe,error:Ne,warning:ze},nt={success:Me,info:Ae,error:De,warning:Ee},at=be("success","info","warning","error"),ot=function(){return{type:P.oneOf(at),closable:{type:Boolean,default:void 0},closeText:P.any,message:P.any,description:P.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:P.any,closeIcon:P.any,onClose:Function}},st=J({compatConfig:{MODE:3},name:"AAlert",inheritAttrs:!1,props:ot(),setup:function(t,e){var l=e.slots,u=e.emit,k=e.attrs,C=e.expose,$=we("alert",t),E=$.prefixCls,N=$.direction,I=D(!1),L=D(!1),R=D(),W=function(s){s.preventDefault();var p=R.value;p.style.height="".concat(p.offsetHeight,"px"),p.style.height="".concat(p.offsetHeight,"px"),I.value=!0,u("close",s)},n=function(){var s;I.value=!1,L.value=!0,(s=t.afterClose)===null||s===void 0||s.call(t)};C({animationEnd:n});var r=D({});return function(){var f,s,p=t.banner,z=t.closeIcon,M=z===void 0?(f=l.closeIcon)===null||f===void 0?void 0:f.call(l):z,o=t.closable,g=t.type,A=t.showIcon,Q=B(l,t,"closeText"),F=B(l,t,"description"),te=B(l,t,"message"),H=B(l,t,"icon");A=p&&A===void 0?!0:A,g=p&&g===void 0?"warning":g||"info";var he=(F?nt:tt)[g]||null;Q&&(o=!0);var v=E.value,me=ke(v,(s={},x(s,"".concat(v,"-").concat(g),!0),x(s,"".concat(v,"-closing"),I.value),x(s,"".concat(v,"-with-description"),!!F),x(s,"".concat(v,"-no-icon"),!A),x(s,"".concat(v,"-banner"),!!p),x(s,"".concat(v,"-closable"),o),x(s,"".concat(v,"-rtl"),N.value==="rtl"),s)),ve=o?h("button",{type:"button",onClick:W,class:"".concat(v,"-close-icon"),tabindex:0},[Q?h("span",{class:"".concat(v,"-close-text")},[Q]):M===void 0?h(ye,null,null):M]):null,fe=H&&(Ce(H)?Oe(H,{class:"".concat(v,"-icon")}):h("span",{class:"".concat(v,"-icon")},[H]))||h(he,{class:"".concat(v,"-icon")},null),ge=$e("".concat(v,"-motion"),{appear:!1,css:!0,onAfterLeave:n,onBeforeLeave:function(j){j.style.maxHeight="".concat(j.offsetHeight,"px")},onLeave:function(j){j.style.maxHeight="0px"}});return L.value?null:h(Se,ge,{default:function(){return[Ie(h("div",ae(ae({role:"alert"},k),{},{style:[k.style,r.value],class:[k.class,me],"data-show":!I.value,ref:R}),[A?fe:null,h("div",{class:"".concat(v,"-content")},[te?h("div",{class:"".concat(v,"-message")},[te]):null,F?h("div",{class:"".concat(v,"-description")},[F]):null]),ve]),[[xe,!I.value]])]}})}}});const lt=_e(st);var it={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm376 116c-119.3 0-216 96.7-216 216s96.7 216 216 216 216-96.7 216-216-96.7-216-216-216zm107.5 323.5C750.8 868.2 712.6 884 672 884s-78.8-15.8-107.5-44.5C535.8 810.8 520 772.6 520 732s15.8-78.8 44.5-107.5C593.2 595.8 631.4 580 672 580s78.8 15.8 107.5 44.5C808.2 653.2 824 691.4 824 732s-15.8 78.8-44.5 107.5zM761 656h-44.3c-2.6 0-5 1.2-6.5 3.3l-63.5 87.8-23.1-31.9a7.92 7.92 0 00-6.5-3.3H573c-6.5 0-10.3 7.4-6.5 12.7l73.8 102.1c3.2 4.4 9.7 4.4 12.9 0l114.2-158c3.9-5.3.1-12.7-6.4-12.7zM440 852H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"file-done",theme:"outlined"};const ct=it;function le(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?Object(arguments[t]):{},l=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(l=l.concat(Object.getOwnPropertySymbols(e).filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable}))),l.forEach(function(u){rt(i,u,e[u])})}return i}function rt(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}var K=function(t,e){var l=le({},t,e.attrs);return h(pe,le({},l,{icon:ct}),null)};K.displayName="FileDoneOutlined";K.inheritAttrs=!1;const ut=K;var dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};const pt=dt;function ie(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?Object(arguments[t]):{},l=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(l=l.concat(Object.getOwnPropertySymbols(e).filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable}))),l.forEach(function(u){ht(i,u,e[u])})}return i}function ht(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}var ee=function(t,e){var l=ie({},t,e.attrs);return h(pe,ie({},l,{icon:pt}),null)};ee.displayName="LockOutlined";ee.inheritAttrs=!1;const ce=ee;const re=async i=>{let t;if({}.TAURI_ARCH){const e=await Le({directory:!0});if(typeof e=="string")t=e;else return}else t=await new Promise(e=>{const l=D("");Y.confirm({title:w("inputTargetFolderPath"),content:()=>Re(Fe,{value:l.value,"onUpdate:value":u=>l.value=u}),async onOk(){const u=l.value;(await He([u]))[u]?e(l.value):Z.error(w("pathDoesNotExist"))}})});Y.confirm({content:w("confirmToAddToExtraPath"),async onOk(){await Je({type:i,path:t}),Z.success(w("addCompleted")),G.emit("searchIndexExpired"),G.emit("updateGlobalSetting")}})},ue=(i,t)=>{Y.confirm({content:w("confirmDelete"),closable:!0,async onOk(){await Ke({type:t,path:i}),Z.success(w("removeCompleted")),G.emit("searchIndexExpired"),G.emit("updateGlobalSetting")}})},de=J({__name:"actionContextMenu",emits:["openOnTheRight","openInNewTab"],setup(i,{emit:t}){const e=l=>{switch(l.key.toString()){case"openOnTheRight":t("openOnTheRight");break;case"openInNewTab":t("openInNewTab");break}};return(l,u)=>{const k=Be,C=Ve,$=et;return m(),S($,{trigger:["contextmenu"]},{overlay:_(()=>[h(C,{onClick:e},{default:_(()=>[h(k,{key:"openOnTheRight"},{default:_(()=>[T(c(l.$t("openOnTheRight")),1)]),_:1}),h(k,{key:"openInNewTab"},{default:_(()=>[T(c(l.$t("openInNewTab")),1)]),_:1})]),_:1})]),default:_(()=>[je(l.$slots,"default")]),_:3})}}}),U=i=>(Xe("data-v-236610db"),i=i(),Ye(),i),mt={class:"container"},vt={class:"header"},ft={key:0,style:{"margin-left":"16px","font-size":"1.5em"}},gt=U(()=>a("div",{"flex-placeholder":""},null,-1)),_t=U(()=>a("a",{href:"https://github.com/zanllp/sd-webui-infinite-image-browsing",target:"_blank",class:"last-record"},"Github",-1)),bt={href:"https://github.com/zanllp/sd-webui-infinite-image-browsing/blob/main/.env.example",target:"_blank",class:"last-record"},wt={href:"https://github.com/zanllp/sd-webui-infinite-image-browsing/wiki/Change-log",target:"_blank",class:"last-record"},kt={href:"https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/90",target:"_blank",class:"last-record"},yt={class:"access-mode-message"},Ct=U(()=>a("div",{"flex-placeholder":""},null,-1)),Ot={class:"access-mode-message"},$t=U(()=>a("div",{"flex-placeholder":""},null,-1)),It={class:"content"},xt={class:"feature-item"},St={class:"text line-clamp-1"},Tt=["onClick"],Pt={class:"text line-clamp-2"},Nt={key:0,class:"feature-item"},zt={class:"text line-clamp-1"},Mt=["onClick"],At={class:"text line-clamp-2"},Dt={class:"feature-item"},Et=["onClick"],Lt={class:"text line-clamp-1"},Rt={class:"text line-clamp-1"},Ft={class:"text line-clamp-1"},Ht={class:"text line-clamp-1"},jt={key:1,class:"feature-item recent"},Bt={class:"title"},Vt=["onClick"],qt={class:"text line-clamp-1"},Gt=J({__name:"emptyStartup",props:{tabIdx:{},paneIdx:{}},setup(i){const t=i,e=qe(),l=Ge(),u={local:w("local"),"tag-search":w("imgSearch"),"fuzzy-search":w("fuzzy-search"),"global-setting":w("globalSettings"),"batch-download":w("batchDownload")+" / "+w("archive")},k=(n,r,f=!1)=>{let s;switch(n){case"tag-search-matched-image-grid":case"img-sli":return;case"global-setting":case"tag-search":case"batch-download":case"fuzzy-search":case"empty":s={type:n,name:u[n],key:Date.now()+X()};break;case"local":s={type:n,name:u[n],key:Date.now()+X(),path:r,walkModePath:f?r:void 0}}return s},C=(n,r,f=!1)=>{const s=k(n,r,f);if(!s)return;const p=e.tabList[t.tabIdx];p.panes.splice(t.paneIdx,1,s),p.key=s.key},$=(n,r,f=!1)=>{const s=k(n,r,f);if(!s)return;e.tabList[t.tabIdx].panes.push(s)},E=(n,r,f=!1)=>{const s=k(n,r,f);if(!s)return;let p=e.tabList[t.tabIdx+1];p||(p={panes:[],key:"",id:X()},e.tabList[t.tabIdx+1]=p),p.panes.push(s),p.key=s.key},N=oe(()=>{var n;return(n=e.tabListHistoryRecord)==null?void 0:n[1]}),I=oe(()=>e.quickMovePaths.filter(({key:n,type:r})=>n==="outdir_txt2img_samples"||n==="outdir_img2img_samples"||n==="outdir_txt2img_grids"||n==="outdir_img2img_grids"||r==="walk")),L=window.parent!==window,R=()=>window.parent.open("/infinite_image_browsing"+(window.parent.location.href.includes("theme=dark")?"?__theme=dark":"")),W=()=>{Ue(N.value),e.tabList=We(N.value.tabs)};return(n,r)=>{var p,z,M;const f=lt,s=Qe;return m(),b("div",mt,[a("div",vt,[a("h1",null,c(n.$t("welcome")),1),(p=d(e).conf)!=null&&p.enable_access_control&&d(e).dontShowAgain?(m(),b("div",ft,[h(d(ce),{title:"Access Control mode",style:{"vertical-align":"text-bottom"}})])):y("",!0),gt,_t,a("a",bt,c(n.$t("privacyAndSecurity")),1),a("a",wt,c(n.$t("changlog")),1),a("a",kt,c(n.$t("faq")),1)]),(z=d(e).conf)!=null&&z.enable_access_control&&!d(e).dontShowAgain?(m(),S(f,{key:0,"show-icon":""},{message:_(()=>[a("div",yt,[a("div",null,c(n.$t("accessControlModeTips")),1),Ct,a("a",{onClick:r[0]||(r[0]=O(o=>d(e).dontShowAgain=!0,["prevent"]))},c(n.$t("dontShowAgain")),1)])]),icon:_(()=>[h(d(ce))]),_:1})):y("",!0),d(e).dontShowAgainNewImgOpts?y("",!0):(m(),S(f,{key:1,"show-icon":""},{message:_(()=>[a("div",Ot,[a("div",null,c(n.$t("majorUpdateCustomCellSizeTips")),1),$t,a("a",{onClick:r[1]||(r[1]=O(o=>d(e).dontShowAgainNewImgOpts=!0,["prevent"]))},c(n.$t("dontShowAgain")),1)])]),_:1})),a("div",It,[a("div",xt,[a("h2",null,c(n.$t("walkMode")),1),a("ul",null,[a("li",{onClick:r[2]||(r[2]=o=>d(re)("walk")),class:"item",style:{"text-align":""}},[a("span",St,[h(d(se)),T(" "+c(n.$t("add")),1)])]),(m(!0),b(V,null,q(I.value,o=>(m(),S(de,{key:o.key,onOpenInNewTab:g=>$("local",o.dir,!0),onOpenOnTheRight:g=>E("local",o.dir,!0)},{default:_(()=>[a("li",{class:"item rem",onClick:O(g=>C("local",o.dir,!0),["prevent"])},[a("span",Pt,c(o.zh),1),o.can_delete?(m(),S(s,{key:0,type:"link",onClick:O(g=>d(ue)(o.dir,"walk"),["stop"])},{default:_(()=>[T(c(n.$t("remove")),1)]),_:2},1032,["onClick"])):y("",!0)],8,Tt)]),_:2},1032,["onOpenInNewTab","onOpenOnTheRight"]))),128))])]),d(e).quickMovePaths.length?(m(),b("div",Nt,[a("h2",null,c(n.$t("launchFromQuickMove")),1),a("ul",null,[a("li",{onClick:r[3]||(r[3]=o=>d(re)("scanned")),class:"item",style:{"text-align":""}},[a("span",zt,[h(d(se)),T(" "+c(n.$t("add")),1)])]),(m(!0),b(V,null,q(d(e).quickMovePaths.filter(o=>o.type!=="walk"),o=>(m(),S(de,{key:o.key,onOpenInNewTab:g=>$("local",o.dir),onOpenOnTheRight:g=>E("local",o.dir)},{default:_(()=>[a("li",{class:"item rem",onClick:O(g=>C("local",o.dir),["prevent"])},[a("span",At,c(o.zh),1),o.can_delete&&o.type=="scanned"?(m(),S(s,{key:0,type:"link",onClick:O(g=>d(ue)(o.dir,"scanned"),["stop"])},{default:_(()=>[T(c(n.$t("remove")),1)]),_:2},1032,["onClick"])):y("",!0)],8,Mt)]),_:2},1032,["onOpenInNewTab","onOpenOnTheRight"]))),128))])])):y("",!0),a("div",Dt,[a("h2",null,c(n.$t("launch")),1),a("ul",null,[(m(!0),b(V,null,q(Object.keys(u),o=>(m(),b("li",{key:o,class:"item",onClick:O(g=>C(o),["prevent"])},[a("span",Lt,c(u[o]),1)],8,Et))),128)),a("li",{class:"item",onClick:r[4]||(r[4]=o=>d(l).opened=!0)},[a("span",Rt,c(n.$t("imgCompare")),1)]),L?(m(),b("li",{key:0,class:"item",onClick:R},[a("span",Ft,c(n.$t("openInNewWindow")),1)])):y("",!0),(M=N.value)!=null&&M.tabs.length?(m(),b("li",{key:1,class:"item",onClick:W},[a("span",Ht,c(n.$t("restoreLastRecord")),1)])):y("",!0)])]),d(e).recent.length?(m(),b("div",jt,[a("div",Bt,[a("h2",null,c(n.$t("recent")),1),h(s,{onClick:r[5]||(r[5]=o=>d(e).recent=[]),type:"link"},{default:_(()=>[T(c(n.$t("clear")),1)]),_:1})]),a("ul",null,[(m(!0),b(V,null,q(d(e).recent,o=>(m(),b("li",{key:o.key,class:"item",onClick:O(g=>C("local",o.path),["prevent"])},[h(d(ut),{class:"icon"}),a("span",qt,c(o.path),1)],8,Vt))),128))])])):y("",!0)])])}}});const Yt=Ze(Gt,[["__scopeId","data-v-236610db"]]);export{Yt as default};
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/emptyStartup-3df6ad3a.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .ant-alert{box-sizing:border-box;margin:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum";position:relative;display:flex;align-items:center;padding:8px 15px;word-wrap:break-word;border-radius:2px}.ant-alert-content{flex:1;min-width:0}.ant-alert-icon{margin-right:8px}.ant-alert-description{display:none;font-size:14px;line-height:22px}.ant-alert-success{background-color:#f6ffed;border:1px solid #b7eb8f}.ant-alert-success .ant-alert-icon{color:#52c41a}.ant-alert-info{background-color:#fff1e6;border:1px solid #f7ae83}.ant-alert-info .ant-alert-icon{color:#d03f0a}.ant-alert-warning{background-color:#fffbe6;border:1px solid #ffe58f}.ant-alert-warning .ant-alert-icon{color:#faad14}.ant-alert-error{background-color:#fff2f0;border:1px solid #ffccc7}.ant-alert-error .ant-alert-icon{color:#ff4d4f}.ant-alert-error .ant-alert-description>pre{margin:0;padding:0}.ant-alert-action{margin-left:8px}.ant-alert-close-icon{margin-left:8px;padding:0;overflow:hidden;font-size:12px;line-height:12px;background-color:transparent;border:none;outline:none;cursor:pointer}.ant-alert-close-icon .anticon-close{color:#00000073;transition:color .3s}.ant-alert-close-icon .anticon-close:hover{color:#000000bf}.ant-alert-close-text{color:#00000073;transition:color .3s}.ant-alert-close-text:hover{color:#000000bf}.ant-alert-with-description{align-items:flex-start;padding:15px 15px 15px 24px}.ant-alert-with-description.ant-alert-no-icon{padding:15px}.ant-alert-with-description .ant-alert-icon{margin-right:15px;font-size:24px}.ant-alert-with-description .ant-alert-message{display:block;margin-bottom:4px;color:#000000d9;font-size:16px}.ant-alert-message{color:#000000d9}.ant-alert-with-description .ant-alert-description{display:block}.ant-alert.ant-alert-motion-leave{overflow:hidden;opacity:1;transition:max-height .3s cubic-bezier(.78,.14,.15,.86),opacity .3s cubic-bezier(.78,.14,.15,.86),padding-top .3s cubic-bezier(.78,.14,.15,.86),padding-bottom .3s cubic-bezier(.78,.14,.15,.86),margin-bottom .3s cubic-bezier(.78,.14,.15,.86)}.ant-alert.ant-alert-motion-leave-active{max-height:0;margin-bottom:0!important;padding-top:0;padding-bottom:0;opacity:0}.ant-alert-banner{margin-bottom:0;border:0;border-radius:0}.ant-alert.ant-alert-rtl{direction:rtl}.ant-alert-rtl .ant-alert-icon{margin-right:auto;margin-left:8px}.ant-alert-rtl .ant-alert-action,.ant-alert-rtl .ant-alert-close-icon{margin-right:8px;margin-left:auto}.ant-alert-rtl.ant-alert-with-description{padding-right:24px;padding-left:15px}.ant-alert-rtl.ant-alert-with-description .ant-alert-icon{margin-right:auto;margin-left:15px}.access-mode-message[data-v-236610db]{display:flex;flex-direction:row;align-items:center}.access-mode-message a[data-v-236610db]{margin-left:16px}.container[data-v-236610db]{padding:20px;background-color:var(--zp-secondary-background);height:100%;overflow:auto}.header[data-v-236610db]{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap}.header h1[data-v-236610db]{font-size:28px;font-weight:700;color:var(--zp-primary);margin:0}.last-record[data-v-236610db]{margin-left:16px;font-size:14px;color:var(--zp-secondary);flex-shrink:0}.last-record a[data-v-236610db]{text-decoration:none;color:var(--zp-secondary)}.last-record a[data-v-236610db]:hover{color:var(--zp-primary)}.content[data-v-236610db]{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));grid-gap:20px;margin-top:16px}.feature-item[data-v-236610db]{background-color:var(--zp-primary-background);border-radius:8px;box-shadow:0 1px 2px #0000001a;padding:20px}.feature-item ul[data-v-236610db]{list-style:none;padding:4px;max-height:70vh;overflow-y:auto}.feature-item.recent .title[data-v-236610db]{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.feature-item.recent .title h2[data-v-236610db]{margin:0}.feature-item .item[data-v-236610db]{margin-bottom:10px;padding:4px 8px;display:flex;align-items:center}.feature-item .item.rem[data-v-236610db]{display:flex;align-items:center;justify-content:space-between}.feature-item .item[data-v-236610db]:hover{background:var(--zp-secondary-background);border-radius:4px;color:var(--primary-color);cursor:pointer}.feature-item .icon[data-v-236610db]{margin-right:8px}.feature-item h2[data-v-236610db]{margin-top:0;margin-bottom:20px;font-size:20px;font-weight:700;color:var(--zp-primary)}.text[data-v-236610db]{flex:1;font-size:16px;word-break:break-all}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/fullScreenContextMenu-5ccd83b3.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .ant-spin{box-sizing:border-box;margin:0;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum";position:absolute;display:none;color:#d03f0a;text-align:center;vertical-align:middle;opacity:0;transition:transform .3s cubic-bezier(.78,.14,.15,.86)}.ant-spin-spinning{position:static;display:inline-block;opacity:1}.ant-spin-nested-loading{position:relative}.ant-spin-nested-loading>div>.ant-spin{position:absolute;top:0;left:0;z-index:4;display:block;width:100%;height:100%;max-height:400px}.ant-spin-nested-loading>div>.ant-spin .ant-spin-dot{position:absolute;top:50%;left:50%;margin:-10px}.ant-spin-nested-loading>div>.ant-spin .ant-spin-text{position:absolute;top:50%;width:100%;padding-top:5px;text-shadow:0 1px 2px #fff}.ant-spin-nested-loading>div>.ant-spin.ant-spin-show-text .ant-spin-dot{margin-top:-20px}.ant-spin-nested-loading>div>.ant-spin-sm .ant-spin-dot{margin:-7px}.ant-spin-nested-loading>div>.ant-spin-sm .ant-spin-text{padding-top:2px}.ant-spin-nested-loading>div>.ant-spin-sm.ant-spin-show-text .ant-spin-dot{margin-top:-17px}.ant-spin-nested-loading>div>.ant-spin-lg .ant-spin-dot{margin:-16px}.ant-spin-nested-loading>div>.ant-spin-lg .ant-spin-text{padding-top:11px}.ant-spin-nested-loading>div>.ant-spin-lg.ant-spin-show-text .ant-spin-dot{margin-top:-26px}.ant-spin-container{position:relative;transition:opacity .3s}.ant-spin-container:after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:10;display:none \ ;width:100%;height:100%;background:#fff;opacity:0;transition:all .3s;content:"";pointer-events:none}.ant-spin-blur{clear:both;opacity:.5;user-select:none;pointer-events:none}.ant-spin-blur:after{opacity:.4;pointer-events:auto}.ant-spin-tip{color:#00000073}.ant-spin-dot{position:relative;display:inline-block;font-size:20px;width:1em;height:1em}.ant-spin-dot-item{position:absolute;display:block;width:9px;height:9px;background-color:#d03f0a;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.ant-spin-dot-item:nth-child(1){top:0;left:0}.ant-spin-dot-item:nth-child(2){top:0;right:0;animation-delay:.4s}.ant-spin-dot-item:nth-child(3){right:0;bottom:0;animation-delay:.8s}.ant-spin-dot-item:nth-child(4){bottom:0;left:0;animation-delay:1.2s}.ant-spin-dot-spin{transform:rotate(45deg);animation:antRotate 1.2s infinite linear}.ant-spin-sm .ant-spin-dot{font-size:14px}.ant-spin-sm .ant-spin-dot i{width:6px;height:6px}.ant-spin-lg .ant-spin-dot{font-size:32px}.ant-spin-lg .ant-spin-dot i{width:14px;height:14px}.ant-spin.ant-spin-show-text .ant-spin-text{display:block}@media all and (-ms-high-contrast: none),(-ms-high-contrast: active){.ant-spin-blur{background:#fff;opacity:.5}}@keyframes antSpinMove{to{opacity:1}}@keyframes antRotate{to{transform:rotate(405deg)}}.ant-spin-rtl{direction:rtl}.ant-spin-rtl .ant-spin-dot-spin{transform:rotate(-45deg);animation-name:antRotateRtl}@keyframes antRotateRtl{to{transform:rotate(-405deg)}}.full-screen-menu[data-v-f11ac69d]{position:fixed;z-index:99999;background:var(--zp-primary-background);padding:8px 16px;box-shadow:0 0 4px var(--zp-secondary);border-radius:4px}.full-screen-menu .tags-container[data-v-f11ac69d]{margin:4px 0}.full-screen-menu .tags-container .tag[data-v-f11ac69d]{margin-right:4px;padding:2px 16px;border-radius:4px;display:inline-block;cursor:pointer;font-weight:700;transition:.5s all ease;border:2px solid var(--tag-color);color:var(--tag-color);background:var(--zp-primary-background);user-select:none}.full-screen-menu .tags-container .tag.selected[data-v-f11ac69d]{background:var(--tag-color);color:#fff}.full-screen-menu .container[data-v-f11ac69d]{height:100%;display:flex;overflow:hidden;flex-direction:column}.full-screen-menu .gen-info[data-v-f11ac69d]{flex:1;word-break:break-all;white-space:pre-line;overflow:auto;z-index:1;padding-top:4px;position:relative}.full-screen-menu .gen-info .info-tags .info-tag[data-v-f11ac69d]{display:inline-block;overflow:hidden;border-radius:4px;margin-right:8px;border:2px solid var(--zp-primary)}.full-screen-menu .gen-info .info-tags .name[data-v-f11ac69d]{background-color:var(--zp-primary);color:var(--zp-primary-background);padding:4px}.full-screen-menu .gen-info .info-tags .value[data-v-f11ac69d]{padding:4px}.full-screen-menu.unset-size[data-v-f11ac69d]{width:unset!important;height:unset!important}.full-screen-menu .mouse-sensor[data-v-f11ac69d]{position:absolute;bottom:0;right:0;transform:rotate(90deg);cursor:se-resize;z-index:1;background:var(--zp-primary-background);border-radius:2px}.full-screen-menu .mouse-sensor>*[data-v-f11ac69d]{font-size:18px;padding:4px}.full-screen-menu .action-bar[data-v-f11ac69d]{display:flex;align-items:center;user-select:none;gap:4px}.full-screen-menu .action-bar .icon[data-v-f11ac69d]{font-size:1.5em;padding:2px 4px;border-radius:4px}.full-screen-menu .action-bar .icon[data-v-f11ac69d]:hover{background:var(--zp-secondary-variant-background)}.full-screen-menu .action-bar>*[data-v-f11ac69d]{flex-wrap:wrap}
extensions/sd-webui-infinite-image-browsing/vue/dist/assets/fullScreenContextMenu-780774ab.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ import{d as fe,br as he,aJ as ye,bY as be,ay as we,aD as H,bZ as _e,b_ as K,e as R,c as o,_ as Oe,h as M,a as ee,bA as Ee,P as te,ag as A,ax as Le,aN as $e,l as ve,k as Se,$ as j,ap as U,bP as Pe,b$ as xe,c0 as Ce,ai as z,o as p,y,p as N,r as s,m as I,n as f,L as ne,c1 as Me,C as k,z as W,x as h,v,t as ie,A as V,N as ae,B as ke,q as De,V as re,W as ze,c2 as Ne,M as Ae,X as je}from"./index-7c0f3f3a.js";import{D as Te}from"./index-00c5caf5.js";/* empty css */import{i as Ie,j as We,_ as Be}from"./FileItem-39204ab7.js";var Fe=["class","style"],Ue=function(){return{prefixCls:String,spinning:{type:Boolean,default:void 0},size:String,wrapperClassName:String,tip:te.any,delay:Number,indicator:te.any}},B=null;function Ve(e,t){return!!e&&!!t&&!isNaN(Number(t))}function Dt(e){var t=e.indicator;B=typeof t=="function"?t:function(){return o(t,null,null)}}const zt=fe({compatConfig:{MODE:3},name:"ASpin",inheritAttrs:!1,props:he(Ue(),{size:"default",spinning:!0,wrapperClassName:""}),setup:function(){return{originalUpdateSpinning:null,configProvider:ye("configProvider",be)}},data:function(){var t=this.spinning,a=this.delay,n=Ve(t,a);return{sSpinning:t&&!n}},created:function(){this.originalUpdateSpinning=this.updateSpinning,this.debouncifyUpdateSpinning(this.$props)},mounted:function(){this.updateSpinning()},updated:function(){var t=this;we(function(){t.debouncifyUpdateSpinning(),t.updateSpinning()})},beforeUnmount:function(){this.cancelExistingSpin()},methods:{debouncifyUpdateSpinning:function(t){var a=t||this.$props,n=a.delay;n&&(this.cancelExistingSpin(),this.updateSpinning=H(this.originalUpdateSpinning,n))},updateSpinning:function(){var t=this.spinning,a=this.sSpinning;a!==t&&(this.sSpinning=t)},cancelExistingSpin:function(){var t=this.updateSpinning;t&&t.cancel&&t.cancel()},renderIndicator:function(t){var a="".concat(t,"-dot"),n=_e(this,"indicator");return n===null?null:(Array.isArray(n)&&(n=n.length===1?n[0]:n),K(n)?R(n,{class:a}):B&&K(B())?R(B(),{class:a}):o("span",{class:"".concat(a," ").concat(t,"-dot-spin")},[o("i",{class:"".concat(t,"-dot-item")},null),o("i",{class:"".concat(t,"-dot-item")},null),o("i",{class:"".concat(t,"-dot-item")},null),o("i",{class:"".concat(t,"-dot-item")},null)]))}},render:function(){var t,a,n,l=this.$props,L=l.size,D=l.prefixCls,P=l.tip,x=P===void 0?(t=(a=this.$slots).tip)===null||t===void 0?void 0:t.call(a):P,b=l.wrapperClassName,$=this.$attrs,C=$.class,_=$.style,O=Oe($,Fe),u=this.configProvider,E=u.getPrefixCls,S=u.direction,m=E("spin",D),i=this.sSpinning,r=(n={},M(n,m,!0),M(n,"".concat(m,"-sm"),L==="small"),M(n,"".concat(m,"-lg"),L==="large"),M(n,"".concat(m,"-spinning"),i),M(n,"".concat(m,"-show-text"),!!x),M(n,"".concat(m,"-rtl"),S==="rtl"),M(n,C,!!C),n),c=o("div",ee(ee({},O),{},{style:_,class:r}),[this.renderIndicator(m),x?o("div",{class:"".concat(m,"-text")},[x]):null]),w=Ee(this);if(w&&w.length){var g,F=(g={},M(g,"".concat(m,"-container"),!0),M(g,"".concat(m,"-blur"),i),g);return o("div",{class:["".concat(m,"-nested-loading"),b]},[i&&o("div",{key:"loading"},[c]),o("div",{class:F,key:"container"},[w])])}return c}});var He={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 000 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0013.5-4.7L863.9 169a7.9 7.9 0 00-8.9-8.9zM416.6 562.3a8.03 8.03 0 00-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 00-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"}}]},name:"arrows-alt",theme:"outlined"};const Xe=He;function le(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable}))),n.forEach(function(l){Ye(e,l,a[l])})}return e}function Ye(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var X=function(t,a){var n=le({},t,a.attrs);return o(A,le({},n,{icon:Xe}),null)};X.displayName="ArrowsAltOutlined";X.inheritAttrs=!1;const Ge=X;var qe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.3 506.3L781.7 405.6a7.23 7.23 0 00-11.7 5.7V476H548V254h64.8c6 0 9.4-7 5.7-11.7L517.7 114.7a7.14 7.14 0 00-11.3 0L405.6 242.3a7.23 7.23 0 005.7 11.7H476v222H254v-64.8c0-6-7-9.4-11.7-5.7L114.7 506.3a7.14 7.14 0 000 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h222v222h-64.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V548h222v64.8c0 6 7 9.4 11.7 5.7l127.5-100.8a7.3 7.3 0 00.1-11.4z"}}]},name:"drag",theme:"outlined"};const Je=qe;function oe(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable}))),n.forEach(function(l){Qe(e,l,a[l])})}return e}function Qe(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Y=function(t,a){var n=oe({},t,a.attrs);return o(A,oe({},n,{icon:Je}),null)};Y.displayName="DragOutlined";Y.inheritAttrs=!1;const Ze=Y;var Ke={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 000 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 00391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 00-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"}}]},name:"fullscreen-exit",theme:"outlined"};const Re=Ke;function se(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable}))),n.forEach(function(l){et(e,l,a[l])})}return e}function et(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var G=function(t,a){var n=se({},t,a.attrs);return o(A,se({},n,{icon:Re}),null)};G.displayName="FullscreenExitOutlined";G.inheritAttrs=!1;const tt=G;var nt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"}}]},name:"fullscreen",theme:"outlined"};const it=nt;function ue(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable}))),n.forEach(function(l){at(e,l,a[l])})}return e}function at(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var q=function(t,a){var n=ue({},t,a.attrs);return o(A,ue({},n,{icon:it}),null)};q.displayName="FullscreenOutlined";q.inheritAttrs=!1;const rt=q;var lt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"left-circle",theme:"outlined"};const ot=lt;function ce(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable}))),n.forEach(function(l){st(e,l,a[l])})}return e}function st(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var J=function(t,a){var n=ce({},t,a.attrs);return o(A,ce({},n,{icon:ot}),null)};J.displayName="LeftCircleOutlined";J.inheritAttrs=!1;const Nt=J;var ut={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"right-circle",theme:"outlined"};const ct=ut;function de(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(a).filter(function(l){return Object.getOwnPropertyDescriptor(a,l).enumerable}))),n.forEach(function(l){dt(e,l,a[l])})}return e}function dt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var Q=function(t,a){var n=de({},t,a.attrs);return o(A,de({},n,{icon:ct}),null)};Q.displayName="RightCircleOutlined";Q.inheritAttrs=!1;const At=Q;function ft(e,t,a,n){let l=0,L=0,D=typeof(n==null?void 0:n.width)=="number"?n.width:0,P=typeof(n==null?void 0:n.height)=="number"?n.height:0,x=typeof(n==null?void 0:n.left)=="number"?n.left:0,b=typeof(n==null?void 0:n.top)=="number"?n.top:0,$=!1;const C=i=>{i.stopPropagation(),i.preventDefault(),!(!e.value||!t.value)&&(l=i instanceof MouseEvent?i.clientX:i.touches[0].clientX,L=i instanceof MouseEvent?i.clientY:i.touches[0].clientY,D=e.value.offsetWidth,P=e.value.offsetHeight,t.value.offsetLeft,t.value.offsetTop,document.documentElement.addEventListener("mousemove",_),document.documentElement.addEventListener("touchmove",_),document.documentElement.addEventListener("mouseup",O),document.documentElement.addEventListener("touchend",O))},_=i=>{if(!e.value||!t.value)return;let r=D+((i instanceof MouseEvent?i.clientX:i.touches[0].clientX)-l),c=P+((i instanceof MouseEvent?i.clientY:i.touches[0].clientY)-L);e.value.offsetLeft+r>window.innerWidth&&(r=window.innerWidth-e.value.offsetLeft),e.value.offsetTop+c>window.innerHeight&&(c=window.innerHeight-e.value.offsetTop),e.value.style.width=`${r}px`,e.value.style.height=`${c}px`,n!=null&&n.onResize&&n.onResize(r,c)},O=()=>{document.documentElement.removeEventListener("mousemove",_),document.documentElement.removeEventListener("touchmove",_),document.documentElement.removeEventListener("mouseup",O),document.documentElement.removeEventListener("touchend",O)},u=i=>{i.stopPropagation(),i.preventDefault(),!(!e.value||!a.value)&&($=!0,x=e.value.offsetLeft,b=e.value.offsetTop,l=i instanceof MouseEvent?i.clientX:i.touches[0].clientX,L=i instanceof MouseEvent?i.clientY:i.touches[0].clientY,document.documentElement.addEventListener("mousemove",E),document.documentElement.addEventListener("touchmove",E),document.documentElement.addEventListener("mouseup",S),document.documentElement.addEventListener("touchend",S))},E=i=>{if(!e.value||!a.value||!$)return;const r=x+((i instanceof MouseEvent?i.clientX:i.touches[0].clientX)-l),c=b+((i instanceof MouseEvent?i.clientY:i.touches[0].clientY)-L);r<0?e.value.style.left="0px":r+e.value.offsetWidth>window.innerWidth?e.value.style.left=`${window.innerWidth-e.value.offsetWidth}px`:e.value.style.left=`${r}px`,c<0?e.value.style.top="0px":c+e.value.offsetHeight>window.innerHeight?e.value.style.top=`${window.innerHeight-e.value.offsetHeight}px`:e.value.style.top=`${c}px`,n!=null&&n.onDrag&&n.onDrag(r,c)},S=()=>{$=!1,document.documentElement.removeEventListener("mousemove",E),document.documentElement.removeEventListener("touchmove",E),document.documentElement.removeEventListener("mouseup",S),document.documentElement.removeEventListener("touchend",S)},m=()=>{if(!e.value||!t.value)return;let i=e.value.offsetLeft,r=e.value.offsetTop,c=e.value.offsetWidth,w=e.value.offsetHeight;i+c>window.innerWidth&&(i=window.innerWidth-c,i<0&&(i=0,c=window.innerWidth)),r+w>window.innerHeight&&(r=window.innerHeight-w,r<0&&(r=0,w=window.innerHeight)),e.value.style.left=`${i}px`,e.value.style.top=`${r}px`,e.value.style.width=`${c}px`,e.value.style.height=`${w}px`};return Le(()=>{!e.value||!n||(typeof n.width=="number"&&(e.value.style.width=`${n.width}px`),typeof n.height=="number"&&(e.value.style.height=`${n.height}px`),typeof n.left=="number"&&(e.value.style.left=`${n.left}px`),typeof n.top=="number"&&(e.value.style.top=`${n.top}px`),m(),window.addEventListener("resize",m))}),$e(()=>{document.documentElement.removeEventListener("mousemove",_),document.documentElement.removeEventListener("touchmove",_),document.documentElement.removeEventListener("mouseup",O),document.documentElement.removeEventListener("touchend",O),document.documentElement.removeEventListener("mousemove",E),document.documentElement.removeEventListener("touchmove",E),document.documentElement.removeEventListener("mouseup",S),document.documentElement.removeEventListener("touchend",S),window.removeEventListener("resize",m)}),ve(()=>[e.value,t.value,a.value],([i,r,c])=>{i&&r&&(r.addEventListener("mousedown",C),r.addEventListener("touchstart",C)),i&&c&&(c.addEventListener("mousedown",u),c.addEventListener("touchstart",u))}),{handleResizeMouseDown:C,handleDragMouseDown:u}}const vt={class:"container"},pt={class:"action-bar"},mt=["title"],gt=["title"],ht={key:0,class:"icon",style:{cursor:"pointer"}},yt={key:0,"flex-placeholder":""},bt={key:1,class:"action-bar"},wt={key:0,class:"gen-info"},_t={class:"info-tags"},Ot={class:"name"},Et={class:"value"},Lt={key:0,class:"tags-container"},$t=["onClick"],St=["title"],Pt=fe({__name:"fullScreenContextMenu",props:{file:{},idx:{}},emits:["contextMenuClick"],setup(e,{emit:t}){const a=e,n=Se(),l=Ie(),L=j(),D=U(()=>l.tagMap.get(a.file.fullpath)??[]),P=j(""),x=Pe(),b=j(""),$=U(()=>b.value.split(`
2
+ `));ve(()=>{var i;return(i=a==null?void 0:a.file)==null?void 0:i.fullpath},async i=>{i&&(x.tasks.forEach(r=>r.cancel()),x.pushAction(()=>xe(i)).res.then(r=>{b.value=r}))},{immediate:!0});const C=j(),_=j(),O={left:100,top:100,width:512,height:384,expanded:!0},u=Ce("fullScreenContextMenu.vue-drag",O);u.value&&(u.value.left<0||u.value.top<0)&&(u.value={...O}),ft(L,C,_,{...u.value,onDrag:H(function(i,r){u.value={...u.value,left:i,top:r}},300),onResize:H(function(i,r){u.value={...u.value,width:i,height:r}},300)});function E(i){return i.parentNode}We("load",i=>{const r=i.target;r.className==="ant-image-preview-img"&&(P.value=`${r.naturalWidth} x ${r.naturalHeight}`)},{capture:!0});const S=U(()=>{const i=[{name:z("fileName"),val:a.file.name},{name:z("fileSize"),val:a.file.size}];return P.value&&i.push({name:z("resolution"),val:P.value}),i}),m=()=>{const i="Negative prompt:",r=b.value.includes(i)?b.value.split(i)[0]:$.value[0]??"";ie(r.trim())};return(i,r)=>{var Z;const c=Te,w=re,g=ze,F=Ne,pe=Ae,me=re;return p(),y("div",{ref_key:"el",ref:L,class:ae(["full-screen-menu",{"unset-size":!s(u).expanded}]),onWheelCapture:r[5]||(r[5]=De(()=>{},["stop"]))},[N("div",vt,[N("div",pt,[N("div",{ref_key:"dragHandle",ref:_,class:"icon",style:{cursor:"grab"},title:s(z)("dragToMovePanel")},[o(s(Ze))],8,mt),N("div",{class:"icon",style:{cursor:"pointer"},onClick:r[0]||(r[0]=d=>s(u).expanded=!s(u).expanded),title:s(z)("clickToToggleMaximizeMinimize")},[s(u).expanded?(p(),I(s(tt),{key:0})):(p(),I(s(rt),{key:1}))],8,gt),o(c,{"get-popup-container":E},{overlay:f(()=>[o(Be,{file:i.file,idx:i.idx,"selected-tag":D.value,"disable-delete":s(ne)(i.file)===s(n).fullscreenPreviewInitialUrl,onContextMenuClick:r[1]||(r[1]=(d,T,ge)=>t("contextMenuClick",d,T,ge))},null,8,["file","idx","selected-tag","disable-delete"])]),default:f(()=>[s(u).expanded?k("",!0):(p(),y("div",ht,[o(s(Me))]))]),_:1}),s(u).expanded?(p(),y("div",yt)):k("",!0),s(u).expanded?(p(),y("div",bt,[o(c,{trigger:["hover"],"get-popup-container":E},{overlay:f(()=>[o(pe,{onClick:r[2]||(r[2]=d=>t("contextMenuClick",d,i.file,i.idx))},{default:f(()=>{var d;return[((d=s(n).conf)==null?void 0:d.launch_mode)!=="server"?(p(),y(W,{key:0},[o(g,{key:"send2txt2img"},{default:f(()=>[h(v(i.$t("sendToTxt2img")),1)]),_:1}),o(g,{key:"send2img2img"},{default:f(()=>[h(v(i.$t("sendToImg2img")),1)]),_:1}),o(g,{key:"send2inpaint"},{default:f(()=>[h(v(i.$t("sendToInpaint")),1)]),_:1}),o(g,{key:"send2extras"},{default:f(()=>[h(v(i.$t("sendToExtraFeatures")),1)]),_:1}),o(F,{key:"sendToThirdPartyExtension",title:i.$t("sendToThirdPartyExtension")},{default:f(()=>[o(g,{key:"send2controlnet-txt2img"},{default:f(()=>[h("ControlNet - "+v(i.$t("t2i")),1)]),_:1}),o(g,{key:"send2controlnet-img2img"},{default:f(()=>[h("ControlNet - "+v(i.$t("i2i")),1)]),_:1}),o(g,{key:"send2outpaint"},{default:f(()=>[h("openOutpaint")]),_:1})]),_:1},8,["title"])],64)):k("",!0),o(g,{key:"send2BatchDownload"},{default:f(()=>[h(v(i.$t("sendToBatchDownload")),1)]),_:1}),o(g,{key:"send2savedDir"},{default:f(()=>[h(v(i.$t("send2savedDir")),1)]),_:1}),o(g,{key:"deleteFiles",disabled:s(ne)(i.file)===s(n).fullscreenPreviewInitialUrl},{default:f(()=>[h(v(i.$t("deleteSelected")),1)]),_:1},8,["disabled"]),o(g,{key:"previewInNewWindow"},{default:f(()=>[h(v(i.$t("previewInNewWindow")),1)]),_:1}),o(g,{key:"copyPreviewUrl"},{default:f(()=>[h(v(i.$t("copySourceFilePreviewLink")),1)]),_:1})]}),_:1})]),default:f(()=>[o(w,null,{default:f(()=>[h(v(s(z)("openContextMenu")),1)]),_:1})]),_:1}),o(me,{onClick:r[3]||(r[3]=d=>t("contextMenuClick",{key:"download"},a.file,a.idx))},{default:f(()=>[h(v(i.$t("download")),1)]),_:1}),b.value?(p(),I(w,{key:0,onClick:r[4]||(r[4]=d=>s(ie)(b.value))},{default:f(()=>[h(v(i.$t("copyPrompt")),1)]),_:1})):k("",!0),b.value?(p(),I(w,{key:1,onClick:m},{default:f(()=>[h(v(i.$t("copyPositivePrompt")),1)]),_:1})):k("",!0)])):k("",!0)]),s(u).expanded?(p(),y("div",wt,[N("div",_t,[(p(!0),y(W,null,V(S.value,d=>(p(),y("span",{class:"info-tag",key:d.name},[N("span",Ot,v(d.name),1),N("span",Et,v(d.val),1)]))),128))]),(Z=s(n).conf)!=null&&Z.all_custom_tags?(p(),y("div",Lt,[(p(!0),y(W,null,V(s(n).conf.all_custom_tags,d=>(p(),y("div",{class:ae(["tag",{selected:D.value.some(T=>T.id===d.id)}]),onClick:T=>t("contextMenuClick",{key:`toggle-tag-${d.id}`},i.file,i.idx),key:d.id,style:ke({"--tag-color":s(l).getColor(d.name)})},v(d.name),15,$t))),128))])):k("",!0),(p(!0),y(W,null,V($.value,d=>(p(),y("p",{key:d,class:"gen-info-frag"},v(d),1))),128))])):k("",!0)]),s(u).expanded?(p(),y("div",{key:0,class:"mouse-sensor",ref_key:"resizeHandle",ref:C,title:s(z)("dragToResizePanel")},[o(s(Ge))],8,St)):k("",!0)],34)}}});const jt=je(Pt,[["__scopeId","data-v-f11ac69d"]]);export{Nt as L,At as R,zt as S,jt as f,Dt as s};